@wervt/nuxt 0.3.7 → 0.3.8

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.
@@ -22,9 +22,14 @@ export declare const emailTheme: {
22
22
  radius: string;
23
23
  font: string;
24
24
  mono: string;
25
- /** Where the logo images live. PNG, because Gmail and Outlook don't show SVG. */
25
+ /**
26
+ * Where the logo images live. PNG, because Gmail and Outlook don't show SVG. Always wervt.app's,
27
+ * even on a self-hosted instance: its docs, which would serve them, may not run there.
28
+ */
26
29
  assets: string;
30
+ /** @deprecated wervt.app's only; `wervtInstance().site` is the instance the app runs on. */
27
31
  site: string;
32
+ /** @deprecated wervt.app's only; `wervtInstance().docs` is the instance's, if it runs any. */
28
33
  docs: string;
29
34
  };
30
35
  /**
@@ -1,3 +1,4 @@
1
+ import { wervtInstance } from "../shared/instance.js";
1
2
  import { defineComponent, h, inject } from "vue";
2
3
  // src/runtime/email/components.ts
3
4
  /** The template's subject, handed to renderEmail() while rendering. */
@@ -23,9 +24,14 @@ const emailTheme = {
23
24
  radius: "8px",
24
25
  font: "Poppins, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",
25
26
  mono: "'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",
26
- /** Where the logo images live. PNG, because Gmail and Outlook don't show SVG. */
27
+ /**
28
+ * Where the logo images live. PNG, because Gmail and Outlook don't show SVG. Always wervt.app's,
29
+ * even on a self-hosted instance: its docs, which would serve them, may not run there.
30
+ */
27
31
  assets: "https://wervt.app/email",
32
+ /** @deprecated wervt.app's only; `wervtInstance().site` is the instance the app runs on. */
28
33
  site: "https://wervt.app",
34
+ /** @deprecated wervt.app's only; `wervtInstance().docs` is the instance's, if it runs any. */
29
35
  docs: "https://wervt.app/getting-started/introduction"
30
36
  };
31
37
  const t = emailTheme;
@@ -198,7 +204,7 @@ function header(app) {
198
204
  verticalAlign: "middle"
199
205
  }
200
206
  }, h("a", {
201
- href: t.site,
207
+ href: wervtInstance().site,
202
208
  style: {
203
209
  textDecoration: "none",
204
210
  color: "#fafafa"
@@ -309,6 +315,7 @@ function footer(props) {
309
315
  color: t.muted,
310
316
  textDecoration: "none"
311
317
  };
318
+ const instance = wervtInstance();
312
319
  return table({ width: "100%" }, [h("tr", [tile ? h("td", {
313
320
  width: 40,
314
321
  style: {
@@ -357,22 +364,18 @@ function footer(props) {
357
364
  color: t.dimmed
358
365
  }
359
366
  }, brand ? brand.securedByWervt === false ? [] : [h("a", {
360
- href: t.site,
367
+ href: instance.site,
361
368
  class: "wv-muted",
362
369
  style: link
363
- }, "Secured by wervt")] : [
364
- h("a", {
365
- href: t.site,
366
- class: "wv-muted",
367
- style: link
368
- }, "wervt.app"),
369
- separator(),
370
- h("a", {
371
- href: t.docs,
372
- class: "wv-muted",
373
- style: link
374
- }, "Docs")
375
- ])
370
+ }, "Secured by wervt")] : [h("a", {
371
+ href: instance.site,
372
+ class: "wv-muted",
373
+ style: link
374
+ }, instance.domain), ...instance.docs ? [separator(), h("a", {
375
+ href: `${instance.docs}/getting-started/introduction`,
376
+ class: "wv-muted",
377
+ style: link
378
+ }, "Docs")] : []])
376
379
  ])])]);
377
380
  }
378
381
  function separator() {
@@ -1,5 +1,6 @@
1
1
  import { LogAlertEmail } from "./alert.js";
2
2
  import { EmailBrand, EmailButton, EmailCode, EmailDivider, EmailHeading, EmailLink, EmailMuted, EmailText, WervtEmail, emailTheme } from "./components.js";
3
3
  import { InviteEmail } from "./invite.js";
4
+ import { WervtInstance, wervtInstance } from "../shared/instance.js";
4
5
  import { EmailProps, RenderedEmail, renderEmail } from "./render.js";
5
- export { type EmailBrand, EmailButton, EmailCode, EmailDivider, EmailHeading, EmailLink, EmailMuted, type EmailProps, EmailText, InviteEmail, LogAlertEmail, type RenderedEmail, WervtEmail, emailTheme, renderEmail };
6
+ export { type EmailBrand, EmailButton, EmailCode, EmailDivider, EmailHeading, EmailLink, EmailMuted, type EmailProps, EmailText, InviteEmail, LogAlertEmail, type RenderedEmail, WervtEmail, type WervtInstance, emailTheme, renderEmail, wervtInstance };
@@ -1,5 +1,6 @@
1
+ import { wervtInstance } from "../shared/instance.js";
1
2
  import { EmailButton, EmailCode, EmailDivider, EmailHeading, EmailLink, EmailMuted, EmailText, WervtEmail, emailTheme } from "./components.js";
2
3
  import { LogAlertEmail } from "./alert.js";
3
4
  import { InviteEmail } from "./invite.js";
4
5
  import { renderEmail } from "./render.js";
5
- export { EmailButton, EmailCode, EmailDivider, EmailHeading, EmailLink, EmailMuted, EmailText, InviteEmail, LogAlertEmail, WervtEmail, emailTheme, renderEmail };
6
+ export { EmailButton, EmailCode, EmailDivider, EmailHeading, EmailLink, EmailMuted, EmailText, InviteEmail, LogAlertEmail, WervtEmail, emailTheme, renderEmail, wervtInstance };
@@ -1,4 +1,5 @@
1
1
  import { WervtRole, WervtUser } from "../shared/user.js";
2
+ import { WervtInstance, wervtInstance } from "../shared/instance.js";
2
3
  import { EmailProps, RenderedEmail, renderEmail } from "../email/render.js";
3
4
  import { WervtAccess, WervtInvite, useWervtAccess } from "./access.js";
4
5
  import { useDb } from "./db.js";
@@ -13,4 +14,4 @@ import { AccountMergedPayload, Task, TaskEvent, TaskResult, defineTask } from ".
13
14
  import { SafeResult, useSafeValidatedBody, useSafeValidatedParams, useSafeValidatedQuery, useValidatedBody, useValidatedParams, useValidatedQuery, vh } from "./validate.js";
14
15
  import { Tool, ToolRoute, defineTool, defineToolRoute } from "./tools.js";
15
16
  import { requireWervtRole, useWervtUser } from "./user.js";
16
- 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 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 };
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 };
@@ -1,3 +1,4 @@
1
+ import { wervtInstance } from "../shared/instance.js";
1
2
  import { renderEmail } from "../email/render.js";
2
3
  import { useWervtAccess } from "./access.js";
3
4
  import { useWorkloadIdentity } from "./identity.js";
@@ -10,4 +11,4 @@ import { defineTask } from "./tasks.js";
10
11
  import { useSafeValidatedBody, useSafeValidatedParams, useSafeValidatedQuery, useValidatedBody, useValidatedParams, useValidatedQuery, vh } from "./validate.js";
11
12
  import { defineTool, defineToolRoute } from "./tools.js";
12
13
  import { requireWervtRole, useWervtUser } from "./user.js";
13
- export { createEvlogError, defineTask, defineTool, defineToolRoute, log, proxyShape, renderEmail, requireWervtRole, seedTable, sendMail, useDb, useLogger, useSafeValidatedBody, useSafeValidatedParams, useSafeValidatedQuery, useValidatedBody, useValidatedParams, useValidatedQuery, useWervtAccess, useWervtUser, useWorkloadIdentity, vh };
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 };
@@ -0,0 +1,17 @@
1
+ /** The wervt instance an app runs on: wervt.app, or a self-hosted one at its own domain. */
2
+ export interface WervtInstance {
3
+ /** E.g. `wervt.app` or `lightdrop.cloud`. */
4
+ domain: string;
5
+ /** The domain as a link. */
6
+ site: string;
7
+ /** The instance's docs site, or `undefined` when it runs none. */
8
+ docs?: string;
9
+ }
10
+ type Env = Record<string, string | undefined>;
11
+ /**
12
+ * Read at call time from what the runtime gives each isolate (`WERVT_BASE_DOMAIN`,
13
+ * `WERVT_DOCS_URL`, empty without docs), so an app built for wervt.app links to the right place
14
+ * on any other instance. Older runtimes pass neither, and were all wervt.app's.
15
+ */
16
+ export declare function wervtInstance(env?: Env): WervtInstance;
17
+ export {};
@@ -0,0 +1,17 @@
1
+ // src/runtime/shared/instance.ts
2
+ const processEnv = () => typeof process === "undefined" ? {} : process.env;
3
+ /**
4
+ * Read at call time from what the runtime gives each isolate (`WERVT_BASE_DOMAIN`,
5
+ * `WERVT_DOCS_URL`, empty without docs), so an app built for wervt.app links to the right place
6
+ * on any other instance. Older runtimes pass neither, and were all wervt.app's.
7
+ */
8
+ function wervtInstance(env = processEnv()) {
9
+ const domain = env.WERVT_BASE_DOMAIN || "wervt.app";
10
+ const site = `${/(^|\.)localhost(:\d+)?$/.test(domain) ? "http" : "https"}://${domain}`;
11
+ return {
12
+ domain,
13
+ site,
14
+ docs: env.WERVT_DOCS_URL === void 0 ? domain === "wervt.app" ? site : void 0 : env.WERVT_DOCS_URL.replace(/\/+$/, "") || void 0
15
+ };
16
+ }
17
+ export { wervtInstance };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wervt/nuxt",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "description": "Nuxt module for apps hosted on wervt: database, live data, MCP and runtime setup.",
5
5
  "keywords": [
6
6
  "drizzle",