qarpeo 0.4.14 → 0.4.15
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/README.md +197 -197
- package/dist/chunks/tools.mjs +1 -1
- package/dist/module.mjs +271 -141
- package/dist/runtime/app/composables/store.d.ts +19 -4
- package/dist/runtime/app/composables/store.mjs +63 -5
- package/dist/runtime/server/routes/store/products/index.get.mjs +2 -0
- package/dist/runtime/server/utils/store/vendor.d.ts +11 -1
- package/dist/runtime/server/utils/store/vendor.mjs +47 -0
- package/dist/runtime/types/store.d.ts +7 -0
- package/dist/types/store-options.d.ts +21 -0
- package/dist/utils/overridable-routes.d.ts +12 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,197 +1,197 @@
|
|
|
1
|
-
# Qarpeo
|
|
2
|
-
|
|
3
|
-
> The Zero-Config Edge Platform for Nuxt & Cloudflare.
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/qarpeo)
|
|
6
|
-
[](https://opensource.org/licenses/MIT)
|
|
7
|
-
|
|
8
|
-
**Qarpeo** bridges Nuxt and Cloudflare Workers into a seamless, high-velocity developer experience. One package, zero manual `wrangler.json` configuration, type-safe auto-imports, global edge persistence across all 12 Cloudflare primitives, and full-stack composable Apps.
|
|
9
|
-
|
|
10
|
-
Documentation: [https://qarpeo.com](https://qarpeo.com)
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## Capabilities & Apps
|
|
15
|
-
|
|
16
|
-
### ⚡ Edge Primitives
|
|
17
|
-
|
|
18
|
-
- **Database (D1)**: Native Cloudflare D1 with automatic Drizzle ORM schemas, migrations, and seed scripts.
|
|
19
|
-
- **Key-Value (KV)**: Ultra-fast edge key-value storage with typed `kv` auto-imports.
|
|
20
|
-
- **Blob Storage (R2)**: S3-compatible asset and file storage with multipart and resumable uploads.
|
|
21
|
-
- **Edge AI & Vector Search**: Workers AI LLM streaming (`ai`), Vectorize vector embeddings, and RAG pipelines.
|
|
22
|
-
- **Queues & Background Tasks**: Cloudflare Queues with typed producer and `defineQueueHandler` consumers.
|
|
23
|
-
- **Browser Rendering**: Headless Chromium automation, screenshots, and PDF generation via Cloudflare Browser Rendering.
|
|
24
|
-
- **Realtime**: WebSockets, room broadcast, and presence powered by Cloudflare Durable Objects.
|
|
25
|
-
- **Telemetry & Rate Limiting**: Privacy-first Analytics Engine and edge rate limiting with zero external Redis.
|
|
26
|
-
- **Hyperdrive**: Pooled connections and query acceleration to external PostgreSQL and MySQL databases.
|
|
27
|
-
|
|
28
|
-
### 🧩 Full-Stack Composable Apps & Layers
|
|
29
|
-
|
|
30
|
-
- **CMS App**: Flagship edge content management system featuring collections, entries, version revisions, categories, tags, bookmarks, newsletter subscribers, RSS/Atom feeds, dynamic sitemaps, and full-text search.
|
|
31
|
-
- **Comments System**: Threaded discussions with materialized path hierarchy, reactions, reporting, adult website/link blocker, duplicate flood detection, batch moderation API, and the turnkey `<QComments />` Vue component.
|
|
32
|
-
- **Auth**: Edge authentication powered by Better Auth and D1, featuring WebAuthn passkeys, enterprise SSO (SAML & OIDC), 2FA/TOTP, magic links, organizations, and user impersonation.
|
|
33
|
-
- **Payments**: Edge payment workflows with Stripe and Lemon Squeezy checkouts, customer portals, and verified webhooks.
|
|
34
|
-
- **Notifications**: Multi-channel alerts featuring in-app feeds, browser Web Push (VAPID via Web Crypto), and transactional emails.
|
|
35
|
-
- **Multi-Tenancy**: Automated tenant subdomains, custom domains via Cloudflare for SaaS, and automated SSL provisioning.
|
|
36
|
-
- **DevTools**: Integrated management console to monitor D1 tables, R2 blobs, realtime rooms, security bans, and AI agents.
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
## Quick Start
|
|
41
|
-
|
|
42
|
-
### 1. Install
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
vp add qarpeo
|
|
46
|
-
# or
|
|
47
|
-
pnpm add qarpeo
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### 2. Configure
|
|
51
|
-
|
|
52
|
-
Enable the edge primitives and apps you need in `nuxt.config.ts`:
|
|
53
|
-
|
|
54
|
-
```ts [nuxt.config.ts]
|
|
55
|
-
export default defineNuxtConfig({
|
|
56
|
-
modules: ["qarpeo"],
|
|
57
|
-
|
|
58
|
-
qarpeo: {
|
|
59
|
-
// Edge Primitives
|
|
60
|
-
db: true,
|
|
61
|
-
blob: true,
|
|
62
|
-
kv: true,
|
|
63
|
-
ai: true,
|
|
64
|
-
realtime: true,
|
|
65
|
-
|
|
66
|
-
// Apps & Capability Layers
|
|
67
|
-
auth: true,
|
|
68
|
-
cms: true,
|
|
69
|
-
comments: {
|
|
70
|
-
moderation: {
|
|
71
|
-
blockAdultContent: true, // Blocks adult domains & TLDs with zero perf overhead
|
|
72
|
-
maxLinks: 2, // Max links allowed per comment
|
|
73
|
-
action: "reject", // "reject" (HTTP 400) or "quarantine" (flags as spam)
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
payments: true,
|
|
77
|
-
notifications: true,
|
|
78
|
-
|
|
79
|
-
// Database Customization (Strict Two-Tier Standard)
|
|
80
|
-
tablePrefix: "app_", // Or per-table overrides: tables: { user: "custom_users" }
|
|
81
|
-
},
|
|
82
|
-
})
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## Usage Examples
|
|
88
|
-
|
|
89
|
-
### 1. Turnkey Threaded Comments (`<QComments />`)
|
|
90
|
-
|
|
91
|
-
Drop threaded comments with reactions, replies, and moderation into any Vue page:
|
|
92
|
-
|
|
93
|
-
```vue [pages/posts/[slug].vue]
|
|
94
|
-
<script setup>
|
|
95
|
-
const route = useRoute()
|
|
96
|
-
</script>
|
|
97
|
-
|
|
98
|
-
<template>
|
|
99
|
-
<article>
|
|
100
|
-
<h1>My Post</h1>
|
|
101
|
-
|
|
102
|
-
<!-- Drop-in turnkey comments -->
|
|
103
|
-
<QComments :target-urn="`urn:cms:blog:${route.params.slug}`" />
|
|
104
|
-
</article>
|
|
105
|
-
</template>
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### 2. Server Event Handlers
|
|
109
|
-
|
|
110
|
-
All Cloudflare bindings and high-level clients are auto-imported and typed:
|
|
111
|
-
|
|
112
|
-
```ts [server/api/example.get.ts]
|
|
113
|
-
export default defineEventHandler(async (event) => {
|
|
114
|
-
// Cloudflare KV
|
|
115
|
-
await kv.set("greeting", "Hello from the edge!")
|
|
116
|
-
|
|
117
|
-
// Cloudflare D1 with dynamic table names
|
|
118
|
-
const users = await db.select().from(schema.users)
|
|
119
|
-
|
|
120
|
-
// Cloudflare Workers AI
|
|
121
|
-
const summary = await ai.run("@cf/meta/llama-3.1-8b-instruct", {
|
|
122
|
-
prompt: "Summarize edge computing in 5 words",
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
return { greeting: await kv.get("greeting"), users, summary }
|
|
126
|
-
})
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
### 3. Server Comments API
|
|
130
|
-
|
|
131
|
-
Manage comments programmatically from server routes:
|
|
132
|
-
|
|
133
|
-
```ts [server/api/moderate.post.ts]
|
|
134
|
-
import { batchModerateComments, queryComments } from "qarpeo/comments"
|
|
135
|
-
|
|
136
|
-
export default defineEventHandler(async (event) => {
|
|
137
|
-
// Batch approve, mark as spam, or delete up to 100 comments
|
|
138
|
-
const result = await batchModerateComments(
|
|
139
|
-
{
|
|
140
|
-
ids: ["cm_1", "cm_2"],
|
|
141
|
-
action: "approve",
|
|
142
|
-
},
|
|
143
|
-
event,
|
|
144
|
-
)
|
|
145
|
-
|
|
146
|
-
return result
|
|
147
|
-
})
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
---
|
|
151
|
-
|
|
152
|
-
## Database Customization Standard
|
|
153
|
-
|
|
154
|
-
Qarpeo follows a strict two-tier database naming architecture:
|
|
155
|
-
|
|
156
|
-
1. **Global Table Prefix**: Set `tablePrefix: "myprefix_"` to namespace all tables.
|
|
157
|
-
2. **Granular Overrides**: Override any individual table name via `tables`:
|
|
158
|
-
|
|
159
|
-
```ts [nuxt.config.ts]
|
|
160
|
-
export default defineNuxtConfig({
|
|
161
|
-
modules: ["qarpeo"],
|
|
162
|
-
qarpeo: {
|
|
163
|
-
db: true,
|
|
164
|
-
tablePrefix: "myco_",
|
|
165
|
-
tables: {
|
|
166
|
-
user: "accounts",
|
|
167
|
-
comment: "discussion_posts",
|
|
168
|
-
cmsEntry: "articles",
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
})
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
---
|
|
175
|
-
|
|
176
|
-
## CLI Tools (`qp` / `qarpeo`)
|
|
177
|
-
|
|
178
|
-
Qarpeo includes an integrated CLI for health diagnostics, database migrations, secrets, and deployment:
|
|
179
|
-
|
|
180
|
-
```bash
|
|
181
|
-
# Validate Cloudflare bindings, migrations, and secrets
|
|
182
|
-
vpx qp doctor
|
|
183
|
-
|
|
184
|
-
# Validate against production/remote deployment criteria
|
|
185
|
-
vpx qp doctor --remote
|
|
186
|
-
|
|
187
|
-
# Database migrations and seed
|
|
188
|
-
vpx qp db list
|
|
189
|
-
vpx qp db push
|
|
190
|
-
vpx qp db seed
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
---
|
|
194
|
-
|
|
195
|
-
## License
|
|
196
|
-
|
|
197
|
-
[MIT](./LICENSE)
|
|
1
|
+
# Qarpeo
|
|
2
|
+
|
|
3
|
+
> The Zero-Config Edge Platform for Nuxt & Cloudflare.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/qarpeo)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
**Qarpeo** bridges Nuxt and Cloudflare Workers into a seamless, high-velocity developer experience. One package, zero manual `wrangler.json` configuration, type-safe auto-imports, global edge persistence across all 12 Cloudflare primitives, and full-stack composable Apps.
|
|
9
|
+
|
|
10
|
+
Documentation: [https://qarpeo.com](https://qarpeo.com)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Capabilities & Apps
|
|
15
|
+
|
|
16
|
+
### ⚡ Edge Primitives
|
|
17
|
+
|
|
18
|
+
- **Database (D1)**: Native Cloudflare D1 with automatic Drizzle ORM schemas, migrations, and seed scripts.
|
|
19
|
+
- **Key-Value (KV)**: Ultra-fast edge key-value storage with typed `kv` auto-imports.
|
|
20
|
+
- **Blob Storage (R2)**: S3-compatible asset and file storage with multipart and resumable uploads.
|
|
21
|
+
- **Edge AI & Vector Search**: Workers AI LLM streaming (`ai`), Vectorize vector embeddings, and RAG pipelines.
|
|
22
|
+
- **Queues & Background Tasks**: Cloudflare Queues with typed producer and `defineQueueHandler` consumers.
|
|
23
|
+
- **Browser Rendering**: Headless Chromium automation, screenshots, and PDF generation via Cloudflare Browser Rendering.
|
|
24
|
+
- **Realtime**: WebSockets, room broadcast, and presence powered by Cloudflare Durable Objects.
|
|
25
|
+
- **Telemetry & Rate Limiting**: Privacy-first Analytics Engine and edge rate limiting with zero external Redis.
|
|
26
|
+
- **Hyperdrive**: Pooled connections and query acceleration to external PostgreSQL and MySQL databases.
|
|
27
|
+
|
|
28
|
+
### 🧩 Full-Stack Composable Apps & Layers
|
|
29
|
+
|
|
30
|
+
- **CMS App**: Flagship edge content management system featuring collections, entries, version revisions, categories, tags, bookmarks, newsletter subscribers, RSS/Atom feeds, dynamic sitemaps, and full-text search.
|
|
31
|
+
- **Comments System**: Threaded discussions with materialized path hierarchy, reactions, reporting, adult website/link blocker, duplicate flood detection, batch moderation API, and the turnkey `<QComments />` Vue component.
|
|
32
|
+
- **Auth**: Edge authentication powered by Better Auth and D1, featuring WebAuthn passkeys, enterprise SSO (SAML & OIDC), 2FA/TOTP, magic links, organizations, and user impersonation.
|
|
33
|
+
- **Payments**: Edge payment workflows with Stripe and Lemon Squeezy checkouts, customer portals, and verified webhooks.
|
|
34
|
+
- **Notifications**: Multi-channel alerts featuring in-app feeds, browser Web Push (VAPID via Web Crypto), and transactional emails.
|
|
35
|
+
- **Multi-Tenancy**: Automated tenant subdomains, custom domains via Cloudflare for SaaS, and automated SSL provisioning.
|
|
36
|
+
- **DevTools**: Integrated management console to monitor D1 tables, R2 blobs, realtime rooms, security bans, and AI agents.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Quick Start
|
|
41
|
+
|
|
42
|
+
### 1. Install
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
vp add qarpeo
|
|
46
|
+
# or
|
|
47
|
+
pnpm add qarpeo
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 2. Configure
|
|
51
|
+
|
|
52
|
+
Enable the edge primitives and apps you need in `nuxt.config.ts`:
|
|
53
|
+
|
|
54
|
+
```ts [nuxt.config.ts]
|
|
55
|
+
export default defineNuxtConfig({
|
|
56
|
+
modules: ["qarpeo"],
|
|
57
|
+
|
|
58
|
+
qarpeo: {
|
|
59
|
+
// Edge Primitives
|
|
60
|
+
db: true,
|
|
61
|
+
blob: true,
|
|
62
|
+
kv: true,
|
|
63
|
+
ai: true,
|
|
64
|
+
realtime: true,
|
|
65
|
+
|
|
66
|
+
// Apps & Capability Layers
|
|
67
|
+
auth: true,
|
|
68
|
+
cms: true,
|
|
69
|
+
comments: {
|
|
70
|
+
moderation: {
|
|
71
|
+
blockAdultContent: true, // Blocks adult domains & TLDs with zero perf overhead
|
|
72
|
+
maxLinks: 2, // Max links allowed per comment
|
|
73
|
+
action: "reject", // "reject" (HTTP 400) or "quarantine" (flags as spam)
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
payments: true,
|
|
77
|
+
notifications: true,
|
|
78
|
+
|
|
79
|
+
// Database Customization (Strict Two-Tier Standard)
|
|
80
|
+
tablePrefix: "app_", // Or per-table overrides: tables: { user: "custom_users" }
|
|
81
|
+
},
|
|
82
|
+
})
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Usage Examples
|
|
88
|
+
|
|
89
|
+
### 1. Turnkey Threaded Comments (`<QComments />`)
|
|
90
|
+
|
|
91
|
+
Drop threaded comments with reactions, replies, and moderation into any Vue page:
|
|
92
|
+
|
|
93
|
+
```vue [pages/posts/[slug].vue]
|
|
94
|
+
<script setup>
|
|
95
|
+
const route = useRoute()
|
|
96
|
+
</script>
|
|
97
|
+
|
|
98
|
+
<template>
|
|
99
|
+
<article>
|
|
100
|
+
<h1>My Post</h1>
|
|
101
|
+
|
|
102
|
+
<!-- Drop-in turnkey comments -->
|
|
103
|
+
<QComments :target-urn="`urn:cms:blog:${route.params.slug}`" />
|
|
104
|
+
</article>
|
|
105
|
+
</template>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 2. Server Event Handlers
|
|
109
|
+
|
|
110
|
+
All Cloudflare bindings and high-level clients are auto-imported and typed:
|
|
111
|
+
|
|
112
|
+
```ts [server/api/example.get.ts]
|
|
113
|
+
export default defineEventHandler(async (event) => {
|
|
114
|
+
// Cloudflare KV
|
|
115
|
+
await kv.set("greeting", "Hello from the edge!")
|
|
116
|
+
|
|
117
|
+
// Cloudflare D1 with dynamic table names
|
|
118
|
+
const users = await db.select().from(schema.users)
|
|
119
|
+
|
|
120
|
+
// Cloudflare Workers AI
|
|
121
|
+
const summary = await ai.run("@cf/meta/llama-3.1-8b-instruct", {
|
|
122
|
+
prompt: "Summarize edge computing in 5 words",
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
return { greeting: await kv.get("greeting"), users, summary }
|
|
126
|
+
})
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 3. Server Comments API
|
|
130
|
+
|
|
131
|
+
Manage comments programmatically from server routes:
|
|
132
|
+
|
|
133
|
+
```ts [server/api/moderate.post.ts]
|
|
134
|
+
import { batchModerateComments, queryComments } from "qarpeo/comments"
|
|
135
|
+
|
|
136
|
+
export default defineEventHandler(async (event) => {
|
|
137
|
+
// Batch approve, mark as spam, or delete up to 100 comments
|
|
138
|
+
const result = await batchModerateComments(
|
|
139
|
+
{
|
|
140
|
+
ids: ["cm_1", "cm_2"],
|
|
141
|
+
action: "approve",
|
|
142
|
+
},
|
|
143
|
+
event,
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
return result
|
|
147
|
+
})
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Database Customization Standard
|
|
153
|
+
|
|
154
|
+
Qarpeo follows a strict two-tier database naming architecture:
|
|
155
|
+
|
|
156
|
+
1. **Global Table Prefix**: Set `tablePrefix: "myprefix_"` to namespace all tables.
|
|
157
|
+
2. **Granular Overrides**: Override any individual table name via `tables`:
|
|
158
|
+
|
|
159
|
+
```ts [nuxt.config.ts]
|
|
160
|
+
export default defineNuxtConfig({
|
|
161
|
+
modules: ["qarpeo"],
|
|
162
|
+
qarpeo: {
|
|
163
|
+
db: true,
|
|
164
|
+
tablePrefix: "myco_",
|
|
165
|
+
tables: {
|
|
166
|
+
user: "accounts",
|
|
167
|
+
comment: "discussion_posts",
|
|
168
|
+
cmsEntry: "articles",
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
})
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## CLI Tools (`qp` / `qarpeo`)
|
|
177
|
+
|
|
178
|
+
Qarpeo includes an integrated CLI for health diagnostics, database migrations, secrets, and deployment:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Validate Cloudflare bindings, migrations, and secrets
|
|
182
|
+
vpx qp doctor
|
|
183
|
+
|
|
184
|
+
# Validate against production/remote deployment criteria
|
|
185
|
+
vpx qp doctor --remote
|
|
186
|
+
|
|
187
|
+
# Database migrations and seed
|
|
188
|
+
vpx qp db list
|
|
189
|
+
vpx qp db push
|
|
190
|
+
vpx qp db seed
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## License
|
|
196
|
+
|
|
197
|
+
[MIT](./LICENSE)
|
package/dist/chunks/tools.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
9
9
|
import { mkdir, writeFile, readFile } from 'node:fs/promises';
|
|
10
10
|
import { defu } from 'defu';
|
|
11
11
|
|
|
12
|
-
const version = "0.4.
|
|
12
|
+
const version = "0.4.15";
|
|
13
13
|
|
|
14
14
|
function spawnBinSync(bin, args, options = {}) {
|
|
15
15
|
const isWindows = process.platform === "win32";
|