@wopr-network/platform-core 1.14.3 → 1.14.4
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/auth/better-auth.js
CHANGED
|
@@ -189,7 +189,14 @@ export function initBetterAuth(config) {
|
|
|
189
189
|
export async function runAuthMigrations() {
|
|
190
190
|
if (!_config)
|
|
191
191
|
throw new Error("BetterAuth not initialized — call initBetterAuth() first");
|
|
192
|
-
|
|
192
|
+
// better-auth 1.5.x moved getMigrations from "better-auth/db" to "better-auth/db/migration"
|
|
193
|
+
let getMigrations;
|
|
194
|
+
try {
|
|
195
|
+
({ getMigrations } = (await import("better-auth/db/migration")));
|
|
196
|
+
}
|
|
197
|
+
catch {
|
|
198
|
+
({ getMigrations } = (await import("better-auth/db")));
|
|
199
|
+
}
|
|
193
200
|
const { runMigrations } = await getMigrations(authOptions(_config));
|
|
194
201
|
await runMigrations();
|
|
195
202
|
if (_config.twoFactor !== false) {
|
package/package.json
CHANGED
package/src/auth/better-auth.ts
CHANGED
|
@@ -264,7 +264,13 @@ export function initBetterAuth(config: BetterAuthConfig): void {
|
|
|
264
264
|
export async function runAuthMigrations(): Promise<void> {
|
|
265
265
|
if (!_config) throw new Error("BetterAuth not initialized — call initBetterAuth() first");
|
|
266
266
|
type DbModule = { getMigrations: (opts: BetterAuthOptions) => Promise<{ runMigrations: () => Promise<void> }> };
|
|
267
|
-
|
|
267
|
+
// better-auth 1.5.x moved getMigrations from "better-auth/db" to "better-auth/db/migration"
|
|
268
|
+
let getMigrations: DbModule["getMigrations"];
|
|
269
|
+
try {
|
|
270
|
+
({ getMigrations } = (await import("better-auth/db/migration")) as unknown as DbModule);
|
|
271
|
+
} catch {
|
|
272
|
+
({ getMigrations } = (await import("better-auth/db")) as unknown as DbModule);
|
|
273
|
+
}
|
|
268
274
|
const { runMigrations } = await getMigrations(authOptions(_config));
|
|
269
275
|
await runMigrations();
|
|
270
276
|
if (_config.twoFactor !== false) {
|