@opengis/fastify-table 2.0.98 → 2.0.99
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTemplate.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/table/funcs/getTemplate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getTemplate.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/table/funcs/getTemplate.ts"],"names":[],"mappings":"AA+FA,wBAA8B,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,gBAyB7D"}
|
|
@@ -10,7 +10,7 @@ async function readFileData(file) {
|
|
|
10
10
|
if (ext === "yml") {
|
|
11
11
|
return yaml.load(data);
|
|
12
12
|
}
|
|
13
|
-
if (ext === "json") {
|
|
13
|
+
if (ext === "json" && data) {
|
|
14
14
|
return JSON.parse(data);
|
|
15
15
|
}
|
|
16
16
|
if (ext === "md") {
|
|
@@ -44,6 +44,13 @@ async function getTemplateData(template) {
|
|
|
44
44
|
// one file template: table, form
|
|
45
45
|
if (template.length === 1) {
|
|
46
46
|
const data = await readFileData(template[0][1]);
|
|
47
|
+
if (template[0][2] === "json" &&
|
|
48
|
+
path.basename(path.dirname(template[0][1])) === "table" &&
|
|
49
|
+
data?.parent) {
|
|
50
|
+
const parentTemplate = getTemplatePath("table").find((el) => el[0] === data.parent);
|
|
51
|
+
const parentData = await readFileData(parentTemplate[1]);
|
|
52
|
+
return { ...(parentData || {}), ...data };
|
|
53
|
+
}
|
|
47
54
|
return data;
|
|
48
55
|
}
|
|
49
56
|
// multi file template: select, etc
|