qarpeo 0.3.4 → 0.4.0

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.
Files changed (105) hide show
  1. package/dist/chunks/{tools.mjs → manifest.get.mjs} +229 -3
  2. package/dist/cli/index.mjs +74 -5
  3. package/dist/features/console.d.ts +4 -0
  4. package/dist/module.mjs +287 -56
  5. package/dist/runtime/app/components/{BlobImage.vue → QImg.vue} +5 -4
  6. package/dist/runtime/app/composables/console.d.ts +60 -0
  7. package/dist/runtime/app/composables/console.mjs +169 -0
  8. package/dist/runtime/app/composables/pwa.d.ts +34 -0
  9. package/dist/runtime/app/composables/pwa.mjs +86 -0
  10. package/dist/runtime/app/composables/rbac.d.ts +33 -0
  11. package/dist/runtime/app/composables/rbac.mjs +60 -0
  12. package/dist/runtime/app/composables/site.d.ts +73 -0
  13. package/dist/runtime/app/composables/site.mjs +174 -1
  14. package/dist/runtime/app/middleware/console.global.d.ts +2 -0
  15. package/dist/runtime/app/middleware/console.global.mjs +37 -0
  16. package/dist/runtime/app/plugins/pwa.client.d.ts +2 -0
  17. package/dist/runtime/app/plugins/pwa.client.mjs +28 -0
  18. package/dist/runtime/app/plugins/pwa.d.ts +2 -0
  19. package/dist/runtime/app/plugins/pwa.mjs +42 -0
  20. package/dist/runtime/app/plugins/seo.mjs +39 -10
  21. package/dist/runtime/drizzle.mjs +4 -2
  22. package/dist/runtime/server/routes/__qarpeo/cloud/agents/run.post.d.ts +13 -0
  23. package/dist/runtime/server/routes/__qarpeo/cloud/agents/run.post.mjs +46 -0
  24. package/dist/runtime/server/routes/__qarpeo/cloud/cms/entry.get.d.ts +22 -0
  25. package/dist/runtime/server/routes/__qarpeo/cloud/cms/entry.get.mjs +40 -0
  26. package/dist/runtime/server/routes/__qarpeo/cloud/cms/entry.post.d.ts +20 -0
  27. package/dist/runtime/server/routes/__qarpeo/cloud/cms/entry.post.mjs +52 -0
  28. package/dist/runtime/server/routes/__qarpeo/cloud/cms.get.d.ts +26 -0
  29. package/dist/runtime/server/routes/__qarpeo/cloud/cms.get.mjs +80 -0
  30. package/dist/runtime/server/routes/__qarpeo/cloud/comments/moderate.post.d.ts +16 -0
  31. package/dist/runtime/server/routes/__qarpeo/cloud/comments/moderate.post.mjs +30 -0
  32. package/dist/runtime/server/routes/__qarpeo/cloud/comments.get.d.ts +21 -0
  33. package/dist/runtime/server/routes/__qarpeo/cloud/comments.get.mjs +49 -0
  34. package/dist/runtime/server/routes/__qarpeo/cloud/extras.get.d.ts +22 -0
  35. package/dist/runtime/server/routes/__qarpeo/cloud/extras.get.mjs +65 -0
  36. package/dist/runtime/server/routes/__qarpeo/cloud/mail/unsuppress.post.d.ts +12 -0
  37. package/dist/runtime/server/routes/__qarpeo/cloud/mail/unsuppress.post.mjs +17 -0
  38. package/dist/runtime/server/routes/__qarpeo/cloud/migrate/cms.post.d.ts +22 -0
  39. package/dist/runtime/server/routes/__qarpeo/cloud/migrate/cms.post.mjs +87 -0
  40. package/dist/runtime/server/routes/__qarpeo/cloud/migrate/products.post.d.ts +25 -0
  41. package/dist/runtime/server/routes/__qarpeo/cloud/migrate/products.post.mjs +119 -0
  42. package/dist/runtime/server/routes/__qarpeo/cloud/migrate/users.post.d.ts +19 -0
  43. package/dist/runtime/server/routes/__qarpeo/cloud/migrate/users.post.mjs +86 -0
  44. package/dist/runtime/server/routes/__qarpeo/cloud/migrate.post.d.ts +21 -0
  45. package/dist/runtime/server/routes/__qarpeo/cloud/migrate.post.mjs +91 -0
  46. package/dist/runtime/server/routes/__qarpeo/cloud/notifications/test.post.d.ts +13 -0
  47. package/dist/runtime/server/routes/__qarpeo/cloud/notifications/test.post.mjs +49 -0
  48. package/dist/runtime/server/routes/__qarpeo/cloud/operations.get.d.ts +43 -0
  49. package/dist/runtime/server/routes/__qarpeo/cloud/operations.get.mjs +111 -0
  50. package/dist/runtime/server/routes/__qarpeo/cloud/overview.get.d.ts +22 -0
  51. package/dist/runtime/server/routes/__qarpeo/cloud/overview.get.mjs +44 -0
  52. package/dist/runtime/server/routes/__qarpeo/cloud/store/order-status.post.d.ts +9 -0
  53. package/dist/runtime/server/routes/__qarpeo/cloud/store/order-status.post.mjs +27 -0
  54. package/dist/runtime/server/routes/__qarpeo/cloud/store/orders.get.d.ts +23 -0
  55. package/dist/runtime/server/routes/__qarpeo/cloud/store/orders.get.mjs +56 -0
  56. package/dist/runtime/server/routes/__qarpeo/cloud/store/products.get.d.ts +21 -0
  57. package/dist/runtime/server/routes/__qarpeo/cloud/store/products.get.mjs +50 -0
  58. package/dist/runtime/server/routes/__qarpeo/cloud/tasks/run.post.d.ts +12 -0
  59. package/dist/runtime/server/routes/__qarpeo/cloud/tasks/run.post.mjs +24 -0
  60. package/dist/runtime/server/routes/__qarpeo/cloud/users/action.post.d.ts +26 -0
  61. package/dist/runtime/server/routes/__qarpeo/cloud/users/action.post.mjs +40 -0
  62. package/dist/runtime/server/routes/__qarpeo/cloud/users.get.d.ts +39 -0
  63. package/dist/runtime/server/routes/__qarpeo/cloud/users.get.mjs +69 -0
  64. package/dist/runtime/server/routes/__qarpeo/manifest.get.d.ts +39 -0
  65. package/dist/runtime/server/routes/__qarpeo/manifest.get.mjs +226 -0
  66. package/dist/runtime/server/routes/__qarpeo/og.get.d.ts +15 -0
  67. package/dist/runtime/server/routes/__qarpeo/og.get.mjs +109 -0
  68. package/dist/runtime/server/routes/__qarpeo/rbac/me.get.d.ts +26 -0
  69. package/dist/runtime/server/routes/__qarpeo/rbac/me.get.mjs +23 -0
  70. package/dist/runtime/server/routes/__qarpeo/rbac/roles.delete.d.ts +12 -0
  71. package/dist/runtime/server/routes/__qarpeo/rbac/roles.delete.mjs +12 -0
  72. package/dist/runtime/server/routes/__qarpeo/rbac/roles.get.d.ts +16 -0
  73. package/dist/runtime/server/routes/__qarpeo/rbac/roles.get.mjs +15 -0
  74. package/dist/runtime/server/routes/__qarpeo/rbac/roles.post.d.ts +11 -0
  75. package/dist/runtime/server/routes/__qarpeo/rbac/roles.post.mjs +16 -0
  76. package/dist/runtime/server/routes/__qarpeo/rbac/users.post.d.ts +14 -0
  77. package/dist/runtime/server/routes/__qarpeo/rbac/users.post.mjs +19 -0
  78. package/dist/runtime/server/routes/manifest.webmanifest.get.d.ts +2 -0
  79. package/dist/runtime/server/routes/manifest.webmanifest.get.mjs +31 -0
  80. package/dist/runtime/server/routes/robots.txt.get.mjs +20 -4
  81. package/dist/runtime/server/routes/sitemap.xml.get.mjs +47 -6
  82. package/dist/runtime/server/routes/sw.js.get.d.ts +8 -0
  83. package/dist/runtime/server/routes/sw.js.get.mjs +141 -0
  84. package/dist/runtime/server/utils/auth.d.ts +2 -14
  85. package/dist/runtime/server/utils/auth.mjs +32 -36
  86. package/dist/runtime/server/utils/cloud-auth.d.ts +8 -0
  87. package/dist/runtime/server/utils/cloud-auth.mjs +23 -0
  88. package/dist/runtime/server/utils/console.d.ts +19 -0
  89. package/dist/runtime/server/utils/console.mjs +34 -0
  90. package/dist/runtime/server/utils/legacy-hash.d.ts +76 -0
  91. package/dist/runtime/server/utils/legacy-hash.mjs +96 -0
  92. package/dist/runtime/server/utils/rbac.d.ts +89 -0
  93. package/dist/runtime/server/utils/rbac.mjs +427 -0
  94. package/dist/runtime/server/utils/role-env.d.ts +19 -0
  95. package/dist/runtime/server/utils/role-env.mjs +34 -0
  96. package/dist/runtime/server.d.ts +2 -0
  97. package/dist/runtime/server.mjs +2 -0
  98. package/dist/types/console.d.ts +67 -0
  99. package/dist/types/index.d.ts +1 -0
  100. package/dist/types/options.d.ts +9 -0
  101. package/dist/types/site.d.ts +102 -0
  102. package/dist/types/storage.d.ts +5 -11
  103. package/package.json +1 -1
  104. package/dist/runtime/providers/qarpeo.d.ts +0 -23
  105. package/dist/runtime/providers/qarpeo.mjs +0 -46
@@ -7,6 +7,7 @@ import type { AuthOptions, EmailOptions } from "./auth";
7
7
  import type { CacheOptions } from "./cache";
8
8
  import type { CMSOptions } from "./cms";
9
9
  import type { CommentsOptions } from "./comments";
10
+ import type { ConsoleOptions } from "./console";
10
11
  import type { DbOptions } from "./db";
11
12
  import type { JobsOptions } from "./jobs";
12
13
  import type { MailOptions } from "./email";
@@ -74,6 +75,8 @@ export interface QarpeoOptions {
74
75
  site?: QarpeoSiteConfig;
75
76
  /** Native SEO engine configuration (alias for site config) */
76
77
  seo?: boolean | QarpeoSiteConfig;
78
+ /** Native Edge PWA configuration (manifest.webmanifest, /sw.js, and usePwa composable) */
79
+ pwa?: boolean | import("./site").QarpeoPwaConfig;
77
80
  /**
78
81
  * Cloudflare Worker service name override.
79
82
  *
@@ -320,6 +323,12 @@ export interface QarpeoOptions {
320
323
  * @default false
321
324
  */
322
325
  store?: boolean | StoreOptions;
326
+ /**
327
+ * Website-injected `/console` staff & operations workspace plumbing (RBAC guards, composables, and nav builder).
328
+ *
329
+ * @default false
330
+ */
331
+ console?: boolean | ConsoleOptions;
323
332
  /**
324
333
  * Configuration for Qarpeo DevTools (Dev-Only Management Console & DevTools panel).
325
334
  *
@@ -54,6 +54,71 @@ export interface DocsVersionItem {
54
54
  /** Whether this version is archived / deprecated */
55
55
  isArchived?: boolean;
56
56
  }
57
+ export interface PwaIconConfig {
58
+ /** Icon URL path (e.g. "/icons/icon-192.png") */
59
+ src: string;
60
+ /** Icon dimensions (e.g. "192x192", "512x512") */
61
+ sizes: string;
62
+ /** MIME type (e.g. "image/png", "image/svg+xml") */
63
+ type?: string;
64
+ /** Icon purpose ("any", "maskable", "monochrome") */
65
+ purpose?: "any" | "maskable" | "monochrome";
66
+ }
67
+ export interface PwaShortcutConfig {
68
+ name: string;
69
+ short_name?: string;
70
+ description?: string;
71
+ url: string;
72
+ icons?: PwaIconConfig[];
73
+ }
74
+ export interface QarpeoPwaConfig {
75
+ /** Enable or disable PWA manifest and service worker. Default: true when pwa object is provided */
76
+ enabled?: boolean;
77
+ /** Application name (defaults to site.name) */
78
+ name?: string;
79
+ /** Short name for home screen icon label (defaults to name) */
80
+ shortName?: string;
81
+ /** Application description (defaults to site.description) */
82
+ description?: string;
83
+ /** Start URL when launched from home screen. Default: "/" */
84
+ startUrl?: string;
85
+ /** Navigation scope. Default: "/" */
86
+ scope?: string;
87
+ /** Display mode. Default: "standalone" */
88
+ display?: "standalone" | "fullscreen" | "minimal-ui" | "browser";
89
+ /** Preferred screen orientation */
90
+ orientation?: "any" | "natural" | "landscape" | "portrait";
91
+ /** Theme color hex (used in manifest and <meta name="theme-color">). Default: "#0f172a" */
92
+ themeColor?: string;
93
+ /** Optional dark mode theme color (<meta name="theme-color" media="(prefers-color-scheme: dark)">) */
94
+ themeColorDark?: string;
95
+ /** Splash screen background color. Default: "#ffffff" */
96
+ backgroundColor?: string;
97
+ /** Language tag (defaults to site.defaultLocale || "en") */
98
+ lang?: string;
99
+ /** Text direction */
100
+ dir?: "ltr" | "rtl" | "auto";
101
+ /** Web App Manifest icons */
102
+ icons?: PwaIconConfig[];
103
+ /** Apple touch icon URL (defaults to first 180x180/192x192 icon if omitted) */
104
+ appleTouchIcon?: string;
105
+ /** App shortcuts */
106
+ shortcuts?: PwaShortcutConfig[];
107
+ /** App store categories */
108
+ categories?: string[];
109
+ /** Optional offline fallback HTML route (e.g. "/offline") */
110
+ offlinePage?: string;
111
+ /** Cache version identifier for Service Worker cache busting */
112
+ cacheVersion?: string;
113
+ /** URL prefixes cached with stale-while-revalidate (e.g. ["/api/cms/"]) */
114
+ cacheRoutes?: string[];
115
+ /** Additional URLs to precache on Service Worker install */
116
+ precacheUrls?: string[];
117
+ /** Auto-register /sw.js on client. Default: true */
118
+ register?: boolean;
119
+ /** Enable Web Push notification handlers in Service Worker. Default: false */
120
+ push?: boolean;
121
+ }
57
122
  export interface SiteRobotsConfig {
58
123
  /**
59
124
  * Allow search engines to index the site. When false, generates Disallow: / on robots.txt and
@@ -64,12 +129,25 @@ export interface SiteRobotsConfig {
64
129
  disallow?: string[];
65
130
  /** Paths to allow in robots.txt. Defaults to ["/"] */
66
131
  allow?: string[];
132
+ /** Block major AI training/scraping bots (GPTBot, CCBot, ClaudeBot, Google-Extended, etc.). Default: false */
133
+ blockAiBots?: boolean;
67
134
  }
68
135
  export interface SiteSitemapUrl {
69
136
  loc: string;
70
137
  lastmod?: string;
71
138
  changefreq?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never";
72
139
  priority?: number;
140
+ /** Alternate language URLs for xhtml:link hreflang */
141
+ alternates?: Array<{
142
+ hreflang: string;
143
+ href: string;
144
+ }>;
145
+ /** Images associated with this URL for Google Image Sitemap */
146
+ images?: Array<{
147
+ loc: string;
148
+ title?: string;
149
+ caption?: string;
150
+ }>;
73
151
  }
74
152
  export interface SiteSitemapConfig {
75
153
  /** Automatically generate /sitemap.xml. Defaults to true when site.url is provided. */
@@ -78,6 +156,10 @@ export interface SiteSitemapConfig {
78
156
  exclude?: string[];
79
157
  /** Include published CMS entries from D1 database. Defaults to true. */
80
158
  cms?: boolean;
159
+ /** Auto-discover static Nuxt pages at build time. Defaults to true. */
160
+ pages?: boolean;
161
+ /** Internal: static page paths discovered at build time */
162
+ discoveredPages?: string[];
81
163
  /** Additional custom URLs to include in sitemap */
82
164
  urls?: SiteSitemapUrl[];
83
165
  }
@@ -93,6 +175,18 @@ export interface SiteFeedConfig {
93
175
  /** Cache-Control max-age in seconds. Default: 3600. */
94
176
  cacheMaxAge?: number;
95
177
  }
178
+ export interface SiteOgImageConfig {
179
+ /** Enable dynamic /__qarpeo/og social card endpoint. Default: true when ogImage object is provided */
180
+ enabled?: boolean;
181
+ /** Visual theme for generated cards. Default: "dark" */
182
+ theme?: "dark" | "light" | "gradient";
183
+ /** Accent color hex. Default: "#3b82f6" */
184
+ themeColor?: string;
185
+ /** Optional logo URL rendered on the card */
186
+ logo?: string;
187
+ /** Cache-Control max-age in seconds. Default: 86400 (24h) */
188
+ cacheMaxAge?: number;
189
+ }
96
190
  export interface QarpeoSiteConfig {
97
191
  /** Project/site name (used for Cloudflare Worker name, SEO, emails, branding) */
98
192
  name?: string;
@@ -118,4 +212,12 @@ export interface QarpeoSiteConfig {
118
212
  feed?: boolean | SiteFeedConfig;
119
213
  /** Auto-inject WebSite JSON-LD schema on root page. Default: true */
120
214
  schemaOrg?: boolean;
215
+ /** Optional site search URL template for WebSite SearchAction JSON-LD (e.g. "/search?q={search_term_string}") */
216
+ searchUrl?: string;
217
+ /** Enforce or strip trailing slash in canonical URLs. Default: false (strip trailing slash) */
218
+ trailingSlash?: boolean;
219
+ /** Native Edge PWA configuration (manifest.webmanifest + Service Worker) */
220
+ pwa?: boolean | QarpeoPwaConfig;
221
+ /** Dynamic Edge OG Image generator (/__qarpeo/og) */
222
+ ogImage?: boolean | SiteOgImageConfig;
121
223
  }
@@ -92,23 +92,17 @@ export interface StorageOptions {
92
92
  presets?: Record<string, StorageImagePreset>;
93
93
  };
94
94
  /**
95
- * Automatically integrate `<BlobImage>` with Nuxt UI components (`<UAvatar>`, `<UCard>`, etc.) so
96
- * their `src` props resolve R2 storage keys without custom slots.
95
+ * Automatically integrate `<QImg>` with Nuxt UI components (`<UAvatar>`, `<UCard>`, etc.) so
96
+ * their `src` props resolve R2 storage keys without custom slots via `#build/ui-image-component`.
97
97
  *
98
- * - When `@nuxt/image` is installed, Qarpeo registers its built-in image provider and optionally
99
- * sets it as the default provider.
100
- * - When `@nuxt/image` is **not** installed, Qarpeo aliases Nuxt UI's internal image component to
101
- * `<BlobImage>` via `#build/ui-image-component`.
102
- *
103
- * Set to `false` to opt out of all automatic Nuxt UI / image integration.
98
+ * Set to `false` to opt out of automatic Nuxt UI image integration.
104
99
  *
105
100
  * @default true
106
101
  */
107
102
  ui?: boolean;
108
103
  /**
109
- * When `@nuxt/image` is **also** installed, alias Nuxt UI's image slot to `<BlobImage>` anyway
110
- * (via `components:extend`), so that the Qarpeo provider is always used even if another provider
111
- * is the global default.
104
+ * Force-alias Nuxt UI's image slot (`#build/ui-image-component`) to `<QImg>` even when no
105
+ * explicit `binding` or `cdnUrl` is configured.
112
106
  *
113
107
  * Ignored when `ui` is `false`.
114
108
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qarpeo",
3
- "version": "0.3.4",
3
+ "version": "0.4.0",
4
4
  "description": "Zero-config Cloudflare Edge Platform for Nuxt",
5
5
  "keywords": [
6
6
  "analytics-engine",
@@ -1,23 +0,0 @@
1
- export interface ProviderModifiers {
2
- width?: number | string;
3
- height?: number | string;
4
- quality?: number | string;
5
- format?: string;
6
- fit?: string;
7
- preset?: string;
8
- [key: string]: any;
9
- }
10
- /**
11
- * Official `@nuxt/image` provider for Qarpeo Cloudflare R2 Blob Storage.
12
- *
13
- * Automatically resolves R2 storage keys into Cloudflare Image Resizing CDN URLs (in production /
14
- * when cdnURL is set) or local Qarpeo storage API endpoints (in development), with no external
15
- * runtime dependencies.
16
- */
17
- export declare function getImage(src: string, { modifiers, baseURL, cdnURL, }?: {
18
- modifiers?: ProviderModifiers;
19
- baseURL?: string;
20
- cdnURL?: string;
21
- }): {
22
- url: string;
23
- };
@@ -1,46 +0,0 @@
1
- export function getImage(src, {
2
- modifiers = {},
3
- baseURL = "/api/storage/file",
4
- cdnURL
5
- } = {}) {
6
- if (!src) return { url: "" };
7
- if (src.startsWith("http://") || src.startsWith("https://") || src.startsWith("data:")) {
8
- return { url: src };
9
- }
10
- const cleanKey = src.replace(/^\/+/, "");
11
- let assetBase;
12
- if (cdnURL) {
13
- assetBase = `${cdnURL.replace(/\/+$/, "")}/${cleanKey}`;
14
- } else {
15
- const base = baseURL.replace(/\/+$/, "");
16
- assetBase = `${base}/${cleanKey}`;
17
- }
18
- const cfParts = [];
19
- if (modifiers.width) cfParts.push(`width=${modifiers.width}`);
20
- if (modifiers.height) cfParts.push(`height=${modifiers.height}`);
21
- if (modifiers.quality) cfParts.push(`quality=${modifiers.quality}`);
22
- if (modifiers.format) cfParts.push(`format=${modifiers.format}`);
23
- if (modifiers.fit) cfParts.push(`fit=${modifiers.fit}`);
24
- const useCloudflare = cfParts.length > 0 && (cdnURL || typeof process !== "undefined" && process.env?.NODE_ENV === "production" && !import.meta.dev);
25
- if (useCloudflare) {
26
- const cfParamStr = cfParts.join(",");
27
- try {
28
- const parsed = new URL(assetBase);
29
- return {
30
- url: `${parsed.origin}/cdn-cgi/image/${cfParamStr}${parsed.pathname}${parsed.search}`
31
- };
32
- } catch {
33
- const cleanPath = assetBase.startsWith("/") ? assetBase : `/${assetBase}`;
34
- return { url: `/cdn-cgi/image/${cfParamStr}${cleanPath}` };
35
- }
36
- }
37
- const qs = new URLSearchParams();
38
- if (modifiers.preset) qs.set("preset", String(modifiers.preset));
39
- if (modifiers.width) qs.set("w", String(modifiers.width));
40
- if (modifiers.height) qs.set("h", String(modifiers.height));
41
- if (modifiers.quality) qs.set("q", String(modifiers.quality));
42
- if (modifiers.format) qs.set("f", String(modifiers.format));
43
- if (modifiers.fit) qs.set("fit", String(modifiers.fit));
44
- const qsStr = qs.toString();
45
- return { url: qsStr ? `${assetBase}?${qsStr}` : assetBase };
46
- }