domma-cms 0.36.9 → 0.36.10
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/package.json
CHANGED
package/server/services/forms.js
CHANGED
|
@@ -63,7 +63,10 @@ export async function listForms() {
|
|
|
63
63
|
for (const entry of entries.filter(e => e.endsWith('.json'))) {
|
|
64
64
|
try {
|
|
65
65
|
const data = JSON.parse(await fs.readFile(path.join(FORMS_DIR, entry), 'utf8'));
|
|
66
|
-
|
|
66
|
+
// The filename is the canonical slug — readForm/deleteForm/save all
|
|
67
|
+
// resolve `${slug}.json`, and the [form] shortcode embeds by file.
|
|
68
|
+
// Normalise so a stale internal slug can't desync list vs read.
|
|
69
|
+
forms.push({...data, slug: entry.replace(/\.json$/, '')});
|
|
67
70
|
} catch {
|
|
68
71
|
// skip malformed
|
|
69
72
|
}
|
|
@@ -406,27 +406,36 @@ export async function getArtefactsForProject(projectSlug) {
|
|
|
406
406
|
menus: [], blocks: [], components: [], views: [], roles: [], users: [], apis: []
|
|
407
407
|
};
|
|
408
408
|
|
|
409
|
+
// The three loops below re-read each artefact by slug; guard PER ITEM so a
|
|
410
|
+
// single unreadable artefact (e.g. a form whose internal slug doesn't match
|
|
411
|
+
// its filename) can't blank the whole type for every project.
|
|
409
412
|
try {
|
|
410
413
|
const {listMenus, getMenu} = await import('./menus.js');
|
|
411
414
|
for (const m of await listMenus()) {
|
|
412
|
-
|
|
413
|
-
|
|
415
|
+
try {
|
|
416
|
+
const full = await getMenu(m.slug);
|
|
417
|
+
if (resolveArtefactProject(full) === projectSlug) out.menus.push(m);
|
|
418
|
+
} catch { /* skip broken menu */ }
|
|
414
419
|
}
|
|
415
420
|
} catch { /* service unavailable */ }
|
|
416
421
|
|
|
417
422
|
try {
|
|
418
423
|
const {listForms, readForm} = await import('./forms.js');
|
|
419
424
|
for (const f of await listForms()) {
|
|
420
|
-
|
|
421
|
-
|
|
425
|
+
try {
|
|
426
|
+
const full = await readForm(f.slug);
|
|
427
|
+
if (resolveArtefactProject(full) === projectSlug) out.forms.push(f);
|
|
428
|
+
} catch { /* skip broken form */ }
|
|
422
429
|
}
|
|
423
430
|
} catch { /* skip */ }
|
|
424
431
|
|
|
425
432
|
try {
|
|
426
433
|
const {listCollections, getCollection} = await import('./collections.js');
|
|
427
434
|
for (const c of await listCollections()) {
|
|
428
|
-
|
|
429
|
-
|
|
435
|
+
try {
|
|
436
|
+
const full = await getCollection(c.slug);
|
|
437
|
+
if (resolveArtefactProject(full) === projectSlug) out.collections.push(c);
|
|
438
|
+
} catch { /* skip broken collection */ }
|
|
430
439
|
}
|
|
431
440
|
} catch { /* skip */ }
|
|
432
441
|
|