@onmax/nuxt-better-auth 0.0.2-alpha.17 → 0.0.2-alpha.19
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.json +1 -1
- package/dist/module.mjs +5 -5
- package/dist/runtime/server/api/_better-auth/accounts.get.js +1 -1
- package/dist/runtime/server/api/_better-auth/sessions.delete.js +1 -1
- package/dist/runtime/server/api/_better-auth/sessions.get.js +1 -1
- package/dist/runtime/server/api/_better-auth/users.get.js +1 -1
- package/package.json +2 -2
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import { generateDrizzleSchema as generateDrizzleSchema$1 } from '@better-auth/c
|
|
|
11
11
|
import { getAuthTables } from 'better-auth/db';
|
|
12
12
|
export { defineClientAuth, defineServerAuth } from '../dist/runtime/config.js';
|
|
13
13
|
|
|
14
|
-
const version = "0.0.2-alpha.
|
|
14
|
+
const version = "0.0.2-alpha.19";
|
|
15
15
|
|
|
16
16
|
function setupDevTools(nuxt) {
|
|
17
17
|
nuxt.hook("devtools:customTabs", (tabs) => {
|
|
@@ -384,7 +384,7 @@ export default defineClientAuth({})
|
|
|
384
384
|
if (secondaryStorageEnabled && !nuxt.options.alias["hub:kv"]) {
|
|
385
385
|
throw new Error("[nuxt-better-auth] hub:kv not found. Ensure @nuxthub/core is loaded before this module and hub.kv is enabled.");
|
|
386
386
|
}
|
|
387
|
-
const secondaryStorageCode = secondaryStorageEnabled ? `import { kv } from '
|
|
387
|
+
const secondaryStorageCode = secondaryStorageEnabled ? `import { kv } from '@nuxthub/kv'
|
|
388
388
|
export function createSecondaryStorage() {
|
|
389
389
|
return {
|
|
390
390
|
get: async (key) => kv.get(\`_auth:\${key}\`),
|
|
@@ -402,7 +402,7 @@ export function createSecondaryStorage() {
|
|
|
402
402
|
const camelCase = (options.schema?.casing ?? getHubCasing(hub)) !== "snake_case";
|
|
403
403
|
let databaseCode;
|
|
404
404
|
if (hasHubDb) {
|
|
405
|
-
databaseCode = `import { db, schema } from '
|
|
405
|
+
databaseCode = `import { db, schema } from '@nuxthub/db'
|
|
406
406
|
import { drizzleAdapter } from 'better-auth/adapters/drizzle'
|
|
407
407
|
const rawDialect = '${hubDialect}'
|
|
408
408
|
const dialect = rawDialect === 'postgresql' ? 'pg' : rawDialect
|
|
@@ -467,7 +467,7 @@ declare module '#nuxt-better-auth' {
|
|
|
467
467
|
interface AuthSession extends InferSession<_Config> {}
|
|
468
468
|
interface ServerAuthContext {
|
|
469
469
|
runtimeConfig: RuntimeConfig
|
|
470
|
-
${hasHubDb ? `db: typeof import('
|
|
470
|
+
${hasHubDb ? `db: typeof import('@nuxthub/db')['db']` : ""}
|
|
471
471
|
}
|
|
472
472
|
type PluginTypes = InferPluginTypes<_Config>
|
|
473
473
|
}
|
|
@@ -475,7 +475,7 @@ declare module '#nuxt-better-auth' {
|
|
|
475
475
|
// Augment the config module to use the extended ServerAuthContext
|
|
476
476
|
interface _AugmentedServerAuthContext {
|
|
477
477
|
runtimeConfig: RuntimeConfig
|
|
478
|
-
${hasHubDb ? `db: typeof import('
|
|
478
|
+
${hasHubDb ? `db: typeof import('@nuxthub/db')['db']` : "db: unknown"}
|
|
479
479
|
}
|
|
480
480
|
|
|
481
481
|
declare module '@onmax/nuxt-better-auth/config' {
|
|
@@ -2,7 +2,7 @@ import { defineEventHandler, getQuery } from "h3";
|
|
|
2
2
|
import { paginationQuerySchema, sanitizeSearchPattern } from "./_schema.js";
|
|
3
3
|
export default defineEventHandler(async (event) => {
|
|
4
4
|
try {
|
|
5
|
-
const { db, schema } = await import("
|
|
5
|
+
const { db, schema } = await import("@nuxthub/db");
|
|
6
6
|
if (!schema.account)
|
|
7
7
|
return { accounts: [], total: 0, error: "Account table not found" };
|
|
8
8
|
const query = paginationQuerySchema.parse(getQuery(event));
|
|
@@ -6,7 +6,7 @@ const deleteSessionSchema = z.object({
|
|
|
6
6
|
export default defineEventHandler(async (event) => {
|
|
7
7
|
try {
|
|
8
8
|
const body = deleteSessionSchema.parse(await readBody(event));
|
|
9
|
-
const { db, schema } = await import("
|
|
9
|
+
const { db, schema } = await import("@nuxthub/db");
|
|
10
10
|
if (!schema.session)
|
|
11
11
|
throw createError({ statusCode: 500, message: "Session table not found" });
|
|
12
12
|
const { eq } = await import("drizzle-orm");
|
|
@@ -2,7 +2,7 @@ import { defineEventHandler, getQuery } from "h3";
|
|
|
2
2
|
import { paginationQuerySchema, sanitizeSearchPattern } from "./_schema.js";
|
|
3
3
|
export default defineEventHandler(async (event) => {
|
|
4
4
|
try {
|
|
5
|
-
const { db, schema } = await import("
|
|
5
|
+
const { db, schema } = await import("@nuxthub/db");
|
|
6
6
|
if (!schema.session)
|
|
7
7
|
return { sessions: [], total: 0, error: "Session table not found" };
|
|
8
8
|
const query = paginationQuerySchema.parse(getQuery(event));
|
|
@@ -2,7 +2,7 @@ import { defineEventHandler, getQuery } from "h3";
|
|
|
2
2
|
import { paginationQuerySchema, sanitizeSearchPattern } from "./_schema.js";
|
|
3
3
|
export default defineEventHandler(async (event) => {
|
|
4
4
|
try {
|
|
5
|
-
const { db, schema } = await import("
|
|
5
|
+
const { db, schema } = await import("@nuxthub/db");
|
|
6
6
|
if (!schema.user)
|
|
7
7
|
return { users: [], total: 0, error: "User table not found" };
|
|
8
8
|
const query = paginationQuerySchema.parse(getQuery(event));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onmax/nuxt-better-auth",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.2-alpha.
|
|
4
|
+
"version": "0.0.2-alpha.19",
|
|
5
5
|
"packageManager": "pnpm@10.15.1",
|
|
6
6
|
"description": "Nuxt module for Better Auth integration with NuxtHub, route protection, session management, and role-based access",
|
|
7
7
|
"author": "onmax",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"test:watch": "vitest watch"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@nuxthub/core": ">=0.10.
|
|
69
|
+
"@nuxthub/core": ">=0.10.5",
|
|
70
70
|
"better-auth": ">=1.0.0",
|
|
71
71
|
"convex": ">=1.25.0"
|
|
72
72
|
},
|