pangea-server 3.3.72 → 3.3.74
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.
|
@@ -62,28 +62,36 @@ async function setFilesUrls(data) {
|
|
|
62
62
|
function collect(node) {
|
|
63
63
|
if (!node)
|
|
64
64
|
return;
|
|
65
|
-
if (Array.isArray(node)) {
|
|
66
|
-
node.forEach(collect);
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
65
|
if (typeof node !== 'object')
|
|
70
66
|
return;
|
|
71
67
|
if (visited.has(node))
|
|
72
68
|
return;
|
|
73
69
|
visited.add(node);
|
|
74
|
-
|
|
70
|
+
if (Array.isArray(node)) {
|
|
71
|
+
node.forEach(collect);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const payload = node.dataValues ? node.dataValues : node;
|
|
75
|
+
if (payload !== node) {
|
|
76
|
+
if (visited.has(payload))
|
|
77
|
+
return;
|
|
78
|
+
visited.add(payload);
|
|
79
|
+
}
|
|
80
|
+
for (const [key, value] of Object.entries(payload)) {
|
|
75
81
|
if (typeof value === 'string' && value.length) {
|
|
76
82
|
if (singularSuffixes.some((s) => key === s.toLowerCase() || (key.length > s.length && key.endsWith(s)))) {
|
|
77
|
-
entries.push({ node, field: key, type: 'singular' });
|
|
83
|
+
entries.push({ node: payload, field: key, type: 'singular' });
|
|
78
84
|
}
|
|
79
85
|
}
|
|
80
86
|
else if (Array.isArray(value) && value.length && value.every((v) => typeof v === 'string')) {
|
|
81
87
|
if (pluralSuffixes.some((s) => key === s.toLowerCase() || (key.length > s.length && key.endsWith(s)))) {
|
|
82
|
-
entries.push({ node, field: key, type: 'plural' });
|
|
88
|
+
entries.push({ node: payload, field: key, type: 'plural' });
|
|
83
89
|
}
|
|
84
90
|
}
|
|
91
|
+
if (typeof value === 'object' && value !== null) {
|
|
92
|
+
collect(value);
|
|
93
|
+
}
|
|
85
94
|
}
|
|
86
|
-
Object.values(node).forEach(collect);
|
|
87
95
|
}
|
|
88
96
|
collect(data);
|
|
89
97
|
if (!entries.length)
|