lhcb-ntuple-wizard-test 2.0.4 → 2.0.6
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/components/modals/UploadDttConfigModal.js +6 -17
- package/dist/models/yamlFile.d.ts +13 -4
- package/dist/models/yamlFile.js +15 -14
- package/dist/pages/RequestPage.d.ts +10 -0
- package/dist/pages/RequestPage.js +25 -29
- package/dist/utils/utils.d.ts +7 -11
- package/dist/utils/utils.js +474 -470
- package/package.json +1 -1
- package/dist/models/blobFile.d.ts +0 -12
- package/dist/models/blobFile.js +0 -1
|
@@ -16,25 +16,14 @@ export function UploadDttConfigModal({ onClose, currentRow }) {
|
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
18
|
setLoading(true);
|
|
19
|
-
const
|
|
19
|
+
const result = await parseProductionFiles(Array.from(files), metadata);
|
|
20
20
|
setLoading(false);
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
.map(([file, error]) => `${file}: ${error}`)
|
|
24
|
-
.join("\n");
|
|
25
|
-
alert(`Some errors were found while importing the configuration files:\n\n${errorMessages}`);
|
|
21
|
+
if (typeof result === "string") {
|
|
22
|
+
alert(result);
|
|
26
23
|
return;
|
|
27
24
|
}
|
|
28
|
-
else if (Object.keys(warnings).length > 0) {
|
|
29
|
-
const warningMessages = Object.entries(warnings)
|
|
30
|
-
.map(([file, warning]) => `${file}: ${warning}`)
|
|
31
|
-
.join("\n");
|
|
32
|
-
if (!confirm(`Some warnings were found while importing the configuration files:\n\n${warningMessages}\n\nContinue?`)) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
25
|
if (currentRow) {
|
|
37
|
-
const importedRow = rows[0];
|
|
26
|
+
const importedRow = result.rows[0];
|
|
38
27
|
const importedConfig = importedRow.dtt.config;
|
|
39
28
|
if (importedConfig.descriptorTemplate === currentRow.decay.descriptors.template) {
|
|
40
29
|
updateRow(currentRow.id, (r) => ({
|
|
@@ -48,8 +37,8 @@ export function UploadDttConfigModal({ onClose, currentRow }) {
|
|
|
48
37
|
}
|
|
49
38
|
}
|
|
50
39
|
else {
|
|
51
|
-
setRows(rows);
|
|
52
|
-
setContactEmails(emails);
|
|
40
|
+
setRows(result.rows);
|
|
41
|
+
setContactEmails(result.emails);
|
|
53
42
|
onClose();
|
|
54
43
|
}
|
|
55
44
|
}
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import Dtt from "./dtt";
|
|
2
2
|
import { RowData } from "./rowData";
|
|
3
3
|
import { MetadataContext } from "../providers/MetadataProvider";
|
|
4
|
-
import { BlobFileDefaults } from "./blobFile";
|
|
5
4
|
import { JobConfig } from "./jobConfig";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
interface InfoYamlDefaults {
|
|
6
|
+
application: string;
|
|
7
|
+
wg: string;
|
|
8
|
+
inform: string[];
|
|
9
|
+
automatically_configure: boolean;
|
|
10
|
+
output: string;
|
|
11
|
+
}
|
|
12
|
+
export type InfoYaml = {
|
|
13
|
+
defaults: InfoYamlDefaults;
|
|
14
|
+
} & {
|
|
15
|
+
[K in string as K extends "defaults" ? never : K]?: JobConfig;
|
|
16
|
+
};
|
|
9
17
|
export declare class YamlFile {
|
|
10
18
|
name: string;
|
|
11
19
|
content: string;
|
|
@@ -13,3 +21,4 @@ export declare class YamlFile {
|
|
|
13
21
|
static fromDtt(dtt: Dtt): YamlFile;
|
|
14
22
|
static createInfoYaml(rows: RowData[], metadata: MetadataContext): YamlFile;
|
|
15
23
|
}
|
|
24
|
+
export {};
|
package/dist/models/yamlFile.js
CHANGED
|
@@ -14,15 +14,7 @@ export class YamlFile {
|
|
|
14
14
|
const uniquePathSet = new Set(rows.flatMap((row) => row.paths));
|
|
15
15
|
const uniquePaths = [...uniquePathSet].sort();
|
|
16
16
|
const pathIndex = new Map(uniquePaths.map((p, i) => [p, i]));
|
|
17
|
-
const
|
|
18
|
-
defaults: {
|
|
19
|
-
application: `DaVinci/${metadata.tupleTools.applicationInfo.DaVinci}`,
|
|
20
|
-
wg: "OpenData",
|
|
21
|
-
inform: [],
|
|
22
|
-
automatically_configure: true,
|
|
23
|
-
output: "DVNtuple.root",
|
|
24
|
-
},
|
|
25
|
-
};
|
|
17
|
+
const jobs = {};
|
|
26
18
|
for (const row of rows) {
|
|
27
19
|
if (!row.dtt)
|
|
28
20
|
continue;
|
|
@@ -32,8 +24,8 @@ export class YamlFile {
|
|
|
32
24
|
continue;
|
|
33
25
|
const key = `job${jobID}`;
|
|
34
26
|
const dttFile = row.dtt.getName();
|
|
35
|
-
if (key
|
|
36
|
-
|
|
27
|
+
if (jobs[key]) {
|
|
28
|
+
jobs[key].options.push(dttFile);
|
|
37
29
|
}
|
|
38
30
|
else {
|
|
39
31
|
const job = {
|
|
@@ -42,14 +34,23 @@ export class YamlFile {
|
|
|
42
34
|
};
|
|
43
35
|
if (path.includes("MDST")) {
|
|
44
36
|
const stream = row.lines[0]?.stream;
|
|
45
|
-
if (stream)
|
|
37
|
+
if (stream)
|
|
46
38
|
job.root_in_tes = `/Event/${stream}`;
|
|
47
|
-
}
|
|
48
39
|
}
|
|
49
|
-
|
|
40
|
+
jobs[key] = job;
|
|
50
41
|
}
|
|
51
42
|
}
|
|
52
43
|
}
|
|
44
|
+
const info = {
|
|
45
|
+
defaults: {
|
|
46
|
+
application: `DaVinci/${metadata.tupleTools.applicationInfo.DaVinci}`,
|
|
47
|
+
wg: "OpenData",
|
|
48
|
+
inform: [],
|
|
49
|
+
automatically_configure: true,
|
|
50
|
+
output: "DVNtuple.root",
|
|
51
|
+
},
|
|
52
|
+
...jobs,
|
|
53
|
+
};
|
|
53
54
|
return new YamlFile("info.yaml", yaml.dump(info));
|
|
54
55
|
}
|
|
55
56
|
}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/*****************************************************************************\
|
|
2
|
+
* (c) Copyright 2021-2024 CERN for the benefit of the LHCb Collaboration *
|
|
3
|
+
* *
|
|
4
|
+
* This software is distributed under the terms of the GNU General Public *
|
|
5
|
+
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
|
|
6
|
+
* *
|
|
7
|
+
* In applying this licence, CERN does not waive the privileges and immunities *
|
|
8
|
+
* granted to it by virtue of its status as an Intergovernmental Organization *
|
|
9
|
+
* or submit itself to any jurisdiction. *
|
|
10
|
+
\*****************************************************************************/
|
|
1
11
|
import { ReactNode } from "react";
|
|
2
12
|
export type NtupleWizardVariant = "standalone" | "embedded";
|
|
3
13
|
interface Props {
|
|
@@ -9,12 +9,11 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
9
9
|
* granted to it by virtue of its status as an Intergovernmental Organization *
|
|
10
10
|
* or submit itself to any jurisdiction. *
|
|
11
11
|
\*****************************************************************************/
|
|
12
|
-
import yaml from "js-yaml";
|
|
13
12
|
import { useEffect, useState } from "react";
|
|
14
13
|
import { Alert, Button, Col, Row, Stack } from "react-bootstrap";
|
|
15
14
|
import { Download, Send } from "react-bootstrap-icons";
|
|
16
15
|
import { useLocation } from "react-router-dom";
|
|
17
|
-
import { downloadZip,
|
|
16
|
+
import { downloadZip, processProductionFiles } from "../utils/utils";
|
|
18
17
|
import { DeleteButton } from "../components/DeleteButton";
|
|
19
18
|
import { useMetadata } from "../providers/MetadataProvider";
|
|
20
19
|
import { ConfigFilesUploadingAlert } from "../components/ConfigFilesUploadingAlert";
|
|
@@ -44,35 +43,32 @@ export function RequestPage({ basePath, submitLocation, requestReasonMessage, re
|
|
|
44
43
|
}
|
|
45
44
|
const urlParams = new URLSearchParams(location.search);
|
|
46
45
|
if (urlParams.get("clone") === "1") {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
46
|
+
const infoYamlString = localStorage.getItem("infoYamlToClone");
|
|
47
|
+
const dttConfigsString = localStorage.getItem("dttConfigsToClone");
|
|
48
|
+
if (!dttConfigsString) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
setProdUploadLoading(true);
|
|
52
|
+
setRows([]);
|
|
53
|
+
try {
|
|
54
|
+
const infoYaml = infoYamlString ? JSON.parse(infoYamlString) : null;
|
|
55
|
+
const dttConfigs = JSON.parse(dttConfigsString);
|
|
56
|
+
const result = processProductionFiles(metadata, dttConfigs, infoYaml);
|
|
57
|
+
if (typeof result === "string") {
|
|
58
|
+
// Show the error message
|
|
59
|
+
alert(result);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
setRows(result.rows);
|
|
63
|
+
setProductionName("");
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
setProdUploadLoading(false);
|
|
67
|
+
localStorage.removeItem("infoYamlToClone");
|
|
68
|
+
localStorage.removeItem("dttConfigsToClone");
|
|
66
69
|
}
|
|
67
|
-
const { rows } = await parseProductionFiles(yamlFiles, metadata);
|
|
68
|
-
setRows(rows);
|
|
69
|
-
setProductionName("");
|
|
70
|
-
}
|
|
71
|
-
finally {
|
|
72
|
-
setProdUploadLoading(false);
|
|
73
|
-
localStorage.removeItem("yamlFilesToClone");
|
|
74
70
|
}
|
|
75
|
-
}
|
|
71
|
+
}, [metadata, location.search]);
|
|
76
72
|
const handlePrimaryAction = async () => {
|
|
77
73
|
if (trySubmit()) {
|
|
78
74
|
if (variant === "standalone") {
|
package/dist/utils/utils.d.ts
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import { YamlFile } from "../models/yamlFile";
|
|
2
|
-
import {
|
|
1
|
+
import { InfoYaml, YamlFile } from "../models/yamlFile";
|
|
2
|
+
import { SavedDttConfig } from "../models/dtt";
|
|
3
3
|
import { RowData } from "../models/rowData";
|
|
4
4
|
import { MetadataContext } from "../providers/MetadataProvider";
|
|
5
|
-
|
|
6
|
-
* Parses a set of production configuration files to DttConfigs and returns the corresponding rows and emails.
|
|
7
|
-
* @param files The files to parse
|
|
8
|
-
* @param metadata The metadata to use for parsing
|
|
9
|
-
* @returns The parsed rows and emails
|
|
10
|
-
*/
|
|
11
|
-
export declare const parseProductionFiles: (files: (BlobFile | File)[], metadata: MetadataContext) => Promise<{
|
|
5
|
+
export declare function parseProductionFiles(files: File[], metadata: MetadataContext): Promise<string | {
|
|
12
6
|
rows: RowData[];
|
|
13
7
|
emails: string[];
|
|
14
|
-
errors: Record<string, string>;
|
|
15
|
-
warnings: Record<string, string>;
|
|
16
8
|
}>;
|
|
9
|
+
export declare function processProductionFiles(metadata: MetadataContext, configs: SavedDttConfig[], infoYaml: InfoYaml | null): string | {
|
|
10
|
+
rows: RowData[];
|
|
11
|
+
emails: string[];
|
|
12
|
+
};
|
|
17
13
|
/**
|
|
18
14
|
* Sanitizes a user-provided filename to prevent path traversal (Zip Slip)
|
|
19
15
|
* and unsafe filesystem characters.
|
package/dist/utils/utils.js
CHANGED
|
@@ -23,512 +23,509 @@ const parseInput = (decay, input) => {
|
|
|
23
23
|
versions: decay.lines[`${stream}/${line}`],
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
emails.push(defaults.inform[0]);
|
|
30
|
-
}
|
|
31
|
-
rows.forEach((row) => {
|
|
32
|
-
if (!row.dtt?.config.name)
|
|
33
|
-
return;
|
|
34
|
-
const dttName = row.dtt.config.name.split("/")[1];
|
|
35
|
-
Object.entries(config).forEach(([key, jobConfig]) => {
|
|
36
|
-
if (key === "defaults")
|
|
37
|
-
return;
|
|
38
|
-
const job = jobConfig;
|
|
39
|
-
if (!job.options)
|
|
40
|
-
return;
|
|
41
|
-
if (job.options.some((opt) => opt.split(".")[0] === dttName)) {
|
|
42
|
-
row.paths.push(job.input.bk_query);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Parses a set of production configuration files to DttConfigs and returns the corresponding rows and emails.
|
|
49
|
-
* @param files The files to parse
|
|
50
|
-
* @param metadata The metadata to use for parsing
|
|
51
|
-
* @returns The parsed rows and emails
|
|
52
|
-
*/
|
|
53
|
-
export const parseProductionFiles = async (files, metadata) => {
|
|
54
|
-
const rows = [];
|
|
55
|
-
const emails = [];
|
|
56
|
-
const errors = {};
|
|
57
|
-
const warnings = {};
|
|
58
|
-
const sorted = [...files].sort((a, b) => (a.name === "info.yaml" ? 1 : b.name === "info.yaml" ? -1 : 0));
|
|
59
|
-
for (let i = 0; i < sorted.length; i++) {
|
|
60
|
-
const file = sorted[i];
|
|
61
|
-
const blob = file.blob ?? file;
|
|
62
|
-
const text = await blob.text();
|
|
63
|
-
let rawConfig;
|
|
64
|
-
try {
|
|
65
|
-
rawConfig = yaml.load(text, { schema: yaml.JSON_SCHEMA });
|
|
66
|
-
}
|
|
67
|
-
catch (e) {
|
|
68
|
-
console.error(`YAML file '${file.name}' is invalid:`, e);
|
|
69
|
-
errors[file.name] = "YAML file is invalid";
|
|
26
|
+
const addBkPathsToRows = (infoYaml, rows) => {
|
|
27
|
+
for (const row of rows) {
|
|
28
|
+
if (!row.dtt?.config.name) {
|
|
70
29
|
continue;
|
|
71
30
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const value = input[key];
|
|
77
|
-
if (undefined === value)
|
|
78
|
-
return true;
|
|
79
|
-
return "object" === typeof value && null !== value && _io2(value);
|
|
80
|
-
}); const _io1 = input => "string" === typeof input.application && "string" === typeof input.wg && (Array.isArray(input.inform) && input.inform.every(elem => "string" === typeof elem)) && "boolean" === typeof input.automatically_configure && "string" === typeof input.output; const _io2 = input => Array.isArray(input.options) && input.options.every(elem => "string" === typeof elem) && ("object" === typeof input.input && null !== input.input && _io3(input.input)) && (undefined === input.root_in_tes || "string" === typeof input.root_in_tes); const _io3 = input => "string" === typeof input.bk_query; const _vo0 = (input, _path, _exceptionable = true) => [("object" === typeof input.defaults && null !== input.defaults || _report(_exceptionable, {
|
|
81
|
-
path: _path + ".defaults",
|
|
82
|
-
expected: "BlobFileDefaults",
|
|
83
|
-
value: input.defaults
|
|
84
|
-
})) && _vo1(input.defaults, _path + ".defaults", true && _exceptionable) || _report(_exceptionable, {
|
|
85
|
-
path: _path + ".defaults",
|
|
86
|
-
expected: "BlobFileDefaults",
|
|
87
|
-
value: input.defaults
|
|
88
|
-
}), false === _exceptionable || Object.keys(input).map(key => {
|
|
89
|
-
if (["defaults"].some(prop => key === prop))
|
|
90
|
-
return true;
|
|
91
|
-
const value = input[key];
|
|
92
|
-
if (undefined === value)
|
|
93
|
-
return true;
|
|
94
|
-
return ("object" === typeof value && null !== value || _report(_exceptionable, {
|
|
95
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
96
|
-
expected: "JobConfig",
|
|
97
|
-
value: value
|
|
98
|
-
})) && _vo2(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || _report(_exceptionable, {
|
|
99
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
100
|
-
expected: "JobConfig",
|
|
101
|
-
value: value
|
|
102
|
-
});
|
|
103
|
-
}).every(flag => flag)].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.application || _report(_exceptionable, {
|
|
104
|
-
path: _path + ".application",
|
|
105
|
-
expected: "string",
|
|
106
|
-
value: input.application
|
|
107
|
-
}), "string" === typeof input.wg || _report(_exceptionable, {
|
|
108
|
-
path: _path + ".wg",
|
|
109
|
-
expected: "string",
|
|
110
|
-
value: input.wg
|
|
111
|
-
}), (Array.isArray(input.inform) || _report(_exceptionable, {
|
|
112
|
-
path: _path + ".inform",
|
|
113
|
-
expected: "Array<string>",
|
|
114
|
-
value: input.inform
|
|
115
|
-
})) && input.inform.map((elem, _index3) => "string" === typeof elem || _report(_exceptionable, {
|
|
116
|
-
path: _path + ".inform[" + _index3 + "]",
|
|
117
|
-
expected: "string",
|
|
118
|
-
value: elem
|
|
119
|
-
})).every(flag => flag) || _report(_exceptionable, {
|
|
120
|
-
path: _path + ".inform",
|
|
121
|
-
expected: "Array<string>",
|
|
122
|
-
value: input.inform
|
|
123
|
-
}), "boolean" === typeof input.automatically_configure || _report(_exceptionable, {
|
|
124
|
-
path: _path + ".automatically_configure",
|
|
125
|
-
expected: "boolean",
|
|
126
|
-
value: input.automatically_configure
|
|
127
|
-
}), "string" === typeof input.output || _report(_exceptionable, {
|
|
128
|
-
path: _path + ".output",
|
|
129
|
-
expected: "string",
|
|
130
|
-
value: input.output
|
|
131
|
-
})].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => [(Array.isArray(input.options) || _report(_exceptionable, {
|
|
132
|
-
path: _path + ".options",
|
|
133
|
-
expected: "Array<string>",
|
|
134
|
-
value: input.options
|
|
135
|
-
})) && input.options.map((elem, _index4) => "string" === typeof elem || _report(_exceptionable, {
|
|
136
|
-
path: _path + ".options[" + _index4 + "]",
|
|
137
|
-
expected: "string",
|
|
138
|
-
value: elem
|
|
139
|
-
})).every(flag => flag) || _report(_exceptionable, {
|
|
140
|
-
path: _path + ".options",
|
|
141
|
-
expected: "Array<string>",
|
|
142
|
-
value: input.options
|
|
143
|
-
}), ("object" === typeof input.input && null !== input.input || _report(_exceptionable, {
|
|
144
|
-
path: _path + ".input",
|
|
145
|
-
expected: "__type",
|
|
146
|
-
value: input.input
|
|
147
|
-
})) && _vo3(input.input, _path + ".input", true && _exceptionable) || _report(_exceptionable, {
|
|
148
|
-
path: _path + ".input",
|
|
149
|
-
expected: "__type",
|
|
150
|
-
value: input.input
|
|
151
|
-
}), undefined === input.root_in_tes || "string" === typeof input.root_in_tes || _report(_exceptionable, {
|
|
152
|
-
path: _path + ".root_in_tes",
|
|
153
|
-
expected: "(string | undefined)",
|
|
154
|
-
value: input.root_in_tes
|
|
155
|
-
})].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => ["string" === typeof input.bk_query || _report(_exceptionable, {
|
|
156
|
-
path: _path + ".bk_query",
|
|
157
|
-
expected: "string",
|
|
158
|
-
value: input.bk_query
|
|
159
|
-
})].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
|
|
160
|
-
if (false === __is(input)) {
|
|
161
|
-
errors = [];
|
|
162
|
-
_report = __typia_transform__validateReport._validateReport(errors);
|
|
163
|
-
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
164
|
-
path: _path + "",
|
|
165
|
-
expected: "InfoYamlType",
|
|
166
|
-
value: input
|
|
167
|
-
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
168
|
-
path: _path + "",
|
|
169
|
-
expected: "InfoYamlType",
|
|
170
|
-
value: input
|
|
171
|
-
}))(input, "$input", true);
|
|
172
|
-
const success = 0 === errors.length;
|
|
173
|
-
return success ? {
|
|
174
|
-
success,
|
|
175
|
-
data: input
|
|
176
|
-
} : {
|
|
177
|
-
success,
|
|
178
|
-
errors,
|
|
179
|
-
data: input
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
return {
|
|
183
|
-
success: true,
|
|
184
|
-
data: input
|
|
185
|
-
};
|
|
186
|
-
}; })()(rawConfig);
|
|
187
|
-
if (validationResult.success) {
|
|
188
|
-
applyInfoYaml(validationResult.data, rows, emails);
|
|
31
|
+
const dttName = row.dtt.config.name.split("/")[1];
|
|
32
|
+
for (const [key, jobConfig] of Object.entries(infoYaml)) {
|
|
33
|
+
if (key === "defaults") {
|
|
34
|
+
continue;
|
|
189
35
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
errors[file.name] =
|
|
194
|
-
`Invalid info.yaml config at: ${validationResult.errors.map((e) => e.path).join(", ")}`;
|
|
36
|
+
const job = jobConfig;
|
|
37
|
+
if (job.options.some((option) => option.split(".")[0] === dttName)) {
|
|
38
|
+
row.paths.push(job.input.bk_query);
|
|
195
39
|
}
|
|
196
|
-
continue;
|
|
197
40
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
return
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
async function parseYamlFile(file) {
|
|
44
|
+
const text = await file.text();
|
|
45
|
+
try {
|
|
46
|
+
return yaml.load(text, { schema: yaml.JSON_SCHEMA });
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
console.error(`YAML file '${file.name}' is invalid:`, e);
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async function parseInfoYamlFile(file) {
|
|
54
|
+
const rawConfig = await parseYamlFile(file);
|
|
55
|
+
if (!rawConfig) {
|
|
56
|
+
return "'info.yaml' is not a valid yaml file";
|
|
57
|
+
}
|
|
58
|
+
const validationResult = (() => { const _io0 = input => "object" === typeof input.defaults && null !== input.defaults && _io1(input.defaults) && Object.keys(input).every(key => {
|
|
59
|
+
if (["defaults"].some(prop => key === prop))
|
|
60
|
+
return true;
|
|
61
|
+
const value = input[key];
|
|
62
|
+
if (undefined === value)
|
|
63
|
+
return true;
|
|
64
|
+
return undefined === value || "object" === typeof value && null !== value && _io2(value);
|
|
65
|
+
}); const _io1 = input => "string" === typeof input.application && "string" === typeof input.wg && (Array.isArray(input.inform) && input.inform.every(elem => "string" === typeof elem)) && "boolean" === typeof input.automatically_configure && "string" === typeof input.output; const _io2 = input => Array.isArray(input.options) && input.options.every(elem => "string" === typeof elem) && ("object" === typeof input.input && null !== input.input && _io3(input.input)) && (undefined === input.root_in_tes || "string" === typeof input.root_in_tes); const _io3 = input => "string" === typeof input.bk_query; const _vo0 = (input, _path, _exceptionable = true) => [("object" === typeof input.defaults && null !== input.defaults || _report(_exceptionable, {
|
|
66
|
+
path: _path + ".defaults",
|
|
67
|
+
expected: "InfoYamlDefaults",
|
|
68
|
+
value: input.defaults
|
|
69
|
+
})) && _vo1(input.defaults, _path + ".defaults", true && _exceptionable) || _report(_exceptionable, {
|
|
70
|
+
path: _path + ".defaults",
|
|
71
|
+
expected: "InfoYamlDefaults",
|
|
72
|
+
value: input.defaults
|
|
73
|
+
}), false === _exceptionable || Object.keys(input).map(key => {
|
|
74
|
+
if (["defaults"].some(prop => key === prop))
|
|
225
75
|
return true;
|
|
226
|
-
const arrayPredicators = [
|
|
227
|
-
[
|
|
228
|
-
top => "string" === typeof top,
|
|
229
|
-
entire => entire.map((elem, _index16) => "string" === typeof elem || _report(_exceptionable, {
|
|
230
|
-
path: _path + "[" + _index16 + "]",
|
|
231
|
-
expected: "string",
|
|
232
|
-
value: elem
|
|
233
|
-
})).every(flag => flag)
|
|
234
|
-
],
|
|
235
|
-
[
|
|
236
|
-
top => "number" === typeof top,
|
|
237
|
-
entire => entire.map((elem, _index17) => "number" === typeof elem || _report(_exceptionable, {
|
|
238
|
-
path: _path + "[" + _index17 + "]",
|
|
239
|
-
expected: "number",
|
|
240
|
-
value: elem
|
|
241
|
-
})).every(flag => flag)
|
|
242
|
-
]
|
|
243
|
-
];
|
|
244
|
-
const passed = arrayPredicators.filter(pred => pred[0](top));
|
|
245
|
-
if (1 === passed.length)
|
|
246
|
-
return passed[0][1](array);
|
|
247
|
-
else if (1 < passed.length)
|
|
248
|
-
for (const pred of passed)
|
|
249
|
-
if (array.every(value => true === pred[0](value)))
|
|
250
|
-
return pred[1](array);
|
|
251
|
-
return _report(_exceptionable, {
|
|
252
|
-
path: _path,
|
|
253
|
-
expected: "(Array<string> | Array<number>)",
|
|
254
|
-
value: input
|
|
255
|
-
});
|
|
256
|
-
}; const _io0 = input => "object" === typeof input.branches && null !== input.branches && false === Array.isArray(input.branches) && _io1(input.branches) && (undefined === input.descriptorTemplate || "string" === typeof input.descriptorTemplate) && ("object" === typeof input.groups && null !== input.groups && false === Array.isArray(input.groups) && _io7(input.groups)) && (undefined === input.inputs || Array.isArray(input.inputs) && input.inputs.every(elem => "string" === typeof elem)) && (undefined === input.name || "string" === typeof input.name) && (Array.isArray(input.tools) && input.tools.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && _io3(elem))); const _io1 = input => Object.keys(input).every(key => {
|
|
257
76
|
const value = input[key];
|
|
258
77
|
if (undefined === value)
|
|
259
78
|
return true;
|
|
260
|
-
return "object" === typeof value && null !== value
|
|
261
|
-
|
|
79
|
+
return undefined === value || ("object" === typeof value && null !== value || _report(_exceptionable, {
|
|
80
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
81
|
+
expected: "(JobConfig | undefined)",
|
|
82
|
+
value: value
|
|
83
|
+
})) && _vo2(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || _report(_exceptionable, {
|
|
84
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
85
|
+
expected: "(JobConfig | undefined)",
|
|
86
|
+
value: value
|
|
87
|
+
});
|
|
88
|
+
}).every(flag => flag)].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.application || _report(_exceptionable, {
|
|
89
|
+
path: _path + ".application",
|
|
90
|
+
expected: "string",
|
|
91
|
+
value: input.application
|
|
92
|
+
}), "string" === typeof input.wg || _report(_exceptionable, {
|
|
93
|
+
path: _path + ".wg",
|
|
94
|
+
expected: "string",
|
|
95
|
+
value: input.wg
|
|
96
|
+
}), (Array.isArray(input.inform) || _report(_exceptionable, {
|
|
97
|
+
path: _path + ".inform",
|
|
98
|
+
expected: "Array<string>",
|
|
99
|
+
value: input.inform
|
|
100
|
+
})) && input.inform.map((elem, _index3) => "string" === typeof elem || _report(_exceptionable, {
|
|
101
|
+
path: _path + ".inform[" + _index3 + "]",
|
|
102
|
+
expected: "string",
|
|
103
|
+
value: elem
|
|
104
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
105
|
+
path: _path + ".inform",
|
|
106
|
+
expected: "Array<string>",
|
|
107
|
+
value: input.inform
|
|
108
|
+
}), "boolean" === typeof input.automatically_configure || _report(_exceptionable, {
|
|
109
|
+
path: _path + ".automatically_configure",
|
|
110
|
+
expected: "boolean",
|
|
111
|
+
value: input.automatically_configure
|
|
112
|
+
}), "string" === typeof input.output || _report(_exceptionable, {
|
|
113
|
+
path: _path + ".output",
|
|
114
|
+
expected: "string",
|
|
115
|
+
value: input.output
|
|
116
|
+
})].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => [(Array.isArray(input.options) || _report(_exceptionable, {
|
|
117
|
+
path: _path + ".options",
|
|
118
|
+
expected: "Array<string>",
|
|
119
|
+
value: input.options
|
|
120
|
+
})) && input.options.map((elem, _index4) => "string" === typeof elem || _report(_exceptionable, {
|
|
121
|
+
path: _path + ".options[" + _index4 + "]",
|
|
122
|
+
expected: "string",
|
|
123
|
+
value: elem
|
|
124
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
125
|
+
path: _path + ".options",
|
|
126
|
+
expected: "Array<string>",
|
|
127
|
+
value: input.options
|
|
128
|
+
}), ("object" === typeof input.input && null !== input.input || _report(_exceptionable, {
|
|
129
|
+
path: _path + ".input",
|
|
130
|
+
expected: "__type",
|
|
131
|
+
value: input.input
|
|
132
|
+
})) && _vo3(input.input, _path + ".input", true && _exceptionable) || _report(_exceptionable, {
|
|
133
|
+
path: _path + ".input",
|
|
134
|
+
expected: "__type",
|
|
135
|
+
value: input.input
|
|
136
|
+
}), undefined === input.root_in_tes || "string" === typeof input.root_in_tes || _report(_exceptionable, {
|
|
137
|
+
path: _path + ".root_in_tes",
|
|
138
|
+
expected: "(string | undefined)",
|
|
139
|
+
value: input.root_in_tes
|
|
140
|
+
})].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => ["string" === typeof input.bk_query || _report(_exceptionable, {
|
|
141
|
+
path: _path + ".bk_query",
|
|
142
|
+
expected: "string",
|
|
143
|
+
value: input.bk_query
|
|
144
|
+
})].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
|
|
145
|
+
if (false === __is(input)) {
|
|
146
|
+
errors = [];
|
|
147
|
+
_report = __typia_transform__validateReport._validateReport(errors);
|
|
148
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
149
|
+
path: _path + "",
|
|
150
|
+
expected: "InfoYaml",
|
|
151
|
+
value: input
|
|
152
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
153
|
+
path: _path + "",
|
|
154
|
+
expected: "InfoYaml",
|
|
155
|
+
value: input
|
|
156
|
+
}))(input, "$input", true);
|
|
157
|
+
const success = 0 === errors.length;
|
|
158
|
+
return success ? {
|
|
159
|
+
success,
|
|
160
|
+
data: input
|
|
161
|
+
} : {
|
|
162
|
+
success,
|
|
163
|
+
errors,
|
|
164
|
+
data: input
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
success: true,
|
|
169
|
+
data: input
|
|
170
|
+
};
|
|
171
|
+
}; })()(rawConfig);
|
|
172
|
+
if (!validationResult.success) {
|
|
173
|
+
return "'info.yaml' does not have the expected structure";
|
|
174
|
+
}
|
|
175
|
+
return validationResult.data;
|
|
176
|
+
}
|
|
177
|
+
async function parseDttConfigFile(file) {
|
|
178
|
+
const rawConfig = await parseYamlFile(file);
|
|
179
|
+
if (!rawConfig) {
|
|
180
|
+
return `'${file.name}' is not a valid yaml file`;
|
|
181
|
+
}
|
|
182
|
+
const validationResult = (() => { const _ip0 = input => {
|
|
183
|
+
const array = input;
|
|
184
|
+
const top = input[0];
|
|
185
|
+
if (0 === input.length)
|
|
186
|
+
return true;
|
|
187
|
+
const arrayPredicators = [
|
|
188
|
+
[
|
|
189
|
+
top => "string" === typeof top,
|
|
190
|
+
entire => entire.every(elem => "string" === typeof elem)
|
|
191
|
+
],
|
|
192
|
+
[
|
|
193
|
+
top => "number" === typeof top,
|
|
194
|
+
entire => entire.every(elem => "number" === typeof elem)
|
|
195
|
+
]
|
|
196
|
+
];
|
|
197
|
+
const passed = arrayPredicators.filter(pred => pred[0](top));
|
|
198
|
+
if (1 === passed.length)
|
|
199
|
+
return passed[0][1](array);
|
|
200
|
+
else if (1 < passed.length)
|
|
201
|
+
for (const pred of passed)
|
|
202
|
+
if (array.every(value => true === pred[0](value)))
|
|
203
|
+
return pred[1](array);
|
|
204
|
+
return false;
|
|
205
|
+
}; const _vp1 = (input, _path, _exceptionable = true) => {
|
|
206
|
+
const array = input;
|
|
207
|
+
const top = input[0];
|
|
208
|
+
if (0 === input.length)
|
|
209
|
+
return true;
|
|
210
|
+
const arrayPredicators = [
|
|
211
|
+
[
|
|
212
|
+
top => "string" === typeof top,
|
|
213
|
+
entire => entire.map((elem, _index16) => "string" === typeof elem || _report(_exceptionable, {
|
|
214
|
+
path: _path + "[" + _index16 + "]",
|
|
215
|
+
expected: "string",
|
|
216
|
+
value: elem
|
|
217
|
+
})).every(flag => flag)
|
|
218
|
+
],
|
|
219
|
+
[
|
|
220
|
+
top => "number" === typeof top,
|
|
221
|
+
entire => entire.map((elem, _index17) => "number" === typeof elem || _report(_exceptionable, {
|
|
222
|
+
path: _path + "[" + _index17 + "]",
|
|
223
|
+
expected: "number",
|
|
224
|
+
value: elem
|
|
225
|
+
})).every(flag => flag)
|
|
226
|
+
]
|
|
227
|
+
];
|
|
228
|
+
const passed = arrayPredicators.filter(pred => pred[0](top));
|
|
229
|
+
if (1 === passed.length)
|
|
230
|
+
return passed[0][1](array);
|
|
231
|
+
else if (1 < passed.length)
|
|
232
|
+
for (const pred of passed)
|
|
233
|
+
if (array.every(value => true === pred[0](value)))
|
|
234
|
+
return pred[1](array);
|
|
235
|
+
return _report(_exceptionable, {
|
|
236
|
+
path: _path,
|
|
237
|
+
expected: "(Array<string> | Array<number>)",
|
|
238
|
+
value: input
|
|
239
|
+
});
|
|
240
|
+
}; const _io0 = input => "object" === typeof input.branches && null !== input.branches && false === Array.isArray(input.branches) && _io1(input.branches) && (undefined === input.descriptorTemplate || "string" === typeof input.descriptorTemplate) && ("object" === typeof input.groups && null !== input.groups && false === Array.isArray(input.groups) && _io7(input.groups)) && (undefined === input.inputs || Array.isArray(input.inputs) && input.inputs.every(elem => "string" === typeof elem)) && (undefined === input.name || "string" === typeof input.name) && (Array.isArray(input.tools) && input.tools.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && _io3(elem))); const _io1 = input => Object.keys(input).every(key => {
|
|
241
|
+
const value = input[key];
|
|
242
|
+
if (undefined === value)
|
|
243
|
+
return true;
|
|
244
|
+
return "object" === typeof value && null !== value && _io2(value);
|
|
245
|
+
}); const _io2 = input => "string" === typeof input.particle && (Array.isArray(input.tools) && input.tools.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && _io3(elem))); const _io3 = input => Object.keys(input).every(key => {
|
|
246
|
+
const value = input[key];
|
|
247
|
+
if (undefined === value)
|
|
248
|
+
return true;
|
|
249
|
+
return "object" === typeof value && null !== value && false === Array.isArray(value) && _io4(value);
|
|
250
|
+
}); const _io4 = input => Object.keys(input).every(key => {
|
|
251
|
+
const value = input[key];
|
|
252
|
+
if (undefined === value)
|
|
253
|
+
return true;
|
|
254
|
+
return null !== value && undefined !== value && ("string" === typeof value || "number" === typeof value || "boolean" === typeof value || (Array.isArray(value) && (_ip0(value) || false) || "object" === typeof value && null !== value && false === Array.isArray(value) && _iu0(value)));
|
|
255
|
+
}); const _io5 = input => Object.keys(input).every(key => {
|
|
256
|
+
const value = input[key];
|
|
257
|
+
if (undefined === value)
|
|
258
|
+
return true;
|
|
259
|
+
return "string" === typeof value;
|
|
260
|
+
}); const _io6 = input => Object.keys(input).every(key => {
|
|
261
|
+
const value = input[key];
|
|
262
|
+
if (undefined === value)
|
|
263
|
+
return true;
|
|
264
|
+
return Array.isArray(value) && value.every(elem => "string" === typeof elem);
|
|
265
|
+
}); const _io7 = input => Object.keys(input).every(key => {
|
|
266
|
+
const value = input[key];
|
|
267
|
+
if (undefined === value)
|
|
268
|
+
return true;
|
|
269
|
+
return "object" === typeof value && null !== value && _io8(value);
|
|
270
|
+
}); const _io8 = input => Array.isArray(input.particles) && input.particles.every(elem => "string" === typeof elem) && (Array.isArray(input.tools) && input.tools.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && _io3(elem))); const _iu0 = input => (() => {
|
|
271
|
+
if (_io6(input))
|
|
272
|
+
return _io6(input);
|
|
273
|
+
if (_io5(input))
|
|
274
|
+
return _io5(input);
|
|
275
|
+
return false;
|
|
276
|
+
})(); const _vo0 = (input, _path, _exceptionable = true) => [("object" === typeof input.branches && null !== input.branches && false === Array.isArray(input.branches) || _report(_exceptionable, {
|
|
277
|
+
path: _path + ".branches",
|
|
278
|
+
expected: "__type",
|
|
279
|
+
value: input.branches
|
|
280
|
+
})) && _vo1(input.branches, _path + ".branches", true && _exceptionable) || _report(_exceptionable, {
|
|
281
|
+
path: _path + ".branches",
|
|
282
|
+
expected: "__type",
|
|
283
|
+
value: input.branches
|
|
284
|
+
}), undefined === input.descriptorTemplate || "string" === typeof input.descriptorTemplate || _report(_exceptionable, {
|
|
285
|
+
path: _path + ".descriptorTemplate",
|
|
286
|
+
expected: "(string | undefined)",
|
|
287
|
+
value: input.descriptorTemplate
|
|
288
|
+
}), ("object" === typeof input.groups && null !== input.groups && false === Array.isArray(input.groups) || _report(_exceptionable, {
|
|
289
|
+
path: _path + ".groups",
|
|
290
|
+
expected: "__type.o4",
|
|
291
|
+
value: input.groups
|
|
292
|
+
})) && _vo7(input.groups, _path + ".groups", true && _exceptionable) || _report(_exceptionable, {
|
|
293
|
+
path: _path + ".groups",
|
|
294
|
+
expected: "__type.o4",
|
|
295
|
+
value: input.groups
|
|
296
|
+
}), undefined === input.inputs || (Array.isArray(input.inputs) || _report(_exceptionable, {
|
|
297
|
+
path: _path + ".inputs",
|
|
298
|
+
expected: "(Array<string> | undefined)",
|
|
299
|
+
value: input.inputs
|
|
300
|
+
})) && input.inputs.map((elem, _index11) => "string" === typeof elem || _report(_exceptionable, {
|
|
301
|
+
path: _path + ".inputs[" + _index11 + "]",
|
|
302
|
+
expected: "string",
|
|
303
|
+
value: elem
|
|
304
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
305
|
+
path: _path + ".inputs",
|
|
306
|
+
expected: "(Array<string> | undefined)",
|
|
307
|
+
value: input.inputs
|
|
308
|
+
}), undefined === input.name || "string" === typeof input.name || _report(_exceptionable, {
|
|
309
|
+
path: _path + ".name",
|
|
310
|
+
expected: "(string | undefined)",
|
|
311
|
+
value: input.name
|
|
312
|
+
}), (Array.isArray(input.tools) || _report(_exceptionable, {
|
|
313
|
+
path: _path + ".tools",
|
|
314
|
+
expected: "Array<SavedToolConfig>",
|
|
315
|
+
value: input.tools
|
|
316
|
+
})) && input.tools.map((elem, _index12) => ("object" === typeof elem && null !== elem && false === Array.isArray(elem) || _report(_exceptionable, {
|
|
317
|
+
path: _path + ".tools[" + _index12 + "]",
|
|
318
|
+
expected: "SavedToolConfig",
|
|
319
|
+
value: elem
|
|
320
|
+
})) && _vo3(elem, _path + ".tools[" + _index12 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
321
|
+
path: _path + ".tools[" + _index12 + "]",
|
|
322
|
+
expected: "SavedToolConfig",
|
|
323
|
+
value: elem
|
|
324
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
325
|
+
path: _path + ".tools",
|
|
326
|
+
expected: "Array<SavedToolConfig>",
|
|
327
|
+
value: input.tools
|
|
328
|
+
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map(key => {
|
|
262
329
|
const value = input[key];
|
|
263
330
|
if (undefined === value)
|
|
264
331
|
return true;
|
|
265
|
-
return "object" === typeof value && null !== value
|
|
266
|
-
|
|
332
|
+
return ("object" === typeof value && null !== value || _report(_exceptionable, {
|
|
333
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
334
|
+
expected: "SavedBranchConfig",
|
|
335
|
+
value: value
|
|
336
|
+
})) && _vo2(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || _report(_exceptionable, {
|
|
337
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
338
|
+
expected: "SavedBranchConfig",
|
|
339
|
+
value: value
|
|
340
|
+
});
|
|
341
|
+
}).every(flag => flag)].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["string" === typeof input.particle || _report(_exceptionable, {
|
|
342
|
+
path: _path + ".particle",
|
|
343
|
+
expected: "string",
|
|
344
|
+
value: input.particle
|
|
345
|
+
}), (Array.isArray(input.tools) || _report(_exceptionable, {
|
|
346
|
+
path: _path + ".tools",
|
|
347
|
+
expected: "Array<SavedToolConfig>",
|
|
348
|
+
value: input.tools
|
|
349
|
+
})) && input.tools.map((elem, _index13) => ("object" === typeof elem && null !== elem && false === Array.isArray(elem) || _report(_exceptionable, {
|
|
350
|
+
path: _path + ".tools[" + _index13 + "]",
|
|
351
|
+
expected: "SavedToolConfig",
|
|
352
|
+
value: elem
|
|
353
|
+
})) && _vo3(elem, _path + ".tools[" + _index13 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
354
|
+
path: _path + ".tools[" + _index13 + "]",
|
|
355
|
+
expected: "SavedToolConfig",
|
|
356
|
+
value: elem
|
|
357
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
358
|
+
path: _path + ".tools",
|
|
359
|
+
expected: "Array<SavedToolConfig>",
|
|
360
|
+
value: input.tools
|
|
361
|
+
})].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map(key => {
|
|
267
362
|
const value = input[key];
|
|
268
363
|
if (undefined === value)
|
|
269
364
|
return true;
|
|
270
|
-
return
|
|
271
|
-
|
|
365
|
+
return ("object" === typeof value && null !== value && false === Array.isArray(value) || _report(_exceptionable, {
|
|
366
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
367
|
+
expected: "__type.o1",
|
|
368
|
+
value: value
|
|
369
|
+
})) && _vo4(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || _report(_exceptionable, {
|
|
370
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
371
|
+
expected: "__type.o1",
|
|
372
|
+
value: value
|
|
373
|
+
});
|
|
374
|
+
}).every(flag => flag)].every(flag => flag); const _vo4 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map(key => {
|
|
272
375
|
const value = input[key];
|
|
273
376
|
if (undefined === value)
|
|
274
377
|
return true;
|
|
275
|
-
return
|
|
276
|
-
|
|
378
|
+
return (null !== value || _report(_exceptionable, {
|
|
379
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
380
|
+
expected: "(Array<number> | Array<string> | __type.o2 | __type.o3 | boolean | number | string)",
|
|
381
|
+
value: value
|
|
382
|
+
})) && (undefined !== value || _report(_exceptionable, {
|
|
383
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
384
|
+
expected: "(Array<number> | Array<string> | __type.o2 | __type.o3 | boolean | number | string)",
|
|
385
|
+
value: value
|
|
386
|
+
})) && ("string" === typeof value || "number" === typeof value || "boolean" === typeof value || (Array.isArray(value) && (_vp1(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || _report(_exceptionable, {
|
|
387
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
388
|
+
expected: "Array<string> | Array<number>",
|
|
389
|
+
value: value
|
|
390
|
+
})) || "object" === typeof value && null !== value && false === Array.isArray(value) && _vu0(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || _report(_exceptionable, {
|
|
391
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
392
|
+
expected: "(Array<number> | Array<string> | __type.o2 | __type.o3 | boolean | number | string)",
|
|
393
|
+
value: value
|
|
394
|
+
})) || _report(_exceptionable, {
|
|
395
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
396
|
+
expected: "(Array<number> | Array<string> | __type.o2 | __type.o3 | boolean | number | string)",
|
|
397
|
+
value: value
|
|
398
|
+
}));
|
|
399
|
+
}).every(flag => flag)].every(flag => flag); const _vo5 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map(key => {
|
|
277
400
|
const value = input[key];
|
|
278
401
|
if (undefined === value)
|
|
279
402
|
return true;
|
|
280
|
-
return
|
|
281
|
-
|
|
403
|
+
return "string" === typeof value || _report(_exceptionable, {
|
|
404
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
405
|
+
expected: "string",
|
|
406
|
+
value: value
|
|
407
|
+
});
|
|
408
|
+
}).every(flag => flag)].every(flag => flag); const _vo6 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map(key => {
|
|
282
409
|
const value = input[key];
|
|
283
410
|
if (undefined === value)
|
|
284
411
|
return true;
|
|
285
|
-
return
|
|
286
|
-
|
|
287
|
-
if (_io6(input))
|
|
288
|
-
return _io6(input);
|
|
289
|
-
if (_io5(input))
|
|
290
|
-
return _io5(input);
|
|
291
|
-
return false;
|
|
292
|
-
})(); const _vo0 = (input, _path, _exceptionable = true) => [("object" === typeof input.branches && null !== input.branches && false === Array.isArray(input.branches) || _report(_exceptionable, {
|
|
293
|
-
path: _path + ".branches",
|
|
294
|
-
expected: "__type",
|
|
295
|
-
value: input.branches
|
|
296
|
-
})) && _vo1(input.branches, _path + ".branches", true && _exceptionable) || _report(_exceptionable, {
|
|
297
|
-
path: _path + ".branches",
|
|
298
|
-
expected: "__type",
|
|
299
|
-
value: input.branches
|
|
300
|
-
}), undefined === input.descriptorTemplate || "string" === typeof input.descriptorTemplate || _report(_exceptionable, {
|
|
301
|
-
path: _path + ".descriptorTemplate",
|
|
302
|
-
expected: "(string | undefined)",
|
|
303
|
-
value: input.descriptorTemplate
|
|
304
|
-
}), ("object" === typeof input.groups && null !== input.groups && false === Array.isArray(input.groups) || _report(_exceptionable, {
|
|
305
|
-
path: _path + ".groups",
|
|
306
|
-
expected: "__type.o4",
|
|
307
|
-
value: input.groups
|
|
308
|
-
})) && _vo7(input.groups, _path + ".groups", true && _exceptionable) || _report(_exceptionable, {
|
|
309
|
-
path: _path + ".groups",
|
|
310
|
-
expected: "__type.o4",
|
|
311
|
-
value: input.groups
|
|
312
|
-
}), undefined === input.inputs || (Array.isArray(input.inputs) || _report(_exceptionable, {
|
|
313
|
-
path: _path + ".inputs",
|
|
314
|
-
expected: "(Array<string> | undefined)",
|
|
315
|
-
value: input.inputs
|
|
316
|
-
})) && input.inputs.map((elem, _index11) => "string" === typeof elem || _report(_exceptionable, {
|
|
317
|
-
path: _path + ".inputs[" + _index11 + "]",
|
|
318
|
-
expected: "string",
|
|
319
|
-
value: elem
|
|
320
|
-
})).every(flag => flag) || _report(_exceptionable, {
|
|
321
|
-
path: _path + ".inputs",
|
|
322
|
-
expected: "(Array<string> | undefined)",
|
|
323
|
-
value: input.inputs
|
|
324
|
-
}), undefined === input.name || "string" === typeof input.name || _report(_exceptionable, {
|
|
325
|
-
path: _path + ".name",
|
|
326
|
-
expected: "(string | undefined)",
|
|
327
|
-
value: input.name
|
|
328
|
-
}), (Array.isArray(input.tools) || _report(_exceptionable, {
|
|
329
|
-
path: _path + ".tools",
|
|
330
|
-
expected: "Array<SavedToolConfig>",
|
|
331
|
-
value: input.tools
|
|
332
|
-
})) && input.tools.map((elem, _index12) => ("object" === typeof elem && null !== elem && false === Array.isArray(elem) || _report(_exceptionable, {
|
|
333
|
-
path: _path + ".tools[" + _index12 + "]",
|
|
334
|
-
expected: "SavedToolConfig",
|
|
335
|
-
value: elem
|
|
336
|
-
})) && _vo3(elem, _path + ".tools[" + _index12 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
337
|
-
path: _path + ".tools[" + _index12 + "]",
|
|
338
|
-
expected: "SavedToolConfig",
|
|
339
|
-
value: elem
|
|
340
|
-
})).every(flag => flag) || _report(_exceptionable, {
|
|
341
|
-
path: _path + ".tools",
|
|
342
|
-
expected: "Array<SavedToolConfig>",
|
|
343
|
-
value: input.tools
|
|
344
|
-
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map(key => {
|
|
345
|
-
const value = input[key];
|
|
346
|
-
if (undefined === value)
|
|
347
|
-
return true;
|
|
348
|
-
return ("object" === typeof value && null !== value || _report(_exceptionable, {
|
|
349
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
350
|
-
expected: "SavedBranchConfig",
|
|
351
|
-
value: value
|
|
352
|
-
})) && _vo2(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || _report(_exceptionable, {
|
|
353
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
354
|
-
expected: "SavedBranchConfig",
|
|
355
|
-
value: value
|
|
356
|
-
});
|
|
357
|
-
}).every(flag => flag)].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["string" === typeof input.particle || _report(_exceptionable, {
|
|
358
|
-
path: _path + ".particle",
|
|
359
|
-
expected: "string",
|
|
360
|
-
value: input.particle
|
|
361
|
-
}), (Array.isArray(input.tools) || _report(_exceptionable, {
|
|
362
|
-
path: _path + ".tools",
|
|
363
|
-
expected: "Array<SavedToolConfig>",
|
|
364
|
-
value: input.tools
|
|
365
|
-
})) && input.tools.map((elem, _index13) => ("object" === typeof elem && null !== elem && false === Array.isArray(elem) || _report(_exceptionable, {
|
|
366
|
-
path: _path + ".tools[" + _index13 + "]",
|
|
367
|
-
expected: "SavedToolConfig",
|
|
368
|
-
value: elem
|
|
369
|
-
})) && _vo3(elem, _path + ".tools[" + _index13 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
370
|
-
path: _path + ".tools[" + _index13 + "]",
|
|
371
|
-
expected: "SavedToolConfig",
|
|
372
|
-
value: elem
|
|
373
|
-
})).every(flag => flag) || _report(_exceptionable, {
|
|
374
|
-
path: _path + ".tools",
|
|
375
|
-
expected: "Array<SavedToolConfig>",
|
|
376
|
-
value: input.tools
|
|
377
|
-
})].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map(key => {
|
|
378
|
-
const value = input[key];
|
|
379
|
-
if (undefined === value)
|
|
380
|
-
return true;
|
|
381
|
-
return ("object" === typeof value && null !== value && false === Array.isArray(value) || _report(_exceptionable, {
|
|
382
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
383
|
-
expected: "__type.o1",
|
|
384
|
-
value: value
|
|
385
|
-
})) && _vo4(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || _report(_exceptionable, {
|
|
386
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
387
|
-
expected: "__type.o1",
|
|
388
|
-
value: value
|
|
389
|
-
});
|
|
390
|
-
}).every(flag => flag)].every(flag => flag); const _vo4 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map(key => {
|
|
391
|
-
const value = input[key];
|
|
392
|
-
if (undefined === value)
|
|
393
|
-
return true;
|
|
394
|
-
return (null !== value || _report(_exceptionable, {
|
|
395
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
396
|
-
expected: "(Array<number> | Array<string> | __type.o2 | __type.o3 | boolean | number | string)",
|
|
397
|
-
value: value
|
|
398
|
-
})) && (undefined !== value || _report(_exceptionable, {
|
|
399
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
400
|
-
expected: "(Array<number> | Array<string> | __type.o2 | __type.o3 | boolean | number | string)",
|
|
401
|
-
value: value
|
|
402
|
-
})) && ("string" === typeof value || "number" === typeof value || "boolean" === typeof value || (Array.isArray(value) && (_vp1(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || _report(_exceptionable, {
|
|
403
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
404
|
-
expected: "Array<string> | Array<number>",
|
|
405
|
-
value: value
|
|
406
|
-
})) || "object" === typeof value && null !== value && false === Array.isArray(value) && _vu0(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || _report(_exceptionable, {
|
|
407
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
408
|
-
expected: "(Array<number> | Array<string> | __type.o2 | __type.o3 | boolean | number | string)",
|
|
409
|
-
value: value
|
|
410
|
-
})) || _report(_exceptionable, {
|
|
411
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
412
|
-
expected: "(Array<number> | Array<string> | __type.o2 | __type.o3 | boolean | number | string)",
|
|
413
|
-
value: value
|
|
414
|
-
}));
|
|
415
|
-
}).every(flag => flag)].every(flag => flag); const _vo5 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map(key => {
|
|
416
|
-
const value = input[key];
|
|
417
|
-
if (undefined === value)
|
|
418
|
-
return true;
|
|
419
|
-
return "string" === typeof value || _report(_exceptionable, {
|
|
420
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
421
|
-
expected: "string",
|
|
422
|
-
value: value
|
|
423
|
-
});
|
|
424
|
-
}).every(flag => flag)].every(flag => flag); const _vo6 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map(key => {
|
|
425
|
-
const value = input[key];
|
|
426
|
-
if (undefined === value)
|
|
427
|
-
return true;
|
|
428
|
-
return (Array.isArray(value) || _report(_exceptionable, {
|
|
429
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
430
|
-
expected: "Array<string>",
|
|
431
|
-
value: value
|
|
432
|
-
})) && value.map((elem, _index18) => "string" === typeof elem || _report(_exceptionable, {
|
|
433
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key) + "[" + _index18 + "]",
|
|
434
|
-
expected: "string",
|
|
435
|
-
value: elem
|
|
436
|
-
})).every(flag => flag) || _report(_exceptionable, {
|
|
437
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
438
|
-
expected: "Array<string>",
|
|
439
|
-
value: value
|
|
440
|
-
});
|
|
441
|
-
}).every(flag => flag)].every(flag => flag); const _vo7 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map(key => {
|
|
442
|
-
const value = input[key];
|
|
443
|
-
if (undefined === value)
|
|
444
|
-
return true;
|
|
445
|
-
return ("object" === typeof value && null !== value || _report(_exceptionable, {
|
|
446
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
447
|
-
expected: "SavedGroupConfig",
|
|
448
|
-
value: value
|
|
449
|
-
})) && _vo8(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || _report(_exceptionable, {
|
|
450
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
451
|
-
expected: "SavedGroupConfig",
|
|
452
|
-
value: value
|
|
453
|
-
});
|
|
454
|
-
}).every(flag => flag)].every(flag => flag); const _vo8 = (input, _path, _exceptionable = true) => [(Array.isArray(input.particles) || _report(_exceptionable, {
|
|
455
|
-
path: _path + ".particles",
|
|
412
|
+
return (Array.isArray(value) || _report(_exceptionable, {
|
|
413
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
456
414
|
expected: "Array<string>",
|
|
457
|
-
value:
|
|
458
|
-
})) &&
|
|
459
|
-
path: _path + "
|
|
415
|
+
value: value
|
|
416
|
+
})) && value.map((elem, _index18) => "string" === typeof elem || _report(_exceptionable, {
|
|
417
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key) + "[" + _index18 + "]",
|
|
460
418
|
expected: "string",
|
|
461
419
|
value: elem
|
|
462
420
|
})).every(flag => flag) || _report(_exceptionable, {
|
|
463
|
-
path: _path +
|
|
421
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
464
422
|
expected: "Array<string>",
|
|
465
|
-
value:
|
|
466
|
-
})
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
423
|
+
value: value
|
|
424
|
+
});
|
|
425
|
+
}).every(flag => flag)].every(flag => flag); const _vo7 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map(key => {
|
|
426
|
+
const value = input[key];
|
|
427
|
+
if (undefined === value)
|
|
428
|
+
return true;
|
|
429
|
+
return ("object" === typeof value && null !== value || _report(_exceptionable, {
|
|
430
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
431
|
+
expected: "SavedGroupConfig",
|
|
432
|
+
value: value
|
|
433
|
+
})) && _vo8(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || _report(_exceptionable, {
|
|
434
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
435
|
+
expected: "SavedGroupConfig",
|
|
436
|
+
value: value
|
|
437
|
+
});
|
|
438
|
+
}).every(flag => flag)].every(flag => flag); const _vo8 = (input, _path, _exceptionable = true) => [(Array.isArray(input.particles) || _report(_exceptionable, {
|
|
439
|
+
path: _path + ".particles",
|
|
440
|
+
expected: "Array<string>",
|
|
441
|
+
value: input.particles
|
|
442
|
+
})) && input.particles.map((elem, _index19) => "string" === typeof elem || _report(_exceptionable, {
|
|
443
|
+
path: _path + ".particles[" + _index19 + "]",
|
|
444
|
+
expected: "string",
|
|
445
|
+
value: elem
|
|
446
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
447
|
+
path: _path + ".particles",
|
|
448
|
+
expected: "Array<string>",
|
|
449
|
+
value: input.particles
|
|
450
|
+
}), (Array.isArray(input.tools) || _report(_exceptionable, {
|
|
451
|
+
path: _path + ".tools",
|
|
452
|
+
expected: "Array<SavedToolConfig>",
|
|
453
|
+
value: input.tools
|
|
454
|
+
})) && input.tools.map((elem, _index20) => ("object" === typeof elem && null !== elem && false === Array.isArray(elem) || _report(_exceptionable, {
|
|
455
|
+
path: _path + ".tools[" + _index20 + "]",
|
|
456
|
+
expected: "SavedToolConfig",
|
|
457
|
+
value: elem
|
|
458
|
+
})) && _vo3(elem, _path + ".tools[" + _index20 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
459
|
+
path: _path + ".tools[" + _index20 + "]",
|
|
460
|
+
expected: "SavedToolConfig",
|
|
461
|
+
value: elem
|
|
462
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
463
|
+
path: _path + ".tools",
|
|
464
|
+
expected: "Array<SavedToolConfig>",
|
|
465
|
+
value: input.tools
|
|
466
|
+
})].every(flag => flag); const _vu0 = (input, _path, _exceptionable = true) => _vo6(input, _path, false && _exceptionable) || _vo5(input, _path, false && _exceptionable); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
|
|
467
|
+
if (false === __is(input)) {
|
|
468
|
+
errors = [];
|
|
469
|
+
_report = __typia_transform__validateReport._validateReport(errors);
|
|
470
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
471
|
+
path: _path + "",
|
|
472
|
+
expected: "SavedDttConfig",
|
|
473
|
+
value: input
|
|
474
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
475
|
+
path: _path + "",
|
|
476
|
+
expected: "SavedDttConfig",
|
|
477
|
+
value: input
|
|
478
|
+
}))(input, "$input", true);
|
|
479
|
+
const success = 0 === errors.length;
|
|
480
|
+
return success ? {
|
|
481
|
+
success,
|
|
482
|
+
data: input
|
|
483
|
+
} : {
|
|
484
|
+
success,
|
|
485
|
+
errors,
|
|
507
486
|
data: input
|
|
508
487
|
};
|
|
509
|
-
}; })()(rawConfig);
|
|
510
|
-
if (!validationResult.success) {
|
|
511
|
-
console.error("Invalid Dtt config:", rawConfig);
|
|
512
|
-
console.error(validationResult.errors);
|
|
513
|
-
errors[file.name] = `Invalid Dtt config at: ${validationResult.errors.map((e) => e.path).join(", ")}`;
|
|
514
|
-
continue;
|
|
515
488
|
}
|
|
516
|
-
|
|
489
|
+
return {
|
|
490
|
+
success: true,
|
|
491
|
+
data: input
|
|
492
|
+
};
|
|
493
|
+
}; })()(rawConfig);
|
|
494
|
+
if (!validationResult.success) {
|
|
495
|
+
return `'${file.name}' does not have the expected structure`;
|
|
496
|
+
}
|
|
497
|
+
return validationResult.data;
|
|
498
|
+
}
|
|
499
|
+
export async function parseProductionFiles(files, metadata) {
|
|
500
|
+
const infoYamlFile = files.find((f) => f.name === "info.yaml");
|
|
501
|
+
const infoYamlResult = infoYamlFile ? await parseInfoYamlFile(infoYamlFile) : null;
|
|
502
|
+
if (typeof infoYamlResult === "string") {
|
|
503
|
+
// The info.yaml is invalid
|
|
504
|
+
return infoYamlResult;
|
|
505
|
+
}
|
|
506
|
+
const dttConfigFiles = files.filter((f) => f.name !== "info.yaml");
|
|
507
|
+
const dttConfigPromises = dttConfigFiles.map((f) => parseDttConfigFile(f));
|
|
508
|
+
const dttConfigResults = await Promise.all(dttConfigPromises);
|
|
509
|
+
const dttConfigErrors = dttConfigResults.filter((r) => typeof r === "string");
|
|
510
|
+
if (dttConfigErrors.length > 0) {
|
|
511
|
+
// One of the DTT config files is invalid
|
|
512
|
+
return dttConfigErrors.join("\n");
|
|
513
|
+
}
|
|
514
|
+
return processProductionFiles(metadata, dttConfigResults, infoYamlResult);
|
|
515
|
+
}
|
|
516
|
+
export function processProductionFiles(metadata, configs, infoYaml) {
|
|
517
|
+
const rows = [];
|
|
518
|
+
const emailsToInform = [];
|
|
519
|
+
for (const config of configs) {
|
|
517
520
|
const decay = Object.values(metadata.decays).find((d) => d.descriptors.template === config.descriptorTemplate);
|
|
518
521
|
if (!decay) {
|
|
519
|
-
|
|
520
|
-
console.error(msg);
|
|
521
|
-
errors[file.name] = msg;
|
|
522
|
-
continue;
|
|
522
|
+
return `[${config.name}] Unknown decay '${config.descriptorTemplate}'`;
|
|
523
523
|
}
|
|
524
524
|
if (!config.inputs) {
|
|
525
|
-
|
|
526
|
-
console.warn(msg);
|
|
527
|
-
warnings[file.name] = msg;
|
|
528
|
-
continue;
|
|
525
|
+
return `[${config.name}] No inputs defined`;
|
|
529
526
|
}
|
|
530
527
|
rows.push({
|
|
531
|
-
id:
|
|
528
|
+
id: rows.length,
|
|
532
529
|
decay,
|
|
533
530
|
lines: config.inputs.map((input) => parseInput(decay, input)),
|
|
534
531
|
paths: [],
|
|
@@ -536,8 +533,15 @@ export const parseProductionFiles = async (files, metadata) => {
|
|
|
536
533
|
dtt: Dtt.fromSavedConfig(config, metadata.tupleTools.tupleTools),
|
|
537
534
|
});
|
|
538
535
|
}
|
|
539
|
-
|
|
540
|
-
|
|
536
|
+
if (infoYaml) {
|
|
537
|
+
const email = infoYaml.defaults.inform[0];
|
|
538
|
+
if (email) {
|
|
539
|
+
emailsToInform.push(email);
|
|
540
|
+
}
|
|
541
|
+
addBkPathsToRows(infoYaml, rows);
|
|
542
|
+
}
|
|
543
|
+
return { rows, emails: emailsToInform };
|
|
544
|
+
}
|
|
541
545
|
/**
|
|
542
546
|
* Sanitizes a user-provided filename to prevent path traversal (Zip Slip)
|
|
543
547
|
* and unsafe filesystem characters.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lhcb-ntuple-wizard-test",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "An application to access large-scale open data from LHCb",
|
|
5
5
|
"url": "https://gitlab.cern.ch/lhcb-dpa/wp6-analysis-preservation-and-open-data/lhcb-ntuple-wizard-frontend/issues",
|
|
6
6
|
"private": false,
|
package/dist/models/blobFile.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|