@xk2800/nextjs-template 0.7.2-beta.1 → 0.7.2-beta.2
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/api/feedback.js +12 -0
- package/dist/api/feedback.js.map +1 -1
- package/dist/api/feedback.mjs +1 -1
- package/dist/api/marketing.js +12 -0
- package/dist/api/marketing.js.map +1 -1
- package/dist/api/marketing.mjs +2 -2
- package/dist/auth/helpers.d.mts +3 -3
- package/dist/auth/helpers.d.ts +3 -3
- package/dist/auth/helpers.js +12 -0
- package/dist/auth/helpers.js.map +1 -1
- package/dist/auth/helpers.mjs +2 -2
- package/dist/auth/index.d.mts +18 -0
- package/dist/auth/index.d.ts +18 -0
- package/dist/auth/index.js +12 -0
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/index.mjs +1 -1
- package/dist/auth-client/index.d.mts +16 -16
- package/dist/auth-client/index.d.ts +16 -16
- package/dist/{chunk-EIS4SCQW.mjs → chunk-K2GCSLRJ.mjs} +14 -2
- package/dist/chunk-K2GCSLRJ.mjs.map +1 -0
- package/dist/{chunk-H3XZTZ5K.mjs → chunk-VVXYKVFJ.mjs} +3 -3
- package/dist/{chunk-H3XZTZ5K.mjs.map → chunk-VVXYKVFJ.mjs.map} +1 -1
- package/package.json +1 -1
- package/dist/chunk-EIS4SCQW.mjs.map +0 -1
package/dist/auth/helpers.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { getCurrentSession, hasRole, normalizeCallbackUrl, requireAuth, requireRole } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { getCurrentSession, hasRole, normalizeCallbackUrl, requireAuth, requireRole } from '../chunk-VVXYKVFJ.mjs';
|
|
2
|
+
import '../chunk-K2GCSLRJ.mjs';
|
|
3
3
|
import '../chunk-O5EQYHNC.mjs';
|
|
4
4
|
import '../chunk-6OAHCEDJ.mjs';
|
|
5
5
|
import '../chunk-2BJ3B4FR.mjs';
|
package/dist/auth/index.d.mts
CHANGED
|
@@ -82,6 +82,15 @@ declare function createAuth(overrides?: AuthOverrides): better_auth.Auth<{
|
|
|
82
82
|
};
|
|
83
83
|
emailVerification: {
|
|
84
84
|
autoSignInAfterVerification: true;
|
|
85
|
+
afterEmailVerification(user: {
|
|
86
|
+
id: string;
|
|
87
|
+
createdAt: Date;
|
|
88
|
+
updatedAt: Date;
|
|
89
|
+
email: string;
|
|
90
|
+
emailVerified: boolean;
|
|
91
|
+
name: string;
|
|
92
|
+
image?: string | null | undefined;
|
|
93
|
+
}): Promise<void>;
|
|
85
94
|
sendVerificationEmail({ user, url }: {
|
|
86
95
|
user: better_auth.User;
|
|
87
96
|
url: string;
|
|
@@ -2410,6 +2419,15 @@ declare const auth: better_auth.Auth<{
|
|
|
2410
2419
|
};
|
|
2411
2420
|
emailVerification: {
|
|
2412
2421
|
autoSignInAfterVerification: true;
|
|
2422
|
+
afterEmailVerification(user: {
|
|
2423
|
+
id: string;
|
|
2424
|
+
createdAt: Date;
|
|
2425
|
+
updatedAt: Date;
|
|
2426
|
+
email: string;
|
|
2427
|
+
emailVerified: boolean;
|
|
2428
|
+
name: string;
|
|
2429
|
+
image?: string | null | undefined;
|
|
2430
|
+
}): Promise<void>;
|
|
2413
2431
|
sendVerificationEmail({ user, url }: {
|
|
2414
2432
|
user: better_auth.User;
|
|
2415
2433
|
url: string;
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -82,6 +82,15 @@ declare function createAuth(overrides?: AuthOverrides): better_auth.Auth<{
|
|
|
82
82
|
};
|
|
83
83
|
emailVerification: {
|
|
84
84
|
autoSignInAfterVerification: true;
|
|
85
|
+
afterEmailVerification(user: {
|
|
86
|
+
id: string;
|
|
87
|
+
createdAt: Date;
|
|
88
|
+
updatedAt: Date;
|
|
89
|
+
email: string;
|
|
90
|
+
emailVerified: boolean;
|
|
91
|
+
name: string;
|
|
92
|
+
image?: string | null | undefined;
|
|
93
|
+
}): Promise<void>;
|
|
85
94
|
sendVerificationEmail({ user, url }: {
|
|
86
95
|
user: better_auth.User;
|
|
87
96
|
url: string;
|
|
@@ -2410,6 +2419,15 @@ declare const auth: better_auth.Auth<{
|
|
|
2410
2419
|
};
|
|
2411
2420
|
emailVerification: {
|
|
2412
2421
|
autoSignInAfterVerification: true;
|
|
2422
|
+
afterEmailVerification(user: {
|
|
2423
|
+
id: string;
|
|
2424
|
+
createdAt: Date;
|
|
2425
|
+
updatedAt: Date;
|
|
2426
|
+
email: string;
|
|
2427
|
+
emailVerified: boolean;
|
|
2428
|
+
name: string;
|
|
2429
|
+
image?: string | null | undefined;
|
|
2430
|
+
}): Promise<void>;
|
|
2413
2431
|
sendVerificationEmail({ user, url }: {
|
|
2414
2432
|
user: better_auth.User;
|
|
2415
2433
|
url: string;
|
package/dist/auth/index.js
CHANGED
|
@@ -1236,6 +1236,14 @@ async function packageSessionCreated(log, ...[session, context]) {
|
|
|
1236
1236
|
console.error("Failed to log login activity", error);
|
|
1237
1237
|
}
|
|
1238
1238
|
}
|
|
1239
|
+
async function promoteFirstAdmin(user) {
|
|
1240
|
+
var _a;
|
|
1241
|
+
const adminEmail = (_a = process.env.ADMIN_EMAIL) == null ? void 0 : _a.trim().toLowerCase();
|
|
1242
|
+
if (!adminEmail || !user.emailVerified || user.email.toLowerCase() !== adminEmail) return;
|
|
1243
|
+
const [existing] = await db.select({ id: users.id }).from(users).where(drizzleOrm.eq(users.role, "admin")).limit(1);
|
|
1244
|
+
if (existing) return;
|
|
1245
|
+
await db.update(users).set({ role: "admin" }).where(drizzleOrm.eq(users.id, user.id));
|
|
1246
|
+
}
|
|
1239
1247
|
function createAuth(overrides = {}) {
|
|
1240
1248
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1241
1249
|
const socialProviders = __spreadValues(__spreadValues({}, config.AUTH_ENABLE_GOOGLE ? {
|
|
@@ -1315,6 +1323,9 @@ function createAuth(overrides = {}) {
|
|
|
1315
1323
|
// callback that flips users.emailVerified on click.
|
|
1316
1324
|
emailVerification: {
|
|
1317
1325
|
autoSignInAfterVerification: true,
|
|
1326
|
+
async afterEmailVerification(user) {
|
|
1327
|
+
await promoteFirstAdmin(user);
|
|
1328
|
+
},
|
|
1318
1329
|
async sendVerificationEmail({ user, url }) {
|
|
1319
1330
|
const { EmailTemplateVerifyEmail: EmailTemplateVerifyEmail2 } = await Promise.resolve().then(() => (init_email_template_verify_email(), email_template_verify_email_exports));
|
|
1320
1331
|
await (await getResend()).emails.send({
|
|
@@ -1358,6 +1369,7 @@ function createAuth(overrides = {}) {
|
|
|
1358
1369
|
create: {
|
|
1359
1370
|
async after(user, context) {
|
|
1360
1371
|
var _a2, _b2, _c2, _d2;
|
|
1372
|
+
await promoteFirstAdmin(user);
|
|
1361
1373
|
await ((_d2 = (_c2 = (_b2 = (_a2 = overrides.databaseHooks) == null ? void 0 : _a2.user) == null ? void 0 : _b2.create) == null ? void 0 : _c2.after) == null ? void 0 : _d2.call(_c2, user, context));
|
|
1362
1374
|
}
|
|
1363
1375
|
}
|