@podosoft/podokit 1.1.5 → 1.1.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/templates/modules/auth/files/apps/api/src/auth/auth.ts +2 -0
- package/dist/templates/modules/auth/files/apps/api/src/auth/schema-validation.ts +13 -0
- package/dist/templates/modules/auth/files/apps/api/src/auth/skip-schema-validation.ts +5 -0
- package/dist/templates/modules/auth/files/apps/api/src/migrate.ts +3 -0
- package/package.json +1 -1
|
@@ -13,6 +13,7 @@ import { oauthProvider } from "@better-auth/oauth-provider";
|
|
|
13
13
|
import { SIGNUP_APPROVAL_REQUIRED } from "@podosoft/podokit-contracts";
|
|
14
14
|
import { runUserDeletedHandlers } from "./user-delete-handlers";
|
|
15
15
|
import { authBaseUrl, authSecret } from "./auth-environment";
|
|
16
|
+
import { authSchemaValidation } from "./schema-validation";
|
|
16
17
|
// podokit:begin:auth-imports
|
|
17
18
|
// podokit:end:auth-imports
|
|
18
19
|
|
|
@@ -226,6 +227,7 @@ export function buildAuth(config: AuthConfig) {
|
|
|
226
227
|
// resolved client IP as x-forwarded-for; trust it so sessions record an IP.
|
|
227
228
|
ipAddressHeaders: ["x-forwarded-for"],
|
|
228
229
|
},
|
|
230
|
+
...(authSchemaValidation() ? {} : { database: { validateSchema: false } }),
|
|
229
231
|
},
|
|
230
232
|
user: {
|
|
231
233
|
additionalFields: {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Better Auth validates the database schema when an instance starts, and fails
|
|
2
|
+
// authentication requests while the schema does not match. Servers keep that check.
|
|
3
|
+
// The migration runner builds an instance only to read its options, before the
|
|
4
|
+
// schema it is about to change exists or matches, so it opts out for its process.
|
|
5
|
+
let validateSchema = true;
|
|
6
|
+
|
|
7
|
+
export function skipAuthSchemaValidation(): void {
|
|
8
|
+
validateSchema = false;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function authSchemaValidation(): boolean {
|
|
12
|
+
return validateSchema;
|
|
13
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Keep this first: Better Auth checks the schema when ./auth/auth creates its
|
|
2
|
+
// instance, and the migrations below are what make that schema match.
|
|
3
|
+
import "./auth/skip-schema-validation";
|
|
1
4
|
import { getMigrations } from "better-auth/db/migration";
|
|
2
5
|
import { auth } from "./auth/auth";
|
|
3
6
|
import { closeAuthDatabase, postgresPool, sqliteDatabase } from "./auth/db";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@podosoft/podokit",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "An opinionated Bun and Elysia full-stack TypeScript starter toolkit and CLI with SvelteKit, TailwindCSS, shadcn-svelte, Docker, and k3s.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|