@wervt/nuxt 0.3.12 → 0.3.14

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/dist/module.d.ts CHANGED
@@ -63,6 +63,8 @@ export interface FeedbackOptions {
63
63
  lang?: 'de' | 'en';
64
64
  /** `none` hides the floating button; open the form with `useWervtFeedback().open()`. */
65
65
  position?: 'bottom-right' | 'bottom-left' | 'none';
66
+ /** With `position: 'none'`: the corner the form opens in, next to your own button. Defaults to `right`. */
67
+ side?: 'left' | 'right';
66
68
  label?: string;
67
69
  /** Accent color (any CSS color). */
68
70
  color?: string;
package/dist/module.js CHANGED
@@ -3,6 +3,7 @@ import { PROCESS_ENV_TYPES } from "./env-types.js";
3
3
  import { dependencyNames, ogImageDefaults, ogImageWarning } from "./og-image.js";
4
4
  import { iconDefaults, iconSources, iconWarning } from "./icons.js";
5
5
  import { CONTENT_DATABASE, contentDependency, nuxtBundleManifest } from "./content.js";
6
+ import { runtimeServesStatic } from "./static-files.js";
6
7
  import { findRouteTools } from "./route-tools.js";
7
8
  import { localFiles, previewManifest } from "./preview.js";
8
9
  import { LOCALES } from "./runtime/shared/i18n.js";
@@ -73,7 +74,7 @@ var module_default = defineNuxtModule({
73
74
  const usesContent = () => !nuxt.options.dev && hasNuxtModule("@nuxt/content", nuxt);
74
75
  nuxt.hook("nitro:config", (config) => {
75
76
  const options = config;
76
- if (!nuxt.options.dev) options.serveStatic = false;
77
+ if (!nuxt.options.dev && runtimeServesStatic(nitro.preset)) options.serveStatic = false;
77
78
  options.externals = {
78
79
  ...options.externals,
79
80
  inline: [
@@ -0,0 +1,2 @@
1
+ /** Whether a changing request comes from a page on another origin. */
2
+ export declare function isCrossOrigin(method: string, headers: Headers): boolean;
@@ -0,0 +1,20 @@
1
+ // src/runtime/server/cross-origin.ts
2
+ const SAFE_METHODS = /* @__PURE__ */ new Set([
3
+ "GET",
4
+ "HEAD",
5
+ "OPTIONS"
6
+ ]);
7
+ /** Whether a changing request comes from a page on another origin. */
8
+ function isCrossOrigin(method, headers) {
9
+ if (SAFE_METHODS.has(method)) return false;
10
+ const site = headers.get("sec-fetch-site");
11
+ if (site) return site !== "same-origin" && site !== "none";
12
+ const origin = headers.get("origin");
13
+ if (!origin) return false;
14
+ try {
15
+ return new URL(origin).host !== headers.get("host");
16
+ } catch {
17
+ return true;
18
+ }
19
+ }
20
+ export { isCrossOrigin };
@@ -2,6 +2,7 @@ import { WervtRole, WervtUser } from "../shared/user.js";
2
2
  import { WervtInstance, wervtInstance } from "../shared/instance.js";
3
3
  import { EmailProps, RenderedEmail, renderEmail } from "../email/render.js";
4
4
  import { WervtAccess, WervtInvite, useWervtAccess } from "./access.js";
5
+ import { isCrossOrigin } from "./cross-origin.js";
5
6
  import { useDb } from "./db.js";
6
7
  import { WorkloadIdentity, useWorkloadIdentity } from "./identity.js";
7
8
  import { createEvlogError, log, useLogger } from "./logger.js";
@@ -14,4 +15,4 @@ import { AccountMergedPayload, Task, TaskEvent, TaskResult, defineTask } from ".
14
15
  import { SafeResult, useSafeValidatedBody, useSafeValidatedParams, useSafeValidatedQuery, useValidatedBody, useValidatedParams, useValidatedQuery, vh } from "./validate.js";
15
16
  import { Tool, ToolRoute, defineTool, defineToolRoute } from "./tools.js";
16
17
  import { requireWervtRole, useWervtUser } from "./user.js";
17
- export { type AccountMergedPayload, type EmailProps, type McpTokenContext, type RenderedEmail, type SafeResult, type SendMailOptions, type ShapeOptions, type ShapeResponse, type ShapeRow, type Task, type TaskEvent, type TaskResult, type Tool, type ToolRoute, type WervtAccess, type WervtInstance, type WervtInvite, type WervtRole, type WervtUser, type WorkloadIdentity, createEvlogError, defineTask, defineTool, defineToolRoute, log, proxyShape, renderEmail, requireWervtRole, seedTable, sendMail, useDb, useLogger, useSafeValidatedBody, useSafeValidatedParams, useSafeValidatedQuery, useValidatedBody, useValidatedParams, useValidatedQuery, useWervtAccess, useWervtUser, useWorkloadIdentity, vh, wervtInstance };
18
+ export { type AccountMergedPayload, type EmailProps, type McpTokenContext, type RenderedEmail, type SafeResult, type SendMailOptions, type ShapeOptions, type ShapeResponse, type ShapeRow, type Task, type TaskEvent, type TaskResult, type Tool, type ToolRoute, type WervtAccess, type WervtInstance, type WervtInvite, type WervtRole, type WervtUser, type WorkloadIdentity, createEvlogError, defineTask, defineTool, defineToolRoute, isCrossOrigin, log, proxyShape, renderEmail, requireWervtRole, seedTable, sendMail, useDb, useLogger, useSafeValidatedBody, useSafeValidatedParams, useSafeValidatedQuery, useValidatedBody, useValidatedParams, useValidatedQuery, useWervtAccess, useWervtUser, useWorkloadIdentity, vh, wervtInstance };
@@ -1,6 +1,7 @@
1
1
  import { wervtInstance } from "../shared/instance.js";
2
2
  import { renderEmail } from "../email/render.js";
3
3
  import { useWervtAccess } from "./access.js";
4
+ import { isCrossOrigin } from "./cross-origin.js";
4
5
  import { useDb } from "./db.js";
5
6
  import { useWorkloadIdentity } from "./identity.js";
6
7
  import { createEvlogError, log, useLogger } from "./logger.js";
@@ -11,4 +12,4 @@ import { defineTask } from "./tasks.js";
11
12
  import { useSafeValidatedBody, useSafeValidatedParams, useSafeValidatedQuery, useValidatedBody, useValidatedParams, useValidatedQuery, vh } from "./validate.js";
12
13
  import { defineTool, defineToolRoute } from "./tools.js";
13
14
  import { requireWervtRole, useWervtUser } from "./user.js";
14
- export { createEvlogError, defineTask, defineTool, defineToolRoute, log, proxyShape, renderEmail, requireWervtRole, seedTable, sendMail, useDb, useLogger, useSafeValidatedBody, useSafeValidatedParams, useSafeValidatedQuery, useValidatedBody, useValidatedParams, useValidatedQuery, useWervtAccess, useWervtUser, useWorkloadIdentity, vh, wervtInstance };
15
+ export { createEvlogError, defineTask, defineTool, defineToolRoute, isCrossOrigin, log, proxyShape, renderEmail, requireWervtRole, seedTable, sendMail, useDb, useLogger, useSafeValidatedBody, useSafeValidatedParams, useSafeValidatedQuery, useValidatedBody, useValidatedParams, useValidatedQuery, useWervtAccess, useWervtUser, useWorkloadIdentity, vh, wervtInstance };
@@ -15,7 +15,8 @@ function useWervtUser(event) {
15
15
  const mcp = event.context[MCP_USER];
16
16
  if (mcp) return mcp.role || header?.id !== mcp.id ? mcp : {
17
17
  ...mcp,
18
- role: header.role
18
+ role: header.role,
19
+ ...header.admin ? { admin: true } : {}
19
20
  };
20
21
  return header ?? devUser(getCookie(event, "wervt_dev_login") === "1");
21
22
  }
@@ -0,0 +1,9 @@
1
+ // src/static-files.ts
2
+ /**
3
+ * Whether the wervt runtime serves `public/` for a build with this Nitro preset. An app built for
4
+ * a server of its own (studio on `node-server`) has nothing else in front of it, so Nitro has to.
5
+ */
6
+ function runtimeServesStatic(preset) {
7
+ return preset?.replaceAll("_", "-") === "deno-server";
8
+ }
9
+ export { runtimeServesStatic };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wervt/nuxt",
3
- "version": "0.3.12",
3
+ "version": "0.3.14",
4
4
  "description": "Nuxt module for apps hosted on wervt: database, live data, MCP and runtime setup.",
5
5
  "keywords": [
6
6
  "drizzle",
@@ -53,10 +53,10 @@
53
53
  "dependencies": {
54
54
  "@electric-sql/client": "^1.5.28",
55
55
  "@valibot/to-json-schema": "^1.8.0",
56
- "@wervt/client": "^0.0.2",
57
- "@wervt/core": "^0.0.2",
58
- "@wervt/nitro": "^0.0.3",
59
- "@wervt/platform": "^0.0.2",
56
+ "@wervt/client": "^0.0.3",
57
+ "@wervt/core": "^0.0.3",
58
+ "@wervt/nitro": "^0.0.5",
59
+ "@wervt/platform": "^0.0.4",
60
60
  "aws4fetch": "^1.0.20",
61
61
  "evlog": "^2.34.0",
62
62
  "h3-mcp": "0.2.0",