better-auth-nuxt 0.0.4 → 0.0.6
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.mts
CHANGED
|
@@ -6,7 +6,6 @@ interface ModuleServerOptions extends Pick<BetterAuthOptions, 'appName' | 'baseU
|
|
|
6
6
|
interface ModuleClientOptions extends Pick<ClientOptions, 'baseURL' | 'basePath' | 'disableDefaultFetchPlugins'> {
|
|
7
7
|
}
|
|
8
8
|
interface ModuleOptions {
|
|
9
|
-
baseUrl: string;
|
|
10
9
|
/**
|
|
11
10
|
* auth endpoint
|
|
12
11
|
* @default 'api/auth/**'
|
|
@@ -24,11 +23,11 @@ interface ModuleOptions {
|
|
|
24
23
|
/**
|
|
25
24
|
* client options object or path to client setup script
|
|
26
25
|
*/
|
|
27
|
-
client
|
|
26
|
+
client?: ModuleClientOptions;
|
|
28
27
|
/**
|
|
29
28
|
* server options object or path to server setup script
|
|
30
29
|
*/
|
|
31
|
-
server
|
|
30
|
+
server?: ModuleServerOptions;
|
|
32
31
|
};
|
|
33
32
|
/**
|
|
34
33
|
* redirect options
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -14,6 +14,11 @@ async function serverAuth({ options }) {
|
|
|
14
14
|
return `import ${config.key} from "${config.path}"`;
|
|
15
15
|
}),
|
|
16
16
|
"const betterAuthConfigs = mergeDeep({all: true})({},",
|
|
17
|
+
"{",
|
|
18
|
+
...options.moduleOptions?.options?.server ? Object.entries(options.moduleOptions.options.server).map(([key, value]) => {
|
|
19
|
+
return ` ${key}: ${JSON.stringify(value)},`;
|
|
20
|
+
}) : [],
|
|
21
|
+
"},",
|
|
17
22
|
...options.configs.map((config) => {
|
|
18
23
|
return `${config.key},`;
|
|
19
24
|
}),
|
|
@@ -52,6 +57,9 @@ async function useUserSession({ options }) {
|
|
|
52
57
|
"",
|
|
53
58
|
" const authClient = createAuthClient({",
|
|
54
59
|
" baseURL: url.origin,",
|
|
60
|
+
...options.moduleOptions?.options?.client ? Object.entries(options.moduleOptions.options.client).map(([key, value]) => {
|
|
61
|
+
return ` ${key}: ${JSON.stringify(value)},`;
|
|
62
|
+
}) : [],
|
|
55
63
|
" fetchOptions: {",
|
|
56
64
|
...options.configs.map((config) => {
|
|
57
65
|
return ` ...${config.key}?.fetchOptions || {},`;
|
|
@@ -173,7 +181,6 @@ const module = defineNuxtModule({
|
|
|
173
181
|
logger.withTag("better-auth").error("Missing endpoint option");
|
|
174
182
|
}
|
|
175
183
|
nuxt.options.runtimeConfig.public.betterAuth = defu(nuxt.options.runtimeConfig.public.betterAuth, {
|
|
176
|
-
baseUrl: options.baseUrl,
|
|
177
184
|
endpoint: options.endpoint,
|
|
178
185
|
redirectOptions: options.redirectOptions
|
|
179
186
|
});
|
|
@@ -233,7 +240,7 @@ const module = defineNuxtModule({
|
|
|
233
240
|
const server = registerTemplate({
|
|
234
241
|
filename: "better-auth/server.mjs",
|
|
235
242
|
getContents: serverAuth,
|
|
236
|
-
options: { configs: serverConfigs }
|
|
243
|
+
options: { configs: serverConfigs, moduleOptions: options }
|
|
237
244
|
});
|
|
238
245
|
addTypeTemplate({
|
|
239
246
|
filename: "better-auth/server.d.ts",
|
|
@@ -284,7 +291,7 @@ const module = defineNuxtModule({
|
|
|
284
291
|
const client = registerTemplate({
|
|
285
292
|
filename: "better-auth/client.mjs",
|
|
286
293
|
getContents: useUserSession,
|
|
287
|
-
options: { configs: clientConfigs }
|
|
294
|
+
options: { configs: clientConfigs, moduleOptions: options }
|
|
288
295
|
});
|
|
289
296
|
addTypeTemplate({
|
|
290
297
|
filename: "better-auth/client.d.ts",
|
|
@@ -332,7 +339,7 @@ const module = defineNuxtModule({
|
|
|
332
339
|
]);
|
|
333
340
|
addRouteMiddleware({
|
|
334
341
|
name: "auth",
|
|
335
|
-
path: resolver.resolve("./runtime/middleware/auth
|
|
342
|
+
path: resolver.resolve("./runtime/middleware/auth"),
|
|
336
343
|
global: true
|
|
337
344
|
});
|
|
338
345
|
addTypeTemplate({
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("
|
|
1
|
+
declare const _default: import("nuxt/app").RouteMiddleware;
|
|
2
2
|
export default _default;
|
package/dist/runtime/plugin.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("
|
|
1
|
+
declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest,
|
|
1
|
+
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, any>;
|
|
2
2
|
export default _default;
|