qarpeo 0.1.8 → 0.1.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.
@@ -1,8 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, nextTick, onMounted, onUnmounted, ref } from "vue"
3
3
 
4
- definePageMeta({ layout: false })
5
-
6
4
  interface LogEntry {
7
5
  id: string
8
6
  timestamp: string
@@ -1,9 +1,8 @@
1
1
  <script setup lang="ts">
2
+ import { useRoute, useFetch, navigateTo } from "nuxt/app"
2
3
  import type { NavigationMenuItem } from "@nuxt/ui"
3
4
  import { computed, onMounted, onUnmounted, ref } from "vue"
4
5
 
5
- definePageMeta({ layout: false })
6
-
7
6
  const route = useRoute()
8
7
 
9
8
  const {
@@ -1,8 +1,7 @@
1
1
  <script setup lang="ts">
2
+ import { useRoute, useFetch } from "nuxt/app"
2
3
  import { computed, onMounted, ref } from "vue"
3
4
 
4
- definePageMeta({ layout: false })
5
-
6
5
  const {
7
6
  data: overviewData,
8
7
  status: overviewStatus,
@@ -120,11 +119,11 @@ const primitives = computed(() => [
120
119
  },
121
120
  {
122
121
  id: "cms",
123
- name: "CMS",
122
+ name: "Headless CMS Engine",
124
123
  icon: "i-lucide-file-text",
125
- desc: "Git-backed content management",
124
+ desc: "D1 database content engine & queryCollection()",
126
125
  bindingKey: null,
127
- to: "/cms",
126
+ to: null,
128
127
  },
129
128
  ])
130
129
 
@@ -210,9 +209,9 @@ onMounted(async () => {
210
209
  <UCard>
211
210
  <div class="text-xs text-muted">Core Module Version</div>
212
211
  <div class="text-base font-bold mt-1 font-mono text-primary">
213
- v{{ overview?.version || "0.0.1" }}
212
+ v{{ overview?.version || "0.1.10" }}
214
213
  </div>
215
- <div class="text-[11px] text-muted mt-0.5">Compatibility: 2025-02-01</div>
214
+ <div class="text-[11px] text-muted mt-0.5">Compatibility: {{ overview?.compatibilityDate || "2026-11-06" }}</div>
216
215
  </UCard>
217
216
 
218
217
  <UCard>
@@ -1,8 +1,7 @@
1
1
  <script setup lang="ts">
2
+ import { useFetch } from "nuxt/app"
2
3
  import { computed, onMounted, ref } from "vue"
3
4
 
4
- definePageMeta({ layout: false })
5
-
6
5
  const {
7
6
  data: settingsData,
8
7
  status: settingsStatus,
@@ -1,8 +1,7 @@
1
1
  <script setup lang="ts">
2
+ import { useRoute, useFetch } from "nuxt/app"
2
3
  import { computed } from "vue"
3
4
 
4
- definePageMeta({ layout: false })
5
-
6
5
  const route = useRoute()
7
6
 
8
7
  const { data: settingsData } = useFetch<any>("/_qarpeo/api/settings", {
@@ -147,15 +146,6 @@ const navMenuItems = computed(() =>
147
146
  >Alt + Q</span
148
147
  >
149
148
  </div>
150
- <UButton
151
- to="/cms"
152
- label="Open CMS"
153
- icon="i-lucide-file-text"
154
- size="xs"
155
- color="neutral"
156
- variant="outline"
157
- class="w-full justify-center text-xs"
158
- />
159
149
  </div>
160
150
  </template>
161
151
  </UDashboardSidebar>
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Qarpeo keyboard shortcuts plugin. Alt+Q -> Open /_qarpeo/devtools (Qarpeo DevTools) Alt+C ->
3
- * Navigate to /cms (CMS)
2
+ * Qarpeo keyboard shortcuts plugin.
3
+ * Alt+Q -> Open /_qarpeo/devtools (Qarpeo DevTools)
4
4
  */
5
5
  declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
6
6
  export default _default;
@@ -1,7 +1,6 @@
1
- import { defineNuxtPlugin, useRouter } from "nuxt/app";
1
+ import { defineNuxtPlugin } from "nuxt/app";
2
2
  export default defineNuxtPlugin(() => {
3
3
  if (import.meta.server) return;
4
- const router = useRouter();
5
4
  window.addEventListener("keydown", (e) => {
6
5
  const target = e.target;
7
6
  if (target && (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.tagName === "SELECT" || target.isContentEditable)) {
@@ -11,9 +10,5 @@ export default defineNuxtPlugin(() => {
11
10
  e.preventDefault();
12
11
  window.open("/_qarpeo/devtools", "_blank");
13
12
  }
14
- if (e.altKey && !e.ctrlKey && !e.metaKey && (e.key === "c" || e.key === "C")) {
15
- e.preventDefault();
16
- router.push("/cms");
17
- }
18
13
  });
19
14
  });
@@ -19,7 +19,7 @@ export default function(nitroApp) {
19
19
  level = "warn";
20
20
  }
21
21
  let source = "nitro:http";
22
- if (url.startsWith("/api/cms") || url.startsWith("/cms")) {
22
+ if (url.startsWith("/api/cms")) {
23
23
  source = "qarpeo:cms";
24
24
  } else if (url.startsWith("/api/auth") || url.startsWith("/auth")) {
25
25
  source = "qarpeo:auth";
@@ -4,7 +4,8 @@
4
4
  */
5
5
  declare const _default: import("nuxt/server").EventHandler<{
6
6
  environment: string;
7
- version: string;
7
+ version: any;
8
+ compatibilityDate: any;
8
9
  engine: string;
9
10
  modules: {
10
11
  db: boolean;
@@ -10,7 +10,8 @@ export default defineEventHandler((event) => {
10
10
  const isDev = process.env.NODE_ENV !== "production";
11
11
  return {
12
12
  environment: isDev ? "development" : "production",
13
- version: "0.0.1",
13
+ version: qarpeoConfig.version || "0.1.10",
14
+ compatibilityDate: qarpeoConfig.compatibilityDate || "2026-11-06",
14
15
  engine: "Nuxt 5 + Cloudflare Edge",
15
16
  modules: {
16
17
  db: Boolean(qarpeoConfig.db?.enabled ?? true),
@@ -4,7 +4,8 @@
4
4
  */
5
5
  declare const _default: import("nuxt/server").EventHandler<Promise<{
6
6
  system: {
7
- version: string;
7
+ version: any;
8
+ compatibilityDate: any;
8
9
  name: string;
9
10
  engine: string;
10
11
  environment: string;
@@ -23,7 +23,8 @@ export default defineEventHandler(async (event) => {
23
23
  }
24
24
  return {
25
25
  system: {
26
- version: "0.0.1",
26
+ version: qarpeoConfig.version || "0.1.10",
27
+ compatibilityDate: qarpeoConfig.compatibilityDate || "2026-11-06",
27
28
  name: "Qarpeo Edge Framework",
28
29
  engine: "Nuxt 5 + Nitro + Cloudflare Workers",
29
30
  environment: isDev ? "development" : "production",
@@ -285,3 +285,25 @@ export declare function rebuildCMSFTS(event?: any): Promise<{
285
285
  * and extracts highlighted context excerpts.
286
286
  */
287
287
  export declare function searchDocs(event: any, options?: DocsSearchOptions): Promise<DocsSearchResponse>;
288
+ /**
289
+ * Server-side chainable query builder for CMS collections.
290
+ * Queries directly against D1 / SQLite with KV caching, with zero HTTP fetch overhead.
291
+ *
292
+ * Usage:
293
+ * const page = await queryCollection(event, "docs").path("/docs/intro").first()
294
+ * const posts = await queryCollection(event, "blog").order("published_at", "DESC").limit(10).all()
295
+ */
296
+ export declare function queryCollection(event: any, collection: string): {
297
+ locale(loc: string): /*elided*/ any;
298
+ path(p: string): /*elided*/ any;
299
+ limit(n: number): /*elided*/ any;
300
+ page(n: number): /*elided*/ any;
301
+ order(field: string, direction?: "ASC" | "DESC"): /*elided*/ any;
302
+ where(field: string, value: any): /*elided*/ any;
303
+ status(s: "all" | CMSEntryStatus): /*elided*/ any;
304
+ tag(t: string): /*elided*/ any;
305
+ preview(enabled?: boolean): /*elided*/ any;
306
+ first(): Promise<CMSEntry | null>;
307
+ all(): Promise<CMSEntry[]>;
308
+ count(): Promise<number>;
309
+ };
@@ -150,8 +150,7 @@ export function getCMSConfig(event) {
150
150
  const rc = useRuntimeConfig(event);
151
151
  const cfg = rc?.qarpeo?.cms || {};
152
152
  return {
153
- admin: cfg.admin !== false,
154
- path: cfg.path || "/cms",
153
+ api: cfg.api === true,
155
154
  apiPath: cfg.apiPath || "/api/cms",
156
155
  contentDir: cfg.contentDir || "content",
157
156
  hybrid: cfg.hybrid !== false,
@@ -3626,3 +3625,94 @@ export async function searchDocs(event, options = {}) {
3626
3625
  mode: modeUsed
3627
3626
  };
3628
3627
  }
3628
+ export function queryCollection(event, collection) {
3629
+ let _path = null;
3630
+ let _locale = null;
3631
+ let _limit = null;
3632
+ let _page = 1;
3633
+ let _sort = null;
3634
+ let _tag = null;
3635
+ let _status = "published";
3636
+ let _preview = false;
3637
+ const _wheres = {};
3638
+ const builder = {
3639
+ locale(loc) {
3640
+ _locale = loc;
3641
+ return builder;
3642
+ },
3643
+ path(p) {
3644
+ _path = p;
3645
+ return builder;
3646
+ },
3647
+ limit(n) {
3648
+ _limit = n;
3649
+ return builder;
3650
+ },
3651
+ page(n) {
3652
+ _page = n;
3653
+ return builder;
3654
+ },
3655
+ order(field, direction = "ASC") {
3656
+ _sort = `${field}:${direction.toLowerCase()}`;
3657
+ return builder;
3658
+ },
3659
+ where(field, value) {
3660
+ _wheres[field] = value;
3661
+ return builder;
3662
+ },
3663
+ status(s) {
3664
+ _status = s;
3665
+ return builder;
3666
+ },
3667
+ tag(t) {
3668
+ _tag = t;
3669
+ return builder;
3670
+ },
3671
+ preview(enabled = true) {
3672
+ _preview = enabled;
3673
+ if (enabled) _status = "all";
3674
+ return builder;
3675
+ },
3676
+ async first() {
3677
+ if (_path) {
3678
+ return await getCMSEntryByPath(event, collection, _path, _locale || void 0, {
3679
+ preview: _preview
3680
+ });
3681
+ }
3682
+ const res = await queryCMSEntries(event, collection, {
3683
+ limit: 1,
3684
+ page: _page,
3685
+ sort: _sort || void 0,
3686
+ status: _status,
3687
+ tag: _tag || void 0,
3688
+ preview: _preview,
3689
+ where: Object.keys(_wheres).length ? _wheres : void 0
3690
+ });
3691
+ return res.entries[0] || null;
3692
+ },
3693
+ async all() {
3694
+ const res = await queryCMSEntries(event, collection, {
3695
+ limit: _limit || 100,
3696
+ page: _page,
3697
+ sort: _sort || void 0,
3698
+ status: _status,
3699
+ tag: _tag || void 0,
3700
+ preview: _preview,
3701
+ where: Object.keys(_wheres).length ? _wheres : void 0
3702
+ });
3703
+ return res.entries;
3704
+ },
3705
+ async count() {
3706
+ const res = await queryCMSEntries(event, collection, {
3707
+ limit: 1,
3708
+ page: 1,
3709
+ status: _status,
3710
+ tag: _tag || void 0,
3711
+ preview: _preview,
3712
+ where: Object.keys(_wheres).length ? _wheres : void 0
3713
+ });
3714
+ return res.total;
3715
+ }
3716
+ };
3717
+ return builder;
3718
+ }
package/dist/types.d.ts CHANGED
@@ -1655,22 +1655,17 @@ export interface CMSRevisionsConfig {
1655
1655
  }
1656
1656
  export interface CMSOptions {
1657
1657
  /**
1658
- * Mount the embedded edge CMS Admin.
1658
+ * Expose built-in REST API endpoints for the CMS at `apiPath` (e.g. `/api/cms/*`).
1659
+ * When `false` (default), the CMS is purely headless and operated via server utilities.
1659
1660
  *
1660
- * @default true
1661
- */
1662
- admin?: boolean;
1663
- /**
1664
- * Base route path for the CMS Admin.
1665
- *
1666
- * @default "/cms"
1661
+ * @default false
1667
1662
  */
1668
- path?: string;
1663
+ api?: boolean;
1669
1664
  /**
1670
- * Base route path for public CMS API endpoints.
1671
- *
1672
- * @default "/api/cms"
1673
- */
1665
+ * Base route path for public CMS API endpoints.
1666
+ *
1667
+ * @default "/api/cms"
1668
+ */
1674
1669
  apiPath?: string;
1675
1670
  /**
1676
1671
  * Root directory in project for file-based markdown/MDX content.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qarpeo",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "Zero-config Cloudflare Edge Platform for Nuxt",
5
5
  "keywords": [
6
6
  "analytics-engine",