create-wervt 0.2.16 → 0.2.17

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-wervt",
3
- "version": "0.2.16",
3
+ "version": "0.2.17",
4
4
  "description": "Create a new wervt app: Nuxt 5, Postgres with Drizzle, live data with Electric.",
5
5
  "homepage": "https://wervt.app",
6
6
  "license": "MIT",
@@ -20,6 +20,8 @@ pnpm exec wervt logs <app> # last hour, oldest f
20
20
  pnpm exec wervt logs <app> 'level:error' --since 1d --json # every field, one JSON object per line
21
21
  pnpm exec wervt logs <app> 'status:>=500' --since 6h --limit 50 --json
22
22
  pnpm exec wervt logs <app> -f # follow while reproducing
23
+ pnpm exec wervt logs <app> --requests --since 1h # one line per request (requestId)
24
+ pnpm exec wervt queries <app> # saved queries; run one with --saved <name>
23
25
  ```
24
26
 
25
27
  The app name is the `name` in package.json. Prefer `--json` and a narrow query: the output goes into
@@ -27,18 +29,18 @@ your context, so ask for what you need (`--limit`, `--since`, filters) instead o
27
29
 
28
30
  ## Fields
29
31
 
30
- | Field | From | |
31
- | ---------------------------------------------- | ------- | ------------------------------------------------------------- |
32
- | `_time`, `_msg` | wervt | Time and the line (`GET /api/x 500` for requests) |
33
- | `level` | wervt | `error`, `warn`, `info`, `debug`. 4xx requests are `warn` |
34
- | `type` | wervt | `log`, `Boot`, `BootFailure`, `UncaughtException`, `Shutdown` |
35
- | `release` | wervt | Which deploy wrote it |
36
- | `execution_id` | wervt | One isolate's lifetime (boot to shutdown) |
37
- | `reason` | wervt | Shutdowns: `CPUTime`, `Memory` (killed) or idle ones |
38
- | `method`, `path`, `status` | evlog | The request |
39
- | `duration`, `requestId` | evlog | Timing and the id to correlate with |
40
- | `error.message`, `error.stack`, `error.status` | evlog | Why it failed |
41
- | anything else | the app | Set with `useLogger(event).set({...})`, e.g. `user.id` |
32
+ | Field | From | |
33
+ | ---------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
34
+ | `_time`, `_msg` | wervt | Time and the line (`GET /api/x 500` for requests) |
35
+ | `level` | wervt | `error`, `warn`, `info`, `debug`. 4xx requests are `warn` |
36
+ | `type` | wervt | `log`, `Boot`, `BootFailure`, `UncaughtException`, `Shutdown`, `Runtime` (the runtime couldn't hand a request to the app), `Alert`, `Task` |
37
+ | `release` | wervt | Which deploy wrote it |
38
+ | `execution_id` | wervt | One isolate's lifetime (boot to shutdown) |
39
+ | `reason` | wervt | Shutdowns: `CPUTime`, `Memory` (killed) or idle ones |
40
+ | `method`, `path`, `status` | evlog | The request |
41
+ | `duration`, `requestId` | evlog | Timing and the id to correlate with |
42
+ | `error.message`, `error.stack`, `error.status` | evlog | Why it failed |
43
+ | anything else | the app | Set with `useLogger(event).set({...})`, e.g. `user.id` |
42
44
 
43
45
  ## Queries (LogsQL)
44
46
 
@@ -61,7 +63,8 @@ https://docs.victoriametrics.com/victorialogs/logsql/
61
63
 
62
64
  1. Start broad and recent: `'level:error' --since 1d --json --limit 20`. Note `release` and
63
65
  `_time` of the first occurrence: did it start with a deploy (`pnpm exec wervt releases <app>`)?
64
- 2. Narrow to the failing route (`path:`), then to one request (`requestId:=`), and read
66
+ 2. Narrow to the failing route (`path:`). `--requests` lists requests with their error counts;
67
+ take one request (`requestId:=`) and read
65
68
  `error.stack`. Stack lines point into the built server, so map them back to the source by the
66
69
  function names and the route.
67
70
  3. `UncaughtException` or `Shutdown` with `reason` `CPUTime` / `Memory`: work outside a request's
@@ -186,6 +186,12 @@ version polling. For a banner in the app's own design, set `wervt: { updates: 'm
186
186
  auto-imported) give the signed-in wervt user or nothing. Private apps always have one; public
187
187
  apps only when the visitor signed in. It works with `ssr: false` too (no own `/api/me` needed). Link to `wervtLoginUrl(path)` / `wervtLogoutUrl(path)` as
188
188
  external links. Never build your own login or OAuth.
189
+ - Users are one row per wervt account: key them by `user.id`, not by email (addresses change).
190
+ When an admin merges two accounts of the same person, wervt runs the task
191
+ `wervt:account-merged` (`server/tasks/wervt/account-merged.ts`) with
192
+ `{ from: { id, email }, into: { id, email } }` (type `AccountMergedPayload`). Apps with their
193
+ own users table define it and move `from`'s rows to `into`, merging where both have one (e.g.
194
+ membership in the same room). Make it idempotent: it can be run again by hand.
189
195
  - `user.role` is what they are to the app: `owner`, `member`, `admin` (wervt), `invited`,
190
196
  `allowed` or `public`. Guard the app's admin features with
191
197
  `requireWervtRole(event, 'owner', 'member', 'admin')` from `@wervt/nuxt/server`; don't keep
@@ -10,7 +10,7 @@
10
10
  "postinstall": "nuxt prepare"
11
11
  },
12
12
  "dependencies": {
13
- "@wervt/nuxt": "^0.3.4",
13
+ "@wervt/nuxt": "^0.3.7",
14
14
  "drizzle-orm": "1.0.0-rc.5",
15
15
  "nuxt": "npm:nuxt-nightly@5x",
16
16
  "valibot": "^1.5.0",
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "devDependencies": {
20
20
  "@golar/vue": "^0.1.11",
21
- "@wervt/cli": "^0.2.16",
21
+ "@wervt/cli": "^0.2.17",
22
22
  "drizzle-kit": "1.0.0-rc.5",
23
23
  "golar": "^0.1.11",
24
24
  "vite-plus": "^1.3.0"