insync-stage-handler 3.1.2 → 4.0.0-beta.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.
- package/dist/library.js +1496 -553
- package/dist/library.js.map +1 -1
- package/dist/module.js +1477 -554
- package/dist/module.js.map +1 -1
- package/package.json +37 -24
package/dist/library.js
CHANGED
|
@@ -2,14 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
|
-
|
|
7
5
|
var R = require('ramda');
|
|
8
|
-
var Ajv =
|
|
6
|
+
var Ajv = require('ajv');
|
|
9
7
|
var fp = require('date-fns/fp');
|
|
10
8
|
|
|
9
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
+
|
|
11
|
+
function _interopNamespace(e) {
|
|
12
|
+
if (e && e.__esModule) return e;
|
|
13
|
+
var n = Object.create(null);
|
|
14
|
+
if (e) {
|
|
15
|
+
Object.keys(e).forEach(function (k) {
|
|
16
|
+
if (k !== 'default') {
|
|
17
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
18
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return e[k]; }
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
n["default"] = e;
|
|
26
|
+
return Object.freeze(n);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var R__namespace = /*#__PURE__*/_interopNamespace(R);
|
|
30
|
+
var Ajv__default = /*#__PURE__*/_interopDefaultLegacy(Ajv);
|
|
31
|
+
|
|
11
32
|
const lookup = R.flip(R.prop);
|
|
12
|
-
|
|
33
|
+
R.flip(R.path);
|
|
13
34
|
const lookupAll = R.curry((from, ids) => R.map(lookup(from), ids));
|
|
14
35
|
const lookupPathAll = R.curry((from, p, ids) => R.map(R.compose(R.path(p), lookup(from)), ids));
|
|
15
36
|
const indexById = R.indexBy(R.prop("id"));
|
|
@@ -19,16 +40,13 @@ const listEntities = R.curry((entitiesContainerPath, from) => R.pipe(R.converge(
|
|
|
19
40
|
* Return the version of a stage object.
|
|
20
41
|
* @param {Object} stage The stage for which to return the version.
|
|
21
42
|
*/
|
|
22
|
-
|
|
23
43
|
var detectVersion = R.pipe(R.prop("version"), R.defaultTo(1));
|
|
24
44
|
|
|
25
45
|
class ValidationError extends Error {
|
|
26
46
|
setErrors(errors) {
|
|
27
47
|
this.errors = errors;
|
|
28
48
|
}
|
|
29
|
-
|
|
30
49
|
}
|
|
31
|
-
|
|
32
50
|
const formatErrorMessage = errors => {
|
|
33
51
|
const header = "Validation errors occurred: \n";
|
|
34
52
|
return R.pipe(R.map(({
|
|
@@ -36,26 +54,22 @@ const formatErrorMessage = errors => {
|
|
|
36
54
|
message
|
|
37
55
|
}) => `path: "${dataPath}", message: ${message}`), R.map(R.of), R.map(R.pipe(R.prepend(" - "), R.append("\n"))), R.flatten, R.prepend(header), R.join(""))(errors);
|
|
38
56
|
};
|
|
39
|
-
|
|
40
|
-
var createValidationError = (errors => {
|
|
57
|
+
var createValidationError = errors => {
|
|
41
58
|
const err = new ValidationError(formatErrorMessage(errors));
|
|
42
59
|
err.setErrors(errors);
|
|
43
60
|
return err;
|
|
44
|
-
}
|
|
61
|
+
};
|
|
45
62
|
|
|
46
|
-
const ajv = new
|
|
63
|
+
const ajv = new Ajv__default["default"]({
|
|
47
64
|
$data: true,
|
|
48
65
|
allErrors: true,
|
|
49
66
|
logger: false
|
|
50
67
|
});
|
|
51
|
-
|
|
52
68
|
require("ajv-keywords")(ajv, "formatMinimum");
|
|
53
69
|
/**
|
|
54
70
|
* Creates a JSON schema validator.
|
|
55
71
|
* @param {Object} obj Object containing json schema rules.
|
|
56
72
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
73
|
const createAJVValidator = schema => {
|
|
60
74
|
const validator = ajv.compile(schema);
|
|
61
75
|
return stage => {
|
|
@@ -71,11 +85,11 @@ const createAJVValidator = schema => {
|
|
|
71
85
|
};
|
|
72
86
|
};
|
|
73
87
|
|
|
74
|
-
var $schema = "http://json-schema.org/draft-07/schema#";
|
|
75
|
-
var id = "stage.1.schema.json";
|
|
76
|
-
var description = "Version 1 of stage file";
|
|
77
|
-
var type = "object";
|
|
78
|
-
var definitions = {
|
|
88
|
+
var $schema$3 = "http://json-schema.org/draft-07/schema#";
|
|
89
|
+
var id$3 = "stage.1.schema.json";
|
|
90
|
+
var description$4 = "Version 1 of stage file";
|
|
91
|
+
var type$3 = "object";
|
|
92
|
+
var definitions$3 = {
|
|
79
93
|
entitiesContainer: {
|
|
80
94
|
type: "object",
|
|
81
95
|
properties: {
|
|
@@ -623,7 +637,7 @@ var definitions = {
|
|
|
623
637
|
]
|
|
624
638
|
}
|
|
625
639
|
};
|
|
626
|
-
var properties = {
|
|
640
|
+
var properties$3 = {
|
|
627
641
|
menu: {
|
|
628
642
|
type: "object",
|
|
629
643
|
properties: {
|
|
@@ -765,25 +779,25 @@ var properties = {
|
|
|
765
779
|
}
|
|
766
780
|
}
|
|
767
781
|
};
|
|
768
|
-
var schema = {
|
|
769
|
-
$schema: $schema,
|
|
770
|
-
id: id,
|
|
771
|
-
description: description,
|
|
772
|
-
type: type,
|
|
773
|
-
definitions: definitions,
|
|
774
|
-
properties: properties
|
|
782
|
+
var schema$3 = {
|
|
783
|
+
$schema: $schema$3,
|
|
784
|
+
id: id$3,
|
|
785
|
+
description: description$4,
|
|
786
|
+
type: type$3,
|
|
787
|
+
definitions: definitions$3,
|
|
788
|
+
properties: properties$3
|
|
775
789
|
};
|
|
776
790
|
|
|
777
|
-
const jsonSchemaValidator = createAJVValidator(schema);
|
|
778
|
-
var v1 =
|
|
779
|
-
return jsonSchemaValidator(stage);
|
|
780
|
-
}
|
|
791
|
+
const jsonSchemaValidator$3 = createAJVValidator(schema$3);
|
|
792
|
+
var v1 = stage => {
|
|
793
|
+
return jsonSchemaValidator$3(stage);
|
|
794
|
+
};
|
|
781
795
|
|
|
782
|
-
var $schema$
|
|
783
|
-
var id$
|
|
784
|
-
var description$
|
|
785
|
-
var type$
|
|
786
|
-
var definitions$
|
|
796
|
+
var $schema$2 = "http://json-schema.org/draft-07/schema#";
|
|
797
|
+
var id$2 = "stage.2.schema.json";
|
|
798
|
+
var description$3 = "Version 2 of stage file";
|
|
799
|
+
var type$2 = "object";
|
|
800
|
+
var definitions$2 = {
|
|
787
801
|
entitiesContainer: {
|
|
788
802
|
type: "object",
|
|
789
803
|
properties: {
|
|
@@ -1344,7 +1358,7 @@ var definitions$1 = {
|
|
|
1344
1358
|
]
|
|
1345
1359
|
}
|
|
1346
1360
|
};
|
|
1347
|
-
var properties$
|
|
1361
|
+
var properties$2 = {
|
|
1348
1362
|
menu: {
|
|
1349
1363
|
type: "object",
|
|
1350
1364
|
properties: {
|
|
@@ -1486,25 +1500,25 @@ var properties$1 = {
|
|
|
1486
1500
|
}
|
|
1487
1501
|
}
|
|
1488
1502
|
};
|
|
1489
|
-
var schema$
|
|
1490
|
-
$schema: $schema$
|
|
1491
|
-
id: id$
|
|
1492
|
-
description: description$
|
|
1493
|
-
type: type$
|
|
1494
|
-
definitions: definitions$
|
|
1495
|
-
properties: properties$
|
|
1503
|
+
var schema$2 = {
|
|
1504
|
+
$schema: $schema$2,
|
|
1505
|
+
id: id$2,
|
|
1506
|
+
description: description$3,
|
|
1507
|
+
type: type$2,
|
|
1508
|
+
definitions: definitions$2,
|
|
1509
|
+
properties: properties$2
|
|
1496
1510
|
};
|
|
1497
1511
|
|
|
1498
|
-
const jsonSchemaValidator$
|
|
1499
|
-
var v2 =
|
|
1500
|
-
return jsonSchemaValidator$
|
|
1501
|
-
}
|
|
1512
|
+
const jsonSchemaValidator$2 = createAJVValidator(schema$2);
|
|
1513
|
+
var v2 = stage => {
|
|
1514
|
+
return jsonSchemaValidator$2(stage);
|
|
1515
|
+
};
|
|
1502
1516
|
|
|
1503
|
-
var $schema$
|
|
1504
|
-
var id$
|
|
1517
|
+
var $schema$1 = "http://json-schema.org/draft-07/schema#";
|
|
1518
|
+
var id$1 = "stage.3.schema.json";
|
|
1505
1519
|
var description$2 = "Version 3 of stage file";
|
|
1506
|
-
var type$
|
|
1507
|
-
var definitions$
|
|
1520
|
+
var type$1 = "object";
|
|
1521
|
+
var definitions$1 = {
|
|
1508
1522
|
entitiesContainer: {
|
|
1509
1523
|
type: "object",
|
|
1510
1524
|
properties: {
|
|
@@ -2061,7 +2075,7 @@ var definitions$2 = {
|
|
|
2061
2075
|
]
|
|
2062
2076
|
}
|
|
2063
2077
|
};
|
|
2064
|
-
var properties$
|
|
2078
|
+
var properties$1 = {
|
|
2065
2079
|
menu: {
|
|
2066
2080
|
type: "object",
|
|
2067
2081
|
properties: {
|
|
@@ -2200,299 +2214,1096 @@ var properties$2 = {
|
|
|
2200
2214
|
}
|
|
2201
2215
|
}
|
|
2202
2216
|
};
|
|
2203
|
-
var schema$
|
|
2204
|
-
$schema: $schema$
|
|
2205
|
-
id: id$
|
|
2217
|
+
var schema$1 = {
|
|
2218
|
+
$schema: $schema$1,
|
|
2219
|
+
id: id$1,
|
|
2206
2220
|
description: description$2,
|
|
2207
|
-
type: type$
|
|
2208
|
-
definitions: definitions$
|
|
2209
|
-
properties: properties$
|
|
2210
|
-
};
|
|
2211
|
-
|
|
2212
|
-
const jsonSchemaValidator$2 = createAJVValidator(schema$2);
|
|
2213
|
-
var v3 = (stage => {
|
|
2214
|
-
return jsonSchemaValidator$2(stage);
|
|
2215
|
-
});
|
|
2216
|
-
|
|
2217
|
-
const map = Object.freeze({
|
|
2218
|
-
"1": v1,
|
|
2219
|
-
"2": v2,
|
|
2220
|
-
"3": v3
|
|
2221
|
-
});
|
|
2222
|
-
|
|
2223
|
-
/**
|
|
2224
|
-
* Parses validation specific options from global options.
|
|
2225
|
-
* @param {obj} options
|
|
2226
|
-
*/
|
|
2227
|
-
|
|
2228
|
-
const optionsParser = ({
|
|
2229
|
-
validationVersion = undefined
|
|
2230
|
-
}) => ({
|
|
2231
|
-
version: validationVersion
|
|
2232
|
-
});
|
|
2233
|
-
/**
|
|
2234
|
-
* Validates a stage
|
|
2235
|
-
* @param {Object} stage
|
|
2236
|
-
* @param {number} version
|
|
2237
|
-
*/
|
|
2238
|
-
|
|
2239
|
-
var validate = ((stage, options = {}) => {
|
|
2240
|
-
const {
|
|
2241
|
-
version = undefined
|
|
2242
|
-
} = options;
|
|
2243
|
-
return R.pipe(R.defaultTo(detectVersion(stage)), lookup(map), R.applyTo(stage))(version);
|
|
2244
|
-
});
|
|
2245
|
-
|
|
2246
|
-
var versions = Object.freeze([1, 2, 3]);
|
|
2247
|
-
|
|
2248
|
-
/**
|
|
2249
|
-
* v1-to-v2.js
|
|
2250
|
-
* Upgrader for version 1 stage files to version 2.
|
|
2251
|
-
* Removes timelines axes with resources. And adds the zoomSteps for the dataviewer.
|
|
2252
|
-
*/
|
|
2253
|
-
const outletsView = listEntities(["data", "entities", "outlets"]); // This adds the zoomsteps on dataviwer based on "visible" prop on the associated outlet.
|
|
2254
|
-
|
|
2255
|
-
const addDataViewerZoomSteps = stage => R.pipe(outletsView, // The association to a dataviewer is defined in the outlet id (dataviewer/<DATAVIEWER ID>),
|
|
2256
|
-
// This only takes outlets associated with a dataviewer.
|
|
2257
|
-
R.filter(R.propSatisfies(R.startsWith("dataviewer/"), "id")), R.map( // This pairs the path to the associated dataviewer to its required zoomSteps.
|
|
2258
|
-
R.converge(R.pair, [R.pipe(R.prop("id"), R.replace("dataviewer/", ""), id => ["data", "entities", "dataViewers", "byId", id, "zoomSteps"]), R.pipe(R.prop("visible"), visible => [visible])])), // Set the "zoomSteps" prop of the dataviewer to the visibility of the outlet.
|
|
2259
|
-
R.reduce((acc, [path, zoomSteps]) => R.assocPath(path, zoomSteps, acc), stage))(stage);
|
|
2260
|
-
|
|
2261
|
-
var v1ToV2 = R.pipe( // Sets the version prop to "2"
|
|
2262
|
-
R.assoc("version", 2), // Remove the association to resources from the timline axes.
|
|
2263
|
-
// In version 2 the tracks for files on the timeline are handled by the v2 consolidation strategy.
|
|
2264
|
-
R.dissocPath(["timeline", "entities", "axes", "byId", "video", "resources"]), R.dissocPath(["timeline", "entities", "axes", "byId", "high-speed", "resources"]), // Adds the zoomsteps to the dataviewers.
|
|
2265
|
-
addDataViewerZoomSteps);
|
|
2266
|
-
|
|
2267
|
-
const NEW_TEST_REGEX = /^([0-9]{5})_(.+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)$/;
|
|
2268
|
-
|
|
2269
|
-
const fsPath = require("path");
|
|
2270
|
-
|
|
2271
|
-
const match = R.curry((regex, st) => st.match(regex));
|
|
2272
|
-
const mapWithIndex = R.addIndex(R.map);
|
|
2273
|
-
const axesSettings = [{
|
|
2274
|
-
id: "video",
|
|
2275
|
-
color: "#41b51b"
|
|
2276
|
-
}, {
|
|
2277
|
-
id: "high-speed",
|
|
2278
|
-
color: "#3318cc"
|
|
2279
|
-
}, {
|
|
2280
|
-
id: "comment",
|
|
2281
|
-
color: "red"
|
|
2282
|
-
}];
|
|
2283
|
-
const tracksIdsPath = ["timeline", "entities", "tracks", "ids"];
|
|
2284
|
-
const tracksByIdPath = ["timeline", "entities", "tracks", "byId"];
|
|
2285
|
-
const axesIdsPath = ["timeline", "entities", "axes", "ids"];
|
|
2286
|
-
const axesByIdPath = ["timeline", "entities", "axes", "byId"];
|
|
2287
|
-
const resourcesIdsView = R.path(["resources", "entities", "resources", "ids"]);
|
|
2288
|
-
const resourcesByIdView = R.path(["resources", "entities", "resources", "byId"]);
|
|
2289
|
-
const filesIdsView = R.path(["files", "entities", "files", "ids"]);
|
|
2290
|
-
const filesByIdView = R.path(["files", "entities", "files", "byId"]);
|
|
2291
|
-
const commentsByIdView = R.path(["timeline", "entities", "comments", "byId"]);
|
|
2292
|
-
const tracksIdsLens = R.lensPath(tracksIdsPath);
|
|
2293
|
-
const tracksByIdLens = R.lensPath(tracksByIdPath);
|
|
2294
|
-
const axesIdsLens = R.lensPath(axesIdsPath);
|
|
2295
|
-
const axesByIdLens = R.lensPath(axesByIdPath);
|
|
2296
|
-
const filesView = R.pipe(filesByIdView, R.values);
|
|
2297
|
-
const commentsView = R.pipe(commentsByIdView, R.values);
|
|
2298
|
-
|
|
2299
|
-
const highSpeedsFilesView = stage => {
|
|
2300
|
-
const filesById = filesByIdView(stage);
|
|
2301
|
-
const resourcesById = resourcesByIdView(stage);
|
|
2302
|
-
return R.pipe( // Iterate R.over the resource ids
|
|
2303
|
-
resourcesIdsView, // Filter out all the ids that don't start with high-speed.
|
|
2304
|
-
R.filter(R.startsWith("high-speed:")), // Map the remaining resource ids to the files ids in the respective resource object.
|
|
2305
|
-
lookupPathAll(resourcesById, ["files"]), // Flatten the ids so we get a single array containing all the files ids referred
|
|
2306
|
-
// to across all high-speed resources.
|
|
2307
|
-
R.flatten, // Map the file ids to file objects.
|
|
2308
|
-
lookupAll(filesById))(stage);
|
|
2309
|
-
};
|
|
2310
|
-
|
|
2311
|
-
const videosFilesView = stage => {
|
|
2312
|
-
const filesIds = filesIdsView(stage);
|
|
2313
|
-
const filesById = filesByIdView(stage);
|
|
2314
|
-
const highSpeedFiles = highSpeedsFilesView(stage);
|
|
2315
|
-
return R.pipe(R.without(R.pluck("id", highSpeedFiles)), lookupAll(filesById), R.filter(R.propEq("type", "video")))(filesIds);
|
|
2316
|
-
};
|
|
2317
|
-
|
|
2318
|
-
const upsertAxes = axes => R.curry(R.pipe(R.unless(R.path(axesIdsPath), R.assocPath(axesIdsPath, [])), R.unless(R.path(axesByIdPath), R.assocPath(axesIdsPath, {})), R.over(axesIdsLens, R.union(R.pluck("id", axes))), R.over(axesByIdLens, R.merge(indexById(axes)))));
|
|
2319
|
-
const createTrackFromEntity = R.curry((axis, entity) => {
|
|
2320
|
-
const {
|
|
2321
|
-
start,
|
|
2322
|
-
end,
|
|
2323
|
-
type,
|
|
2324
|
-
id
|
|
2325
|
-
} = entity;
|
|
2326
|
-
return {
|
|
2327
|
-
id: `track:${id}`,
|
|
2328
|
-
start,
|
|
2329
|
-
end,
|
|
2330
|
-
type,
|
|
2331
|
-
axisRef: axis,
|
|
2332
|
-
ref: id
|
|
2333
|
-
};
|
|
2334
|
-
});
|
|
2335
|
-
const mapEntitiesToTracks = R.curry((entitiesSelector, axis, stage) => R.map(createTrackFromEntity(axis), entitiesSelector(stage)));
|
|
2336
|
-
const mapCommentsToTracks = R.pipe(mapEntitiesToTracks(commentsView, "comment"), R.map(R.mergeLeft({
|
|
2337
|
-
type: "comment",
|
|
2338
|
-
label: "comment"
|
|
2339
|
-
})));
|
|
2340
|
-
|
|
2341
|
-
const formatTestNo = input => {
|
|
2342
|
-
const [// eslint-disable-next-line no-unused-vars
|
|
2343
|
-
m, project, facility, program, category, test, experiment, measurement] = input.match(NEW_TEST_REGEX);
|
|
2344
|
-
return `${project}_${program.padStart(2, "0")}${facility}_${category.padStart(2, "0")}_${test.padStart(3, "0")}_${experiment.padStart(3, "0")}_${measurement.padStart(2, "0")}`;
|
|
2345
|
-
};
|
|
2346
|
-
|
|
2347
|
-
const extractTestNumberFromMetadata = R.pipe(R.path(["metadata", "location", "$id"]), R.when(R.test(NEW_TEST_REGEX), formatTestNo));
|
|
2348
|
-
const extractTestNumberFromFileName = R.compose(R.head, R.defaultTo([undefined]), R.either(match(/[0-9]{5}_[0-9]{2}[a-zA-Z]+_[0-9]{2}_[0-9]{3}_[0-9]{3}_[0-9]{2}/), match(/[A-Za-z]+[0-9]{5}_[0-9]+_[0-9]+_[0-9]+/)), R.prop("path"));
|
|
2349
|
-
|
|
2350
|
-
const extractTestNumber = (stage, track) => R.pipe(filesByIdView, R.prop(track.ref), R.either(extractTestNumberFromMetadata, extractTestNumberFromFileName))(stage);
|
|
2351
|
-
|
|
2352
|
-
const formatter = fp.formatWithOptions({
|
|
2353
|
-
awareOfUnicodeTokens: true
|
|
2354
|
-
});
|
|
2355
|
-
|
|
2356
|
-
const extractRecordingChannel = (stage, track) => R.pipe(filesByIdView, R.path([track.ref, "metadata", "recChannel"]))(stage);
|
|
2357
|
-
|
|
2358
|
-
const createHighSpeedTracksLabels = stage => tracks => mapWithIndex((hs, index) => {
|
|
2359
|
-
const recordingChannel = extractRecordingChannel(stage, hs);
|
|
2360
|
-
const no = recordingChannel || index + 1;
|
|
2361
|
-
return R.assoc("label", `HS ${no}`, hs);
|
|
2362
|
-
}, tracks);
|
|
2363
|
-
|
|
2364
|
-
const createVideoTracksLabels = stage => tracks => mapWithIndex((vid, index) => {
|
|
2365
|
-
const recordingChannel = extractRecordingChannel(stage, vid);
|
|
2366
|
-
const no = recordingChannel || index + 1;
|
|
2367
|
-
return R.assoc("label", `VID ${no}`, vid);
|
|
2368
|
-
}, tracks);
|
|
2369
|
-
|
|
2370
|
-
const extractFormat = (stage, track) => R.pipe(filesByIdView, R.path([track.ref, "path"]), p => fsPath.extname(p))(stage);
|
|
2371
|
-
|
|
2372
|
-
const extractSecondFractions = isoStr => R.pipe(match(/[0-9]{2}:[0-9]{2}:[0-9]{2}.([0-9]+)/), R.ifElse(R.isNil, R.always("000"), R.nth(1)))(isoStr);
|
|
2373
|
-
|
|
2374
|
-
const extractDate = (stage, track) => {
|
|
2375
|
-
return R.pipe(filesByIdView, R.path([track.ref, "start"]), fp.parseISO, formatter("dd-MM-yyyy"))(stage);
|
|
2376
|
-
};
|
|
2377
|
-
|
|
2378
|
-
const createTime = R.converge(R.pipe(R.pair, R.join(".")), [R.pipe(fp.parseISO, formatter("HH:mm:ss")), extractSecondFractions]);
|
|
2379
|
-
|
|
2380
|
-
const extractStart = (stage, track) => R.pipe(filesByIdView, R.path([track.ref, "start"]), createTime)(stage);
|
|
2381
|
-
|
|
2382
|
-
const extractEnd = (stage, track) => R.pipe(filesByIdView, R.path([track.ref, "end"]), createTime)(stage);
|
|
2383
|
-
|
|
2384
|
-
const createVideoMetadata = R.curry((type, stage, track) => ({ ...track,
|
|
2385
|
-
metadata: track.metadata || [[{
|
|
2386
|
-
label: "Test",
|
|
2387
|
-
value: extractTestNumber(stage, track)
|
|
2388
|
-
}], [{
|
|
2389
|
-
label: "Type",
|
|
2390
|
-
value: type
|
|
2391
|
-
}, {
|
|
2392
|
-
label: "Recording channel",
|
|
2393
|
-
value: extractRecordingChannel(stage, track)
|
|
2394
|
-
}, {
|
|
2395
|
-
label: "Format",
|
|
2396
|
-
value: extractFormat(stage, track)
|
|
2397
|
-
}], [{
|
|
2398
|
-
label: "Date",
|
|
2399
|
-
value: extractDate(stage, track)
|
|
2400
|
-
}, {
|
|
2401
|
-
label: "Start",
|
|
2402
|
-
value: extractStart(stage, track)
|
|
2403
|
-
}, {
|
|
2404
|
-
label: "End",
|
|
2405
|
-
value: extractEnd(stage, track)
|
|
2406
|
-
}]]
|
|
2407
|
-
}));
|
|
2408
|
-
const createHighSpeedsMetadata = R.curry((stage, tracks) => R.map(createVideoMetadata("high-speed", stage), tracks));
|
|
2409
|
-
const createVideosMetadata = R.curry((stage, tracks) => R.map(createVideoMetadata("video", stage), tracks));
|
|
2410
|
-
|
|
2411
|
-
const createTracks = stage => R.converge((...args) => R.flatten(args), [R.pipe(mapEntitiesToTracks(highSpeedsFilesView, "high-speed"), createHighSpeedTracksLabels(stage), createHighSpeedsMetadata(stage)), R.pipe(mapEntitiesToTracks(videosFilesView, "video"), createVideoTracksLabels(stage), createVideosMetadata(stage)), mapCommentsToTracks])(stage);
|
|
2412
|
-
|
|
2413
|
-
const upsertTracks = tracks => R.curry(R.pipe(R.unless(R.path(tracksIdsPath), R.assocPath(tracksIdsPath, [])), R.unless(R.path(tracksByIdPath), R.assocPath(tracksByIdPath, {})), R.over(tracksIdsLens, R.union(R.pluck("id", tracks))), R.over(tracksByIdLens, R.merge(indexById(tracks)))));
|
|
2414
|
-
|
|
2415
|
-
const earliestTime = stage => R.pipe(filesView, R.map(R.prop("start")), R.map(Date.parse), R.apply(Math.min), t => new Date(t), d => d.toISOString())(stage);
|
|
2416
|
-
|
|
2417
|
-
const latestTime = stage => R.pipe(filesView, R.map(R.prop("end")), R.map(Date.parse), R.apply(Math.max), t => new Date(t), d => d.toISOString())(stage);
|
|
2418
|
-
|
|
2419
|
-
const setTimeLineStartEnd = stage => R.pipe(R.assocPath(["timeline", "start"], earliestTime(stage)), R.assocPath(["timeline", "end"], latestTime(stage)))(stage);
|
|
2420
|
-
|
|
2421
|
-
const setCommentAxis = R.assocPath(["timeline", "commentAxis"], "comment");
|
|
2422
|
-
|
|
2423
|
-
const consolidateTimeline = stage => {
|
|
2424
|
-
return R.pipe(upsertAxes(axesSettings), upsertTracks(createTracks(stage)), setTimeLineStartEnd, setCommentAxis)(stage);
|
|
2221
|
+
type: type$1,
|
|
2222
|
+
definitions: definitions$1,
|
|
2223
|
+
properties: properties$1
|
|
2425
2224
|
};
|
|
2426
2225
|
|
|
2427
|
-
const
|
|
2428
|
-
|
|
2226
|
+
const jsonSchemaValidator$1 = createAJVValidator(schema$1);
|
|
2227
|
+
var v3$1 = stage => {
|
|
2228
|
+
return jsonSchemaValidator$1(stage);
|
|
2429
2229
|
};
|
|
2430
2230
|
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
}
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2231
|
+
var $schema = "http://json-schema.org/draft-07/schema#";
|
|
2232
|
+
var id = "stage.4.schema.json";
|
|
2233
|
+
var description$1 = "Version 4 of stage file - DockView layout format";
|
|
2234
|
+
var type = "object";
|
|
2235
|
+
var definitions = {
|
|
2236
|
+
entitiesContainer: {
|
|
2237
|
+
type: "object",
|
|
2238
|
+
properties: {
|
|
2239
|
+
ids: {
|
|
2240
|
+
type: "array",
|
|
2241
|
+
items: {
|
|
2242
|
+
type: "string"
|
|
2243
|
+
}
|
|
2244
|
+
},
|
|
2245
|
+
byId: {
|
|
2246
|
+
type: "object",
|
|
2247
|
+
additionalProperties: {
|
|
2248
|
+
type: "object"
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
},
|
|
2253
|
+
entity: {
|
|
2254
|
+
type: "object",
|
|
2255
|
+
properties: {
|
|
2256
|
+
id: {
|
|
2257
|
+
type: "string"
|
|
2258
|
+
}
|
|
2259
|
+
},
|
|
2260
|
+
required: [
|
|
2261
|
+
"id"
|
|
2262
|
+
]
|
|
2263
|
+
},
|
|
2264
|
+
ref: {
|
|
2265
|
+
type: "object",
|
|
2266
|
+
properties: {
|
|
2267
|
+
type: {
|
|
2268
|
+
type: "string"
|
|
2269
|
+
},
|
|
2270
|
+
id: {
|
|
2271
|
+
type: "string"
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
},
|
|
2275
|
+
asset: {
|
|
2276
|
+
allOf: [
|
|
2277
|
+
{
|
|
2278
|
+
$ref: "#/definitions/entity"
|
|
2279
|
+
},
|
|
2280
|
+
{
|
|
2281
|
+
type: "object",
|
|
2282
|
+
properties: {
|
|
2283
|
+
resource: {
|
|
2284
|
+
type: "string"
|
|
2285
|
+
},
|
|
2286
|
+
annotationsViewerId: {
|
|
2287
|
+
type: "string"
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
]
|
|
2292
|
+
},
|
|
2293
|
+
timing: {
|
|
2294
|
+
allOf: [
|
|
2295
|
+
{
|
|
2296
|
+
$ref: "#/definitions/entity"
|
|
2297
|
+
},
|
|
2298
|
+
{
|
|
2299
|
+
type: "object",
|
|
2300
|
+
properties: {
|
|
2301
|
+
start: {
|
|
2302
|
+
format: "date-time",
|
|
2303
|
+
message: "Is not a valid date time"
|
|
2304
|
+
},
|
|
2305
|
+
end: {
|
|
2306
|
+
format: "date-time",
|
|
2307
|
+
message: "Is not a valid date time",
|
|
2308
|
+
formatMinimum: {
|
|
2309
|
+
$data: "1/start"
|
|
2310
|
+
}
|
|
2311
|
+
},
|
|
2312
|
+
ref: {
|
|
2313
|
+
$ref: "#definitions/ref"
|
|
2314
|
+
}
|
|
2315
|
+
},
|
|
2316
|
+
required: [
|
|
2317
|
+
"start",
|
|
2318
|
+
"end",
|
|
2319
|
+
"ref"
|
|
2320
|
+
]
|
|
2321
|
+
}
|
|
2322
|
+
]
|
|
2323
|
+
},
|
|
2324
|
+
file: {
|
|
2325
|
+
allOf: [
|
|
2326
|
+
{
|
|
2327
|
+
$ref: "#/definitions/entity"
|
|
2328
|
+
},
|
|
2329
|
+
{
|
|
2330
|
+
type: "object",
|
|
2331
|
+
properties: {
|
|
2332
|
+
type: {
|
|
2333
|
+
type: "string"
|
|
2334
|
+
},
|
|
2335
|
+
path: {
|
|
2336
|
+
type: "string"
|
|
2337
|
+
},
|
|
2338
|
+
fps: {
|
|
2339
|
+
type: "number"
|
|
2340
|
+
},
|
|
2341
|
+
originalFps: {
|
|
2342
|
+
type: "number"
|
|
2343
|
+
}
|
|
2344
|
+
},
|
|
2345
|
+
required: [
|
|
2346
|
+
"type",
|
|
2347
|
+
"path"
|
|
2348
|
+
],
|
|
2349
|
+
"if": {
|
|
2350
|
+
properties: {
|
|
2351
|
+
type: {
|
|
2352
|
+
"const": "video"
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
},
|
|
2356
|
+
then: {
|
|
2357
|
+
required: [
|
|
2358
|
+
"fps"
|
|
2359
|
+
]
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
]
|
|
2363
|
+
},
|
|
2364
|
+
resource: {
|
|
2365
|
+
allOf: [
|
|
2366
|
+
{
|
|
2367
|
+
$ref: "#/definitions/entity"
|
|
2368
|
+
},
|
|
2369
|
+
{
|
|
2370
|
+
type: "object",
|
|
2371
|
+
properties: {
|
|
2372
|
+
type: {
|
|
2373
|
+
type: "string"
|
|
2374
|
+
},
|
|
2375
|
+
files: {
|
|
2376
|
+
type: "array",
|
|
2377
|
+
items: {
|
|
2378
|
+
type: "string"
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
]
|
|
2384
|
+
},
|
|
2385
|
+
dataViewer: {
|
|
2386
|
+
allOf: [
|
|
2387
|
+
{
|
|
2388
|
+
$ref: "#/definitions/entity"
|
|
2389
|
+
},
|
|
2390
|
+
{
|
|
2391
|
+
type: "object",
|
|
2392
|
+
properties: {
|
|
2393
|
+
id: {
|
|
2394
|
+
type: "string"
|
|
2395
|
+
},
|
|
2396
|
+
configVisible: {
|
|
2397
|
+
type: "boolean"
|
|
2398
|
+
},
|
|
2399
|
+
configAvailable: {
|
|
2400
|
+
type: "boolean"
|
|
2401
|
+
},
|
|
2402
|
+
measurements: {
|
|
2403
|
+
type: "array",
|
|
2404
|
+
items: {
|
|
2405
|
+
time: "string"
|
|
2406
|
+
}
|
|
2407
|
+
},
|
|
2408
|
+
zoomSteps: {
|
|
2409
|
+
type: "array",
|
|
2410
|
+
items: {
|
|
2411
|
+
type: "number"
|
|
2412
|
+
}
|
|
2413
|
+
},
|
|
2414
|
+
activeZoomStep: {
|
|
2415
|
+
type: "number"
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2419
|
+
]
|
|
2420
|
+
},
|
|
2421
|
+
measurement: {
|
|
2422
|
+
allOf: [
|
|
2423
|
+
{
|
|
2424
|
+
$ref: "#/definitions/entity"
|
|
2425
|
+
},
|
|
2426
|
+
{
|
|
2427
|
+
type: "object",
|
|
2428
|
+
properties: {
|
|
2429
|
+
color: {
|
|
2430
|
+
type: "string"
|
|
2431
|
+
}
|
|
2432
|
+
},
|
|
2433
|
+
required: [
|
|
2434
|
+
"color"
|
|
2435
|
+
]
|
|
2436
|
+
}
|
|
2437
|
+
]
|
|
2438
|
+
},
|
|
2439
|
+
annotation: {
|
|
2440
|
+
allOf: [
|
|
2441
|
+
{
|
|
2442
|
+
$ref: "#/definitions/entity"
|
|
2443
|
+
},
|
|
2444
|
+
{
|
|
2445
|
+
type: "object",
|
|
2446
|
+
properties: {
|
|
2447
|
+
type: {
|
|
2448
|
+
type: "string"
|
|
2449
|
+
},
|
|
2450
|
+
content: {
|
|
2451
|
+
type: "string"
|
|
2452
|
+
},
|
|
2453
|
+
contentRevision: {
|
|
2454
|
+
type: "number"
|
|
2455
|
+
},
|
|
2456
|
+
streamPoints: {
|
|
2457
|
+
type: "array",
|
|
2458
|
+
items: {
|
|
2459
|
+
type: "string"
|
|
2460
|
+
}
|
|
2461
|
+
},
|
|
2462
|
+
textEditable: {
|
|
2463
|
+
type: "boolean"
|
|
2464
|
+
},
|
|
2465
|
+
style: {
|
|
2466
|
+
type: "object"
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
]
|
|
2471
|
+
},
|
|
2472
|
+
streamPoint: {
|
|
2473
|
+
allOf: [
|
|
2474
|
+
{
|
|
2475
|
+
$ref: "#/definitions/entity"
|
|
2476
|
+
},
|
|
2477
|
+
{
|
|
2478
|
+
type: "object",
|
|
2479
|
+
properties: {
|
|
2480
|
+
frequency: {
|
|
2481
|
+
type: "number"
|
|
2482
|
+
},
|
|
2483
|
+
x: {
|
|
2484
|
+
type: "object",
|
|
2485
|
+
properties: {
|
|
2486
|
+
active: {
|
|
2487
|
+
type: "boolean"
|
|
2488
|
+
},
|
|
2489
|
+
scaled: {
|
|
2490
|
+
type: "boolean"
|
|
2491
|
+
},
|
|
2492
|
+
format: {
|
|
2493
|
+
type: "string"
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
},
|
|
2497
|
+
y: {
|
|
2498
|
+
type: "object",
|
|
2499
|
+
properties: {
|
|
2500
|
+
active: {
|
|
2501
|
+
type: "boolean"
|
|
2502
|
+
},
|
|
2503
|
+
format: {
|
|
2504
|
+
type: "string"
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2507
|
+
},
|
|
2508
|
+
measurement: {
|
|
2509
|
+
type: "string"
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
}
|
|
2513
|
+
]
|
|
2514
|
+
},
|
|
2515
|
+
annotationViewer: {
|
|
2516
|
+
allOf: [
|
|
2517
|
+
{
|
|
2518
|
+
$ref: "#/definitions/entity"
|
|
2519
|
+
},
|
|
2520
|
+
{
|
|
2521
|
+
type: "object",
|
|
2522
|
+
properties: {
|
|
2523
|
+
id: {
|
|
2524
|
+
type: "string"
|
|
2525
|
+
},
|
|
2526
|
+
active: {
|
|
2527
|
+
type: "boolean"
|
|
2528
|
+
},
|
|
2529
|
+
editable: {
|
|
2530
|
+
type: "boolean"
|
|
2531
|
+
},
|
|
2532
|
+
annotations: {
|
|
2533
|
+
type: "array",
|
|
2534
|
+
items: {
|
|
2535
|
+
type: "string"
|
|
2536
|
+
}
|
|
2537
|
+
},
|
|
2538
|
+
inTextEditMode: {
|
|
2539
|
+
type: "boolean"
|
|
2540
|
+
}
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
]
|
|
2544
|
+
},
|
|
2545
|
+
dockviewLeafData: {
|
|
2546
|
+
type: "object",
|
|
2547
|
+
properties: {
|
|
2548
|
+
id: {
|
|
2549
|
+
type: "string"
|
|
2550
|
+
},
|
|
2551
|
+
views: {
|
|
2552
|
+
type: "array",
|
|
2553
|
+
items: {
|
|
2554
|
+
type: "string"
|
|
2555
|
+
}
|
|
2556
|
+
},
|
|
2557
|
+
activeView: {
|
|
2558
|
+
type: "string"
|
|
2559
|
+
}
|
|
2560
|
+
},
|
|
2561
|
+
required: [
|
|
2562
|
+
"id",
|
|
2563
|
+
"views"
|
|
2564
|
+
]
|
|
2565
|
+
},
|
|
2566
|
+
dockviewNode: {
|
|
2567
|
+
oneOf: [
|
|
2568
|
+
{
|
|
2569
|
+
type: "object",
|
|
2570
|
+
properties: {
|
|
2571
|
+
type: {
|
|
2572
|
+
"const": "leaf"
|
|
2573
|
+
},
|
|
2574
|
+
size: {
|
|
2575
|
+
type: "number"
|
|
2576
|
+
},
|
|
2577
|
+
data: {
|
|
2578
|
+
$ref: "#/definitions/dockviewLeafData"
|
|
2579
|
+
}
|
|
2580
|
+
},
|
|
2581
|
+
required: [
|
|
2582
|
+
"type",
|
|
2583
|
+
"data"
|
|
2584
|
+
]
|
|
2585
|
+
},
|
|
2586
|
+
{
|
|
2587
|
+
type: "object",
|
|
2588
|
+
properties: {
|
|
2589
|
+
type: {
|
|
2590
|
+
"const": "branch"
|
|
2591
|
+
},
|
|
2592
|
+
size: {
|
|
2593
|
+
type: "number"
|
|
2594
|
+
},
|
|
2595
|
+
data: {
|
|
2596
|
+
type: "array",
|
|
2597
|
+
items: {
|
|
2598
|
+
$ref: "#/definitions/dockviewNode"
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2601
|
+
},
|
|
2602
|
+
required: [
|
|
2603
|
+
"type",
|
|
2604
|
+
"data"
|
|
2605
|
+
]
|
|
2606
|
+
}
|
|
2607
|
+
]
|
|
2608
|
+
},
|
|
2609
|
+
dockviewPanel: {
|
|
2610
|
+
type: "object",
|
|
2611
|
+
properties: {
|
|
2612
|
+
id: {
|
|
2613
|
+
type: "string"
|
|
2614
|
+
},
|
|
2615
|
+
contentComponent: {
|
|
2616
|
+
type: "string"
|
|
2617
|
+
},
|
|
2618
|
+
title: {
|
|
2619
|
+
type: "string"
|
|
2620
|
+
},
|
|
2621
|
+
params: {
|
|
2622
|
+
type: "object"
|
|
2623
|
+
}
|
|
2624
|
+
},
|
|
2625
|
+
required: [
|
|
2626
|
+
"id",
|
|
2627
|
+
"contentComponent",
|
|
2628
|
+
"title",
|
|
2629
|
+
"params"
|
|
2630
|
+
]
|
|
2631
|
+
},
|
|
2632
|
+
dockviewLayout: {
|
|
2633
|
+
type: "object",
|
|
2634
|
+
properties: {
|
|
2635
|
+
grid: {
|
|
2636
|
+
type: "object",
|
|
2637
|
+
properties: {
|
|
2638
|
+
root: {
|
|
2639
|
+
$ref: "#/definitions/dockviewNode"
|
|
2640
|
+
},
|
|
2641
|
+
orientation: {
|
|
2642
|
+
type: "string",
|
|
2643
|
+
"enum": [
|
|
2644
|
+
"HORIZONTAL",
|
|
2645
|
+
"VERTICAL"
|
|
2646
|
+
]
|
|
2647
|
+
},
|
|
2648
|
+
width: {
|
|
2649
|
+
type: "number"
|
|
2650
|
+
},
|
|
2651
|
+
height: {
|
|
2652
|
+
type: "number"
|
|
2653
|
+
}
|
|
2654
|
+
},
|
|
2655
|
+
required: [
|
|
2656
|
+
"root",
|
|
2657
|
+
"orientation",
|
|
2658
|
+
"width",
|
|
2659
|
+
"height"
|
|
2660
|
+
]
|
|
2661
|
+
},
|
|
2662
|
+
panels: {
|
|
2663
|
+
type: "object",
|
|
2664
|
+
additionalProperties: {
|
|
2665
|
+
$ref: "#/definitions/dockviewPanel"
|
|
2666
|
+
}
|
|
2667
|
+
},
|
|
2668
|
+
activeGroup: {
|
|
2669
|
+
type: "string"
|
|
2670
|
+
}
|
|
2671
|
+
},
|
|
2672
|
+
required: [
|
|
2673
|
+
"grid",
|
|
2674
|
+
"panels"
|
|
2675
|
+
]
|
|
2676
|
+
},
|
|
2677
|
+
axis: {
|
|
2678
|
+
allOf: [
|
|
2679
|
+
{
|
|
2680
|
+
$ref: "#/definitions/entity"
|
|
2681
|
+
},
|
|
2682
|
+
{
|
|
2683
|
+
type: "object",
|
|
2684
|
+
properties: {
|
|
2685
|
+
color: {
|
|
2686
|
+
type: "string"
|
|
2687
|
+
},
|
|
2688
|
+
resources: {
|
|
2689
|
+
type: "array",
|
|
2690
|
+
items: {
|
|
2691
|
+
type: "string"
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2695
|
+
}
|
|
2696
|
+
]
|
|
2697
|
+
},
|
|
2698
|
+
assetsContainer: {
|
|
2699
|
+
allOf: [
|
|
2700
|
+
{
|
|
2701
|
+
$ref: "#/definitions/entitiesContainer"
|
|
2702
|
+
},
|
|
2703
|
+
{
|
|
2704
|
+
type: "object",
|
|
2705
|
+
properties: {
|
|
2706
|
+
byId: {
|
|
2707
|
+
type: "object",
|
|
2708
|
+
additionalProperties: {
|
|
2709
|
+
$ref: "#/definitions/asset"
|
|
2710
|
+
}
|
|
2711
|
+
}
|
|
2712
|
+
}
|
|
2713
|
+
}
|
|
2714
|
+
]
|
|
2715
|
+
},
|
|
2716
|
+
annotationsContainer: {
|
|
2717
|
+
allOf: [
|
|
2718
|
+
{
|
|
2719
|
+
$ref: "#/definitions/entitiesContainer"
|
|
2720
|
+
},
|
|
2721
|
+
{
|
|
2722
|
+
type: "object",
|
|
2723
|
+
properties: {
|
|
2724
|
+
byId: {
|
|
2725
|
+
type: "object",
|
|
2726
|
+
additionalProperties: {
|
|
2727
|
+
$ref: "#/definitions/annotation"
|
|
2728
|
+
}
|
|
2729
|
+
}
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
]
|
|
2733
|
+
},
|
|
2734
|
+
streamPointsContainer: {
|
|
2735
|
+
allOf: [
|
|
2736
|
+
{
|
|
2737
|
+
$ref: "#/definitions/entitiesContainer"
|
|
2738
|
+
},
|
|
2739
|
+
{
|
|
2740
|
+
type: "object",
|
|
2741
|
+
properties: {
|
|
2742
|
+
byId: {
|
|
2743
|
+
type: "object",
|
|
2744
|
+
additionalProperties: {
|
|
2745
|
+
$ref: "#/definitions/streamPoint"
|
|
2746
|
+
}
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
}
|
|
2750
|
+
]
|
|
2751
|
+
},
|
|
2752
|
+
annotationsViewersContainer: {
|
|
2753
|
+
allOf: [
|
|
2754
|
+
{
|
|
2755
|
+
$ref: "#/definitions/entitiesContainer"
|
|
2756
|
+
},
|
|
2757
|
+
{
|
|
2758
|
+
type: "object",
|
|
2759
|
+
properties: {
|
|
2760
|
+
byId: {
|
|
2761
|
+
type: "object",
|
|
2762
|
+
additionalProperties: {
|
|
2763
|
+
$ref: "#/definitions/annotationViewer"
|
|
2764
|
+
}
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
}
|
|
2768
|
+
]
|
|
2769
|
+
},
|
|
2770
|
+
dataViewersContainer: {
|
|
2771
|
+
allOf: [
|
|
2772
|
+
{
|
|
2773
|
+
$ref: "#/definitions/entitiesContainer"
|
|
2774
|
+
},
|
|
2775
|
+
{
|
|
2776
|
+
type: "object",
|
|
2777
|
+
properties: {
|
|
2778
|
+
byId: {
|
|
2779
|
+
type: "object",
|
|
2780
|
+
additionalProperties: {
|
|
2781
|
+
$ref: "#/definitions/dataViewer"
|
|
2782
|
+
}
|
|
2783
|
+
}
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2786
|
+
]
|
|
2787
|
+
},
|
|
2788
|
+
measurementsContainer: {
|
|
2789
|
+
allOf: [
|
|
2790
|
+
{
|
|
2791
|
+
$ref: "#/definitions/entitiesContainer"
|
|
2792
|
+
},
|
|
2793
|
+
{
|
|
2794
|
+
type: "object",
|
|
2795
|
+
properties: {
|
|
2796
|
+
byId: {
|
|
2797
|
+
type: "object",
|
|
2798
|
+
additionalProperties: {
|
|
2799
|
+
$ref: "#/definitions/measurement"
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2804
|
+
]
|
|
2805
|
+
},
|
|
2806
|
+
filesContainer: {
|
|
2807
|
+
allOf: [
|
|
2808
|
+
{
|
|
2809
|
+
$ref: "#/definitions/entitiesContainer"
|
|
2810
|
+
},
|
|
2811
|
+
{
|
|
2812
|
+
type: "object",
|
|
2813
|
+
properties: {
|
|
2814
|
+
byId: {
|
|
2815
|
+
type: "object",
|
|
2816
|
+
additionalProperties: {
|
|
2817
|
+
$ref: "#/definitions/file"
|
|
2818
|
+
}
|
|
2819
|
+
}
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
]
|
|
2823
|
+
},
|
|
2824
|
+
resourcesContainer: {
|
|
2825
|
+
allOf: [
|
|
2826
|
+
{
|
|
2827
|
+
$ref: "#/definitions/entitiesContainer"
|
|
2828
|
+
},
|
|
2829
|
+
{
|
|
2830
|
+
type: "object",
|
|
2831
|
+
properties: {
|
|
2832
|
+
byId: {
|
|
2833
|
+
type: "object",
|
|
2834
|
+
additionalProperties: {
|
|
2835
|
+
$ref: "#/definitions/resource"
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
}
|
|
2839
|
+
}
|
|
2840
|
+
]
|
|
2841
|
+
},
|
|
2842
|
+
axesContainer: {
|
|
2843
|
+
allOf: [
|
|
2844
|
+
{
|
|
2845
|
+
$ref: "#/definitions/entitiesContainer"
|
|
2846
|
+
},
|
|
2847
|
+
{
|
|
2848
|
+
type: "object",
|
|
2849
|
+
properties: {
|
|
2850
|
+
byId: {
|
|
2851
|
+
type: "object",
|
|
2852
|
+
additionalProperties: {
|
|
2853
|
+
$ref: "#/definitions/axis"
|
|
2854
|
+
}
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
}
|
|
2858
|
+
]
|
|
2859
|
+
}
|
|
2860
|
+
};
|
|
2861
|
+
var properties = {
|
|
2862
|
+
version: {
|
|
2863
|
+
type: "number",
|
|
2864
|
+
"const": 4
|
|
2865
|
+
},
|
|
2866
|
+
menu: {
|
|
2867
|
+
type: "object",
|
|
2868
|
+
properties: {
|
|
2869
|
+
visible: {
|
|
2870
|
+
type: "boolean"
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2873
|
+
},
|
|
2874
|
+
files: {
|
|
2875
|
+
type: "object",
|
|
2876
|
+
properties: {
|
|
2877
|
+
entities: {
|
|
2878
|
+
type: "object",
|
|
2879
|
+
properties: {
|
|
2880
|
+
files: {
|
|
2881
|
+
$ref: "#/definitions/filesContainer"
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
2886
|
+
},
|
|
2887
|
+
resources: {
|
|
2888
|
+
type: "object",
|
|
2889
|
+
properties: {
|
|
2890
|
+
entities: {
|
|
2891
|
+
type: "object",
|
|
2892
|
+
properties: {
|
|
2893
|
+
resources: {
|
|
2894
|
+
$ref: "#/definitions/resourcesContainer"
|
|
2895
|
+
}
|
|
2896
|
+
}
|
|
2897
|
+
}
|
|
2898
|
+
}
|
|
2899
|
+
},
|
|
2900
|
+
assets: {
|
|
2901
|
+
type: "object",
|
|
2902
|
+
properties: {
|
|
2903
|
+
entities: {
|
|
2904
|
+
type: "object",
|
|
2905
|
+
properties: {
|
|
2906
|
+
assets: {
|
|
2907
|
+
$ref: "#/definitions/assetsContainer"
|
|
2908
|
+
}
|
|
2909
|
+
}
|
|
2910
|
+
}
|
|
2911
|
+
}
|
|
2912
|
+
},
|
|
2913
|
+
layout: {
|
|
2914
|
+
type: "object",
|
|
2915
|
+
properties: {
|
|
2916
|
+
dockviewLayout: {
|
|
2917
|
+
oneOf: [
|
|
2918
|
+
{
|
|
2919
|
+
$ref: "#/definitions/dockviewLayout"
|
|
2920
|
+
},
|
|
2921
|
+
{
|
|
2922
|
+
type: "null"
|
|
2923
|
+
}
|
|
2924
|
+
]
|
|
2925
|
+
},
|
|
2926
|
+
focus: {
|
|
2927
|
+
type: "string"
|
|
2928
|
+
},
|
|
2929
|
+
dragging: {
|
|
2930
|
+
type: "boolean"
|
|
2931
|
+
},
|
|
2932
|
+
resizingPanels: {
|
|
2933
|
+
type: "boolean"
|
|
2934
|
+
}
|
|
2935
|
+
}
|
|
2936
|
+
},
|
|
2937
|
+
data: {
|
|
2938
|
+
type: "object",
|
|
2939
|
+
properties: {
|
|
2940
|
+
measurementScale: {
|
|
2941
|
+
type: "number"
|
|
2942
|
+
},
|
|
2943
|
+
entities: {
|
|
2944
|
+
type: "object",
|
|
2945
|
+
properties: {
|
|
2946
|
+
dataViewers: {
|
|
2947
|
+
$ref: "#/definitions/dataViewersContainer"
|
|
2948
|
+
},
|
|
2949
|
+
measurements: {
|
|
2950
|
+
$ref: "#/definitions/measurementsContainer"
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
2953
|
+
}
|
|
2954
|
+
}
|
|
2955
|
+
},
|
|
2956
|
+
annotations: {
|
|
2957
|
+
type: "object",
|
|
2958
|
+
properties: {
|
|
2959
|
+
allowed: {
|
|
2960
|
+
type: "boolean"
|
|
2961
|
+
},
|
|
2962
|
+
editorOpen: {
|
|
2963
|
+
type: "boolean"
|
|
2964
|
+
},
|
|
2965
|
+
streamPointSelectorOpen: {
|
|
2966
|
+
type: "boolean"
|
|
2967
|
+
},
|
|
2968
|
+
entities: {
|
|
2969
|
+
type: "object",
|
|
2970
|
+
properties: {
|
|
2971
|
+
annotations: {
|
|
2972
|
+
$ref: "#/definitions/entitiesContainer"
|
|
2973
|
+
},
|
|
2974
|
+
streamPoints: {
|
|
2975
|
+
$ref: "#/definitions/streamPointsContainer"
|
|
2976
|
+
},
|
|
2977
|
+
annotationsViewers: {
|
|
2978
|
+
$ref: "#/definitions/annotationsViewersContainer"
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2981
|
+
}
|
|
2982
|
+
}
|
|
2983
|
+
},
|
|
2984
|
+
timeline: {
|
|
2985
|
+
type: "object",
|
|
2986
|
+
properties: {
|
|
2987
|
+
entities: {
|
|
2988
|
+
type: "object",
|
|
2989
|
+
properties: {
|
|
2990
|
+
axes: {
|
|
2991
|
+
$ref: "#/definitions/axesContainer"
|
|
2992
|
+
}
|
|
2993
|
+
}
|
|
2994
|
+
}
|
|
2995
|
+
}
|
|
2996
|
+
},
|
|
2997
|
+
timer: {
|
|
2998
|
+
type: "object",
|
|
2999
|
+
properties: {
|
|
3000
|
+
running: {
|
|
3001
|
+
type: "boolean"
|
|
3002
|
+
},
|
|
3003
|
+
startTime: {
|
|
3004
|
+
oneOf: [
|
|
3005
|
+
{
|
|
3006
|
+
type: "number"
|
|
3007
|
+
},
|
|
3008
|
+
{
|
|
3009
|
+
type: "null"
|
|
3010
|
+
}
|
|
3011
|
+
]
|
|
3012
|
+
},
|
|
3013
|
+
waiting: {
|
|
3014
|
+
type: "boolean"
|
|
3015
|
+
},
|
|
3016
|
+
waitingReasons: {
|
|
3017
|
+
type: "array"
|
|
3018
|
+
},
|
|
3019
|
+
range: {
|
|
3020
|
+
type: "array"
|
|
3021
|
+
},
|
|
3022
|
+
rate: {
|
|
3023
|
+
type: "number"
|
|
3024
|
+
}
|
|
3025
|
+
}
|
|
3026
|
+
}
|
|
3027
|
+
};
|
|
3028
|
+
var schema = {
|
|
3029
|
+
$schema: $schema,
|
|
3030
|
+
id: id,
|
|
3031
|
+
description: description$1,
|
|
3032
|
+
type: type,
|
|
3033
|
+
definitions: definitions,
|
|
3034
|
+
properties: properties
|
|
3035
|
+
};
|
|
3036
|
+
|
|
3037
|
+
const jsonSchemaValidator = createAJVValidator(schema);
|
|
3038
|
+
var v4 = stage => {
|
|
3039
|
+
return jsonSchemaValidator(stage);
|
|
3040
|
+
};
|
|
3041
|
+
|
|
3042
|
+
const map = Object.freeze({
|
|
3043
|
+
1: v1,
|
|
3044
|
+
2: v2,
|
|
3045
|
+
3: v3$1,
|
|
3046
|
+
4: v4
|
|
3047
|
+
});
|
|
3048
|
+
|
|
3049
|
+
/**
|
|
3050
|
+
* Parses validation specific options from global options.
|
|
3051
|
+
* @param {obj} options
|
|
3052
|
+
*/
|
|
3053
|
+
const optionsParser$1 = ({
|
|
3054
|
+
validationVersion = undefined
|
|
3055
|
+
}) => ({
|
|
3056
|
+
version: validationVersion
|
|
3057
|
+
});
|
|
3058
|
+
|
|
3059
|
+
/**
|
|
3060
|
+
* Validates a stage
|
|
3061
|
+
* @param {Object} stage
|
|
3062
|
+
* @param {number} version
|
|
3063
|
+
*/
|
|
3064
|
+
|
|
3065
|
+
var validate = (stage, options = {}) => {
|
|
3066
|
+
const {
|
|
3067
|
+
version = undefined
|
|
3068
|
+
} = options;
|
|
3069
|
+
return R.pipe(R.defaultTo(detectVersion(stage)), lookup(map), R.applyTo(stage))(version);
|
|
3070
|
+
};
|
|
3071
|
+
|
|
3072
|
+
var versions = Object.freeze([1, 2, 3, 4]);
|
|
3073
|
+
|
|
3074
|
+
/**
|
|
3075
|
+
* v1-to-v2.js
|
|
3076
|
+
* Upgrader for version 1 stage files to version 2.
|
|
3077
|
+
* Removes timelines axes with resources. And adds the zoomSteps for the dataviewer.
|
|
3078
|
+
*/
|
|
3079
|
+
const outletsView = listEntities(["data", "entities", "outlets"]);
|
|
3080
|
+
|
|
3081
|
+
// This adds the zoomsteps on dataviwer based on "visible" prop on the associated outlet.
|
|
3082
|
+
const addDataViewerZoomSteps = stage => R.pipe(outletsView,
|
|
3083
|
+
// The association to a dataviewer is defined in the outlet id (dataviewer/<DATAVIEWER ID>),
|
|
3084
|
+
// This only takes outlets associated with a dataviewer.
|
|
3085
|
+
R.filter(R.propSatisfies(R.startsWith("dataviewer/"), "id")), R.map(
|
|
3086
|
+
// This pairs the path to the associated dataviewer to its required zoomSteps.
|
|
3087
|
+
R.converge(R.pair, [R.pipe(R.prop("id"), R.replace("dataviewer/", ""), id => ["data", "entities", "dataViewers", "byId", id, "zoomSteps"]), R.pipe(R.prop("visible"), visible => [visible])])),
|
|
3088
|
+
// Set the "zoomSteps" prop of the dataviewer to the visibility of the outlet.
|
|
3089
|
+
R.reduce((acc, [path, zoomSteps]) => R.assocPath(path, zoomSteps, acc), stage))(stage);
|
|
3090
|
+
var v1ToV2 = R.pipe(
|
|
3091
|
+
// Sets the version prop to "2"
|
|
3092
|
+
R.assoc("version", 2),
|
|
3093
|
+
// Remove the association to resources from the timline axes.
|
|
3094
|
+
// In version 2 the tracks for files on the timeline are handled by the v2 consolidation strategy.
|
|
3095
|
+
R.dissocPath(["timeline", "entities", "axes", "byId", "video", "resources"]), R.dissocPath(["timeline", "entities", "axes", "byId", "high-speed", "resources"]),
|
|
3096
|
+
// Adds the zoomsteps to the dataviewers.
|
|
3097
|
+
addDataViewerZoomSteps);
|
|
3098
|
+
|
|
3099
|
+
const NEW_TEST_REGEX$1 = /^([0-9]{5})_(.+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)$/;
|
|
3100
|
+
const fsPath$1 = require("path");
|
|
3101
|
+
const match$1 = R__namespace.curry((regex, st) => st.match(regex));
|
|
3102
|
+
const mapWithIndex$1 = R__namespace.addIndex(R__namespace.map);
|
|
3103
|
+
const axesSettings$1 = [{
|
|
3104
|
+
id: "video",
|
|
3105
|
+
color: "#41b51b"
|
|
3106
|
+
}, {
|
|
3107
|
+
id: "high-speed",
|
|
3108
|
+
color: "#3318cc"
|
|
3109
|
+
}, {
|
|
3110
|
+
id: "comment",
|
|
3111
|
+
color: "red"
|
|
3112
|
+
}];
|
|
3113
|
+
const tracksIdsPath$1 = ["timeline", "entities", "tracks", "ids"];
|
|
3114
|
+
const tracksByIdPath$1 = ["timeline", "entities", "tracks", "byId"];
|
|
3115
|
+
const axesIdsPath$1 = ["timeline", "entities", "axes", "ids"];
|
|
3116
|
+
const axesByIdPath$1 = ["timeline", "entities", "axes", "byId"];
|
|
3117
|
+
const resourcesIdsView$1 = R__namespace.pathOr([], ["resources", "entities", "resources", "ids"]);
|
|
3118
|
+
const resourcesByIdView$1 = R__namespace.pathOr({}, ["resources", "entities", "resources", "byId"]);
|
|
3119
|
+
const filesIdsView$1 = R__namespace.pathOr([], ["files", "entities", "files", "ids"]);
|
|
3120
|
+
const filesByIdView$1 = R__namespace.pathOr({}, ["files", "entities", "files", "byId"]);
|
|
3121
|
+
const commentsByIdView$1 = R__namespace.pathOr({}, ["timeline", "entities", "comments", "byId"]);
|
|
3122
|
+
const tracksIdsLens$1 = R__namespace.lensPath(tracksIdsPath$1);
|
|
3123
|
+
const tracksByIdLens$1 = R__namespace.lensPath(tracksByIdPath$1);
|
|
3124
|
+
const axesIdsLens$1 = R__namespace.lensPath(axesIdsPath$1);
|
|
3125
|
+
const axesByIdLens$1 = R__namespace.lensPath(axesByIdPath$1);
|
|
3126
|
+
const filesView = R__namespace.pipe(filesByIdView$1, R__namespace.values);
|
|
3127
|
+
const commentsView$1 = R__namespace.pipe(commentsByIdView$1, R__namespace.values);
|
|
3128
|
+
const highSpeedsFilesView$1 = stage => {
|
|
3129
|
+
const filesById = filesByIdView$1(stage);
|
|
2466
3130
|
const resourcesById = resourcesByIdView$1(stage);
|
|
2467
|
-
return
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
3131
|
+
return R__namespace.pipe(
|
|
3132
|
+
// Iterate R.over the resource ids
|
|
3133
|
+
resourcesIdsView$1,
|
|
3134
|
+
// Filter out all the ids that don't start with high-speed.
|
|
3135
|
+
R__namespace.filter(R__namespace.startsWith("high-speed:")),
|
|
3136
|
+
// Map the remaining resource ids to the files ids in the respective resource object.
|
|
3137
|
+
lookupPathAll(resourcesById, ["files"]),
|
|
3138
|
+
// Flatten the ids so we get a single array containing all the files ids referred
|
|
3139
|
+
// to across all high-speed resources.
|
|
3140
|
+
R__namespace.flatten,
|
|
3141
|
+
// Map the file ids to file objects.
|
|
3142
|
+
lookupAll(filesById))(stage);
|
|
3143
|
+
};
|
|
3144
|
+
const videosFilesView$1 = stage => {
|
|
3145
|
+
const filesIds = filesIdsView$1(stage);
|
|
3146
|
+
const filesById = filesByIdView$1(stage);
|
|
3147
|
+
const highSpeedFiles = highSpeedsFilesView$1(stage);
|
|
3148
|
+
return R__namespace.pipe(R__namespace.without(R__namespace.pluck("id", highSpeedFiles)), lookupAll(filesById), R__namespace.filter(R__namespace.propEq("video", "type")))(filesIds);
|
|
3149
|
+
};
|
|
3150
|
+
const upsertAxes$1 = axes => R__namespace.curry(R__namespace.pipe(R__namespace.unless(R__namespace.path(axesIdsPath$1), R__namespace.assocPath(axesIdsPath$1, [])), R__namespace.unless(R__namespace.path(axesByIdPath$1), R__namespace.assocPath(axesIdsPath$1, {})), R__namespace.over(axesIdsLens$1, R__namespace.union(R__namespace.pluck("id", axes))), R__namespace.over(axesByIdLens$1, R__namespace.mergeRight(indexById(axes)))));
|
|
3151
|
+
const createTrackFromEntity$1 = R__namespace.curry((axis, entity) => {
|
|
3152
|
+
const {
|
|
3153
|
+
start,
|
|
3154
|
+
end,
|
|
3155
|
+
type,
|
|
3156
|
+
id
|
|
3157
|
+
} = entity;
|
|
3158
|
+
return {
|
|
3159
|
+
id: `track:${id}`,
|
|
3160
|
+
start,
|
|
3161
|
+
end,
|
|
3162
|
+
type,
|
|
3163
|
+
axisRef: axis,
|
|
3164
|
+
ref: id
|
|
3165
|
+
};
|
|
3166
|
+
});
|
|
3167
|
+
const mapEntitiesToTracks$1 = R__namespace.curry((entitiesSelector, axis, stage) => R__namespace.map(createTrackFromEntity$1(axis), entitiesSelector(stage)));
|
|
3168
|
+
const mapCommentsToTracks$1 = R__namespace.pipe(mapEntitiesToTracks$1(commentsView$1, "comment"), R__namespace.map(R__namespace.mergeLeft({
|
|
3169
|
+
type: "comment",
|
|
3170
|
+
label: "comment"
|
|
3171
|
+
})));
|
|
3172
|
+
const formatTestNo$1 = input => {
|
|
3173
|
+
const [
|
|
3174
|
+
// eslint-disable-next-line no-unused-vars
|
|
3175
|
+
m, project, facility, program, category, test, experiment, measurement] = input.match(NEW_TEST_REGEX$1);
|
|
3176
|
+
return `${project}_${program.padStart(2, "0")}${facility}_${category.padStart(2, "0")}_${test.padStart(3, "0")}_${experiment.padStart(3, "0")}_${measurement.padStart(2, "0")}`;
|
|
3177
|
+
};
|
|
3178
|
+
const extractTestNumberFromMetadata$1 = R__namespace.pipe(R__namespace.path(["metadata", "location", "$id"]), R__namespace.when(R__namespace.test(NEW_TEST_REGEX$1), formatTestNo$1));
|
|
3179
|
+
const extractTestNumberFromFileName$1 = R__namespace.compose(R__namespace.head, R__namespace.defaultTo([undefined]), R__namespace.either(match$1(/[0-9]{5}_[0-9]{2}[a-zA-Z]+_[0-9]{2}_[0-9]{3}_[0-9]{3}_[0-9]{2}/), match$1(/[A-Za-z]+[0-9]{5}_[0-9]+_[0-9]+_[0-9]+/)), R__namespace.prop("path"));
|
|
3180
|
+
const extractTestNumber$1 = (stage, track) => R__namespace.pipe(filesByIdView$1, R__namespace.prop(track.ref), R__namespace.either(extractTestNumberFromMetadata$1, extractTestNumberFromFileName$1))(stage);
|
|
3181
|
+
const formatter$1 = fp.formatWithOptions({
|
|
3182
|
+
awareOfUnicodeTokens: true
|
|
3183
|
+
});
|
|
3184
|
+
const extractRecordingChannel$1 = (stage, track) => R__namespace.pipe(filesByIdView$1, R__namespace.path([track.ref, "metadata", "recChannel"]))(stage);
|
|
3185
|
+
const createHighSpeedTracksLabels$1 = stage => tracks => mapWithIndex$1((hs, index) => {
|
|
3186
|
+
const recordingChannel = extractRecordingChannel$1(stage, hs);
|
|
3187
|
+
const no = recordingChannel || index + 1;
|
|
3188
|
+
return R__namespace.assoc("label", `HS ${no}`, hs);
|
|
3189
|
+
}, tracks);
|
|
3190
|
+
const createVideoTracksLabels$1 = stage => tracks => mapWithIndex$1((vid, index) => {
|
|
3191
|
+
const recordingChannel = extractRecordingChannel$1(stage, vid);
|
|
3192
|
+
const no = recordingChannel || index + 1;
|
|
3193
|
+
return R__namespace.assoc("label", `VID ${no}`, vid);
|
|
3194
|
+
}, tracks);
|
|
3195
|
+
const extractFormat$1 = (stage, track) => R__namespace.pipe(filesByIdView$1, R__namespace.path([track.ref, "path"]), p => fsPath$1.extname(p))(stage);
|
|
3196
|
+
const extractSecondFractions$1 = isoStr => R__namespace.pipe(match$1(/[0-9]{2}:[0-9]{2}:[0-9]{2}.([0-9]+)/), R__namespace.ifElse(R__namespace.isNil, R__namespace.always("000"), R__namespace.nth(1)))(isoStr);
|
|
3197
|
+
const extractDate = (stage, track) => {
|
|
3198
|
+
return R__namespace.pipe(filesByIdView$1, R__namespace.path([track.ref, "start"]), fp.parseISO, formatter$1("dd-MM-yyyy"))(stage);
|
|
3199
|
+
};
|
|
3200
|
+
const createTime$1 = R__namespace.converge(R__namespace.pipe(R__namespace.pair, R__namespace.join(".")), [R__namespace.pipe(fp.parseISO, formatter$1("HH:mm:ss")), extractSecondFractions$1]);
|
|
3201
|
+
const extractStart = (stage, track) => R__namespace.pipe(filesByIdView$1, R__namespace.path([track.ref, "start"]), createTime$1)(stage);
|
|
3202
|
+
const extractEnd = (stage, track) => R__namespace.pipe(filesByIdView$1, R__namespace.path([track.ref, "end"]), createTime$1)(stage);
|
|
3203
|
+
const createVideoMetadata$1 = R__namespace.curry((type, stage, track) => ({
|
|
3204
|
+
...track,
|
|
3205
|
+
metadata: track.metadata || [[{
|
|
3206
|
+
label: "Test",
|
|
3207
|
+
value: extractTestNumber$1(stage, track)
|
|
3208
|
+
}], [{
|
|
3209
|
+
label: "Type",
|
|
3210
|
+
value: type
|
|
3211
|
+
}, {
|
|
3212
|
+
label: "Recording channel",
|
|
3213
|
+
value: extractRecordingChannel$1(stage, track)
|
|
3214
|
+
}, {
|
|
3215
|
+
label: "Format",
|
|
3216
|
+
value: extractFormat$1(stage, track)
|
|
3217
|
+
}], [{
|
|
3218
|
+
label: "Date",
|
|
3219
|
+
value: extractDate(stage, track)
|
|
3220
|
+
}, {
|
|
3221
|
+
label: "Start",
|
|
3222
|
+
value: extractStart(stage, track)
|
|
3223
|
+
}, {
|
|
3224
|
+
label: "End",
|
|
3225
|
+
value: extractEnd(stage, track)
|
|
3226
|
+
}]]
|
|
3227
|
+
}));
|
|
3228
|
+
const createHighSpeedsMetadata$1 = R__namespace.curry((stage, tracks) => R__namespace.map(createVideoMetadata$1("high-speed", stage), tracks));
|
|
3229
|
+
const createVideosMetadata$1 = R__namespace.curry((stage, tracks) => R__namespace.map(createVideoMetadata$1("video", stage), tracks));
|
|
3230
|
+
const createTracks$1 = stage => R__namespace.converge((...args) => R__namespace.flatten(args), [R__namespace.pipe(mapEntitiesToTracks$1(highSpeedsFilesView$1, "high-speed"), createHighSpeedTracksLabels$1(stage), createHighSpeedsMetadata$1(stage)), R__namespace.pipe(mapEntitiesToTracks$1(videosFilesView$1, "video"), createVideoTracksLabels$1(stage), createVideosMetadata$1(stage)), mapCommentsToTracks$1])(stage);
|
|
3231
|
+
const upsertTracks$1 = tracks => R__namespace.curry(R__namespace.pipe(R__namespace.unless(R__namespace.path(tracksIdsPath$1), R__namespace.assocPath(tracksIdsPath$1, [])), R__namespace.unless(R__namespace.path(tracksByIdPath$1), R__namespace.assocPath(tracksByIdPath$1, {})), R__namespace.over(tracksIdsLens$1, R__namespace.union(R__namespace.pluck("id", tracks))), R__namespace.over(tracksByIdLens$1, R__namespace.mergeRight(indexById(tracks)))));
|
|
3232
|
+
const earliestTime$1 = stage => R__namespace.pipe(filesView, R__namespace.map(R__namespace.prop("start")), R__namespace.map(Date.parse), R__namespace.apply(Math.min), t => new Date(t), d => d.toISOString())(stage);
|
|
3233
|
+
const latestTime$1 = stage => R__namespace.pipe(filesView, R__namespace.map(R__namespace.prop("end")), R__namespace.map(Date.parse), R__namespace.apply(Math.max), t => new Date(t), d => d.toISOString())(stage);
|
|
3234
|
+
const setTimeLineStartEnd$1 = stage => R__namespace.pipe(R__namespace.assocPath(["timeline", "start"], earliestTime$1(stage)), R__namespace.assocPath(["timeline", "end"], latestTime$1(stage)))(stage);
|
|
3235
|
+
const setCommentAxis$1 = R__namespace.assocPath(["timeline", "commentAxis"], "comment");
|
|
3236
|
+
const consolidateTimeline$1 = stage => {
|
|
3237
|
+
return R__namespace.pipe(upsertAxes$1(axesSettings$1), upsertTracks$1(createTracks$1(stage)), setTimeLineStartEnd$1, setCommentAxis$1)(stage);
|
|
3238
|
+
};
|
|
3239
|
+
const consolidate$1 = stage => {
|
|
3240
|
+
return consolidateTimeline$1(stage);
|
|
3241
|
+
};
|
|
3242
|
+
|
|
3243
|
+
const NEW_TEST_REGEX = /^([0-9]{5})_(.+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)$/;
|
|
3244
|
+
const fsPath = require("path");
|
|
3245
|
+
const match = R__namespace.curry((regex, st) => st.match(regex));
|
|
3246
|
+
const mapWithIndex = R__namespace.addIndex(R__namespace.map);
|
|
3247
|
+
const axesSettings = [{
|
|
3248
|
+
id: "video",
|
|
3249
|
+
color: "#41b51b"
|
|
3250
|
+
}, {
|
|
3251
|
+
id: "high-speed",
|
|
3252
|
+
color: "#3318cc"
|
|
3253
|
+
}, {
|
|
3254
|
+
id: "comment",
|
|
3255
|
+
color: "red"
|
|
3256
|
+
}];
|
|
3257
|
+
const tracksIdsPath = ["timeline", "entities", "tracks", "ids"];
|
|
3258
|
+
const tracksByIdPath = ["timeline", "entities", "tracks", "byId"];
|
|
3259
|
+
const axesIdsPath = ["timeline", "entities", "axes", "ids"];
|
|
3260
|
+
const axesByIdPath = ["timeline", "entities", "axes", "byId"];
|
|
3261
|
+
const resourcesIdsView = R__namespace.pathOr([], ["resources", "entities", "resources", "ids"]);
|
|
3262
|
+
const resourcesByIdView = R__namespace.pathOr({}, ["resources", "entities", "resources", "byId"]);
|
|
3263
|
+
const filesIdsView = R__namespace.pathOr([], ["files", "entities", "files", "ids"]);
|
|
3264
|
+
const filesByIdView = R__namespace.pathOr({}, ["files", "entities", "files", "byId"]);
|
|
3265
|
+
const timingByIdView = R__namespace.pathOr({}, ["timing", "entities", "timing", "byId"]);
|
|
3266
|
+
const commentsByIdView = R__namespace.pathOr({}, ["timeline", "entities", "comments", "byId"]);
|
|
3267
|
+
const tracksIdsLens = R__namespace.lensPath(tracksIdsPath);
|
|
3268
|
+
const tracksByIdLens = R__namespace.lensPath(tracksByIdPath);
|
|
3269
|
+
const axesIdsLens = R__namespace.lensPath(axesIdsPath);
|
|
3270
|
+
const axesByIdLens = R__namespace.lensPath(axesByIdPath);
|
|
3271
|
+
const timingsView = R__namespace.pipe(timingByIdView, R__namespace.values);
|
|
3272
|
+
const commentsView = R__namespace.pipe(commentsByIdView, R__namespace.values);
|
|
3273
|
+
const highSpeedsFilesView = stage => {
|
|
3274
|
+
const filesById = filesByIdView(stage);
|
|
3275
|
+
const resourcesById = resourcesByIdView(stage);
|
|
3276
|
+
return R__namespace.pipe(
|
|
3277
|
+
// Iterate R.over the resource ids
|
|
3278
|
+
resourcesIdsView,
|
|
3279
|
+
// Filter out all the ids that don't start with high-speed.
|
|
3280
|
+
R__namespace.filter(R__namespace.startsWith("high-speed:")),
|
|
3281
|
+
// Map the remaining resource ids to the files ids in the respective resource object.
|
|
3282
|
+
lookupPathAll(resourcesById, ["props", "files"]),
|
|
3283
|
+
// Flatten the ids so we get a single array containing all the files ids referred
|
|
2471
3284
|
// to across all high-speed resources.
|
|
2472
|
-
|
|
3285
|
+
R__namespace.flatten,
|
|
3286
|
+
// Map the file ids to file objects.
|
|
2473
3287
|
lookupAll(filesById))(stage);
|
|
2474
3288
|
};
|
|
2475
|
-
|
|
2476
3289
|
const highSpeedsTimingsView = stage => {
|
|
2477
3290
|
const timings = timingsView(stage);
|
|
2478
|
-
return
|
|
3291
|
+
return R__namespace.pipe(highSpeedsFilesView,
|
|
3292
|
+
// Map the file ids to file objects.
|
|
2479
3293
|
files => files.map(file => timings.find(timing => timing.ref.id === file.id)))(stage);
|
|
2480
3294
|
};
|
|
2481
|
-
|
|
2482
|
-
const
|
|
2483
|
-
const
|
|
2484
|
-
const
|
|
2485
|
-
|
|
2486
|
-
return R.pipe(R.without(R.pluck("id", highSpeedFiles)), lookupAll(filesById), R.filter(R.propEq("type", "video")))(filesIds);
|
|
3295
|
+
const videosFilesView = stage => {
|
|
3296
|
+
const filesIds = filesIdsView(stage);
|
|
3297
|
+
const filesById = filesByIdView(stage);
|
|
3298
|
+
const highSpeedFiles = highSpeedsFilesView(stage);
|
|
3299
|
+
return R__namespace.pipe(R__namespace.without(R__namespace.pluck("id", highSpeedFiles)), lookupAll(filesById), R__namespace.filter(R__namespace.propEq("video", "type")))(filesIds);
|
|
2487
3300
|
};
|
|
2488
|
-
|
|
2489
3301
|
const videoTimingsView = stage => {
|
|
2490
3302
|
const timings = timingsView(stage);
|
|
2491
|
-
return
|
|
3303
|
+
return R__namespace.pipe(videosFilesView, files => files.map(file => timings.find(timing => timing.ref.id === file.id)))(stage);
|
|
2492
3304
|
};
|
|
2493
|
-
|
|
2494
|
-
const
|
|
2495
|
-
const createTrackFromEntity$1 = R.curry((axis, entity) => {
|
|
3305
|
+
const upsertAxes = axes => R__namespace.curry(R__namespace.pipe(R__namespace.unless(R__namespace.path(axesIdsPath), R__namespace.assocPath(axesIdsPath, [])), R__namespace.unless(R__namespace.path(axesByIdPath), R__namespace.assocPath(axesIdsPath, {})), R__namespace.over(axesIdsLens, R__namespace.union(R__namespace.pluck("id", axes))), R__namespace.over(axesByIdLens, R__namespace.mergeRight(indexById(axes)))));
|
|
3306
|
+
const createTrackFromEntity = R__namespace.curry((axis, entity) => {
|
|
2496
3307
|
const {
|
|
2497
3308
|
start,
|
|
2498
3309
|
end,
|
|
@@ -2512,8 +3323,8 @@ const createTrackFromEntity$1 = R.curry((axis, entity) => {
|
|
|
2512
3323
|
timeline: "1"
|
|
2513
3324
|
};
|
|
2514
3325
|
});
|
|
2515
|
-
const mapEntitiesToTracks
|
|
2516
|
-
const createTrackFromTiming =
|
|
3326
|
+
const mapEntitiesToTracks = R__namespace.curry((entitiesSelector, axis, stage) => R__namespace.map(createTrackFromEntity(axis), entitiesSelector(stage)));
|
|
3327
|
+
const createTrackFromTiming = R__namespace.curry((axis, timing) => {
|
|
2517
3328
|
const {
|
|
2518
3329
|
start,
|
|
2519
3330
|
end,
|
|
@@ -2536,62 +3347,54 @@ const createTrackFromTiming = R.curry((axis, timing) => {
|
|
|
2536
3347
|
timeline: "1"
|
|
2537
3348
|
};
|
|
2538
3349
|
});
|
|
2539
|
-
const mapTimingsToTracks =
|
|
2540
|
-
const mapCommentsToTracks
|
|
3350
|
+
const mapTimingsToTracks = R__namespace.curry((entitiesSelector, axis, stage) => R__namespace.map(createTrackFromTiming(axis), entitiesSelector(stage)));
|
|
3351
|
+
const mapCommentsToTracks = R__namespace.pipe(mapEntitiesToTracks(commentsView, "comment"), R__namespace.map(R__namespace.mergeLeft({
|
|
2541
3352
|
type: "comment",
|
|
2542
3353
|
label: "comment"
|
|
2543
3354
|
})));
|
|
2544
|
-
|
|
2545
|
-
const
|
|
2546
|
-
|
|
2547
|
-
m, project, facility, program, category, test, experiment, measurement] = input.match(NEW_TEST_REGEX
|
|
3355
|
+
const formatTestNo = input => {
|
|
3356
|
+
const [
|
|
3357
|
+
// eslint-disable-next-line no-unused-vars
|
|
3358
|
+
m, project, facility, program, category, test, experiment, measurement] = input.match(NEW_TEST_REGEX);
|
|
2548
3359
|
return `${project}_${program.padStart(2, "0")}${facility}_${category.padStart(2, "0")}_${test.padStart(3, "0")}_${experiment.padStart(3, "0")}_${measurement.padStart(2, "0")}`;
|
|
2549
3360
|
};
|
|
2550
|
-
|
|
2551
|
-
const
|
|
2552
|
-
const
|
|
2553
|
-
|
|
2554
|
-
const extractTestNumber$1 = (stage, track) => R.pipe(filesByIdView$1, R.prop(track.ref.id), R.either(extractTestNumberFromMetadata$1, extractTestNumberFromFileName$1))(stage);
|
|
2555
|
-
|
|
2556
|
-
const formatter$1 = fp.formatWithOptions({
|
|
3361
|
+
const extractTestNumberFromMetadata = R__namespace.pipe(R__namespace.path(["metadata", "location", "$id"]), R__namespace.when(R__namespace.test(NEW_TEST_REGEX), formatTestNo));
|
|
3362
|
+
const extractTestNumberFromFileName = R__namespace.compose(R__namespace.head, R__namespace.defaultTo([undefined]), R__namespace.either(match(/[0-9]{5}_[0-9]{2}[a-zA-Z]+_[0-9]{2}_[0-9]{3}_[0-9]{3}_[0-9]{2}/), match(/[A-Za-z]+[0-9]{5}_[0-9]+_[0-9]+_[0-9]+/)), R__namespace.prop("path"));
|
|
3363
|
+
const extractTestNumber = (stage, track) => R__namespace.pipe(filesByIdView, R__namespace.prop(track.ref.id), R__namespace.either(extractTestNumberFromMetadata, extractTestNumberFromFileName))(stage);
|
|
3364
|
+
const formatter = fp.formatWithOptions({
|
|
2557
3365
|
awareOfUnicodeTokens: true
|
|
2558
3366
|
});
|
|
2559
|
-
|
|
2560
|
-
const
|
|
2561
|
-
|
|
2562
|
-
const createHighSpeedTracksLabels$1 = stage => tracks => mapWithIndex$1((hs, index) => {
|
|
2563
|
-
const recordingChannel = extractRecordingChannel$1(stage, hs);
|
|
3367
|
+
const extractRecordingChannel = (stage, track) => R__namespace.pipe(filesByIdView, R__namespace.path([track.ref.id, "metadata", "recChannel"]))(stage);
|
|
3368
|
+
const createHighSpeedTracksLabels = stage => tracks => mapWithIndex((hs, index) => {
|
|
3369
|
+
const recordingChannel = extractRecordingChannel(stage, hs);
|
|
2564
3370
|
const no = recordingChannel || index + 1;
|
|
2565
|
-
return
|
|
3371
|
+
return R__namespace.assoc("label", `HS ${no}`, hs);
|
|
2566
3372
|
}, tracks);
|
|
2567
|
-
|
|
2568
|
-
const
|
|
2569
|
-
const recordingChannel = extractRecordingChannel$1(stage, vid);
|
|
3373
|
+
const createVideoTracksLabels = stage => tracks => mapWithIndex((vid, index) => {
|
|
3374
|
+
const recordingChannel = extractRecordingChannel(stage, vid);
|
|
2570
3375
|
const no = recordingChannel || index + 1;
|
|
2571
|
-
return
|
|
3376
|
+
return R__namespace.assoc("label", `VID ${no}`, vid);
|
|
2572
3377
|
}, tracks);
|
|
2573
|
-
|
|
2574
|
-
const
|
|
2575
|
-
|
|
2576
|
-
const
|
|
2577
|
-
|
|
2578
|
-
const
|
|
2579
|
-
const
|
|
2580
|
-
|
|
2581
|
-
const extractEndFromTrack = R.pipe(R.prop("end"), createTime$1);
|
|
2582
|
-
const createVideoMetadata$1 = R.curry((type, stage, track) => ({ ...track,
|
|
3378
|
+
const extractFormat = (stage, track) => R__namespace.pipe(filesByIdView, R__namespace.path([track.ref.id, "path"]), p => fsPath.extname(p))(stage);
|
|
3379
|
+
const extractSecondFractions = isoStr => R__namespace.pipe(match(/[0-9]{2}:[0-9]{2}:[0-9]{2}.([0-9]+)/), R__namespace.ifElse(R__namespace.isNil, R__namespace.always("000"), R__namespace.nth(1)))(isoStr);
|
|
3380
|
+
const extractDateFromTrack = R__namespace.pipe(R__namespace.prop("start"), fp.parseISO, formatter("dd-MM-yyyy"));
|
|
3381
|
+
const createTime = R__namespace.converge(R__namespace.pipe(R__namespace.pair, R__namespace.join(".")), [R__namespace.pipe(fp.parseISO, formatter("HH:mm:ss")), extractSecondFractions]);
|
|
3382
|
+
const extractStartFromTrack = R__namespace.pipe(R__namespace.prop("start"), createTime);
|
|
3383
|
+
const extractEndFromTrack = R__namespace.pipe(R__namespace.prop("end"), createTime);
|
|
3384
|
+
const createVideoMetadata = R__namespace.curry((type, stage, track) => ({
|
|
3385
|
+
...track,
|
|
2583
3386
|
metadata: [[{
|
|
2584
3387
|
label: "Test",
|
|
2585
|
-
value: extractTestNumber
|
|
3388
|
+
value: extractTestNumber(stage, track)
|
|
2586
3389
|
}], [{
|
|
2587
3390
|
label: "Type",
|
|
2588
3391
|
value: type
|
|
2589
3392
|
}, {
|
|
2590
3393
|
label: "Recording channel",
|
|
2591
|
-
value: extractRecordingChannel
|
|
3394
|
+
value: extractRecordingChannel(stage, track)
|
|
2592
3395
|
}, {
|
|
2593
3396
|
label: "Format",
|
|
2594
|
-
value: extractFormat
|
|
3397
|
+
value: extractFormat(stage, track)
|
|
2595
3398
|
}], [{
|
|
2596
3399
|
label: "Date",
|
|
2597
3400
|
value: extractDateFromTrack(track)
|
|
@@ -2603,41 +3406,33 @@ const createVideoMetadata$1 = R.curry((type, stage, track) => ({ ...track,
|
|
|
2603
3406
|
value: extractEndFromTrack(track)
|
|
2604
3407
|
}]]
|
|
2605
3408
|
}));
|
|
2606
|
-
const createHighSpeedsMetadata
|
|
2607
|
-
const createVideosMetadata
|
|
2608
|
-
|
|
2609
|
-
const
|
|
2610
|
-
|
|
2611
|
-
const upsertTracks$1 = tracks => stage => {
|
|
3409
|
+
const createHighSpeedsMetadata = R__namespace.curry((stage, tracks) => R__namespace.map(createVideoMetadata("high-speed", stage), tracks));
|
|
3410
|
+
const createVideosMetadata = R__namespace.curry((stage, tracks) => R__namespace.map(createVideoMetadata("video", stage), tracks));
|
|
3411
|
+
const createTracks = stage => R__namespace.converge((...args) => R__namespace.flatten(args), [R__namespace.pipe(mapTimingsToTracks(highSpeedsTimingsView, "high-speed"), createHighSpeedTracksLabels(stage), createHighSpeedsMetadata(stage)), R__namespace.pipe(mapTimingsToTracks(videoTimingsView, "video"), createVideoTracksLabels(stage), createVideosMetadata(stage)), mapCommentsToTracks])(stage);
|
|
3412
|
+
const upsertTracks = tracks => stage => {
|
|
2612
3413
|
const indexedById = indexById(tracks);
|
|
2613
|
-
return
|
|
3414
|
+
return R__namespace.pipe(R__namespace.unless(R__namespace.path(tracksIdsPath), R__namespace.assocPath(tracksIdsPath, [])), R__namespace.unless(R__namespace.path(tracksByIdPath), R__namespace.assocPath(tracksByIdPath, {})), R__namespace.over(tracksIdsLens, R__namespace.union(R__namespace.pluck("id", tracks))), R__namespace.over(tracksByIdLens, R__namespace.mergeLeft(indexedById)))(stage);
|
|
2614
3415
|
};
|
|
2615
|
-
|
|
2616
|
-
const
|
|
2617
|
-
|
|
2618
|
-
const
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
const setCommentAxis$1 = R.assocPath(["timeline", "commentAxis"], "comment");
|
|
2623
|
-
|
|
2624
|
-
const consolidateTimeline$1 = stage => {
|
|
2625
|
-
return R.pipe(upsertAxes$1(axesSettings$1), upsertTracks$1(createTracks$1(stage)), setTimeLineStartEnd$1, setCommentAxis$1)(stage);
|
|
3416
|
+
const earliestTime = stage => R__namespace.pipe(timingsView, R__namespace.map(R__namespace.prop("start")), R__namespace.map(Date.parse), R__namespace.apply(Math.min), t => new Date(t), d => d.toISOString())(stage);
|
|
3417
|
+
const latestTime = stage => R__namespace.pipe(timingsView, R__namespace.map(R__namespace.prop("end")), R__namespace.map(Date.parse), R__namespace.apply(Math.max), t => new Date(t), d => d.toISOString())(stage);
|
|
3418
|
+
const setTimeLineStartEnd = stage => R__namespace.pipe(R__namespace.assocPath(["timeline", "start"], earliestTime(stage)), R__namespace.assocPath(["timeline", "end"], latestTime(stage)))(stage);
|
|
3419
|
+
const setCommentAxis = R__namespace.assocPath(["timeline", "commentAxis"], "comment");
|
|
3420
|
+
const consolidateTimeline = stage => {
|
|
3421
|
+
return R__namespace.pipe(upsertAxes(axesSettings), upsertTracks(createTracks(stage)), setTimeLineStartEnd, setCommentAxis)(stage);
|
|
2626
3422
|
};
|
|
2627
|
-
|
|
2628
|
-
var v3$1 = R.pipe(R.tap(s => {
|
|
3423
|
+
var v3 = R.pipe(R.tap(s => {
|
|
2629
3424
|
console.log("consolidating v3 stage!", s);
|
|
2630
|
-
}), consolidateTimeline
|
|
3425
|
+
}), consolidateTimeline);
|
|
2631
3426
|
|
|
2632
3427
|
var _consolidators = Object.freeze({
|
|
2633
|
-
2: consolidate,
|
|
2634
|
-
3: v3
|
|
3428
|
+
2: consolidate$1,
|
|
3429
|
+
3: v3,
|
|
3430
|
+
4: v3
|
|
2635
3431
|
});
|
|
2636
3432
|
|
|
2637
3433
|
const _consolidate = consolidators => stage => {
|
|
2638
3434
|
const version = detectVersion(stage);
|
|
2639
3435
|
const consolidator = R.propOr(R.always(stage), version, consolidators);
|
|
2640
|
-
|
|
2641
3436
|
try {
|
|
2642
3437
|
return {
|
|
2643
3438
|
stage: consolidator(stage)
|
|
@@ -2648,101 +3443,95 @@ const _consolidate = consolidators => stage => {
|
|
|
2648
3443
|
};
|
|
2649
3444
|
}
|
|
2650
3445
|
};
|
|
2651
|
-
var consolidate
|
|
3446
|
+
var consolidate = _consolidate(_consolidators);
|
|
2652
3447
|
|
|
2653
|
-
const upgradeResources =
|
|
3448
|
+
const upgradeResources = R__namespace.over(R__namespace.lensPath(["resources", "entities", "resources", "byId"]), R__namespace.map(({
|
|
2654
3449
|
files,
|
|
2655
3450
|
...resource
|
|
2656
|
-
}) => ({
|
|
3451
|
+
}) => ({
|
|
3452
|
+
...resource,
|
|
2657
3453
|
props: {
|
|
2658
3454
|
files
|
|
2659
3455
|
}
|
|
2660
3456
|
})));
|
|
2661
|
-
const createTimingSlice =
|
|
3457
|
+
const createTimingSlice = R__namespace.pipe(R__namespace.assocPath(["timing", "entities", "timing"], {
|
|
2662
3458
|
ids: [],
|
|
2663
3459
|
byId: {}
|
|
2664
|
-
}),
|
|
3460
|
+
}), R__namespace.assocPath(["timing", "entities", "offset"], {
|
|
2665
3461
|
ids: [],
|
|
2666
3462
|
byId: {}
|
|
2667
3463
|
}));
|
|
2668
|
-
|
|
2669
3464
|
const createFilesTimings = s => {
|
|
2670
|
-
const timings =
|
|
3465
|
+
const timings = R__namespace.pipe(R__namespace.path(["files", "entities", "files"]), R__namespace.over(R__namespace.lensProp("byId"), R__namespace.map(R__namespace.pipe(R__namespace.pick(["id", "start", "end"]), timing => R__namespace.assoc("ref", {
|
|
2671
3466
|
id: timing.id,
|
|
2672
3467
|
type: "file"
|
|
2673
3468
|
}, timing)))))(s);
|
|
2674
|
-
return
|
|
3469
|
+
return R__namespace.pipe(R__namespace.over(R__namespace.lensPath(["files", "entities", "files", "byId"]), R__namespace.map(R__namespace.omit(["start", "end"]))), R__namespace.over(R__namespace.lensPath(["timing", "entities", "timing"]), R__namespace.mergeDeepRight(timings)), R__namespace.over(R__namespace.lensPath(["timing", "entities", "timing"]), entities => R__namespace.assoc("ids", R__namespace.keys(entities.byId), entities)))(s);
|
|
2675
3470
|
};
|
|
2676
|
-
|
|
2677
|
-
const createComments = R.unless(R.pipe(R.path(["timeline", "entities", "comments"]), R.complement(R.isNil)), R.assocPath(["timeline", "entities", "comments"], {
|
|
3471
|
+
const createComments = R__namespace.unless(R__namespace.pipe(R__namespace.path(["timeline", "entities", "comments"]), R__namespace.complement(R__namespace.isNil)), R__namespace.assocPath(["timeline", "entities", "comments"], {
|
|
2678
3472
|
ids: [],
|
|
2679
3473
|
byId: {}
|
|
2680
3474
|
}));
|
|
2681
|
-
|
|
2682
3475
|
const createCommentsTimings = s => {
|
|
2683
|
-
const timings =
|
|
3476
|
+
const timings = R__namespace.pipe(R__namespace.path(["timeline", "entities", "comments"]), R__namespace.over(R__namespace.lensProp("byId"), R__namespace.map(R__namespace.pipe(R__namespace.pick(["id", "start", "end"]), timing => R__namespace.assoc("ref", {
|
|
2684
3477
|
id: timing.id,
|
|
2685
3478
|
type: "comment"
|
|
2686
3479
|
}, timing)))))(s);
|
|
2687
|
-
return
|
|
3480
|
+
return R__namespace.pipe(R__namespace.over(R__namespace.lensPath(["timeline", "entities", "comments", "byId"]), R__namespace.map(R__namespace.omit(["start", "end"]))), R__namespace.over(R__namespace.lensPath(["timing", "entities", "timing"]), R__namespace.mergeDeepRight(timings)), R__namespace.over(R__namespace.lensPath(["timing", "entities", "timing"]), entities => R__namespace.assoc("ids", R__namespace.keys(entities.byId), entities)))(s);
|
|
2688
3481
|
};
|
|
2689
|
-
|
|
2690
|
-
const
|
|
2691
|
-
const outlets = R.path(["data", "entities", "outlets"], s);
|
|
2692
|
-
|
|
3482
|
+
const removeOutlets$1 = s => {
|
|
3483
|
+
const outlets = R__namespace.path(["data", "entities", "outlets"], s);
|
|
2693
3484
|
if (outlets) {
|
|
2694
|
-
return
|
|
3485
|
+
return R__namespace.pipe(R__namespace.dissocPath(["data", "entities", "outlets"]), R__namespace.over(R__namespace.lensPath(["data", "entities", "dataViewers", "byId"]), R__namespace.map(({
|
|
2695
3486
|
outletId,
|
|
2696
3487
|
...dataViewer
|
|
2697
3488
|
}) => {
|
|
2698
|
-
const outlet =
|
|
3489
|
+
const outlet = R__namespace.path(["byId", outletId], outlets) || {
|
|
2699
3490
|
streams: []
|
|
2700
3491
|
};
|
|
2701
|
-
return {
|
|
3492
|
+
return {
|
|
3493
|
+
...dataViewer,
|
|
2702
3494
|
streams: outlet.streams
|
|
2703
3495
|
};
|
|
2704
3496
|
})))(s);
|
|
2705
3497
|
}
|
|
2706
|
-
|
|
2707
3498
|
return s;
|
|
2708
3499
|
};
|
|
2709
|
-
|
|
2710
3500
|
const createSliceEntities = entityName => slice => {
|
|
2711
|
-
const result =
|
|
3501
|
+
const result = R__namespace.pipe(R__namespace.unless(R__namespace.has("entities"), R__namespace.assoc("entities", {})), R__namespace.unless(R__namespace.hasPath(["entities", entityName]), R__namespace.assocPath(["entities", entityName], {
|
|
2712
3502
|
ids: [],
|
|
2713
3503
|
byId: {}
|
|
2714
3504
|
})))(slice);
|
|
2715
3505
|
return result;
|
|
2716
3506
|
};
|
|
2717
|
-
|
|
2718
3507
|
const createTimelineSlice = s => {
|
|
2719
|
-
return
|
|
3508
|
+
return R__namespace.pipe(R__namespace.over(R__namespace.lensProp("timeline"), R__namespace.pipe(createSliceEntities("axes"), createSliceEntities("groups"), createSliceEntities("timeline"), createSliceEntities("tracks"))))(s);
|
|
2720
3509
|
};
|
|
2721
|
-
|
|
2722
3510
|
const createTimelineGroups = s => {
|
|
2723
|
-
const groups =
|
|
2724
|
-
return
|
|
3511
|
+
const groups = R__namespace.pipe(R__namespace.path(["timeline", "entities", "axes"]), R__namespace.over(R__namespace.lensProp("byId"), R__namespace.map(R__namespace.dissoc("resources"))))(s);
|
|
3512
|
+
return R__namespace.pipe(R__namespace.dissocPath(["timeline", "entities", "axes"]), R__namespace.assocPath(["timeline", "entities", "groups"], groups))(s);
|
|
2725
3513
|
};
|
|
2726
|
-
|
|
2727
|
-
const createTimeline = s => R.pipe(R.assocPath(["timeline", "entities", "timeline", "byId", "1"], {
|
|
3514
|
+
const createTimeline = s => R__namespace.pipe(R__namespace.assocPath(["timeline", "entities", "timeline", "byId", "1"], {
|
|
2728
3515
|
id: "1",
|
|
2729
3516
|
groupOrder: ["video", "high-speed", "comment"],
|
|
2730
3517
|
actions: {
|
|
2731
3518
|
copyLink: true,
|
|
2732
3519
|
addComment: true
|
|
2733
3520
|
},
|
|
2734
|
-
start:
|
|
2735
|
-
end:
|
|
2736
|
-
}),
|
|
2737
|
-
|
|
2738
|
-
|
|
3521
|
+
start: R__namespace.path(["timeline", "start"], s),
|
|
3522
|
+
end: R__namespace.path(["timeline", "end"], s)
|
|
3523
|
+
}), R__namespace.dissocPath(["timeline", "start"]), R__namespace.dissocPath(["timeline", "end"]), R__namespace.assocPath(["timeline", "entities", "timeline", "ids"], ["1"]), R__namespace.over(R__namespace.lensPath(["timeline", "entities", "tracks", "byId"]), R__namespace.map(R__namespace.pipe(R__namespace.assoc("timeline", "1")))), R__namespace.assocPath(["timeline", "masterTimeline"], "1"))(s);
|
|
3524
|
+
const fixTracks = s => R__namespace.pipe(R__namespace.over(R__namespace.lensPath(["timeline", "entities", "tracks", "byId"]),
|
|
3525
|
+
// eslint-disable-next-line no-unused-vars
|
|
3526
|
+
R__namespace.map(({
|
|
2739
3527
|
axisRef,
|
|
2740
3528
|
type,
|
|
2741
3529
|
ref,
|
|
2742
3530
|
start,
|
|
2743
3531
|
end,
|
|
2744
3532
|
...track
|
|
2745
|
-
}) => ({
|
|
3533
|
+
}) => ({
|
|
3534
|
+
...track,
|
|
2746
3535
|
group: axisRef,
|
|
2747
3536
|
ref: {
|
|
2748
3537
|
type: type === "video" || type === "image" ? "file" : type,
|
|
@@ -2751,16 +3540,15 @@ const fixTracks = s => R.pipe(R.over(R.lensPath(["timeline", "entities", "tracks
|
|
|
2751
3540
|
editable: type === "comment",
|
|
2752
3541
|
timeline: "1"
|
|
2753
3542
|
}))))(s);
|
|
2754
|
-
|
|
2755
|
-
const
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
const measurementsSlice = R.pipe(R.over(R.lensProp("byId"), R.pipe(R.map(measurement => ({ ...measurement,
|
|
3543
|
+
const dataStreamsToMeasurements$1 = s => {
|
|
3544
|
+
const streamsSlice = R__namespace.path(["data", "entities", "dataStreams"], s);
|
|
3545
|
+
if (!R__namespace.isEmpty(streamsSlice) && !R__namespace.isNil(streamsSlice)) {
|
|
3546
|
+
const measurementsSlice = R__namespace.pipe(R__namespace.over(R__namespace.lensProp("byId"), R__namespace.pipe(R__namespace.map(measurement => ({
|
|
3547
|
+
...measurement,
|
|
2760
3548
|
legacy: true,
|
|
2761
3549
|
name: measurement.id
|
|
2762
3550
|
})))))(streamsSlice);
|
|
2763
|
-
return
|
|
3551
|
+
return R__namespace.pipe(R__namespace.dissocPath(["data", "entities", "dataStreams"]), R__namespace.assocPath(["data", "entities", "measurements"], measurementsSlice), R__namespace.over(R__namespace.lensPath(["data", "entities", "dataViewers", "byId"]), R__namespace.map(({
|
|
2764
3552
|
streams = [],
|
|
2765
3553
|
...dataViewer
|
|
2766
3554
|
}) => ({
|
|
@@ -2768,69 +3556,234 @@ const dataStreamsToMeasurements = s => {
|
|
|
2768
3556
|
...dataViewer
|
|
2769
3557
|
}))))(s);
|
|
2770
3558
|
}
|
|
2771
|
-
|
|
2772
3559
|
return s;
|
|
2773
3560
|
};
|
|
2774
|
-
|
|
2775
|
-
const translateComponent = component => {
|
|
3561
|
+
const translateComponent$1 = component => {
|
|
2776
3562
|
switch (component) {
|
|
2777
3563
|
case "DataViewerComponent":
|
|
2778
3564
|
return "DataViewerPanel";
|
|
2779
|
-
|
|
2780
3565
|
case "VideoComponent":
|
|
2781
3566
|
return "VideoPanel";
|
|
2782
|
-
|
|
2783
3567
|
case "PlaylistComponent":
|
|
2784
3568
|
return "PlaylistPanel";
|
|
2785
|
-
|
|
2786
3569
|
default:
|
|
2787
3570
|
return component;
|
|
2788
3571
|
}
|
|
2789
3572
|
};
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
return R.pipe(R.over(R.lensPath(["layout", "entities", "layoutSections", "byId"]), R.unless(R.isNil, R.map(R.when(R.has("component"), R.over(R.lensProp("component"), translateComponent))))))(s);
|
|
3573
|
+
const fixPanels$1 = s => {
|
|
3574
|
+
if (R__namespace.hasPath(["layout", "entities", "layoutSections", "byId"], s)) {
|
|
3575
|
+
return R__namespace.pipe(R__namespace.over(R__namespace.lensPath(["layout", "entities", "layoutSections", "byId"]), R__namespace.unless(R__namespace.isNil, R__namespace.map(R__namespace.when(R__namespace.has("component"), R__namespace.over(R__namespace.lensProp("component"), translateComponent$1))))))(s);
|
|
2794
3576
|
}
|
|
2795
|
-
|
|
2796
3577
|
return s;
|
|
2797
3578
|
};
|
|
2798
|
-
|
|
2799
|
-
const scaleZoomSteps = stage => {
|
|
3579
|
+
const scaleZoomSteps$1 = stage => {
|
|
2800
3580
|
const {
|
|
2801
3581
|
measurementScale
|
|
2802
3582
|
} = stage.data;
|
|
2803
|
-
return
|
|
3583
|
+
return R__namespace.over(R__namespace.lensPath(["data", "entities", "dataViewers", "byId"]), R__namespace.unless(R__namespace.isNil, R__namespace.mapObjIndexed(({
|
|
2804
3584
|
zoomSteps = [],
|
|
2805
3585
|
...rest
|
|
2806
|
-
}) => ({
|
|
3586
|
+
}) => ({
|
|
3587
|
+
...rest,
|
|
2807
3588
|
zoomSteps: rest.zoomStepsIsScaled ? zoomSteps : zoomSteps.map(step => step * Math.sqrt(measurementScale))
|
|
2808
3589
|
}))))(stage);
|
|
2809
3590
|
};
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
var v2ToV3 = R.pipe(R.tap(stage => {
|
|
3591
|
+
const updateVersion$2 = R__namespace.assoc("version", 3);
|
|
3592
|
+
var v2ToV3$1 = R__namespace.pipe(R__namespace.tap(stage => {
|
|
2813
3593
|
console.log("upgrading ", stage, " from 2 to 3");
|
|
2814
|
-
}), consolidate
|
|
3594
|
+
}), consolidate, R__namespace.unless(R__namespace.prop("error"), R__namespace.pipe(R__namespace.prop("stage"), removeOutlets$1, scaleZoomSteps$1, dataStreamsToMeasurements$1, createTimingSlice, createTimelineSlice, createFilesTimings, createComments, createCommentsTimings, createTimelineGroups, createTimeline, fixTracks, updateVersion$2, fixPanels$1, upgradeResources)));
|
|
2815
3595
|
|
|
2816
|
-
|
|
3596
|
+
/**
|
|
3597
|
+
* v3-to-v4 Stage Upgrader
|
|
3598
|
+
*
|
|
3599
|
+
* Converts Golden Layout (v3) to DockView layout (v4).
|
|
3600
|
+
*
|
|
3601
|
+
* Key changes:
|
|
3602
|
+
* - Converts layout.entities.layoutSections (flat structure) to layout.dockviewLayout (hierarchical tree)
|
|
3603
|
+
* - Maps component names: DataViewerComponent → DataViewerPanel, VideoComponent → VideoPanel, etc.
|
|
3604
|
+
* - Converts row/column/stack structure to branch/leaf DockView nodes
|
|
3605
|
+
* - Updates version to 4
|
|
3606
|
+
*/
|
|
2817
3607
|
|
|
2818
|
-
const
|
|
3608
|
+
const DOCKVIEW_HORIZONTAL = "HORIZONTAL";
|
|
3609
|
+
const DOCKVIEW_VERTICAL = "VERTICAL";
|
|
3610
|
+
const LEGACY_COMPONENT_TO_DOCKVIEW = {
|
|
3611
|
+
DataViewerComponent: "DataViewerPanel",
|
|
3612
|
+
VideoComponent: "VideoPanel",
|
|
3613
|
+
PlaylistComponent: "PlaylistPanel"
|
|
3614
|
+
};
|
|
3615
|
+
const mapLegacyComponentToDockview = component => {
|
|
3616
|
+
return LEGACY_COMPONENT_TO_DOCKVIEW[component] || component;
|
|
3617
|
+
};
|
|
3618
|
+
const getSectionId = value => {
|
|
3619
|
+
if (Array.isArray(value)) {
|
|
3620
|
+
return value[0];
|
|
3621
|
+
}
|
|
3622
|
+
return value || "";
|
|
3623
|
+
};
|
|
3624
|
+
const getSection = (sections, value) => sections[getSectionId(value)];
|
|
3625
|
+
const isComponentSection = section => {
|
|
3626
|
+
return Boolean(section) && !["row", "column", "stack"].includes((section === null || section === void 0 ? void 0 : section.type) || "");
|
|
3627
|
+
};
|
|
3628
|
+
const getRootSection = (content, sections) => {
|
|
3629
|
+
const rootId = getSectionId(content && content[0]);
|
|
3630
|
+
return rootId ? sections[rootId] : undefined;
|
|
3631
|
+
};
|
|
3632
|
+
const getOrientationForSection = section => {
|
|
3633
|
+
return (section === null || section === void 0 ? void 0 : section.type) === "row" ? DOCKVIEW_HORIZONTAL : DOCKVIEW_VERTICAL;
|
|
3634
|
+
};
|
|
3635
|
+
const getChildSize = (parent, child) => {
|
|
3636
|
+
if (!parent || !child) {
|
|
3637
|
+
return undefined;
|
|
3638
|
+
}
|
|
3639
|
+
return parent.type === "row" ? child.width : child.height;
|
|
3640
|
+
};
|
|
3641
|
+
const flattenDirectionalChildren = (section, sections) => {
|
|
3642
|
+
const content = (section === null || section === void 0 ? void 0 : section.content) || [];
|
|
3643
|
+
return content.flatMap(childValue => {
|
|
3644
|
+
const child = getSection(sections, childValue);
|
|
3645
|
+
if ((child === null || child === void 0 ? void 0 : child.type) === section.type) {
|
|
3646
|
+
return flattenDirectionalChildren(child, sections);
|
|
3647
|
+
}
|
|
3648
|
+
return [childValue];
|
|
3649
|
+
});
|
|
3650
|
+
};
|
|
3651
|
+
const createDockviewPanelState = section => {
|
|
3652
|
+
var _section$props, _section$props2;
|
|
3653
|
+
return {
|
|
3654
|
+
id: section.id,
|
|
3655
|
+
contentComponent: mapLegacyComponentToDockview(section.component || ""),
|
|
3656
|
+
title: ((_section$props = section.props) === null || _section$props === void 0 ? void 0 : _section$props.title) || section.title || section.id,
|
|
3657
|
+
params: {
|
|
3658
|
+
...section.props,
|
|
3659
|
+
wrapMode: section.wrapMode || ((_section$props2 = section.props) === null || _section$props2 === void 0 ? void 0 : _section$props2.wrapMode) || "over"
|
|
3660
|
+
}
|
|
3661
|
+
};
|
|
3662
|
+
};
|
|
3663
|
+
const createDockviewGroupId = section => {
|
|
3664
|
+
if (section.type === "stack") {
|
|
3665
|
+
return section.id;
|
|
3666
|
+
}
|
|
3667
|
+
return `${section.id}__group`;
|
|
3668
|
+
};
|
|
3669
|
+
const createDockviewLeaf = (section, sections) => {
|
|
3670
|
+
const childValues = section.type === "stack" ? section.content || [] : [section.id];
|
|
3671
|
+
const panelIds = childValues.map(getSectionId).filter(panelId => Boolean(sections[panelId]));
|
|
3672
|
+
const activeIndex = Math.max(0, Math.min(section.activeItemIndex || 0, Math.max(panelIds.length - 1, 0)));
|
|
3673
|
+
return {
|
|
3674
|
+
type: "leaf",
|
|
3675
|
+
data: {
|
|
3676
|
+
id: createDockviewGroupId(section),
|
|
3677
|
+
views: panelIds,
|
|
3678
|
+
activeView: panelIds[activeIndex]
|
|
3679
|
+
}
|
|
3680
|
+
};
|
|
3681
|
+
};
|
|
3682
|
+
const createDockviewGridNode = (section, sections) => {
|
|
3683
|
+
if (!section) {
|
|
3684
|
+
return null;
|
|
3685
|
+
}
|
|
3686
|
+
if (section.type === "stack" || isComponentSection(section)) {
|
|
3687
|
+
return createDockviewLeaf(section, sections);
|
|
3688
|
+
}
|
|
3689
|
+
const childValues = flattenDirectionalChildren(section, sections);
|
|
3690
|
+
const children = childValues.map(childValue => {
|
|
3691
|
+
const childSection = getSection(sections, childValue);
|
|
3692
|
+
const node = createDockviewGridNode(childSection, sections);
|
|
3693
|
+
if (!node) {
|
|
3694
|
+
return null;
|
|
3695
|
+
}
|
|
3696
|
+
return {
|
|
3697
|
+
...node,
|
|
3698
|
+
size: getChildSize(section, childSection)
|
|
3699
|
+
};
|
|
3700
|
+
}).filter(n => n !== null);
|
|
3701
|
+
if (children.length === 0) {
|
|
3702
|
+
return null;
|
|
3703
|
+
}
|
|
3704
|
+
if (children.length === 1) {
|
|
3705
|
+
return children[0];
|
|
3706
|
+
}
|
|
3707
|
+
return {
|
|
3708
|
+
type: "branch",
|
|
3709
|
+
data: children
|
|
3710
|
+
};
|
|
3711
|
+
};
|
|
3712
|
+
const filterLayoutSectionsByAssets = (sectionsById, assetsById) => {
|
|
3713
|
+
return R__namespace.pipe(R__namespace.map(section => {
|
|
3714
|
+
const assetId = R__namespace.path(["props", "assetId"], section);
|
|
3715
|
+
if (assetId && !assetsById[assetId]) {
|
|
3716
|
+
return null;
|
|
3717
|
+
}
|
|
3718
|
+
return section;
|
|
3719
|
+
}), R__namespace.filter(R__namespace.identity))(sectionsById);
|
|
3720
|
+
};
|
|
3721
|
+
const createPanelsById = sections => {
|
|
3722
|
+
return R__namespace.pipe(R__namespace.values, R__namespace.filter(isComponentSection), R__namespace.reduce((acc, section) => {
|
|
3723
|
+
return {
|
|
3724
|
+
...acc,
|
|
3725
|
+
[section.id]: createDockviewPanelState(section)
|
|
3726
|
+
};
|
|
3727
|
+
}, {}))(sections);
|
|
3728
|
+
};
|
|
3729
|
+
const convertLegacyLayoutToDockview = stage => {
|
|
3730
|
+
var _rootSection$content;
|
|
3731
|
+
const content = R__namespace.path(["layout", "content"], stage);
|
|
3732
|
+
const rawSections = R__namespace.pathOr({}, ["layout", "entities", "layoutSections", "byId"], stage);
|
|
3733
|
+
const assetsById = R__namespace.pathOr({}, ["assets", "entities", "assets", "byId"], stage);
|
|
3734
|
+
const sections = filterLayoutSectionsByAssets(rawSections, assetsById);
|
|
3735
|
+
const rootSection = getRootSection(content, sections);
|
|
3736
|
+
const rootNode = createDockviewGridNode(rootSection, sections);
|
|
3737
|
+
if (!rootSection || !rootNode) {
|
|
3738
|
+
return null;
|
|
3739
|
+
}
|
|
3740
|
+
return {
|
|
3741
|
+
grid: {
|
|
3742
|
+
root: rootNode,
|
|
3743
|
+
height: 100,
|
|
3744
|
+
width: 100,
|
|
3745
|
+
orientation: getOrientationForSection(rootSection)
|
|
3746
|
+
},
|
|
3747
|
+
panels: createPanelsById(sections),
|
|
3748
|
+
activeGroup: createDockviewGroupId(rootSection.type === "stack" ? rootSection : getSection(sections, (_rootSection$content = rootSection.content) === null || _rootSection$content === void 0 ? void 0 : _rootSection$content[0]) || rootSection)
|
|
3749
|
+
};
|
|
3750
|
+
};
|
|
3751
|
+
const upgradeToDockviewLayout = stage => {
|
|
3752
|
+
// If already has dockviewLayout, skip conversion
|
|
3753
|
+
if (R__namespace.hasPath(["layout", "dockviewLayout"], stage)) {
|
|
3754
|
+
return stage;
|
|
3755
|
+
}
|
|
2819
3756
|
|
|
2820
|
-
|
|
3757
|
+
// If no legacy layout sections, nothing to convert
|
|
3758
|
+
if (!R__namespace.hasPath(["layout", "entities", "layoutSections"], stage)) {
|
|
3759
|
+
return stage;
|
|
3760
|
+
}
|
|
3761
|
+
const dockviewLayout = convertLegacyLayoutToDockview(stage);
|
|
2821
3762
|
|
|
2822
|
-
|
|
3763
|
+
// Remove legacy layout structure, keep other layout state
|
|
3764
|
+
return R__namespace.pipe(R__namespace.dissocPath(["layout", "entities"]), R__namespace.dissocPath(["layout", "content"]), R__namespace.assocPath(["layout", "dockviewLayout"], dockviewLayout),
|
|
3765
|
+
// Preserve these layout state properties if they exist
|
|
3766
|
+
R__namespace.when(R__namespace.hasPath(["layout", "focus"]), R__namespace.identity), R__namespace.when(R__namespace.hasPath(["layout", "dragging"]), R__namespace.identity), R__namespace.when(R__namespace.hasPath(["layout", "resizingPanels"]), R__namespace.identity))(stage);
|
|
3767
|
+
};
|
|
3768
|
+
const updateVersion$1 = R__namespace.assoc("version", 4);
|
|
3769
|
+
var v3ToV4 = R__namespace.pipe(R__namespace.tap(stage => {
|
|
3770
|
+
console.log("upgrading ", stage, " from 3 to 4");
|
|
3771
|
+
}), upgradeToDockviewLayout, updateVersion$1);
|
|
2823
3772
|
|
|
2824
|
-
|
|
3773
|
+
var upgraders = () => [[2, v1ToV2], [3, v2ToV3$1], [4, v3ToV4]];
|
|
2825
3774
|
|
|
2826
|
-
const
|
|
3775
|
+
const resolveFrom = stage => detectVersion(stage);
|
|
3776
|
+
const resolveTo = to => R.defaultTo(R.last(versions))(to);
|
|
3777
|
+
const versionsCorrect = (from, to) => R.gte(to, from);
|
|
3778
|
+
const upgradePipe = (from, to, stage) => R.pipe(R.filter(([v]) => v > from && v <= to), R.map(R.nth(1)), R.prepend(R.always(stage)), R.apply(R.pipe), R.applyTo(stage))(upgraders());
|
|
3779
|
+
const optionsParser = ({
|
|
2827
3780
|
upgradeFrom: from = undefined,
|
|
2828
3781
|
upgradeTo: to = undefined
|
|
2829
3782
|
}) => ({
|
|
2830
3783
|
from,
|
|
2831
3784
|
to
|
|
2832
3785
|
});
|
|
2833
|
-
var upgrade = (
|
|
3786
|
+
var upgrade = (stage, options = {}) => {
|
|
2834
3787
|
const {
|
|
2835
3788
|
to = undefined
|
|
2836
3789
|
} = options;
|
|
@@ -2839,18 +3792,16 @@ var upgrade = ((stage, options = {}) => {
|
|
|
2839
3792
|
let upgraded = stage;
|
|
2840
3793
|
let error;
|
|
2841
3794
|
console.log(`upgrading from ${resolvedFrom} to ${resolvedTo}.`);
|
|
2842
|
-
|
|
2843
3795
|
if (versionsCorrect(resolvedFrom, resolvedTo)) {
|
|
2844
3796
|
upgraded = upgradePipe(resolvedFrom, resolvedTo, stage);
|
|
2845
3797
|
} else {
|
|
2846
3798
|
error = new Error(`Incorrect version: from: ${resolvedFrom} > to: ${resolvedTo}`);
|
|
2847
3799
|
}
|
|
2848
|
-
|
|
2849
3800
|
return {
|
|
2850
3801
|
stage: upgraded,
|
|
2851
3802
|
error
|
|
2852
3803
|
};
|
|
2853
|
-
}
|
|
3804
|
+
};
|
|
2854
3805
|
|
|
2855
3806
|
var timezoneData = {
|
|
2856
3807
|
version: "2018g",
|
|
@@ -2863,19 +3814,15 @@ const {
|
|
|
2863
3814
|
setTimeZone,
|
|
2864
3815
|
populateTimeZones
|
|
2865
3816
|
} = require("timezone-support/dist/lookup-convert");
|
|
2866
|
-
|
|
2867
3817
|
const {
|
|
2868
3818
|
formatZonedTime
|
|
2869
3819
|
} = require("timezone-support/dist/parse-format");
|
|
2870
|
-
|
|
2871
3820
|
populateTimeZones(timezoneData);
|
|
2872
3821
|
const dateWithoutTimeZoneExp = /^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})((\.)([0-9]{0,}))?$/;
|
|
2873
3822
|
const dateWithWrongSeconds = /^([0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:)([0-9]{3,})((\.[0-9]+)?((Z|(\+|-)([0-9]{2}:[0-9]{2}|[0-9]+))))$/;
|
|
2874
3823
|
const amsterdam = findTimeZone("Europe/Amsterdam");
|
|
2875
|
-
|
|
2876
3824
|
const fixDateWithoutTimezone = d => {
|
|
2877
3825
|
const matches = dateWithoutTimeZoneExp.exec(d);
|
|
2878
|
-
|
|
2879
3826
|
if (matches) {
|
|
2880
3827
|
const timeObj = {
|
|
2881
3828
|
year: matches[1],
|
|
@@ -2892,89 +3839,79 @@ const fixDateWithoutTimezone = d => {
|
|
|
2892
3839
|
const formattedTimezone = formatZonedTime(withTimezone, "Z");
|
|
2893
3840
|
return `${formattedDate}T${formattedTime}${milliseconds || ""}${formattedTimezone}`;
|
|
2894
3841
|
}
|
|
2895
|
-
|
|
2896
3842
|
return d;
|
|
2897
3843
|
};
|
|
2898
|
-
|
|
2899
3844
|
const fixDateWithWrongSeconds = d => {
|
|
2900
3845
|
const matches = dateWithWrongSeconds.exec(d);
|
|
2901
|
-
|
|
2902
3846
|
if (matches) {
|
|
2903
3847
|
const [, rest, seconds, timezone] = matches;
|
|
2904
3848
|
const newDate = `${rest}${seconds.substring(seconds.length - 2)}${timezone}`;
|
|
2905
3849
|
return newDate;
|
|
2906
3850
|
}
|
|
2907
|
-
|
|
2908
3851
|
return d;
|
|
2909
3852
|
};
|
|
2910
|
-
|
|
2911
|
-
const
|
|
2912
|
-
|
|
2913
|
-
const fixDates = obj => R.pipe(R.map(R.ifElse(isIncorrectTime, R.pipe(R.tap(x => `${x} is incorrect date`), fixDateWithoutTimezone, fixDateWithWrongSeconds), R.when(R.is(Object), c => fixDates(c)))))(obj);
|
|
3853
|
+
const isIncorrectTime = input => R__namespace.both(R__namespace.is(String), R__namespace.pipe(R__namespace.anyPass([R__namespace.test(dateWithoutTimeZoneExp), R__namespace.test(dateWithWrongSeconds)])))(input);
|
|
3854
|
+
const fixDates = obj => R__namespace.pipe(R__namespace.map(R__namespace.ifElse(isIncorrectTime, R__namespace.pipe(R__namespace.tap(x => `${x} is incorrect date`), fixDateWithoutTimezone, fixDateWithWrongSeconds), R__namespace.when(R__namespace.is(Object), c => fixDates(c)))))(obj);
|
|
2914
3855
|
|
|
2915
3856
|
const fixDatesWithOptions = (options, stage) => ({
|
|
2916
3857
|
stage: fixDates(stage)
|
|
2917
3858
|
});
|
|
2918
|
-
|
|
2919
3859
|
const validateWithOptions = (options, stage) => {
|
|
2920
|
-
const validated = validate(stage, optionsParser(options));
|
|
3860
|
+
const validated = validate(stage, optionsParser$1(options));
|
|
2921
3861
|
return validated;
|
|
2922
3862
|
};
|
|
2923
|
-
|
|
2924
|
-
const
|
|
2925
|
-
|
|
2926
|
-
const consolidateWithOptions = (options, stage) => consolidate$1(stage);
|
|
2927
|
-
|
|
2928
|
-
var steps = (() => [fixDatesWithOptions, validateWithOptions, consolidateWithOptions, upgradeWithOptions]);
|
|
3863
|
+
const upgradeWithOptions = (options, stage) => upgrade(stage, optionsParser(options));
|
|
3864
|
+
const consolidateWithOptions = (options, stage) => consolidate(stage);
|
|
3865
|
+
var steps = () => [fixDatesWithOptions, validateWithOptions, consolidateWithOptions, upgradeWithOptions];
|
|
2929
3866
|
|
|
2930
3867
|
const hasError = R.prop("error");
|
|
2931
3868
|
const doStep = R.curry((options, step, response) => {
|
|
2932
3869
|
const normalizedStep = R.curry(R.nAry(2, step));
|
|
2933
3870
|
return R.pipe(R.defaultTo({}), R.unless(hasError, R.pipe(R.prop("stage"), normalizedStep(options))))(response);
|
|
2934
3871
|
});
|
|
2935
|
-
const handler = R.curry((steps, options, stage) => R.pipe(R.defaultTo([]), R.map(doStep(options)),
|
|
3872
|
+
const handler = R.curry((steps, options, stage) => R.pipe(R.defaultTo([]), R.map(doStep(options)),
|
|
3873
|
+
// Map all the steps to a doStep wrapper so they can be piped.
|
|
2936
3874
|
R.prepend(R.always({
|
|
2937
3875
|
stage
|
|
2938
|
-
})), R.apply(R.pipe),
|
|
3876
|
+
})), R.apply(R.pipe),
|
|
3877
|
+
// Create a pipe of all the steps.
|
|
2939
3878
|
R.applyTo(stage) // Pipe the stage through the steps.
|
|
2940
3879
|
)(steps));
|
|
2941
|
-
var handlerFactory = (
|
|
3880
|
+
var handlerFactory = (steps, options) => handler(steps, options);
|
|
2942
3881
|
|
|
2943
|
-
var defaultOptions = (
|
|
3882
|
+
var defaultOptions = () => Object.freeze({
|
|
2944
3883
|
upgradeFrom: undefined,
|
|
2945
3884
|
upgradeTo: undefined,
|
|
2946
3885
|
validateVersion: undefined
|
|
2947
|
-
})
|
|
2948
|
-
|
|
2949
|
-
const removeOutlets$1 = s => {
|
|
2950
|
-
const outlets = R.path(["data", "entities", "outlets"], s);
|
|
3886
|
+
});
|
|
2951
3887
|
|
|
3888
|
+
const removeOutlets = s => {
|
|
3889
|
+
const outlets = R__namespace.path(["data", "entities", "outlets"], s);
|
|
2952
3890
|
if (outlets) {
|
|
2953
|
-
return
|
|
3891
|
+
return R__namespace.pipe(R__namespace.dissocPath(["data", "entities", "outlets"]), R__namespace.over(R__namespace.lensPath(["data", "entities", "dataViewers", "byId"]), R__namespace.map(({
|
|
2954
3892
|
outletId,
|
|
2955
3893
|
...dataViewer
|
|
2956
3894
|
}) => {
|
|
2957
|
-
const outlet =
|
|
3895
|
+
const outlet = R__namespace.path(["byId", outletId], outlets) || {
|
|
2958
3896
|
streams: []
|
|
2959
3897
|
};
|
|
2960
|
-
return {
|
|
3898
|
+
return {
|
|
3899
|
+
...dataViewer,
|
|
2961
3900
|
streams: outlet.streams
|
|
2962
3901
|
};
|
|
2963
3902
|
})))(s);
|
|
2964
3903
|
}
|
|
2965
|
-
|
|
2966
3904
|
return s;
|
|
2967
3905
|
};
|
|
2968
|
-
|
|
2969
|
-
const
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
const measurementsSlice = R.pipe(R.over(R.lensProp("byId"), R.pipe(R.map(measurement => ({ ...measurement,
|
|
3906
|
+
const dataStreamsToMeasurements = s => {
|
|
3907
|
+
const streamsSlice = R__namespace.path(["data", "entities", "dataStreams"], s);
|
|
3908
|
+
if (!R__namespace.isEmpty(streamsSlice) && !R__namespace.isNil(streamsSlice)) {
|
|
3909
|
+
const measurementsSlice = R__namespace.pipe(R__namespace.over(R__namespace.lensProp("byId"), R__namespace.pipe(R__namespace.map(measurement => ({
|
|
3910
|
+
...measurement,
|
|
2974
3911
|
legacy: true,
|
|
2975
3912
|
name: measurement.id
|
|
2976
3913
|
})))))(streamsSlice);
|
|
2977
|
-
return
|
|
3914
|
+
return R__namespace.pipe(R__namespace.dissocPath(["data", "entities", "dataStreams"]), R__namespace.assocPath(["data", "entities", "measurements"], measurementsSlice), R__namespace.over(R__namespace.lensPath(["data", "entities", "dataViewers", "byId"]), R__namespace.map(({
|
|
2978
3915
|
streams = [],
|
|
2979
3916
|
...dataViewer
|
|
2980
3917
|
}) => ({
|
|
@@ -2982,64 +3919,56 @@ const dataStreamsToMeasurements$1 = s => {
|
|
|
2982
3919
|
...dataViewer
|
|
2983
3920
|
}))))(s);
|
|
2984
3921
|
}
|
|
2985
|
-
|
|
2986
3922
|
return s;
|
|
2987
3923
|
};
|
|
2988
|
-
|
|
2989
|
-
const translateComponent$1 = component => {
|
|
3924
|
+
const translateComponent = component => {
|
|
2990
3925
|
switch (component) {
|
|
2991
3926
|
case "DataViewerComponent":
|
|
2992
3927
|
return "DataViewerPanel";
|
|
2993
|
-
|
|
2994
3928
|
case "VideoComponent":
|
|
2995
3929
|
return "VideoPanel";
|
|
2996
|
-
|
|
2997
3930
|
case "PlaylistComponent":
|
|
2998
3931
|
return "PlaylistPanel";
|
|
2999
|
-
|
|
3000
3932
|
default:
|
|
3001
3933
|
return component;
|
|
3002
3934
|
}
|
|
3003
3935
|
};
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
return R.pipe(R.over(R.lensPath(["layout", "entities", "layoutSections", "byId"]), R.unless(R.isNil, R.map(R.when(R.has("component"), R.over(R.lensProp("component"), translateComponent$1))))))(s);
|
|
3936
|
+
const fixPanels = s => {
|
|
3937
|
+
if (R__namespace.hasPath(["layout", "entities", "layoutSections", "byId"], s)) {
|
|
3938
|
+
return R__namespace.pipe(R__namespace.over(R__namespace.lensPath(["layout", "entities", "layoutSections", "byId"]), R__namespace.unless(R__namespace.isNil, R__namespace.map(R__namespace.when(R__namespace.has("component"), R__namespace.over(R__namespace.lensProp("component"), translateComponent))))))(s);
|
|
3008
3939
|
}
|
|
3009
|
-
|
|
3010
3940
|
return s;
|
|
3011
3941
|
};
|
|
3012
|
-
|
|
3013
|
-
const scaleZoomSteps$1 = stage => settings => {
|
|
3942
|
+
const scaleZoomSteps = stage => settings => {
|
|
3014
3943
|
const {
|
|
3015
3944
|
measurementScale
|
|
3016
3945
|
} = stage.data;
|
|
3017
|
-
return
|
|
3946
|
+
return R__namespace.over(R__namespace.lensPath(["data", "entities", "dataViewers", "byId"]), R__namespace.unless(R__namespace.isNil, R__namespace.mapObjIndexed(({
|
|
3018
3947
|
zoomSteps = [],
|
|
3019
3948
|
...rest
|
|
3020
|
-
}) => ({
|
|
3949
|
+
}) => ({
|
|
3950
|
+
...rest,
|
|
3021
3951
|
zoomSteps: rest.zoomStepsIsScaled ? zoomSteps : zoomSteps.map(step => step * Math.sqrt(measurementScale))
|
|
3022
3952
|
}))))(settings);
|
|
3023
3953
|
};
|
|
3024
|
-
|
|
3025
|
-
const
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
return R.pipe(R.tap(s => {
|
|
3954
|
+
const removeTimeline = R__namespace.dissoc("timeline");
|
|
3955
|
+
const updateVersion = R__namespace.assoc("version", 3);
|
|
3956
|
+
var v2ToV3 = R__namespace.curry((stage, settings) => {
|
|
3957
|
+
return R__namespace.pipe(R__namespace.tap(s => {
|
|
3029
3958
|
console.log("upgrading settings", s, " from 2 to 3");
|
|
3030
|
-
}),
|
|
3959
|
+
}), R__namespace.pipe(removeOutlets, dataStreamsToMeasurements, updateVersion, scaleZoomSteps(stage), fixPanels, removeTimeline))(settings);
|
|
3031
3960
|
});
|
|
3032
3961
|
|
|
3033
|
-
var settingsUpgrader =
|
|
3034
|
-
return
|
|
3962
|
+
var settingsUpgrader = R__namespace.curry((stage, settings) => {
|
|
3963
|
+
return R__namespace.pipe(R__namespace.unless(R__namespace.propEq(3, "version"), v2ToV3(stage)))(settings);
|
|
3035
3964
|
});
|
|
3036
3965
|
|
|
3037
|
-
const settingsCleaner =
|
|
3038
|
-
var settingsHandler = (
|
|
3966
|
+
const settingsCleaner = R__namespace.pipe(R__namespace.dissocPath(["timer", "wantedTime"]));
|
|
3967
|
+
var settingsHandler = (stage, settings) => R__namespace.pipe(settingsUpgrader(stage), settingsCleaner)(settings);
|
|
3039
3968
|
|
|
3040
3969
|
var name = "insync-stage-handler";
|
|
3041
|
-
var version = "
|
|
3042
|
-
var description
|
|
3970
|
+
var version = "4.0.0-beta.1";
|
|
3971
|
+
var description = "Handles stages files. This consists of validating, upgrading and consolodating them.";
|
|
3043
3972
|
var author = "David Ammeraal (Noterik B.V.)";
|
|
3044
3973
|
var license = "MIT";
|
|
3045
3974
|
var main = "dist/library.js";
|
|
@@ -3060,39 +3989,52 @@ var scripts = {
|
|
|
3060
3989
|
"lint:fix": "yarn lint --fix"
|
|
3061
3990
|
};
|
|
3062
3991
|
var devDependencies = {
|
|
3063
|
-
"@babel/core": "^7.
|
|
3064
|
-
"@babel/
|
|
3065
|
-
"@
|
|
3992
|
+
"@babel/core": "^7.29.7",
|
|
3993
|
+
"@babel/eslint-parser": "^7.25.0",
|
|
3994
|
+
"@babel/preset-env": "^7.29.7",
|
|
3995
|
+
"@eslint/js": "^10.0.1",
|
|
3996
|
+
"@rollup/plugin-babel": "^5.3.1",
|
|
3066
3997
|
"@rollup/plugin-json": "^4.1.0",
|
|
3067
|
-
"@rollup/plugin-node-resolve": "^
|
|
3068
|
-
"babel-
|
|
3069
|
-
"babel-
|
|
3070
|
-
|
|
3071
|
-
eslint: "
|
|
3072
|
-
"eslint-config-
|
|
3073
|
-
"eslint-
|
|
3074
|
-
"eslint-import
|
|
3075
|
-
"eslint-plugin-
|
|
3076
|
-
"eslint-plugin-
|
|
3077
|
-
|
|
3078
|
-
jest: "^
|
|
3079
|
-
prettier: "^2.
|
|
3080
|
-
rollup: "^2.
|
|
3081
|
-
"rollup-plugin-eslint": "^7.0.0"
|
|
3998
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
3999
|
+
"babel-jest": "^30.0.0",
|
|
4000
|
+
"babel-plugin-module-resolver": "^4.1.0",
|
|
4001
|
+
eslint: "^10.0.0",
|
|
4002
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
4003
|
+
"eslint-config-prettier": "^10.0.0",
|
|
4004
|
+
"eslint-import-resolver-babel-module": "^5.3.2",
|
|
4005
|
+
"eslint-plugin-import": "^2.32.0",
|
|
4006
|
+
"eslint-plugin-jest": "^29.0.0",
|
|
4007
|
+
"eslint-plugin-prettier": "^5.2.0",
|
|
4008
|
+
globals: "^17.6.0",
|
|
4009
|
+
jest: "^30.0.0",
|
|
4010
|
+
prettier: "^2.8.8",
|
|
4011
|
+
rollup: "^2.80.0"
|
|
3082
4012
|
};
|
|
3083
4013
|
var dependencies = {
|
|
3084
|
-
ajv: "^6.
|
|
4014
|
+
ajv: "^6.15.0",
|
|
3085
4015
|
"ajv-keywords": "^3.5.2",
|
|
3086
|
-
"core-js": "^3.
|
|
3087
|
-
"date-fns": "^
|
|
4016
|
+
"core-js": "^3.49.0",
|
|
4017
|
+
"date-fns": "^4.1.0",
|
|
3088
4018
|
"object-hash": "^1.3.1",
|
|
3089
|
-
ramda: "^0.
|
|
4019
|
+
ramda: "^0.32.0",
|
|
3090
4020
|
"timezone-support": "^1.8.1"
|
|
3091
4021
|
};
|
|
4022
|
+
var resolutions = {
|
|
4023
|
+
minimist: "^1.2.8",
|
|
4024
|
+
"ansi-regex": "^5.0.1",
|
|
4025
|
+
"brace-expansion": "^2.0.1",
|
|
4026
|
+
minimatch: "^3.1.4",
|
|
4027
|
+
"path-parse": "^1.0.7",
|
|
4028
|
+
json5: "^2.2.3",
|
|
4029
|
+
picomatch: "^2.3.1",
|
|
4030
|
+
lodash: "^4.17.21",
|
|
4031
|
+
"js-yaml": "^4.1.0",
|
|
4032
|
+
debug: "^4.3.5"
|
|
4033
|
+
};
|
|
3092
4034
|
var pkg = {
|
|
3093
4035
|
name: name,
|
|
3094
4036
|
version: version,
|
|
3095
|
-
description: description
|
|
4037
|
+
description: description,
|
|
3096
4038
|
author: author,
|
|
3097
4039
|
license: license,
|
|
3098
4040
|
main: main,
|
|
@@ -3101,7 +4043,8 @@ var pkg = {
|
|
|
3101
4043
|
files: files,
|
|
3102
4044
|
scripts: scripts,
|
|
3103
4045
|
devDependencies: devDependencies,
|
|
3104
|
-
dependencies: dependencies
|
|
4046
|
+
dependencies: dependencies,
|
|
4047
|
+
resolutions: resolutions
|
|
3105
4048
|
};
|
|
3106
4049
|
|
|
3107
4050
|
console.log("inSync StageHandler version", pkg.version);
|