qarpeo 0.1.3 → 0.1.5

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/module.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { existsSync, readFileSync, writeFileSync, appendFileSync, readdirSync, statSync } from 'node:fs';
1
+ import { existsSync, readFileSync, writeFileSync, appendFileSync, readdirSync, statSync, rmSync } from 'node:fs';
2
2
  import { createRequire } from 'node:module';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import { defineNuxtModule, useLogger, createResolver, addVitePlugin, addTemplate, hasNuxtModule, installModule, addNitroPlugin, addImports, addServerImports, addTypeTemplate, updateTemplates, addServerImportsDir, addServerHandler, addRouteMiddleware, addComponent, extendPages, addPlugin } from '@nuxt/kit';
@@ -19,7 +19,7 @@ import 'drizzle-orm/node-sqlite';
19
19
  import 'node:process';
20
20
  import 'node:readline/promises';
21
21
 
22
- const version = "0.1.3";
22
+ const version = "0.1.5";
23
23
 
24
24
  function ensureDevEnv(rootDir) {
25
25
  const envPath = join(rootDir, ".env");
@@ -240,7 +240,7 @@ async function discoverSources(contentDir) {
240
240
  const fullPath = resolve(currentDir, entry.name);
241
241
  if (entry.isDirectory()) {
242
242
  await walk(fullPath);
243
- } else if (entry.isFile() && entry.name === ".sources.json") {
243
+ } else if (entry.isFile() && (entry.name === ".sources.json" || entry.name === "_sources.json")) {
244
244
  try {
245
245
  const raw = await readFile(fullPath, "utf8");
246
246
  const parsed = JSON.parse(raw);
@@ -275,21 +275,25 @@ async function resolveAllCmsSources(options) {
275
275
  if (isRemoteSource(src.from)) {
276
276
  const hash = createHash("sha256").update(src.from).digest("hex").slice(0, 12);
277
277
  const targetDir = resolve(cacheDir, `qarpeo/cms-sources/source-${hash}`);
278
+ const _auth = src.token || process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
278
279
  try {
279
- await downloadTemplate(src.from, {
280
- dir: targetDir,
281
- preferOffline: true,
282
- auth: src.token || process.env.GITHUB_TOKEN || process.env.GH_TOKEN
283
- });
284
- resolvedDir = targetDir;
285
- } catch (err) {
286
- console.warn(
287
- `[qarpeo:cms] Failed to download remote source "${src.from}":`,
288
- err?.message || err
289
- );
290
280
  if (existsSync(targetDir)) {
281
+ const cached = await readdir(targetDir);
282
+ if (cached.length > 0) {
283
+ resolvedDir = targetDir;
284
+ } else {
285
+ rmSync(targetDir, { recursive: true, force: true });
286
+ }
287
+ }
288
+ if (!resolvedDir) {
289
+ await downloadTemplate(src.from, { dir: targetDir, auth: _auth });
291
290
  resolvedDir = targetDir;
292
291
  }
292
+ } catch (err) {
293
+ console.warn(
294
+ `[qarpeo:cms] Failed to download remote source "${src.from}": ${err?.message ?? String(err)}`
295
+ );
296
+ if (existsSync(targetDir)) resolvedDir = targetDir;
293
297
  }
294
298
  } else {
295
299
  resolvedDir = resolve(sourceFileDir, src.from);
@@ -319,21 +323,25 @@ async function resolveAllCmsSources(options) {
319
323
  if (isRemoteSource(src.from)) {
320
324
  const hash = createHash("sha256").update(src.from).digest("hex").slice(0, 12);
321
325
  const targetDir = resolve(cacheDir, `qarpeo/cms-sources/source-${hash}`);
326
+ const _auth2 = src.token || process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
322
327
  try {
323
- await downloadTemplate(src.from, {
324
- dir: targetDir,
325
- preferOffline: true,
326
- auth: src.token || process.env.GITHUB_TOKEN || process.env.GH_TOKEN
327
- });
328
- resolvedDir = targetDir;
329
- } catch (err) {
330
- console.warn(
331
- `[qarpeo:cms] Failed to download remote source "${src.from}":`,
332
- err?.message || err
333
- );
334
328
  if (existsSync(targetDir)) {
329
+ const cached = await readdir(targetDir);
330
+ if (cached.length > 0) {
331
+ resolvedDir = targetDir;
332
+ } else {
333
+ rmSync(targetDir, { recursive: true, force: true });
334
+ }
335
+ }
336
+ if (!resolvedDir) {
337
+ await downloadTemplate(src.from, { dir: targetDir, auth: _auth2 });
335
338
  resolvedDir = targetDir;
336
339
  }
340
+ } catch (err) {
341
+ console.warn(
342
+ `[qarpeo:cms] Failed to download remote source "${src.from}": ${err?.message ?? String(err)}`
343
+ );
344
+ if (existsSync(targetDir)) resolvedDir = targetDir;
337
345
  }
338
346
  } else {
339
347
  resolvedDir = resolve(contentDir, src.from);
@@ -3275,7 +3283,23 @@ export default queueHandler;
3275
3283
  const cmsPath = cmsConfig.path || "/cms";
3276
3284
  const contentDirName = cmsConfig.contentDir || "content";
3277
3285
  const resolvedContentDir = existsSync(resolve(nuxt.options.rootDir, contentDirName)) ? resolve(nuxt.options.rootDir, contentDirName) : resolve(nuxt.options.srcDir || nuxt.options.rootDir, contentDirName);
3278
- const cacheDir = nuxt.options.buildDir || resolve(nuxt.options.rootDir, ".nuxt");
3286
+ const cacheDir = resolve(nuxt.options.rootDir, ".nuxt");
3287
+ try {
3288
+ const dotenvPath = resolve(nuxt.options.rootDir, ".env");
3289
+ if (existsSync(dotenvPath)) {
3290
+ const raw = readFileSync(dotenvPath, "utf8");
3291
+ for (const line of raw.split(/\r?\n/)) {
3292
+ const trimmed = line.trim();
3293
+ if (!trimmed || trimmed.startsWith("#")) continue;
3294
+ const eqIdx = trimmed.indexOf("=");
3295
+ if (eqIdx < 1) continue;
3296
+ const key = trimmed.slice(0, eqIdx).trim();
3297
+ const val = trimmed.slice(eqIdx + 1).trim().replace(/^["']|["']$/g, "");
3298
+ if (key && !(key in process.env)) process.env[key] = val;
3299
+ }
3300
+ }
3301
+ } catch {
3302
+ }
3279
3303
  let resolvedSources = [];
3280
3304
  try {
3281
3305
  resolvedSources = await resolveAllCmsSources({
@@ -3357,8 +3381,15 @@ export default queueHandler;
3357
3381
  sources: resolvedSources,
3358
3382
  exclude: cmsConfig.exclude
3359
3383
  });
3360
- return `export const manifestEntries = ${JSON.stringify(entries)};
3361
- export const manifestCollections = ${JSON.stringify(cmsConfig.collections || {})};
3384
+ const payload = JSON.stringify({
3385
+ entries,
3386
+ collections: cmsConfig.collections || {}
3387
+ });
3388
+ const b64 = Buffer.from(payload).toString("base64");
3389
+ return `const raw = /*#__PURE__*/ Buffer.from("${b64}", "base64").toString("utf-8");
3390
+ const parsed = JSON.parse(raw);
3391
+ export const manifestEntries = parsed.entries;
3392
+ export const manifestCollections = parsed.collections;
3362
3393
  `;
3363
3394
  } catch (err) {
3364
3395
  console.warn("[qarpeo:cms] Error scanning CMS manifest at build time:", err);
@@ -3369,9 +3400,39 @@ export const manifestCollections = ${JSON.stringify(cmsConfig.collections || {})
3369
3400
  }
3370
3401
  });
3371
3402
  nuxt.options.alias["#qarpeo/cms/manifest"] = cmsManifestTemplate.dst;
3372
- nuxt.hook("nitro:config", (nitroConfig) => {
3403
+ nuxt.hook("nitro:config", async (nitroConfig) => {
3373
3404
  nitroConfig.alias = nitroConfig.alias || {};
3374
3405
  nitroConfig.alias["#qarpeo/cms/manifest"] = cmsManifestTemplate.dst;
3406
+ const routeRules = nuxt.options.routeRules || {};
3407
+ const prerenderPatterns = Object.entries(routeRules).filter(([_, rule]) => rule?.prerender === true).map(([pattern]) => pattern);
3408
+ if (prerenderPatterns.length > 0) {
3409
+ try {
3410
+ const entries = await scanContentEntries({
3411
+ contentDir: resolvedContentDir,
3412
+ collectionsConfig: cmsConfig.collections,
3413
+ sources: resolvedSources,
3414
+ exclude: cmsConfig.exclude
3415
+ });
3416
+ const matchingRoutes = entries.map((e) => e.path).filter((p) => Boolean(p) && matchPathPatterns(p, prerenderPatterns));
3417
+ if (matchingRoutes.length > 0) {
3418
+ nitroConfig.prerender = nitroConfig.prerender || {};
3419
+ nitroConfig.prerender.autoSubfolderIndex = true;
3420
+ nitroConfig.prerender.routes = Array.from(
3421
+ /* @__PURE__ */ new Set([...nitroConfig.prerender.routes || [], ...matchingRoutes])
3422
+ );
3423
+ nitroConfig.hooks = nitroConfig.hooks || {};
3424
+ const prevHook = nitroConfig.hooks["prerender:generate"];
3425
+ nitroConfig.hooks["prerender:generate"] = async (route, nitro) => {
3426
+ if (prevHook) await prevHook(route, nitro);
3427
+ if (route.fileName && !route.fileName.includes(".")) {
3428
+ route.fileName = `${route.fileName}/index.html`;
3429
+ }
3430
+ };
3431
+ }
3432
+ } catch (err) {
3433
+ console.warn("[qarpeo:cms] Error configuring SSG prerender routes:", err);
3434
+ }
3435
+ }
3375
3436
  });
3376
3437
  addNitroPlugin(resolver.resolve("./runtime/server/plugins/cms"));
3377
3438
  addServerHandler({
@@ -8,7 +8,11 @@ import { fireCMSWebhooks, fireCMSDeployTrigger } from "./cms-events.mjs";
8
8
  import { getQarpeoConfig } from "./config.mjs";
9
9
  import { getAuthContext } from "./context.mjs";
10
10
  function getCMSDb(event) {
11
- return getD1Binding("DB", event);
11
+ try {
12
+ return getD1Binding("DB", event);
13
+ } catch {
14
+ return null;
15
+ }
12
16
  }
13
17
  function nanoid(size = 21) {
14
18
  const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
@@ -582,12 +586,36 @@ function rowToCollection(row, config) {
582
586
  };
583
587
  }
584
588
  export async function listCMSCollections(event) {
585
- await ensureCMSSynced(event);
589
+ await ensureCMSSynced(event).catch(() => {
590
+ });
586
591
  const db = getCMSDb(event);
587
- const results = await db.prepare('SELECT * FROM _qarpeo_cms_collections ORDER BY "order" ASC, name ASC').all();
588
- return (results.results || []).map(
589
- (r) => rowToCollection(r)
590
- );
592
+ if (db) {
593
+ try {
594
+ const results = await db.prepare('SELECT * FROM _qarpeo_cms_collections ORDER BY "order" ASC, name ASC').all();
595
+ return (results.results || []).map(
596
+ (r) => rowToCollection(r)
597
+ );
598
+ } catch {
599
+ }
600
+ }
601
+ try {
602
+ const { manifestCollections } = await import("#qarpeo/cms/manifest");
603
+ if (manifestCollections) {
604
+ return Object.entries(manifestCollections).map(([id, cfg]) => ({
605
+ id,
606
+ name: cfg.name || id.charAt(0).toUpperCase() + id.slice(1).replace(/-/g, " "),
607
+ description: cfg.description,
608
+ schemaJson: JSON.stringify(cfg.fields || {}),
609
+ fields: cfg.fields || {},
610
+ source: "config",
611
+ order: cfg.order ?? 0,
612
+ createdAt: 0,
613
+ updatedAt: 0
614
+ }));
615
+ }
616
+ } catch {
617
+ }
618
+ return [];
591
619
  }
592
620
  export async function createCMSCollection(event, data) {
593
621
  const db = getCMSDb(event);
@@ -1701,6 +1729,7 @@ export async function verifyPreviewToken(event, collection, slugOrId, token, exp
1701
1729
  }
1702
1730
  export async function ensureCMSTables(event) {
1703
1731
  const db = getCMSDb(event);
1732
+ if (!db) return;
1704
1733
  const statements = [
1705
1734
  `CREATE TABLE IF NOT EXISTS _qarpeo_cms_collections (id TEXT PRIMARY KEY, tenant_id TEXT, name TEXT NOT NULL, description TEXT, schema_json TEXT NOT NULL DEFAULT '{}', source TEXT NOT NULL DEFAULT 'db', "order" INTEGER NOT NULL DEFAULT 0, created_at INTEGER NOT NULL, updated_at INTEGER NOT NULL);`,
1706
1735
  `CREATE TABLE IF NOT EXISTS _qarpeo_cms_entries (id TEXT PRIMARY KEY, tenant_id TEXT, collection_id TEXT NOT NULL, slug TEXT NOT NULL, title TEXT NOT NULL, description TEXT, cover_image TEXT, tags TEXT, "order" INTEGER NOT NULL DEFAULT 0, content_md TEXT NOT NULL DEFAULT '', content_html TEXT NOT NULL DEFAULT '', metadata_json TEXT DEFAULT '{}', status TEXT NOT NULL DEFAULT 'draft', source TEXT NOT NULL DEFAULT 'db', path TEXT, file_path TEXT, content_hash TEXT, author_id TEXT, locale TEXT NOT NULL DEFAULT 'en', version TEXT NOT NULL DEFAULT 'latest', published_at INTEGER, created_at INTEGER NOT NULL, updated_at INTEGER NOT NULL);`,
@@ -1821,6 +1850,8 @@ async function _runCMSSync(event) {
1821
1850
  }
1822
1851
  let prodTablesChecked = false;
1823
1852
  export async function ensureCMSSynced(event) {
1853
+ const db = getCMSDb(event);
1854
+ if (!db) return;
1824
1855
  if (process.env.NODE_ENV !== "production" || import.meta.dev) {
1825
1856
  if (!hasInitialSynced) {
1826
1857
  if (!syncPromise) {
@@ -2720,27 +2751,30 @@ export async function getCMSEntryByPath(event, collectionId, path, locale, optio
2720
2751
  if (auth?.user && config.roles.some((r) => r === auth.role || auth.isAdmin)) {
2721
2752
  allowDraft = true;
2722
2753
  }
2723
- if (!allowDraft) {
2754
+ if (!allowDraft && db) {
2724
2755
  const token = options.previewToken || cookieObj?.token;
2725
2756
  const expires = options.previewExpires || cookieObj?.expires;
2726
2757
  if (token && expires) {
2727
- const candidate = await db.prepare(
2728
- `SELECT id, slug, collection_id FROM _qarpeo_cms_entries WHERE (collection_id = ? OR ? = 'content') AND (path = ? OR path = ?) ${tenantClause} LIMIT 1`
2729
- ).bind(collectionId, collectionId, cleanPath, `${cleanPath}/`).first();
2730
- if (candidate) {
2731
- allowDraft = await verifyPreviewToken(
2732
- event,
2733
- candidate.collection_id,
2734
- candidate.id,
2735
- token,
2736
- expires
2737
- ) || await verifyPreviewToken(
2738
- event,
2739
- candidate.collection_id,
2740
- candidate.slug,
2741
- token,
2742
- expires
2743
- );
2758
+ try {
2759
+ const candidate = await db.prepare(
2760
+ `SELECT id, slug, collection_id FROM _qarpeo_cms_entries WHERE (collection_id = ? OR ? = 'content') AND (path = ? OR path = ?) ${tenantClause} LIMIT 1`
2761
+ ).bind(collectionId, collectionId, cleanPath, `${cleanPath}/`).first();
2762
+ if (candidate) {
2763
+ allowDraft = await verifyPreviewToken(
2764
+ event,
2765
+ candidate.collection_id,
2766
+ candidate.id,
2767
+ token,
2768
+ expires
2769
+ ) || await verifyPreviewToken(
2770
+ event,
2771
+ candidate.collection_id,
2772
+ candidate.slug,
2773
+ token,
2774
+ expires
2775
+ );
2776
+ }
2777
+ } catch {
2744
2778
  }
2745
2779
  }
2746
2780
  }
@@ -2748,30 +2782,35 @@ export async function getCMSEntryByPath(event, collectionId, path, locale, optio
2748
2782
  const statusFilter = allowDraft ? "status IN ('draft', 'published', 'scheduled')" : "status = 'published'";
2749
2783
  const statusOrder = allowDraft ? "CASE WHEN status = 'draft' THEN 1 WHEN status = 'scheduled' THEN 2 ELSE 3 END," : "";
2750
2784
  let row = null;
2751
- if (locale) {
2752
- const bindsLocale = tenantId ? [collectionId, cleanPath, `${cleanPath}/`, locale, tenantId] : [collectionId, cleanPath, `${cleanPath}/`, locale];
2753
- row = await db.prepare(
2754
- `SELECT * FROM _qarpeo_cms_entries WHERE collection_id = ? AND (path = ? OR path = ?) AND locale = ? AND ${statusFilter}${tenantClause} ORDER BY ${statusOrder} created_at DESC LIMIT 1`
2755
- ).bind(...bindsLocale).first();
2756
- }
2757
- const binds1 = tenantId ? [collectionId, cleanPath, `${cleanPath}/`, tenantId] : [collectionId, cleanPath, `${cleanPath}/`];
2758
- if (!row) {
2759
- row = await db.prepare(
2760
- `SELECT * FROM _qarpeo_cms_entries WHERE collection_id = ? AND (path = ? OR path = ?) AND ${statusFilter}${tenantClause} ORDER BY ${statusOrder} CASE WHEN locale = 'en' THEN 1 ELSE 2 END LIMIT 1`
2761
- ).bind(...binds1).first();
2762
- }
2763
- if (!row && cleanPath.startsWith(`/${collectionId}`)) {
2764
- const unPrefixed = cleanPath.slice(`/${collectionId}`.length) || "/";
2765
- const binds2 = tenantId ? [collectionId, unPrefixed, `${unPrefixed}/`, tenantId] : [collectionId, unPrefixed, `${unPrefixed}/`];
2766
- row = await db.prepare(
2767
- `SELECT * FROM _qarpeo_cms_entries WHERE collection_id = ? AND (path = ? OR path = ?) AND ${statusFilter}${tenantClause} ORDER BY ${statusOrder} created_at DESC LIMIT 1`
2768
- ).bind(...binds2).first();
2769
- }
2770
- if (!row) {
2771
- const binds3 = tenantId ? [cleanPath, `${cleanPath}/`, tenantId] : [cleanPath, `${cleanPath}/`];
2772
- row = await db.prepare(
2773
- `SELECT * FROM _qarpeo_cms_entries WHERE (path = ? OR path = ?) AND ${statusFilter}${tenantClause} ORDER BY ${statusOrder} created_at DESC LIMIT 1`
2774
- ).bind(...binds3).first();
2785
+ if (db) {
2786
+ try {
2787
+ if (locale) {
2788
+ const bindsLocale = tenantId ? [collectionId, cleanPath, `${cleanPath}/`, locale, tenantId] : [collectionId, cleanPath, `${cleanPath}/`, locale];
2789
+ row = await db.prepare(
2790
+ `SELECT * FROM _qarpeo_cms_entries WHERE collection_id = ? AND (path = ? OR path = ?) AND locale = ? AND ${statusFilter}${tenantClause} ORDER BY ${statusOrder} created_at DESC LIMIT 1`
2791
+ ).bind(...bindsLocale).first();
2792
+ }
2793
+ const binds1 = tenantId ? [collectionId, cleanPath, `${cleanPath}/`, tenantId] : [collectionId, cleanPath, `${cleanPath}/`];
2794
+ if (!row) {
2795
+ row = await db.prepare(
2796
+ `SELECT * FROM _qarpeo_cms_entries WHERE collection_id = ? AND (path = ? OR path = ?) AND ${statusFilter}${tenantClause} ORDER BY ${statusOrder} CASE WHEN locale = 'en' THEN 1 ELSE 2 END LIMIT 1`
2797
+ ).bind(...binds1).first();
2798
+ }
2799
+ if (!row && cleanPath.startsWith(`/${collectionId}`)) {
2800
+ const unPrefixed = cleanPath.slice(`/${collectionId}`.length) || "/";
2801
+ const binds2 = tenantId ? [collectionId, unPrefixed, `${unPrefixed}/`, tenantId] : [collectionId, unPrefixed, `${unPrefixed}/`];
2802
+ row = await db.prepare(
2803
+ `SELECT * FROM _qarpeo_cms_entries WHERE collection_id = ? AND (path = ? OR path = ?) AND ${statusFilter}${tenantClause} ORDER BY ${statusOrder} created_at DESC LIMIT 1`
2804
+ ).bind(...binds2).first();
2805
+ }
2806
+ if (!row) {
2807
+ const binds3 = tenantId ? [cleanPath, `${cleanPath}/`, tenantId] : [cleanPath, `${cleanPath}/`];
2808
+ row = await db.prepare(
2809
+ `SELECT * FROM _qarpeo_cms_entries WHERE (path = ? OR path = ?) AND ${statusFilter}${tenantClause} ORDER BY ${statusOrder} created_at DESC LIMIT 1`
2810
+ ).bind(...binds3).first();
2811
+ }
2812
+ } catch {
2813
+ }
2775
2814
  }
2776
2815
  if (!row) {
2777
2816
  try {
@@ -2846,6 +2885,7 @@ export async function getCMSEntrySurroundings(event, collectionId, path, fields
2846
2885
  } catch (err) {
2847
2886
  console.warn("[qarpeo:cms] getCMSEntrySurroundings navTree lookup failed:", err);
2848
2887
  }
2888
+ if (!db) return [null, null];
2849
2889
  const tenantId = getCMSTenantId(event);
2850
2890
  const tenantClause = tenantId ? " AND (tenant_id = ? OR tenant_id IS NULL)" : "";
2851
2891
  const binds = tenantId ? [collectionId, tenantId] : [collectionId];
@@ -2935,8 +2975,29 @@ export async function getCMSNavigationTree(event, collectionId, options) {
2935
2975
  rootBinds.push(navRootTenantId);
2936
2976
  }
2937
2977
  rootSql += ' ORDER BY "order" ASC';
2938
- const rootEntries = await db.prepare(rootSql).bind(...rootBinds).all();
2939
- const rows2 = rootEntries.results || [];
2978
+ let rows2 = [];
2979
+ if (db) {
2980
+ try {
2981
+ const rootEntries = await db.prepare(rootSql).bind(...rootBinds).all();
2982
+ rows2 = rootEntries.results || [];
2983
+ } catch {
2984
+ }
2985
+ }
2986
+ if (!rows2.length) {
2987
+ try {
2988
+ const { manifestEntries } = await import("#qarpeo/cms/manifest");
2989
+ rows2 = (manifestEntries || []).filter((e) => e.collection_id === "content").map((e) => ({
2990
+ id: e.id,
2991
+ slug: e.slug,
2992
+ path: e.path,
2993
+ title: e.title,
2994
+ order: e.order ?? 0,
2995
+ metadata_json: typeof e.metadata_json === "string" ? e.metadata_json : JSON.stringify(e.metadata || {}),
2996
+ status: e.status || "published"
2997
+ }));
2998
+ } catch {
2999
+ }
3000
+ }
2940
3001
  for (const r of rows2) {
2941
3002
  let meta = {};
2942
3003
  try {
@@ -2991,8 +3052,28 @@ export async function getCMSNavigationTree(event, collectionId, options) {
2991
3052
  binds.push(searchPath, `${searchPath}/%`);
2992
3053
  }
2993
3054
  sql += ' ORDER BY "order" ASC';
2994
- const all = await db.prepare(sql).bind(...binds).all();
2995
- const rows = all.results || [];
3055
+ let rows = [];
3056
+ if (db) {
3057
+ try {
3058
+ const all = await db.prepare(sql).bind(...binds).all();
3059
+ rows = all.results || [];
3060
+ } catch {
3061
+ }
3062
+ }
3063
+ if (!rows.length) {
3064
+ try {
3065
+ const { manifestEntries } = await import("#qarpeo/cms/manifest");
3066
+ rows = (manifestEntries || []).filter((e) => e.collection_id === collectionId).map((e) => ({
3067
+ id: e.id,
3068
+ slug: e.slug,
3069
+ path: e.path,
3070
+ title: e.title,
3071
+ order: e.order ?? 0,
3072
+ metadata_json: typeof e.metadata_json === "string" ? e.metadata_json : JSON.stringify(e.metadata || {})
3073
+ }));
3074
+ } catch {
3075
+ }
3076
+ }
2996
3077
  const sectionsMap = /* @__PURE__ */ new Map();
2997
3078
  for (const r of rows) {
2998
3079
  let meta = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qarpeo",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Zero-config Cloudflare Edge Platform for Nuxt",
5
5
  "keywords": [
6
6
  "analytics-engine",