@lenne.tech/nuxt-extensions 1.27.0 → 4.0.0

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.
@@ -74,7 +74,7 @@ export interface LtAuthClientConfig {
74
74
  baseURL?: string;
75
75
  /** Auth API base path (default: '/iam' - must match nest-server betterAuth.basePath) */
76
76
  basePath?: string;
77
- /** Enable admin plugin (default: true) */
77
+ /** Register Better-Auth's admin client plugin (default: false; nest-server serves no admin routes) */
78
78
  enableAdmin?: boolean;
79
79
  /** Enable passkey plugin (default: true) */
80
80
  enablePasskey?: boolean;
@@ -88,6 +88,11 @@ export interface LtAuthClientConfig {
88
88
  /**
89
89
  * Normalized response type for Better-Auth operations
90
90
  * The Vue client returns complex union types - this provides a consistent interface
91
+ *
92
+ * @deprecated No function of this module returns or accepts it. Its `data.token` invites
93
+ * storing whatever token an answer carries, and Better-Auth's 2FA answer carries the session
94
+ * token there, which application code must never hold. Type the result of the method you
95
+ * call instead. Removed in the next major version.
91
96
  */
92
97
  export interface LtAuthResponse {
93
98
  data?: null | {
@@ -18,15 +18,6 @@ export interface LtParsedError {
18
18
  /** Translated user-friendly message */
19
19
  translatedMessage: string;
20
20
  }
21
- /**
22
- * Error translation module options
23
- */
24
- export interface LtErrorTranslationModuleOptions {
25
- /** Enable error translation feature (default: true) */
26
- enabled?: boolean;
27
- /** Default locale if not detected (default: 'de') */
28
- defaultLocale?: string;
29
- }
30
21
  /**
31
22
  * Return type for useLtErrorTranslation composable
32
23
  */
@@ -62,11 +53,16 @@ export interface UseLtErrorTranslationReturn {
62
53
  parseError: (errorOrMessage: unknown) => LtParsedError;
63
54
  /** Show translated error as toast notification */
64
55
  showErrorToast: (errorOrMessage: unknown, title?: string) => void;
65
- /** Manually load translations for a locale */
56
+ /**
57
+ * Load the translations for a locale (default: the current one). The plugin calls it after
58
+ * the app is mounted and does not wait for it; await it where the translations have to be
59
+ * there first. A load already in flight for that locale is shared, not repeated. Resolves
60
+ * once they are loaded, or once the load failed (logged, never rejected).
61
+ */
66
62
  loadTranslations: (locale?: string) => Promise<void>;
67
63
  /** Check if translations are loaded for current locale */
68
64
  isLoaded: ComputedRef<boolean>;
69
- /** Check if translations are currently loading */
65
+ /** `true` while a load is in flight; shared by every instance of the composable */
70
66
  isLoading: Ref<boolean>;
71
67
  /** Current detected locale */
72
68
  currentLocale: ComputedRef<string>;
@@ -61,9 +61,22 @@ export interface LtAuthModuleOptions {
61
61
  baseURL?: string;
62
62
  /** Override the cookie names used for auth state and JWT storage */
63
63
  cookieNames?: LtAuthCookieNamesOptions;
64
- /** Enable the auth module (default: true) */
64
+ /**
65
+ * Gate of the 401 auth interceptor plugin (default: true). Despite its name it does not switch
66
+ * the auth module off: `useLtAuth()`, `useLtAuthClient()`, the auth helpers and the Better-Auth
67
+ * client stay registered, because the AI composables and offline sync authenticate through
68
+ * `ltAuthFetch` and TUS uploads send the same session. `false` has the same effect as
69
+ * `interceptor.enabled: false`; prefer that.
70
+ */
65
71
  enabled?: boolean;
66
- /** Enable admin plugin (default: true) */
72
+ /**
73
+ * Register Better-Auth's admin client plugin (`admin.*`, default: false).
74
+ *
75
+ * `@lenne.tech/nest-server` does not register the server-side `admin()` plugin, so the routes
76
+ * answer 404, and `admin.createUser` / `admin.setUserPassword` are not password-hashed by this
77
+ * module. Switch it on only for a backend that serves them; `useLtAuth()` warns once when it is on
78
+ * and `/iam/features` reports no admin plugin. It does not affect `isAdmin`.
79
+ */
67
80
  enableAdmin?: boolean;
68
81
  /** Enable passkey plugin (default: true) */
69
82
  enablePasskey?: boolean;
@@ -90,10 +103,12 @@ export interface LtTusModuleOptions {
90
103
  /** Default chunk size in bytes (default: 5MB) */
91
104
  defaultChunkSize?: number;
92
105
  /**
93
- * Default TUS upload endpoint (default: '/files/upload').
106
+ * Default TUS upload endpoint (default: '/tus', nest-server's TUS path unless its `tus.path` is
107
+ * changed; before DEV-4072 the default was '/files/upload').
94
108
  *
95
- * nest-server serves TUS at `/tus` unless its `tus.path` is changed. A relative value is a path
96
- * on the API while `resolveAgainstApi` is on; an absolute URL is used as it is.
109
+ * A relative value is a path on the API while `resolveAgainstApi` is on; an absolute URL is used
110
+ * as it is. An endpoint ending in `/upload` also sets the base of the `useLtFile()` routes
111
+ * (`'/api/files/upload'` → `'/api/files'`); any other endpoint leaves them at `/files`.
97
112
  */
98
113
  defaultEndpoint?: string;
99
114
  /**
@@ -103,6 +118,9 @@ export interface LtTusModuleOptions {
103
118
  * `/api` dev-proxy prefix while `NUXT_PUBLIC_API_PROXY` is on. Without it, a relative endpoint
104
119
  * goes to the app origin, where nothing serves TUS unless the project put its own proxy in
105
120
  * front. Set it to `false` for exactly that setup. Absolute endpoints are never rewritten.
121
+ *
122
+ * Also governs the file routes of `useLtFile()` (links, downloads, file info), which are API
123
+ * routes as well.
106
124
  */
107
125
  resolveAgainstApi?: boolean;
108
126
  }
@@ -129,11 +129,11 @@ export interface UseLtFileReturn {
129
129
  formatDuration: (seconds: number) => string;
130
130
  /** Format bytes to human readable string (e.g., "1.5 MB") */
131
131
  formatFileSize: (bytes: number) => string;
132
- /** Get download URL for a file by ID */
132
+ /** Download URL of a file by ID (nest-server `GET /files/id/:id`; `filename` is ignored, the server names the download after the stored file) */
133
133
  getDownloadUrl: (id: string, filename?: string) => string;
134
134
  /** Get file info from the server by ID */
135
135
  getFileInfo: (id: string | undefined) => Promise<LtFileInfo | null | string>;
136
- /** Get direct file URL by ID */
136
+ /** URL of a file by ID (nest-server `GET /files/id/:id`) */
137
137
  getFileUrl: (id: string) => string;
138
138
  /** Check if a string is a valid MongoDB ObjectId */
139
139
  isValidMongoID: (id: string) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lenne.tech/nuxt-extensions",
3
- "version": "1.27.0",
3
+ "version": "4.0.0",
4
4
  "description": "Reusable Nuxt 4 composables, components, and Better-Auth integration for lenne.tech projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -82,9 +82,11 @@
82
82
  },
83
83
  "peerDependencies": {
84
84
  "@better-auth/passkey": ">=1.7.16 <1.8.0",
85
+ "@nuxt/ui": ">=3.0.0",
85
86
  "@playwright/test": ">=1.0.0",
86
87
  "better-auth": ">=1.7.16 <1.8.0",
87
88
  "nuxt": "^4.0.0",
89
+ "tailwindcss": ">=4.0.0",
88
90
  "tus-js-client": ">=4.0.0"
89
91
  },
90
92
  "peerDependenciesMeta": {
@@ -94,9 +96,15 @@
94
96
  "@better-auth/passkey": {
95
97
  "optional": true
96
98
  },
99
+ "@nuxt/ui": {
100
+ "optional": true
101
+ },
97
102
  "@playwright/test": {
98
103
  "optional": true
99
104
  },
105
+ "tailwindcss": {
106
+ "optional": true
107
+ },
100
108
  "tus-js-client": {
101
109
  "optional": true
102
110
  }
@@ -120,6 +128,7 @@
120
128
  "oxlint-tsgolint": "7.0.2005",
121
129
  "reka-ui": "2.11.0",
122
130
  "semver": "7.8.6",
131
+ "tailwindcss": "4.3.4",
123
132
  "tus-js-client": "4.3.1",
124
133
  "typescript": "5.9.3",
125
134
  "vitest": "5.1.0",