@wervt/nuxt 0.3.3 → 0.3.4

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 (122) hide show
  1. package/dist/dev.d.ts +1 -3
  2. package/dist/dev.js +33 -11
  3. package/dist/env-types.js +1 -2
  4. package/dist/icons.js +1 -2
  5. package/dist/loading.js +30 -0
  6. package/dist/module.d.ts +0 -2
  7. package/dist/module.js +3 -2
  8. package/dist/node_modules/.pnpm/nitro@3.0.260903-beta/node_modules/nitro/dist/runtime/internal/task.js +1 -2
  9. package/dist/og-image.js +1 -2
  10. package/dist/preview.d.ts +1 -3
  11. package/dist/preview.js +1 -2
  12. package/dist/provision.d.ts +12 -2
  13. package/dist/provision.js +35 -21
  14. package/dist/route-tools.js +1 -2
  15. package/dist/runtime/app/plugins/analytics.client.d.ts +0 -2
  16. package/dist/runtime/app/plugins/analytics.client.js +1 -2
  17. package/dist/runtime/app/plugins/feedback.client.d.ts +0 -2
  18. package/dist/runtime/app/plugins/feedback.client.js +1 -2
  19. package/dist/runtime/app/plugins/update.client.d.ts +0 -2
  20. package/dist/runtime/app/plugins/update.client.js +1 -2
  21. package/dist/runtime/app/plugins/user.client.d.ts +0 -2
  22. package/dist/runtime/app/plugins/user.client.js +1 -2
  23. package/dist/runtime/app/plugins/webmcp.client.d.ts +0 -2
  24. package/dist/runtime/app/plugins/webmcp.client.js +1 -2
  25. package/dist/runtime/app/preview-error.d.ts +26 -0
  26. package/dist/runtime/app/preview-error.js +69 -0
  27. package/dist/runtime/app/snapshot.d.ts +1 -3
  28. package/dist/runtime/app/snapshot.js +1 -2
  29. package/dist/runtime/app/useShape.d.ts +1 -3
  30. package/dist/runtime/app/useShape.js +3 -4
  31. package/dist/runtime/app/useWervtFeedback.d.ts +0 -2
  32. package/dist/runtime/app/useWervtFeedback.js +1 -2
  33. package/dist/runtime/app/useWervtTrack.d.ts +1 -3
  34. package/dist/runtime/app/useWervtTrack.js +1 -2
  35. package/dist/runtime/app/useWervtUpdate.d.ts +1 -3
  36. package/dist/runtime/app/useWervtUpdate.js +2 -3
  37. package/dist/runtime/app/useWervtUser.d.ts +1 -3
  38. package/dist/runtime/app/useWervtUser.js +1 -2
  39. package/dist/runtime/email/components.d.ts +1 -3
  40. package/dist/runtime/email/components.js +1 -2
  41. package/dist/runtime/email/invite.d.ts +1 -3
  42. package/dist/runtime/email/invite.js +1 -2
  43. package/dist/runtime/email/render.d.ts +1 -3
  44. package/dist/runtime/email/render.js +1 -2
  45. package/dist/runtime/server/access.d.ts +1 -3
  46. package/dist/runtime/server/access.js +1 -2
  47. package/dist/runtime/server/agent-token-plugin.d.ts +0 -2
  48. package/dist/runtime/server/agent-token-plugin.js +1 -2
  49. package/dist/runtime/server/anthropic.d.ts +1 -3
  50. package/dist/runtime/server/anthropic.js +1 -2
  51. package/dist/runtime/server/boot.d.ts +0 -2
  52. package/dist/runtime/server/boot.js +1 -2
  53. package/dist/runtime/server/db.d.ts +1 -3
  54. package/dist/runtime/server/db.js +1 -2
  55. package/dist/runtime/server/dev-auth.d.ts +0 -2
  56. package/dist/runtime/server/dev-auth.js +1 -2
  57. package/dist/runtime/server/email-preview.d.ts +0 -2
  58. package/dist/runtime/server/email-preview.js +1 -2
  59. package/dist/runtime/server/identity.d.ts +1 -3
  60. package/dist/runtime/server/identity.js +1 -2
  61. package/dist/runtime/server/logger.d.ts +0 -2
  62. package/dist/runtime/server/logger.js +1 -2
  63. package/dist/runtime/server/mail.d.ts +1 -3
  64. package/dist/runtime/server/mail.js +1 -2
  65. package/dist/runtime/server/mcp-auth-server.d.ts +0 -2
  66. package/dist/runtime/server/mcp-auth-server.js +1 -2
  67. package/dist/runtime/server/mcp-auth.d.ts +1 -3
  68. package/dist/runtime/server/mcp-auth.js +1 -2
  69. package/dist/runtime/server/mcp-claims.d.ts +1 -3
  70. package/dist/runtime/server/mcp-claims.js +1 -2
  71. package/dist/runtime/server/mcp-metadata.d.ts +0 -2
  72. package/dist/runtime/server/mcp-metadata.js +1 -2
  73. package/dist/runtime/server/mcp.d.ts +0 -2
  74. package/dist/runtime/server/mcp.js +1 -2
  75. package/dist/runtime/server/preview-errors-plugin.d.ts +13 -0
  76. package/dist/runtime/server/preview-errors-plugin.js +19 -0
  77. package/dist/runtime/server/seed.d.ts +1 -3
  78. package/dist/runtime/server/seed.js +1 -2
  79. package/dist/runtime/server/shape.d.ts +1 -3
  80. package/dist/runtime/server/shape.js +1 -2
  81. package/dist/runtime/server/storage-plugin.d.ts +1 -3
  82. package/dist/runtime/server/storage-plugin.js +1 -2
  83. package/dist/runtime/server/task-handlers.d.ts +1 -3
  84. package/dist/runtime/server/task-handlers.js +1 -2
  85. package/dist/runtime/server/task-list-nitro2.d.ts +0 -2
  86. package/dist/runtime/server/task-list-nitro2.js +1 -2
  87. package/dist/runtime/server/task-list-nitro3.d.ts +0 -2
  88. package/dist/runtime/server/task-list-nitro3.js +1 -2
  89. package/dist/runtime/server/task-run-nitro2.d.ts +0 -2
  90. package/dist/runtime/server/task-run-nitro2.js +1 -2
  91. package/dist/runtime/server/task-run-nitro3.d.ts +0 -2
  92. package/dist/runtime/server/task-run-nitro3.js +1 -2
  93. package/dist/runtime/server/tasks.d.ts +1 -3
  94. package/dist/runtime/server/tasks.js +1 -2
  95. package/dist/runtime/server/tool-handlers.d.ts +1 -3
  96. package/dist/runtime/server/tool-handlers.js +1 -2
  97. package/dist/runtime/server/tool-list.js +1 -2
  98. package/dist/runtime/server/tool-run.js +1 -2
  99. package/dist/runtime/server/tools.d.ts +0 -2
  100. package/dist/runtime/server/tools.js +1 -2
  101. package/dist/runtime/server/user-route.d.ts +0 -2
  102. package/dist/runtime/server/user-route.js +1 -2
  103. package/dist/runtime/server/user.d.ts +0 -2
  104. package/dist/runtime/server/user.js +1 -2
  105. package/dist/runtime/server/validate.d.ts +0 -2
  106. package/dist/runtime/server/validate.js +1 -2
  107. package/dist/runtime/shared/agent-token.d.ts +1 -3
  108. package/dist/runtime/shared/agent-token.js +1 -2
  109. package/dist/runtime/shared/mark.d.ts +1 -0
  110. package/dist/runtime/shared/mark.js +3 -0
  111. package/dist/runtime/shared/preview-errors.d.ts +10 -0
  112. package/dist/runtime/shared/preview-errors.js +14 -0
  113. package/dist/runtime/shared/shape.d.ts +0 -2
  114. package/dist/runtime/shared/shape.js +1 -2
  115. package/dist/runtime/shared/user.d.ts +1 -3
  116. package/dist/runtime/shared/user.js +1 -2
  117. package/dist/seed.js +1 -2
  118. package/dist/shapes.js +1 -2
  119. package/dist/storage.d.ts +2 -3
  120. package/dist/storage.js +7 -2
  121. package/dist/studio-preview.js +34 -0
  122. package/package.json +6 -6
@@ -1,6 +1,6 @@
1
1
  import { useDb } from "./db.js";
2
2
  import { sql } from "drizzle-orm";
3
- //#region src/runtime/server/seed.ts
3
+ // src/runtime/server/seed.ts
4
4
  /**
5
5
  * Inserts `rows` into `table` only while it is empty, so a seed task can run again without
6
6
  * duplicating data or touching what users created. Returns how many rows it inserted.
@@ -23,5 +23,4 @@ async function seedTable(table, rows) {
23
23
  await db.insert(target).values(rows);
24
24
  return rows.length;
25
25
  }
26
- //#endregion
27
26
  export { seedTable };
@@ -1,7 +1,6 @@
1
1
  import { ShapeResponse } from "../shared/shape.js";
2
2
  import { RequestEvent } from "nuxt/server";
3
3
  import { InferSelectModel, Table } from "drizzle-orm";
4
- //#region src/runtime/server/shape.d.ts
5
4
  export interface ShapeOptions<T extends Table | string = Table | string> {
6
5
  /**
7
6
  * The Drizzle table (`todos` from `server/db/schema`), or its name without schema. With the
@@ -22,5 +21,4 @@ export type ShapeRow<T extends Table | string> = T extends Table ? InferSelectMo
22
21
  * In production the request goes through the wervt runtime gateway, which pins the
23
22
  * table to this app's schema. In dev it goes to Electric directly (ELECTRIC_URL).
24
23
  */
25
- export declare function proxyShape<T extends Table | string>(event: RequestEvent, { table: tableOrName, where, params, columns }: ShapeOptions<T>): Promise<ShapeResponse<ShapeRow<T>>>;
26
- //#endregion
24
+ export declare function proxyShape<T extends Table | string>(event: RequestEvent, { table: tableOrName, where, params, columns }: ShapeOptions<T>): Promise<ShapeResponse<ShapeRow<T>>>;
@@ -1,5 +1,5 @@
1
1
  import { getTableName, isTable } from "drizzle-orm";
2
- //#region src/runtime/server/shape.ts
2
+ // src/runtime/server/shape.ts
3
3
  const CLIENT_PARAMS = [
4
4
  "offset",
5
5
  "handle",
@@ -53,5 +53,4 @@ function devTable(table) {
53
53
  function quoteIdentifier(name) {
54
54
  return /^[a-z_][a-z0-9_]*$/.test(name) ? name : `"${name.replaceAll("\"", "\"\"")}"`;
55
55
  }
56
- //#endregion
57
56
  export { proxyShape };
@@ -1,3 +1 @@
1
- //#region src/runtime/server/storage-plugin.d.ts
2
- export default function wervtStorage(): void;
3
- //#endregion
1
+ export default function wervtStorage(): void;
@@ -1,5 +1,5 @@
1
1
  import { createS3Provider, setFileStorageProvider } from "#imports";
2
- //#region src/runtime/server/storage-plugin.ts
2
+ // src/runtime/server/storage-plugin.ts
3
3
  function wervtStorage() {
4
4
  const env = process.env;
5
5
  if (!env.WERVT_S3_URL || !env.WERVT_S3_BUCKET) return;
@@ -12,5 +12,4 @@ function wervtStorage() {
12
12
  publicEndpoint: env.WERVT_S3_PUBLIC_URL
13
13
  }));
14
14
  }
15
- //#endregion
16
15
  export { wervtStorage as default };
@@ -1,4 +1,3 @@
1
- //#region src/runtime/server/task-handlers.d.ts
2
1
  type RunTask = (name: string, options: {
3
2
  payload?: Record<string, unknown>;
4
3
  }) => Promise<{
@@ -12,8 +11,8 @@ type Registry = Record<string, {
12
11
  }>;
13
12
  /** `POST /_wervt/tasks/:name`: runs a task when the control plane asks. */
14
13
  export declare function taskRunHandler(runTask: RunTask): import("nuxt/server").EventHandler<Promise<{
15
- error: string;
16
14
  result?: undefined;
15
+ error: string;
17
16
  } | {
18
17
  error?: undefined;
19
18
  result: {} | null;
@@ -25,5 +24,4 @@ export declare function taskListHandler(tasks: Registry): import("nuxt/server").
25
24
  }[] | {
26
25
  error: string;
27
26
  }>>;
28
- //#endregion
29
27
  export {};
@@ -1,5 +1,5 @@
1
1
  import { defineEventHandler } from "nuxt/server";
2
- //#region src/runtime/server/task-handlers.ts
2
+ // src/runtime/server/task-handlers.ts
3
3
  function trusted(event) {
4
4
  if (event.req.headers.get("x-wervt-task") === "1") return true;
5
5
  event.res.status = 404;
@@ -34,5 +34,4 @@ function taskListHandler(tasks) {
34
34
  }));
35
35
  });
36
36
  }
37
- //#endregion
38
37
  export { taskListHandler, taskRunHandler };
@@ -1,9 +1,7 @@
1
- //#region src/runtime/server/task-list-nitro2.d.ts
2
1
  declare const _default: import("nuxt/server").EventHandler<Promise<{
3
2
  name: string;
4
3
  description: string | undefined;
5
4
  }[] | {
6
5
  error: string;
7
6
  }>>;
8
- //#endregion
9
7
  export { _default as default };
@@ -1,6 +1,5 @@
1
1
  import { taskListHandler } from "./task-handlers.js";
2
2
  import { tasks } from "#nitro-internal-virtual/tasks";
3
- //#region src/runtime/server/task-list-nitro2.ts
3
+ // src/runtime/server/task-list-nitro2.ts
4
4
  var task_list_nitro2_default = taskListHandler(tasks);
5
- //#endregion
6
5
  export { task_list_nitro2_default as default };
@@ -1,9 +1,7 @@
1
- //#region src/runtime/server/task-list-nitro3.d.ts
2
1
  declare const _default: import("nuxt/server").EventHandler<Promise<{
3
2
  name: string;
4
3
  description: string | undefined;
5
4
  }[] | {
6
5
  error: string;
7
6
  }>>;
8
- //#endregion
9
7
  export { _default as default };
@@ -1,6 +1,5 @@
1
1
  import { taskListHandler } from "./task-handlers.js";
2
2
  import { tasks } from "#nitro/virtual/tasks";
3
- //#region src/runtime/server/task-list-nitro3.ts
3
+ // src/runtime/server/task-list-nitro3.ts
4
4
  var task_list_nitro3_default = taskListHandler(tasks);
5
- //#endregion
6
5
  export { task_list_nitro3_default as default };
@@ -1,4 +1,3 @@
1
- //#region src/runtime/server/task-run-nitro2.d.ts
2
1
  declare const _default: import("nuxt/server").EventHandler<Promise<{
3
2
  error: string;
4
3
  result?: undefined;
@@ -6,5 +5,4 @@ declare const _default: import("nuxt/server").EventHandler<Promise<{
6
5
  error?: undefined;
7
6
  result: {} | null;
8
7
  }>>;
9
- //#endregion
10
8
  export { _default as default };
@@ -1,6 +1,5 @@
1
1
  import { taskRunHandler } from "./task-handlers.js";
2
2
  import { runTask } from "nitropack/runtime";
3
- //#region src/runtime/server/task-run-nitro2.ts
3
+ // src/runtime/server/task-run-nitro2.ts
4
4
  var task_run_nitro2_default = taskRunHandler(runTask);
5
- //#endregion
6
5
  export { task_run_nitro2_default as default };
@@ -1,4 +1,3 @@
1
- //#region src/runtime/server/task-run-nitro3.d.ts
2
1
  declare const _default: import("nuxt/server").EventHandler<Promise<{
3
2
  error: string;
4
3
  result?: undefined;
@@ -6,5 +5,4 @@ declare const _default: import("nuxt/server").EventHandler<Promise<{
6
5
  error?: undefined;
7
6
  result: {} | null;
8
7
  }>>;
9
- //#endregion
10
8
  export { _default as default };
@@ -1,7 +1,6 @@
1
1
  import { taskRunHandler } from "./task-handlers.js";
2
2
  import { runTask } from "../../node_modules/.pnpm/nitro@3.0.260903-beta/node_modules/nitro/dist/runtime/internal/task.js";
3
3
  import "../../node_modules/.pnpm/nitro@3.0.260903-beta/node_modules/nitro/dist/runtime/task.js";
4
- //#region src/runtime/server/task-run-nitro3.ts
4
+ // src/runtime/server/task-run-nitro3.ts
5
5
  var task_run_nitro3_default = taskRunHandler(runTask);
6
- //#endregion
7
6
  export { task_run_nitro3_default as default };
@@ -1,4 +1,3 @@
1
- //#region src/runtime/server/tasks.d.ts
2
1
  export interface TaskEvent<P = Record<string, unknown>> {
3
2
  name: string;
4
3
  /** `{ scheduledTime }` for scheduled runs, or what was passed to a manual run. */
@@ -16,5 +15,4 @@ export interface Task<R = unknown, P = Record<string, unknown>> {
16
15
  run(event: TaskEvent<P>): TaskResult<R> | Promise<TaskResult<R>>;
17
16
  }
18
17
  /** A task in `server/tasks/` (`server/tasks/presence/sweep.ts` is `presence:sweep`). */
19
- export declare function defineTask<R = unknown, P = Record<string, unknown>>(task: Task<R, P>): Task<R, P>;
20
- //#endregion
18
+ export declare function defineTask<R = unknown, P = Record<string, unknown>>(task: Task<R, P>): Task<R, P>;
@@ -1,4 +1,4 @@
1
- //#region src/runtime/server/tasks.ts
1
+ // src/runtime/server/tasks.ts
2
2
  /** A task in `server/tasks/` (`server/tasks/presence/sweep.ts` is `presence:sweep`). */
3
3
  function defineTask(task) {
4
4
  if (typeof task.run !== "function") task.run = () => {
@@ -6,5 +6,4 @@ function defineTask(task) {
6
6
  };
7
7
  return task;
8
8
  }
9
- //#endregion
10
9
  export { defineTask };
@@ -1,6 +1,5 @@
1
1
  import { Input } from "./validate.js";
2
2
  import { Tool } from "./tools.js";
3
- //#region src/runtime/server/tool-handlers.d.ts
4
3
  /**
5
4
  * Every tool by the name agents see. A tool may rename itself (`name`), so the file-derived
6
5
  * keys of `#wervt/tools` are only a default and the whole list is loaded once.
@@ -40,5 +39,4 @@ export declare const runTool: import("nuxt/server").EventHandler<Promise<{
40
39
  error?: undefined;
41
40
  issues?: undefined;
42
41
  result: {} | null;
43
- }>>;
44
- //#endregion
42
+ }>>;
@@ -4,7 +4,7 @@ import { TOOL_ROUTE } from "./tools.js";
4
4
  import { defineEventHandler } from "nuxt/server";
5
5
  import { toJsonSchema } from "@valibot/to-json-schema";
6
6
  import { routeMethods, tools } from "#wervt/tools";
7
- //#region src/runtime/server/tool-handlers.ts
7
+ // src/runtime/server/tool-handlers.ts
8
8
  let index;
9
9
  /**
10
10
  * Every tool by the name agents see. A tool may rename itself (`name`), so the file-derived
@@ -90,5 +90,4 @@ const runTool = defineEventHandler(async (event) => {
90
90
  }
91
91
  return { result: await tool.handler(event, input) ?? null };
92
92
  });
93
- //#endregion
94
93
  export { allTools, listTools, loadTool, runTool, toolInputSchema };
@@ -1,5 +1,4 @@
1
1
  import { listTools } from "./tool-handlers.js";
2
- //#region src/runtime/server/tool-list.ts
2
+ // src/runtime/server/tool-list.ts
3
3
  var tool_list_default = listTools;
4
- //#endregion
5
4
  export { tool_list_default as default };
@@ -1,5 +1,4 @@
1
1
  import { runTool } from "./tool-handlers.js";
2
- //#region src/runtime/server/tool-run.ts
2
+ // src/runtime/server/tool-run.ts
3
3
  var tool_run_default = runTool;
4
- //#endregion
5
4
  export { tool_run_default as default };
@@ -1,6 +1,5 @@
1
1
  import { Input, Output } from "./validate.js";
2
2
  import { RequestEvent } from "nuxt/server";
3
- //#region src/runtime/server/tools.d.ts
4
3
  export interface Tool<I extends Input | undefined = Input | undefined, R = unknown> {
5
4
  /** Overrides the name from the file path. Agents see it, so keep it short and stable. */
6
5
  name?: string;
@@ -48,5 +47,4 @@ export declare const TOOL_ROUTE: unique symbol;
48
47
  export declare function defineToolRoute<R, P extends Input | undefined = undefined, I extends Input | undefined = undefined>(route: ToolRoute<P, I, R>): import("nuxt/server").EventHandler<Promise<R>> & {
49
48
  [TOOL_ROUTE]: Tool<Input | undefined, unknown>;
50
49
  };
51
- //#endregion
52
50
  export {};
@@ -1,7 +1,7 @@
1
1
  import { validate } from "./validate.js";
2
2
  import { defineEventHandler, getQuery, getRouterParams, readBody } from "nuxt/server";
3
3
  import * as v from "valibot";
4
- //#region src/runtime/server/tools.ts
4
+ // src/runtime/server/tools.ts
5
5
  /** A tool in `server/tools/` (`server/tools/todos/add.ts` is `todos.add`). */
6
6
  function defineTool(tool) {
7
7
  return tool;
@@ -55,5 +55,4 @@ function entries(input) {
55
55
  if ("entries" in input) return input.entries;
56
56
  throw new Error("defineToolRoute: `params` and `input` must be objects to merge into a tool.");
57
57
  }
58
- //#endregion
59
58
  export { TOOL_ROUTE, defineTool, defineToolRoute };
@@ -1,8 +1,6 @@
1
1
  import { WervtUser } from "../shared/user.js";
2
2
  import "./user.js";
3
- //#region src/runtime/server/user-route.d.ts
4
3
  declare const _default: import("nuxt/server").EventHandler<{
5
4
  user: WervtUser | null;
6
5
  }>;
7
- //#endregion
8
6
  export { _default as default };
@@ -1,9 +1,8 @@
1
1
  import { useWervtUser } from "./user.js";
2
2
  import { defineEventHandler } from "nuxt/server";
3
- //#region src/runtime/server/user-route.ts
3
+ // src/runtime/server/user-route.ts
4
4
  var user_route_default = defineEventHandler((event) => {
5
5
  event.res.headers.set("cache-control", "private, no-store");
6
6
  return { user: useWervtUser(event) ?? null };
7
7
  });
8
- //#endregion
9
8
  export { user_route_default as default };
@@ -1,6 +1,5 @@
1
1
  import { DEV_LOGIN_COOKIE, WervtRole, WervtUser, parseWervtUser } from "../shared/user.js";
2
2
  import { RequestEvent } from "nuxt/server";
3
- //#region src/runtime/server/user.d.ts
4
3
  /**
5
4
  * The signed-in wervt user, or `undefined` when nobody is signed in.
6
5
  * Private apps always have one (the runtime checked the login and the allow-list); public
@@ -14,5 +13,4 @@ export declare function useWervtUser(event: RequestEvent): WervtUser | undefined
14
13
  * Throws 401 without a signed-in user, 403 with another role.
15
14
  */
16
15
  export declare function requireWervtRole(event: RequestEvent, ...roles: WervtRole[]): WervtUser;
17
- //#endregion
18
16
  export { DEV_LOGIN_COOKIE, type WervtRole, type WervtUser, parseWervtUser };
@@ -1,6 +1,6 @@
1
1
  import { DEV_LOGIN_COOKIE, devUser, parseWervtUser } from "../shared/user.js";
2
2
  import { createError, getCookie } from "nuxt/server";
3
- //#region src/runtime/server/user.ts
3
+ // src/runtime/server/user.ts
4
4
  const MCP_USER = "wervtMcpUser";
5
5
  /**
6
6
  * The signed-in wervt user, or `undefined` when nobody is signed in.
@@ -34,5 +34,4 @@ function requireWervtRole(event, ...roles) {
34
34
  });
35
35
  return user;
36
36
  }
37
- //#endregion
38
37
  export { DEV_LOGIN_COOKIE, parseWervtUser, requireWervtRole, useWervtUser };
@@ -1,6 +1,5 @@
1
1
  import { RequestEvent } from "nuxt/server";
2
2
  import * as v from "valibot";
3
- //#region src/runtime/server/validate.d.ts
4
3
  type Schema = v.GenericSchema | v.GenericSchemaAsync;
5
4
  type Shape = v.ObjectEntriesAsync;
6
5
  export type Input = Schema | Shape;
@@ -40,5 +39,4 @@ export declare const vh: {
40
39
  /** Positive integer id (e.g. a serial primary key) → number. */
41
40
  id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DigitsAction<string, undefined>, v.TransformAction<any, number>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
42
41
  };
43
- //#endregion
44
42
  export {};
@@ -1,6 +1,6 @@
1
1
  import { createError, getQuery, getRouterParams, readBody } from "nuxt/server";
2
2
  import * as v from "valibot";
3
- //#region src/runtime/server/validate.ts
3
+ // src/runtime/server/validate.ts
4
4
  function toSchema(input) {
5
5
  return "kind" in input && input.kind === "schema" ? input : v.objectAsync(input);
6
6
  }
@@ -47,5 +47,4 @@ const vh = {
47
47
  /** Positive integer id (e.g. a serial primary key) → number. */
48
48
  id: v.pipe(v.string(), v.digits(), v.transform(Number), v.safeInteger(), v.minValue(1))
49
49
  };
50
- //#endregion
51
50
  export { safeValidate, toSchema, useSafeValidatedBody, useSafeValidatedParams, useSafeValidatedQuery, useValidatedBody, useValidatedParams, useValidatedQuery, validate, vh };
@@ -1,9 +1,7 @@
1
- //#region src/runtime/shared/agent-token.d.ts
2
1
  /** Who minted the agent token a request came with, and its id (the control plane's log). */
3
2
  export interface AgentToken {
4
3
  id: string;
5
4
  by: string;
6
5
  }
7
6
  /** Parses the `x-wervt-agent-token` header the runtime sets (and strips from client requests). */
8
- export declare function parseAgentToken(header: string | null | undefined): AgentToken | undefined;
9
- //#endregion
7
+ export declare function parseAgentToken(header: string | null | undefined): AgentToken | undefined;
@@ -1,4 +1,4 @@
1
- //#region src/runtime/shared/agent-token.ts
1
+ // src/runtime/shared/agent-token.ts
2
2
  /** Parses the `x-wervt-agent-token` header the runtime sets (and strips from client requests). */
3
3
  function parseAgentToken(header) {
4
4
  if (!header) return void 0;
@@ -13,5 +13,4 @@ function parseAgentToken(header) {
13
13
  return;
14
14
  }
15
15
  }
16
- //#endregion
17
16
  export { parseAgentToken };
@@ -0,0 +1 @@
1
+ export declare const WERVT_MARK = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\" role=\"img\" aria-label=\"wervt\"><defs> <mask id=\"w56m\" maskUnits=\"userSpaceOnUse\" x=\"-4\" y=\"-4\" width=\"40\" height=\"40\"><rect x=\"-4\" y=\"-4\" width=\"40\" height=\"40\" fill=\"#fff\"/><path d=\"M-15.47 20.8 Q-12.8 19.4 -10.13 20.8 Q-7.47 22.2 -4.8 20.8 Q-2.13 19.4 0.53 20.8 Q3.2 22.2 5.87 20.8 Q8.53 19.4 11.2 20.8 Q13.87 22.2 16.53 20.8 Q19.2 19.4 21.87 20.8 Q24.53 22.2 27.2 20.8 Q29.87 19.4 32.53 20.8 Q35.2 22.2 37.87 20.8\" fill=\"none\" stroke=\"#000\" stroke-width=\"1.5\"/></mask> <clipPath id=\"w56a\"><path d=\"M-15.47 20.8 Q-12.8 19.4 -10.13 20.8 Q-7.47 22.2 -4.8 20.8 Q-2.13 19.4 0.53 20.8 Q3.2 22.2 5.87 20.8 Q8.53 19.4 11.2 20.8 Q13.87 22.2 16.53 20.8 Q19.2 19.4 21.87 20.8 Q24.53 22.2 27.2 20.8 Q29.87 19.4 32.53 20.8 Q35.2 22.2 37.87 20.8 L37.87 -4 L-15.47 -4 Z\"/></clipPath> <clipPath id=\"w56b\"><path d=\"M-15.47 20.8 Q-12.8 19.4 -10.13 20.8 Q-7.47 22.2 -4.8 20.8 Q-2.13 19.4 0.53 20.8 Q3.2 22.2 5.87 20.8 Q8.53 19.4 11.2 20.8 Q13.87 22.2 16.53 20.8 Q19.2 19.4 21.87 20.8 Q24.53 22.2 27.2 20.8 Q29.87 19.4 32.53 20.8 Q35.2 22.2 37.87 20.8 L37.87 40 L-15.47 40 Z\"/></clipPath></defs> <g mask=\"url(#w56m)\"><path d=\"M4 5 L11.8 5 L16 19.66 L20.2 5 L28 5 L18.1 27 L13.9 27 Z\" clip-path=\"url(#w56a)\" fill=\"currentColor\"/><path d=\"M4 5 L11.8 5 L16 19.66 L20.2 5 L28 5 L18.1 27 L13.9 27 Z\" clip-path=\"url(#w56b)\" style=\"fill:var(--a)\"/></g></svg>";
@@ -0,0 +1,3 @@
1
+ // src/runtime/shared/mark.ts
2
+ const WERVT_MARK = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" role="img" aria-label="wervt"><defs> <mask id="w56m" maskUnits="userSpaceOnUse" x="-4" y="-4" width="40" height="40"><rect x="-4" y="-4" width="40" height="40" fill="#fff"/><path d="M-15.47 20.8 Q-12.8 19.4 -10.13 20.8 Q-7.47 22.2 -4.8 20.8 Q-2.13 19.4 0.53 20.8 Q3.2 22.2 5.87 20.8 Q8.53 19.4 11.2 20.8 Q13.87 22.2 16.53 20.8 Q19.2 19.4 21.87 20.8 Q24.53 22.2 27.2 20.8 Q29.87 19.4 32.53 20.8 Q35.2 22.2 37.87 20.8" fill="none" stroke="#000" stroke-width="1.5"/></mask> <clipPath id="w56a"><path d="M-15.47 20.8 Q-12.8 19.4 -10.13 20.8 Q-7.47 22.2 -4.8 20.8 Q-2.13 19.4 0.53 20.8 Q3.2 22.2 5.87 20.8 Q8.53 19.4 11.2 20.8 Q13.87 22.2 16.53 20.8 Q19.2 19.4 21.87 20.8 Q24.53 22.2 27.2 20.8 Q29.87 19.4 32.53 20.8 Q35.2 22.2 37.87 20.8 L37.87 -4 L-15.47 -4 Z"/></clipPath> <clipPath id="w56b"><path d="M-15.47 20.8 Q-12.8 19.4 -10.13 20.8 Q-7.47 22.2 -4.8 20.8 Q-2.13 19.4 0.53 20.8 Q3.2 22.2 5.87 20.8 Q8.53 19.4 11.2 20.8 Q13.87 22.2 16.53 20.8 Q19.2 19.4 21.87 20.8 Q24.53 22.2 27.2 20.8 Q29.87 19.4 32.53 20.8 Q35.2 22.2 37.87 20.8 L37.87 40 L-15.47 40 Z"/></clipPath></defs> <g mask="url(#w56m)"><path d="M4 5 L11.8 5 L16 19.66 L20.2 5 L28 5 L18.1 27 L13.9 27 Z" clip-path="url(#w56a)" fill="currentColor"/><path d="M4 5 L11.8 5 L16 19.66 L20.2 5 L28 5 L18.1 27 L13.9 27 Z" clip-path="url(#w56b)" style="fill:var(--a)"/></g></svg>`;
3
+ export { WERVT_MARK };
@@ -0,0 +1,10 @@
1
+ export interface PreviewError {
2
+ at: number;
3
+ source: 'browser' | 'server';
4
+ message: string;
5
+ stack?: string;
6
+ url?: string;
7
+ }
8
+ export declare function recordPreviewError(file: string, error: PreviewError): Promise<void>;
9
+ /** The frames that point at the app; enough to find the line, not a wall of text. */
10
+ export declare function trimStack(stack: string | undefined): string | undefined;
@@ -0,0 +1,14 @@
1
+ import { appendFile, mkdir } from "node:fs/promises";
2
+ import { dirname } from "node:path";
3
+ // src/runtime/shared/preview-errors.ts
4
+ async function recordPreviewError(file, error) {
5
+ try {
6
+ await mkdir(dirname(file), { recursive: true });
7
+ await appendFile(file, `${JSON.stringify(error)}\n`);
8
+ } catch {}
9
+ }
10
+ /** The frames that point at the app; enough to find the line, not a wall of text. */
11
+ function trimStack(stack) {
12
+ return stack?.split("\n").slice(1).filter((line) => !line.includes("node_modules")).slice(0, 6).join("\n");
13
+ }
14
+ export { recordPreviewError, trimStack };
@@ -1,4 +1,3 @@
1
- //#region src/runtime/shared/shape.d.ts
2
1
  declare const shapeRow: unique symbol;
3
2
  export type ShapeResponse<Row> = Response & {
4
3
  readonly [shapeRow]?: Row;
@@ -15,5 +14,4 @@ export declare const shapeParser: {
15
14
  timestamp: typeof parseTimestamp;
16
15
  timestamptz: typeof parseTimestamp;
17
16
  };
18
- //#endregion
19
17
  export {};
@@ -1,4 +1,4 @@
1
- //#region src/runtime/shared/shape.ts
1
+ // src/runtime/shared/shape.ts
2
2
  /**
3
3
  * Postgres text of a `timestamp`/`timestamptz` as a Date, like Drizzle's default `mode: 'date'`
4
4
  * reads it. Drizzle stores `timestamp` without time zone as UTC, so it's read as UTC too.
@@ -12,5 +12,4 @@ const shapeParser = {
12
12
  timestamp: parseTimestamp,
13
13
  timestamptz: parseTimestamp
14
14
  };
15
- //#endregion
16
15
  export { parseTimestamp, shapeParser };
@@ -1,4 +1,3 @@
1
- //#region src/runtime/shared/user.d.ts
2
1
  /**
3
2
  * What the user is to this app: its `owner` or one of its `member`s (`wervt members`), a wervt
4
3
  * `admin`, someone `invited` through the app (invite-only apps) or `allowed` by the app's list
@@ -20,5 +19,4 @@ export declare const DEV_LOGIN_COOKIE = "wervt_dev_login";
20
19
  /** Parses the `x-wervt-user` header the runtime sets (and strips from client requests). */
21
20
  export declare function parseWervtUser(header: string | null | undefined): WervtUser | undefined;
22
21
  /** During `nuxt dev`: the configured dev user, after `/_wervt/login`. */
23
- export declare function devUser(loggedIn: boolean): WervtUser | undefined;
24
- //#endregion
22
+ export declare function devUser(loggedIn: boolean): WervtUser | undefined;
@@ -1,4 +1,4 @@
1
- //#region src/runtime/shared/user.ts
1
+ // src/runtime/shared/user.ts
2
2
  /** Cookie set by the dev stand-in for `/_wervt/login` (see `server/dev-auth.ts`). */
3
3
  const DEV_LOGIN_COOKIE = "wervt_dev_login";
4
4
  /** Parses the `x-wervt-user` header the runtime sets (and strips from client requests). */
@@ -19,5 +19,4 @@ function devUser(loggedIn) {
19
19
  ...JSON.parse(user)
20
20
  };
21
21
  }
22
- //#endregion
23
22
  export { DEV_LOGIN_COOKIE, devUser, parseWervtUser };
package/dist/seed.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/seed.ts
1
+ // src/seed.ts
2
2
  /** The conventional seed task: `server/tasks/db/seed.ts`. */
3
3
  const SEED_TASK = "db:seed";
4
4
  /**
@@ -48,5 +48,4 @@ async function runDevSeed(baseUrl, { fetch: request = fetch, timeout = 12e4, int
48
48
  result: body.result
49
49
  };
50
50
  }
51
- //#endregion
52
51
  export { SEED_TASK, runDevSeed, unscheduleSeed };
package/dist/shapes.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { readdir } from "node:fs/promises";
2
2
  import { extname, join, relative, sep } from "node:path";
3
- //#region src/shapes.ts
3
+ // src/shapes.ts
4
4
  const ROUTE_EXTENSIONS = /* @__PURE__ */ new Set([
5
5
  ".ts",
6
6
  ".mts",
@@ -66,5 +66,4 @@ function shapeRoutesTypes(routes, typesDir, shapeTypes) {
66
66
  ""
67
67
  ].join("\n");
68
68
  }
69
- //#endregion
70
69
  export { findShapeRoutes, shapeRoutes, shapeRoutesTypes, shapesManifest };
package/dist/storage.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/storage.d.ts
2
1
  export interface StorageOptions {
3
2
  /** Garage's admin API, e.g. http://garage:3903 */
4
3
  adminUrl: string;
@@ -68,6 +67,6 @@ export declare function createStorage(options: StorageOptions): {
68
67
  }) => Promise<{
69
68
  deleted: string[];
70
69
  }>;
70
+ hasBucket: (app: string) => Promise<boolean>;
71
71
  drop: (app: string) => Promise<void>;
72
- };
73
- //#endregion
72
+ };
package/dist/storage.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { storageCredentials } from "./provision.js";
2
2
  import { AwsClient } from "aws4fetch";
3
- //#region src/storage.ts
3
+ // src/storage.ts
4
4
  var StorageError = class extends Error {};
5
5
  /**
6
6
  * ablage marks bytes uploaded straight from browsers (`x-amz-meta-ablage-direct-upload`). Its
@@ -227,6 +227,11 @@ function createStorage(options) {
227
227
  }
228
228
  return { deleted };
229
229
  }
230
+ /** Whether the app's bucket exists, e.g. left over from a deleted app that kept its data. */
231
+ async function hasBucket(app) {
232
+ const creds = await storageCredentials(app, options.secret);
233
+ return Boolean(await exists(`GetBucketInfo?globalAlias=${creds.bucket}`));
234
+ }
230
235
  /** Deletes every object and unfinished upload, then the bucket. Only with "drop data". */
231
236
  async function drop(app) {
232
237
  const { creds, client, base } = await s3(app);
@@ -351,8 +356,8 @@ function createStorage(options) {
351
356
  downloadUrl,
352
357
  remove,
353
358
  sweepAbandonedUploads,
359
+ hasBucket,
354
360
  drop
355
361
  };
356
362
  }
357
- //#endregion
358
363
  export { ABANDONED_UPLOAD_GRACE_MS, MAX_KEY_BYTES, StorageError, companionKeyOf, createStorage, metaKeyOf, parseObjectList };
@@ -0,0 +1,34 @@
1
+ import { previewLoadingTemplate } from "./loading.js";
2
+ import { recordPreviewError, trimStack } from "./runtime/shared/preview-errors.js";
3
+ import { addServerPlugin, createResolver } from "nuxt/kit";
4
+ import { join } from "node:path";
5
+ // src/studio-preview.ts
6
+ /** One error per line: what the app raised in the browser or on the server. */
7
+ const PREVIEW_ERRORS = ".data/preview-errors.jsonl";
8
+ function setupStudioPreview(nuxt) {
9
+ const devtools = nuxt.options.devtools;
10
+ nuxt.options.devtools = {
11
+ ...typeof devtools === "object" ? devtools : {},
12
+ enabled: false
13
+ };
14
+ nuxt.options.devServer.loadingTemplate = previewLoadingTemplate;
15
+ nuxt.options.app.head.style = [...nuxt.options.app.head.style ?? [], { innerHTML: "nuxt-error-overlay,[data-nuxt-dev-error]{display:none!important}" }];
16
+ const resolver = createResolver(import.meta.url);
17
+ nuxt.hook("app:resolve", (app) => {
18
+ if (!app.errorComponent || app.errorComponent.includes("nuxt-error-page")) app.errorComponent = resolver.resolve("./runtime/app/preview-error");
19
+ });
20
+ const file = join(nuxt.options.rootDir, PREVIEW_ERRORS);
21
+ process.env.WERVT_PREVIEW_ERRORS = file;
22
+ addServerPlugin(resolver.resolve("./runtime/server/preview-errors-plugin"));
23
+ nuxt.hook("vite:serverCreated", (server) => {
24
+ server.environments?.client?.hot.on("nuxt:dev:client-error", (data) => {
25
+ recordPreviewError(file, {
26
+ at: Date.now(),
27
+ source: "browser",
28
+ message: `${data.name ?? "Error"}: ${data.message ?? ""}`,
29
+ stack: trimStack(data.stack)
30
+ });
31
+ });
32
+ });
33
+ }
34
+ export { PREVIEW_ERRORS, setupStudioPreview };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wervt/nuxt",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Nuxt module for apps hosted on wervt: database, live data, MCP and runtime setup.",
5
5
  "keywords": [
6
6
  "drizzle",
@@ -50,18 +50,18 @@
50
50
  "@electric-sql/client": "^1.5.28",
51
51
  "@valibot/to-json-schema": "^1.8.0",
52
52
  "aws4fetch": "^1.0.20",
53
- "evlog": "^2.33.1",
53
+ "evlog": "^2.34.0",
54
54
  "h3-mcp": "0.2.0",
55
- "html-to-text": "^9.0.5",
56
- "jose": "^6.2.12",
55
+ "html-to-text": "^10.0.1",
56
+ "jose": "^6.2.13",
57
57
  "postgres": "^3.4.9",
58
58
  "valibot": "^1.5.0"
59
59
  },
60
60
  "devDependencies": {
61
- "@anthropic-ai/sdk": "^0.97.1",
61
+ "@anthropic-ai/sdk": "^1.3.0",
62
62
  "@types/html-to-text": "^9.0.4",
63
63
  "drizzle-orm": "1.0.0-rc.5",
64
- "h3": "2.0.5",
64
+ "h3": "2.0.8",
65
65
  "nitro": "3.0.260903-beta",
66
66
  "nuxt": "npm:nuxt-nightly@5x",
67
67
  "vue": "^3.5.44"