create-z3 0.0.54 → 0.0.56
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/package.json +1 -1
- package/templates/nextjs/convex/auth/index.ts +2 -2
- package/templates/nextjs/convex/auth/plugins/index.ts +5 -3
- package/templates/nextjs/convex/http.ts +16 -3
- package/templates/nextjs/src/app/(frontend)/@auth/(...)auth/[pathname]/view.tsx +1 -1
- package/templates/tanstack-start/convex/auth/index.ts +2 -2
- package/templates/tanstack-start/convex/auth/plugins/index.ts +5 -3
- package/templates/tanstack-start/convex/http.ts +11 -0
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@ import type { DataModel } from "../_generated/dataModel"
|
|
|
14
14
|
|
|
15
15
|
import schema from "../schema"
|
|
16
16
|
import { convexAdapter } from "./adapter"
|
|
17
|
-
import
|
|
17
|
+
import { createPlugins } from "./plugins"
|
|
18
18
|
|
|
19
19
|
export const createAuth = (
|
|
20
20
|
ctx: GenericActionCtx<DataModel>,
|
|
@@ -31,7 +31,7 @@ export const createAuth = (
|
|
|
31
31
|
logger: {
|
|
32
32
|
disabled: optionsOnly
|
|
33
33
|
},
|
|
34
|
-
plugins:
|
|
34
|
+
plugins: createPlugins(),
|
|
35
35
|
secret: process.env.BETTER_AUTH_SECRET,
|
|
36
36
|
session: {
|
|
37
37
|
modelName: TABLE_SLUG_SESSIONS
|
|
@@ -5,7 +5,11 @@ import { convex } from "@convex-dev/better-auth/plugins"
|
|
|
5
5
|
import { USER_ROLES } from "~/db/constants"
|
|
6
6
|
import authConfig from "@convex/auth.config"
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// Return a new array each call so plugin initialization (including the convex()
|
|
9
|
+
// factory which internally calls the deprecated oidc-provider plugin) runs inside
|
|
10
|
+
// createAuth() rather than at module-eval time. This lets the console.warn filter
|
|
11
|
+
// in http.ts suppress the deprecation noise before it fires.
|
|
12
|
+
export const createPlugins = () => [
|
|
9
13
|
admin({
|
|
10
14
|
adminRoles: [USER_ROLES.admin],
|
|
11
15
|
defaultRole: USER_ROLES.user,
|
|
@@ -14,5 +18,3 @@ const plugins = [
|
|
|
14
18
|
nextCookies(),
|
|
15
19
|
convex({ authConfig }),
|
|
16
20
|
]
|
|
17
|
-
|
|
18
|
-
export default plugins
|
|
@@ -7,9 +7,22 @@ const http = httpRouter();
|
|
|
7
7
|
|
|
8
8
|
// Auth request handler - basePath hardcoded to /api/auth for now
|
|
9
9
|
const authRequestHandler = httpAction(async (ctx, request) => {
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
// Suppress the oidc-provider deprecation warning spammed by @convex-dev/better-auth
|
|
11
|
+
// on every request. Convex wraps console.warn per-invocation, so this must run
|
|
12
|
+
// inside the handler (not at module level) to intercept after Convex's wrapper is set.
|
|
13
|
+
// Remove once @convex-dev/better-auth migrates to @better-auth/oauth-provider.
|
|
14
|
+
const _warn = console.warn;
|
|
15
|
+
console.warn = (...args: unknown[]) => {
|
|
16
|
+
if (typeof args[0] === "string" && args[0].includes("oidc-provider")) return;
|
|
17
|
+
_warn(...args);
|
|
18
|
+
};
|
|
19
|
+
try {
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
21
|
+
const auth = createAuth(ctx);
|
|
22
|
+
return await auth.handler(request);
|
|
23
|
+
} finally {
|
|
24
|
+
console.warn = _warn;
|
|
25
|
+
}
|
|
13
26
|
});
|
|
14
27
|
|
|
15
28
|
// Register auth routes for GET and POST
|
|
@@ -12,7 +12,7 @@ export default function AuthCard({ pathname }: { pathname: string }) {
|
|
|
12
12
|
</Activity>
|
|
13
13
|
<DialogContent
|
|
14
14
|
aria-describedby={undefined}
|
|
15
|
-
className="grid place-items-center
|
|
15
|
+
className="grid place-items-center bg-transparent ring-transparent shadow-none"
|
|
16
16
|
showCloseButton={false}
|
|
17
17
|
>
|
|
18
18
|
<AuthView path={pathname} />
|
|
@@ -14,7 +14,7 @@ import type { DataModel } from "../_generated/dataModel"
|
|
|
14
14
|
|
|
15
15
|
import schema from "../schema"
|
|
16
16
|
import { convexAdapter } from "./adapter"
|
|
17
|
-
import
|
|
17
|
+
import { createPlugins } from "./plugins"
|
|
18
18
|
|
|
19
19
|
export const createAuth = (
|
|
20
20
|
ctx: GenericActionCtx<DataModel>,
|
|
@@ -31,7 +31,7 @@ export const createAuth = (
|
|
|
31
31
|
logger: {
|
|
32
32
|
disabled: optionsOnly
|
|
33
33
|
},
|
|
34
|
-
plugins:
|
|
34
|
+
plugins: createPlugins(),
|
|
35
35
|
secret: process.env.BETTER_AUTH_SECRET,
|
|
36
36
|
session: {
|
|
37
37
|
modelName: TABLE_SLUG_SESSIONS
|
|
@@ -4,7 +4,11 @@ import { convex } from "@convex-dev/better-auth/plugins"
|
|
|
4
4
|
import authConfig from "@convex/auth.config"
|
|
5
5
|
import { USER_ROLES } from "~/db/constants"
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// Return a new array each call so plugin initialization (including the convex()
|
|
8
|
+
// factory which internally calls the deprecated oidc-provider plugin) runs inside
|
|
9
|
+
// createAuth() rather than at module-eval time. This lets the console.warn filter
|
|
10
|
+
// in http.ts suppress the deprecation noise before it fires.
|
|
11
|
+
export const createPlugins = () => [
|
|
8
12
|
admin({
|
|
9
13
|
adminRoles: [USER_ROLES.admin],
|
|
10
14
|
defaultRole: USER_ROLES.user
|
|
@@ -12,5 +16,3 @@ const plugins = [
|
|
|
12
16
|
apiKey(),
|
|
13
17
|
convex({ authConfig }),
|
|
14
18
|
]
|
|
15
|
-
|
|
16
|
-
export default plugins
|
|
@@ -8,6 +8,15 @@ const http = httpRouter()
|
|
|
8
8
|
* Auth handler - handles Better Auth requests with custom adapter
|
|
9
9
|
*/
|
|
10
10
|
const authRequestHandler = httpAction(async (ctx, request) => {
|
|
11
|
+
// Suppress the oidc-provider deprecation warning spammed by @convex-dev/better-auth
|
|
12
|
+
// on every request. Convex wraps console.warn per-invocation, so this must run
|
|
13
|
+
// inside the handler (not at module level) to intercept after Convex's wrapper is set.
|
|
14
|
+
// Remove once @convex-dev/better-auth migrates to @better-auth/oauth-provider.
|
|
15
|
+
const _warn = console.warn
|
|
16
|
+
console.warn = (...args: unknown[]) => {
|
|
17
|
+
if (typeof args[0] === "string" && args[0].includes("oidc-provider")) return
|
|
18
|
+
_warn(...args)
|
|
19
|
+
}
|
|
11
20
|
try {
|
|
12
21
|
const auth = createAuth(ctx)
|
|
13
22
|
const response = await auth.handler(request)
|
|
@@ -15,6 +24,8 @@ const authRequestHandler = httpAction(async (ctx, request) => {
|
|
|
15
24
|
} catch (error) {
|
|
16
25
|
console.error("❌ Auth error:", error)
|
|
17
26
|
return new Response("Auth error", { status: 500 })
|
|
27
|
+
} finally {
|
|
28
|
+
console.warn = _warn
|
|
18
29
|
}
|
|
19
30
|
})
|
|
20
31
|
|