@withwiz/toolkit 0.5.2 → 0.6.1
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/adapters/prisma/index.js +24 -23
- package/dist/auth/config.js +2 -2
- package/dist/auth/core/jwt/cookie.js +3 -3
- package/dist/auth/core/jwt/index.js +3 -3
- package/dist/auth/core/jwt/types.js +2 -1
- package/dist/auth/core/oauth/index.js +2 -1
- package/dist/auth/core/password/client-helper.js +2 -1
- package/dist/auth/core/password/index.js +2 -1
- package/dist/auth/email/index.d.ts +2 -0
- package/dist/auth/email/index.js +7 -0
- package/dist/auth/email/sender.d.ts +54 -0
- package/dist/auth/email/sender.js +7 -0
- package/dist/auth/handlers/forgot-password.handler.d.ts +3 -0
- package/dist/auth/handlers/forgot-password.handler.js +12 -0
- package/dist/auth/handlers/index.d.ts +25 -0
- package/dist/auth/handlers/index.js +79 -0
- package/dist/auth/handlers/login.handler.d.ts +3 -0
- package/dist/auth/handlers/login.handler.js +13 -0
- package/dist/auth/handlers/logout.handler.d.ts +3 -0
- package/dist/auth/handlers/logout.handler.js +11 -0
- package/dist/auth/handlers/me.handler.d.ts +3 -0
- package/dist/auth/handlers/me.handler.js +13 -0
- package/dist/auth/handlers/oauth-authorize.handler.d.ts +3 -0
- package/dist/auth/handlers/oauth-authorize.handler.js +15 -0
- package/dist/auth/handlers/oauth-callback.handler.d.ts +3 -0
- package/dist/auth/handlers/oauth-callback.handler.js +21 -0
- package/dist/auth/handlers/refresh.handler.d.ts +3 -0
- package/dist/auth/handlers/refresh.handler.js +14 -0
- package/dist/auth/handlers/register.handler.d.ts +3 -0
- package/dist/auth/handlers/register.handler.js +12 -0
- package/dist/auth/handlers/reset-password.handler.d.ts +3 -0
- package/dist/auth/handlers/reset-password.handler.js +12 -0
- package/dist/auth/handlers/verify-email.handler.d.ts +3 -0
- package/dist/auth/handlers/verify-email.handler.js +12 -0
- package/dist/auth/index.js +21 -20
- package/dist/auth/services/email-verification.service.d.ts +18 -0
- package/dist/auth/services/email-verification.service.js +11 -0
- package/dist/auth/services/index.d.ts +12 -0
- package/dist/auth/services/index.js +36 -0
- package/dist/auth/services/login.service.d.ts +19 -0
- package/dist/auth/services/login.service.js +13 -0
- package/dist/auth/services/oauth-callback.service.d.ts +32 -0
- package/dist/auth/services/oauth-callback.service.js +13 -0
- package/dist/auth/services/password-reset.service.d.ts +20 -0
- package/dist/auth/services/password-reset.service.js +11 -0
- package/dist/auth/services/register.service.d.ts +28 -0
- package/dist/auth/services/register.service.js +11 -0
- package/dist/auth/services/token-refresh.service.d.ts +25 -0
- package/dist/auth/services/token-refresh.service.js +13 -0
- package/dist/auth/types/handler-types.d.ts +68 -0
- package/dist/auth/types/handler-types.js +1 -0
- package/dist/auth/types/index.d.ts +1 -0
- package/dist/auth/types/index.js +2 -1
- package/dist/cache/cache-config.js +6 -6
- package/dist/cache/cache-env.js +5 -5
- package/dist/cache/cache-factory.js +14 -14
- package/dist/cache/cache-invalidation.js +15 -15
- package/dist/cache/cache-redis.js +8 -8
- package/dist/cache/cache-wrapper.js +15 -15
- package/dist/cache/cache.js +22 -22
- package/dist/cache/config.js +2 -2
- package/dist/cache/hybrid-cache-manager.js +10 -10
- package/dist/cache/index.js +22 -22
- package/dist/cache/inmemory-cache-manager.js +4 -4
- package/dist/cache/noop-cache-manager.js +7 -7
- package/dist/cache/redis-cache-manager.js +9 -9
- package/dist/{chunk-7ZQQ6PJ4.js → chunk-2VMTIYLX.js} +2 -2
- package/dist/{chunk-ZX7PHFX3.js → chunk-3AJHXCDG.js} +2 -2
- package/dist/{chunk-6YQU2AIK.js → chunk-3ECJUXLM.js} +3 -3
- package/dist/{chunk-PEFRPADW.js → chunk-4BGAE7NU.js} +1 -1
- package/dist/chunk-4YQ6YBM7.js +50 -0
- package/dist/chunk-6B7VU6RZ.js +90 -0
- package/dist/chunk-6JY6NUR6.js +38 -0
- package/dist/{chunk-YIB6H6P7.js → chunk-77BJRPMN.js} +4 -4
- package/dist/{chunk-LTEXLSIE.js → chunk-7JKZBEVB.js} +12 -12
- package/dist/{chunk-3TD5OAQS.js → chunk-7KZRPDQD.js} +4 -4
- package/dist/{chunk-QHDOMDC6.js → chunk-BEV7PQM3.js} +1 -1
- package/dist/{chunk-ZRXE4WSP.js → chunk-CKK55QFQ.js} +1 -1
- package/dist/{chunk-PAYLVMZN.js → chunk-CMU52MEQ.js} +6 -6
- package/dist/{chunk-MAATEX2R.js → chunk-CRMXLNLC.js} +1 -1
- package/dist/{chunk-7GKSYCKZ.js → chunk-CW3INZMV.js} +1 -1
- package/dist/{chunk-5FSPXXNB.js → chunk-DBHISLC6.js} +4 -4
- package/dist/chunk-DFSNHVXF.js +54 -0
- package/dist/chunk-ETMTDHK2.js +53 -0
- package/dist/{chunk-HHJZTDXL.js → chunk-EXJQKCTN.js} +6 -6
- package/dist/chunk-FI46LV42.js +56 -0
- package/dist/{chunk-LX2EYD74.js → chunk-FNECYXI4.js} +10 -10
- package/dist/chunk-FRY3TNJ6.js +37 -0
- package/dist/{chunk-ZEIFD4OQ.js → chunk-G2Q4TI3Q.js} +1 -1
- package/dist/{chunk-LCKQOHXI.js → chunk-G5OMETUS.js} +1 -1
- package/dist/chunk-GTPUVHSV.js +30 -0
- package/dist/{chunk-GCR4PGRY.js → chunk-HHCDMWEF.js} +1 -1
- package/dist/{chunk-ENIKCCAV.js → chunk-IHUQRVPV.js} +2 -2
- package/dist/chunk-JQFQT4S2.js +55 -0
- package/dist/{chunk-5E66FUBP.js → chunk-KF3O2DAV.js} +1 -1
- package/dist/chunk-KY7JZ54O.js +62 -0
- package/dist/{chunk-33BG6FPO.js → chunk-L5WLPC2T.js} +1 -1
- package/dist/{chunk-YGJJIC6S.js → chunk-LFKPXF5E.js} +4 -4
- package/dist/{chunk-DCUQNXVP.js → chunk-MDTID4D2.js} +3 -3
- package/dist/{chunk-KHYY4KCV.js → chunk-MEFZZE4M.js} +4 -4
- package/dist/chunk-MGQV723O.js +104 -0
- package/dist/chunk-N6TMHITU.js +49 -0
- package/dist/{chunk-BYHP4EH3.js → chunk-O35V6RIF.js} +3 -3
- package/dist/{chunk-2B4EKCV6.js → chunk-OCI7QCLM.js} +2 -2
- package/dist/{chunk-XKWT6W4K.js → chunk-ON7HZ3PW.js} +1 -1
- package/dist/{chunk-OBNS4ADX.js → chunk-PAF5OGDU.js} +7 -7
- package/dist/{chunk-S2O22ULX.js → chunk-PYVYYO4X.js} +7 -7
- package/dist/{chunk-ORYZZD5P.js → chunk-Q6KXN7HL.js} +2 -2
- package/dist/chunk-Q7VFOUFI.js +68 -0
- package/dist/chunk-QYXI45KH.js +62 -0
- package/dist/chunk-R4SXQYIT.js +0 -0
- package/dist/chunk-S7OQWKUJ.js +83 -0
- package/dist/{chunk-UWD5AHWI.js → chunk-SR3SQL72.js} +2 -2
- package/dist/{chunk-D7OUX5VJ.js → chunk-SSS6XSEG.js} +1 -1
- package/dist/{chunk-L6OEQBOM.js → chunk-TEXVRHPF.js} +1 -1
- package/dist/chunk-TFZOOP3V.js +50 -0
- package/dist/{chunk-HW732FCA.js → chunk-VCOA6LMN.js} +1 -1
- package/dist/{chunk-QWAMNYUT.js → chunk-W2GBKW2T.js} +2 -2
- package/dist/chunk-WC2IYFGC.js +51 -0
- package/dist/{chunk-XIDMCDD3.js → chunk-WJSMXUZB.js} +1 -1
- package/dist/chunk-WNEXLSDB.js +17 -0
- package/dist/{chunk-TCQ2DA6Y.js → chunk-WRWWB2NU.js} +4 -4
- package/dist/{chunk-IPXPCBDO.js → chunk-WVDYHSHD.js} +1 -1
- package/dist/{chunk-4J4D27BV.js → chunk-X6MGVFT3.js} +1 -1
- package/dist/chunk-YZXGOOFC.js +0 -0
- package/dist/components/ui/DataTable.js +10 -9
- package/dist/components/ui/data-table/DataTable.js +9 -9
- package/dist/components/ui/data-table/DataTableBulkActions.js +2 -2
- package/dist/components/ui/data-table/DataTableFilters.js +3 -3
- package/dist/components/ui/data-table/DataTablePagination.js +2 -2
- package/dist/components/ui/data-table/DataTableSearch.js +3 -3
- package/dist/components/ui/data-table/index.js +42 -0
- package/dist/components/ui/data-table/types.js +9 -0
- package/dist/config/common.js +2 -2
- package/dist/config/registry.d.ts +8 -15
- package/dist/config/registry.js +1 -4
- package/dist/error/error-handler.js +4 -4
- package/dist/error/index.js +4 -4
- package/dist/geolocation/batch-processor.js +4 -4
- package/dist/geolocation/config.js +2 -2
- package/dist/geolocation/index.js +12 -12
- package/dist/geolocation/providers/index.js +9 -9
- package/dist/geolocation/providers/ipgeolocation-provider.js +3 -3
- package/dist/geolocation/providers/maxmind-provider.js +3 -3
- package/dist/initialize.d.ts +1 -1
- package/dist/initialize.js +15 -17
- package/dist/logger/config.js +2 -2
- package/dist/logger/logger.js +3 -3
- package/dist/middleware/auth.js +6 -6
- package/dist/middleware/cors-config.js +2 -2
- package/dist/middleware/cors.js +5 -5
- package/dist/middleware/error-handler.js +5 -5
- package/dist/middleware/index.js +15 -15
- package/dist/middleware/middleware-chain.js +4 -4
- package/dist/middleware/rate-limit.js +4 -4
- package/dist/middleware/response-logger.js +4 -4
- package/dist/middleware/security.js +4 -4
- package/dist/middleware/wrappers.js +15 -15
- package/dist/storage/config.js +2 -2
- package/dist/storage/r2-storage.js +2 -2
- package/dist/system/cpu.js +5 -5
- package/dist/system/disk.js +5 -5
- package/dist/system/environment.js +10 -10
- package/dist/system/health-check.js +7 -7
- package/dist/system/index.js +15 -15
- package/dist/system/memory.js +5 -5
- package/dist/system/network.js +5 -5
- package/dist/system/utils.js +4 -4
- package/dist/utils/cors.js +4 -4
- package/dist/utils/csv-export.js +4 -4
- package/dist/utils/error-processor.js +4 -4
- package/dist/utils/index.js +16 -16
- package/package.json +6 -2
- package/dist/chunk-6PGZTY4N.js +0 -30
- package/dist/{chunk-2VNDWG6P.js → chunk-3CBGGMIY.js} +3 -3
- package/dist/{chunk-SEZJN4TC.js → chunk-5UVEOCRU.js} +6 -6
- package/dist/{chunk-OSNQ3TUX.js → chunk-A2XAOU55.js} +3 -3
- package/dist/{chunk-PL33DK2X.js → chunk-AYZJN32D.js} +3 -3
- package/dist/{chunk-23LXAAMU.js → chunk-GFWGLWTS.js} +3 -3
- package/dist/{chunk-NY5QXT33.js → chunk-I6Q3WUDT.js} +0 -0
- package/dist/{chunk-QKC73SWB.js → chunk-ITGUSYUH.js} +0 -0
- package/dist/{chunk-6O3I4ORK.js → chunk-OHBAELPZ.js} +3 -3
- package/dist/{chunk-XICTHSUH.js → chunk-SFPMFVSD.js} +3 -3
- package/dist/{chunk-AN7GU7PF.js → chunk-UCIUAZQT.js} +3 -3
|
@@ -32,35 +32,36 @@ var PrismaUserRepository = class {
|
|
|
32
32
|
return user ? this.mapToBaseUser(user) : null;
|
|
33
33
|
}
|
|
34
34
|
async findByEmail(email) {
|
|
35
|
+
var _a;
|
|
35
36
|
const user = await this.prisma.user.findUnique({ where: { email } });
|
|
36
|
-
|
|
37
|
+
if (!user) return null;
|
|
38
|
+
const baseUser = this.mapToBaseUser(user);
|
|
39
|
+
return Object.assign(baseUser, { password: (_a = user[this.config.userFields.password]) != null ? _a : null });
|
|
37
40
|
}
|
|
38
41
|
async create(data) {
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
const createData = {
|
|
43
|
+
email: data.email,
|
|
44
|
+
name: data.name || null
|
|
45
|
+
};
|
|
46
|
+
createData[this.config.userFields.password] = data.password || null;
|
|
47
|
+
if (this.config.userFields.role !== "role" || data.role) {
|
|
48
|
+
createData[this.config.userFields.role] = data.role || "USER";
|
|
49
|
+
}
|
|
50
|
+
createData[this.config.userFields.emailVerified] = data.emailVerified || null;
|
|
51
|
+
createData[this.config.userFields.image] = data.image || null;
|
|
52
|
+
const user = await this.prisma.user.create({ data: createData });
|
|
49
53
|
return this.mapToBaseUser(user);
|
|
50
54
|
}
|
|
51
55
|
async update(id, data) {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
image: data.image
|
|
62
|
-
}
|
|
63
|
-
});
|
|
56
|
+
const updateData = {};
|
|
57
|
+
if (data.email !== void 0) updateData.email = data.email;
|
|
58
|
+
if (data.name !== void 0) updateData.name = data.name;
|
|
59
|
+
if (data.isActive !== void 0) updateData.isActive = data.isActive;
|
|
60
|
+
if (data.password !== void 0) updateData[this.config.userFields.password] = data.password;
|
|
61
|
+
if (data.role !== void 0) updateData[this.config.userFields.role] = data.role;
|
|
62
|
+
if (data.emailVerified !== void 0) updateData[this.config.userFields.emailVerified] = data.emailVerified;
|
|
63
|
+
if (data.image !== void 0) updateData[this.config.userFields.image] = data.image;
|
|
64
|
+
const user = await this.prisma.user.update({ where: { id }, data: updateData });
|
|
64
65
|
return this.mapToBaseUser(user);
|
|
65
66
|
}
|
|
66
67
|
async delete(id) {
|
package/dist/auth/config.js
CHANGED
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
getAuthConfig,
|
|
3
3
|
initializeAuth,
|
|
4
4
|
resetAuth
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-2QH66EVQ.js";
|
|
5
|
+
} from "../chunk-A2XAOU55.js";
|
|
7
6
|
import "../chunk-K25ICPU4.js";
|
|
7
|
+
import "../chunk-2QH66EVQ.js";
|
|
8
8
|
import "../chunk-ORMEWXMH.js";
|
|
9
9
|
export {
|
|
10
10
|
getAuthConfig,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clearTokenCookies,
|
|
3
3
|
setTokenCookies
|
|
4
|
-
} from "../../../chunk-
|
|
5
|
-
import "../../../chunk-
|
|
6
|
-
import "../../../chunk-2QH66EVQ.js";
|
|
4
|
+
} from "../../../chunk-G2Q4TI3Q.js";
|
|
5
|
+
import "../../../chunk-A2XAOU55.js";
|
|
7
6
|
import "../../../chunk-K25ICPU4.js";
|
|
7
|
+
import "../../../chunk-2QH66EVQ.js";
|
|
8
8
|
import "../../../chunk-ORMEWXMH.js";
|
|
9
9
|
export {
|
|
10
10
|
clearTokenCookies,
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
clearTokenCookies,
|
|
7
7
|
setTokenCookies
|
|
8
|
-
} from "../../../chunk-
|
|
8
|
+
} from "../../../chunk-G2Q4TI3Q.js";
|
|
9
9
|
import "../../../chunk-AIH3F7JV.js";
|
|
10
|
-
import "../../../chunk-
|
|
11
|
-
import "../../../chunk-2QH66EVQ.js";
|
|
10
|
+
import "../../../chunk-A2XAOU55.js";
|
|
12
11
|
import "../../../chunk-K25ICPU4.js";
|
|
12
|
+
import "../../../chunk-2QH66EVQ.js";
|
|
13
13
|
import "../../../chunk-ORMEWXMH.js";
|
|
14
14
|
export {
|
|
15
15
|
JWTManager,
|
|
@@ -13,7 +13,8 @@ import {
|
|
|
13
13
|
} from "../../../chunk-RVL5ROWQ.js";
|
|
14
14
|
import {
|
|
15
15
|
OAUTH_PROVIDERS
|
|
16
|
-
} from "../../../chunk-
|
|
16
|
+
} from "../../../chunk-ITGUSYUH.js";
|
|
17
|
+
import "../../../chunk-YZXGOOFC.js";
|
|
17
18
|
import "../../../chunk-AIH3F7JV.js";
|
|
18
19
|
import "../../../chunk-ORMEWXMH.js";
|
|
19
20
|
export {
|
|
@@ -12,7 +12,8 @@ import {
|
|
|
12
12
|
PasswordHasher,
|
|
13
13
|
PasswordValidator
|
|
14
14
|
} from "../../../chunk-IHXRF3BH.js";
|
|
15
|
-
import "../../../chunk-
|
|
15
|
+
import "../../../chunk-ITGUSYUH.js";
|
|
16
|
+
import "../../../chunk-YZXGOOFC.js";
|
|
16
17
|
import "../../../chunk-ORMEWXMH.js";
|
|
17
18
|
export {
|
|
18
19
|
DEFAULT_PASSWORD_CONFIG,
|
|
@@ -4,7 +4,8 @@ import {
|
|
|
4
4
|
defaultPasswordSchema,
|
|
5
5
|
strongPasswordSchema
|
|
6
6
|
} from "../../../chunk-IHXRF3BH.js";
|
|
7
|
-
import "../../../chunk-
|
|
7
|
+
import "../../../chunk-ITGUSYUH.js";
|
|
8
|
+
import "../../../chunk-YZXGOOFC.js";
|
|
8
9
|
import "../../../chunk-ORMEWXMH.js";
|
|
9
10
|
export {
|
|
10
11
|
PasswordHasher,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { EmailSender } from '../types';
|
|
2
|
+
export interface SmtpConfig {
|
|
3
|
+
host: string;
|
|
4
|
+
port: number;
|
|
5
|
+
user: string;
|
|
6
|
+
pass: string;
|
|
7
|
+
from: string;
|
|
8
|
+
baseUrl: string;
|
|
9
|
+
secure?: boolean;
|
|
10
|
+
templates?: Partial<EmailTemplates>;
|
|
11
|
+
}
|
|
12
|
+
export interface EmailTemplates {
|
|
13
|
+
verification: (params: {
|
|
14
|
+
email: string;
|
|
15
|
+
token: string;
|
|
16
|
+
baseUrl: string;
|
|
17
|
+
}) => {
|
|
18
|
+
subject: string;
|
|
19
|
+
html: string;
|
|
20
|
+
};
|
|
21
|
+
passwordReset: (params: {
|
|
22
|
+
email: string;
|
|
23
|
+
token: string;
|
|
24
|
+
baseUrl: string;
|
|
25
|
+
}) => {
|
|
26
|
+
subject: string;
|
|
27
|
+
html: string;
|
|
28
|
+
};
|
|
29
|
+
magicLink: (params: {
|
|
30
|
+
email: string;
|
|
31
|
+
token: string;
|
|
32
|
+
baseUrl: string;
|
|
33
|
+
}) => {
|
|
34
|
+
subject: string;
|
|
35
|
+
html: string;
|
|
36
|
+
};
|
|
37
|
+
welcome: (params: {
|
|
38
|
+
email: string;
|
|
39
|
+
name: string;
|
|
40
|
+
}) => {
|
|
41
|
+
subject: string;
|
|
42
|
+
html: string;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export declare class SmtpEmailSender implements EmailSender {
|
|
46
|
+
private config;
|
|
47
|
+
private templates;
|
|
48
|
+
constructor(config: SmtpConfig);
|
|
49
|
+
sendVerificationEmail(email: string, token: string): Promise<void>;
|
|
50
|
+
sendPasswordResetEmail(email: string, token: string): Promise<void>;
|
|
51
|
+
sendMagicLinkEmail(email: string, token: string): Promise<void>;
|
|
52
|
+
sendWelcomeEmail(email: string, name: string): Promise<void>;
|
|
53
|
+
private send;
|
|
54
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createForgotPasswordHandler
|
|
3
|
+
} from "../../chunk-FRY3TNJ6.js";
|
|
4
|
+
import "../../chunk-WC2IYFGC.js";
|
|
5
|
+
import "../../chunk-GDWEDUHO.js";
|
|
6
|
+
import "../../chunk-ITGUSYUH.js";
|
|
7
|
+
import "../../chunk-YZXGOOFC.js";
|
|
8
|
+
import "../../chunk-AIH3F7JV.js";
|
|
9
|
+
import "../../chunk-ORMEWXMH.js";
|
|
10
|
+
export {
|
|
11
|
+
createForgotPasswordHandler
|
|
12
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { NextRequest } from 'next/server';
|
|
2
|
+
import type { AuthHandlerOptions } from '../types/handler-types';
|
|
3
|
+
export interface AuthRouteHandlers {
|
|
4
|
+
login: (req: NextRequest) => Promise<Response>;
|
|
5
|
+
register: (req: NextRequest) => Promise<Response>;
|
|
6
|
+
logout: (req: NextRequest) => Promise<Response>;
|
|
7
|
+
refresh: (req: NextRequest) => Promise<Response>;
|
|
8
|
+
me: (req: NextRequest) => Promise<Response>;
|
|
9
|
+
oauthAuthorize: (req: NextRequest) => Promise<Response>;
|
|
10
|
+
oauthCallback: (req: NextRequest) => Promise<Response>;
|
|
11
|
+
forgotPassword: (req: NextRequest) => Promise<Response>;
|
|
12
|
+
resetPassword: (req: NextRequest) => Promise<Response>;
|
|
13
|
+
verifyEmail: (req: NextRequest) => Promise<Response>;
|
|
14
|
+
}
|
|
15
|
+
export declare function createAuthHandlers(options: AuthHandlerOptions): AuthRouteHandlers;
|
|
16
|
+
export { createLoginHandler } from './login.handler';
|
|
17
|
+
export { createRegisterHandler } from './register.handler';
|
|
18
|
+
export { createLogoutHandler } from './logout.handler';
|
|
19
|
+
export { createRefreshHandler } from './refresh.handler';
|
|
20
|
+
export { createMeHandler } from './me.handler';
|
|
21
|
+
export { createOAuthAuthorizeHandler } from './oauth-authorize.handler';
|
|
22
|
+
export { createOAuthCallbackHandler } from './oauth-callback.handler';
|
|
23
|
+
export { createForgotPasswordHandler } from './forgot-password.handler';
|
|
24
|
+
export { createResetPasswordHandler } from './reset-password.handler';
|
|
25
|
+
export { createVerifyEmailHandler } from './verify-email.handler';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createRefreshHandler
|
|
3
|
+
} from "../../chunk-FI46LV42.js";
|
|
4
|
+
import {
|
|
5
|
+
createRegisterHandler
|
|
6
|
+
} from "../../chunk-Q7VFOUFI.js";
|
|
7
|
+
import {
|
|
8
|
+
createResetPasswordHandler
|
|
9
|
+
} from "../../chunk-TFZOOP3V.js";
|
|
10
|
+
import {
|
|
11
|
+
createVerifyEmailHandler
|
|
12
|
+
} from "../../chunk-QYXI45KH.js";
|
|
13
|
+
import {
|
|
14
|
+
createForgotPasswordHandler
|
|
15
|
+
} from "../../chunk-FRY3TNJ6.js";
|
|
16
|
+
import {
|
|
17
|
+
createLoginHandler
|
|
18
|
+
} from "../../chunk-MGQV723O.js";
|
|
19
|
+
import {
|
|
20
|
+
createLogoutHandler
|
|
21
|
+
} from "../../chunk-WNEXLSDB.js";
|
|
22
|
+
import {
|
|
23
|
+
createMeHandler
|
|
24
|
+
} from "../../chunk-4YQ6YBM7.js";
|
|
25
|
+
import {
|
|
26
|
+
createOAuthAuthorizeHandler
|
|
27
|
+
} from "../../chunk-6JY6NUR6.js";
|
|
28
|
+
import {
|
|
29
|
+
createOAuthCallbackHandler
|
|
30
|
+
} from "../../chunk-S7OQWKUJ.js";
|
|
31
|
+
import "../../chunk-JQFQT4S2.js";
|
|
32
|
+
import "../../chunk-N6TMHITU.js";
|
|
33
|
+
import "../../chunk-6B7VU6RZ.js";
|
|
34
|
+
import "../../chunk-WC2IYFGC.js";
|
|
35
|
+
import "../../chunk-ETMTDHK2.js";
|
|
36
|
+
import "../../chunk-HZLJYEOO.js";
|
|
37
|
+
import "../../chunk-T4MDCVUQ.js";
|
|
38
|
+
import "../../chunk-2QQNL4ND.js";
|
|
39
|
+
import "../../chunk-GBLNXNEH.js";
|
|
40
|
+
import "../../chunk-RVL5ROWQ.js";
|
|
41
|
+
import "../../chunk-GDWEDUHO.js";
|
|
42
|
+
import "../../chunk-ITGUSYUH.js";
|
|
43
|
+
import "../../chunk-YZXGOOFC.js";
|
|
44
|
+
import "../../chunk-3GAY2T2A.js";
|
|
45
|
+
import "../../chunk-G2Q4TI3Q.js";
|
|
46
|
+
import "../../chunk-AIH3F7JV.js";
|
|
47
|
+
import "../../chunk-A2XAOU55.js";
|
|
48
|
+
import "../../chunk-K25ICPU4.js";
|
|
49
|
+
import "../../chunk-2QH66EVQ.js";
|
|
50
|
+
import "../../chunk-ORMEWXMH.js";
|
|
51
|
+
|
|
52
|
+
// src/auth/handlers/index.ts
|
|
53
|
+
function createAuthHandlers(options) {
|
|
54
|
+
return {
|
|
55
|
+
login: createLoginHandler(options),
|
|
56
|
+
register: createRegisterHandler(options),
|
|
57
|
+
logout: createLogoutHandler(options),
|
|
58
|
+
refresh: createRefreshHandler(options),
|
|
59
|
+
me: createMeHandler(options),
|
|
60
|
+
oauthAuthorize: createOAuthAuthorizeHandler(options),
|
|
61
|
+
oauthCallback: createOAuthCallbackHandler(options),
|
|
62
|
+
forgotPassword: createForgotPasswordHandler(options),
|
|
63
|
+
resetPassword: createResetPasswordHandler(options),
|
|
64
|
+
verifyEmail: createVerifyEmailHandler(options)
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
createAuthHandlers,
|
|
69
|
+
createForgotPasswordHandler,
|
|
70
|
+
createLoginHandler,
|
|
71
|
+
createLogoutHandler,
|
|
72
|
+
createMeHandler,
|
|
73
|
+
createOAuthAuthorizeHandler,
|
|
74
|
+
createOAuthCallbackHandler,
|
|
75
|
+
createRefreshHandler,
|
|
76
|
+
createRegisterHandler,
|
|
77
|
+
createResetPasswordHandler,
|
|
78
|
+
createVerifyEmailHandler
|
|
79
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createLoginHandler
|
|
3
|
+
} from "../../chunk-MGQV723O.js";
|
|
4
|
+
import "../../chunk-3GAY2T2A.js";
|
|
5
|
+
import "../../chunk-G2Q4TI3Q.js";
|
|
6
|
+
import "../../chunk-AIH3F7JV.js";
|
|
7
|
+
import "../../chunk-A2XAOU55.js";
|
|
8
|
+
import "../../chunk-K25ICPU4.js";
|
|
9
|
+
import "../../chunk-2QH66EVQ.js";
|
|
10
|
+
import "../../chunk-ORMEWXMH.js";
|
|
11
|
+
export {
|
|
12
|
+
createLoginHandler
|
|
13
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createLogoutHandler
|
|
3
|
+
} from "../../chunk-WNEXLSDB.js";
|
|
4
|
+
import "../../chunk-G2Q4TI3Q.js";
|
|
5
|
+
import "../../chunk-A2XAOU55.js";
|
|
6
|
+
import "../../chunk-K25ICPU4.js";
|
|
7
|
+
import "../../chunk-2QH66EVQ.js";
|
|
8
|
+
import "../../chunk-ORMEWXMH.js";
|
|
9
|
+
export {
|
|
10
|
+
createLogoutHandler
|
|
11
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createMeHandler
|
|
3
|
+
} from "../../chunk-4YQ6YBM7.js";
|
|
4
|
+
import "../../chunk-3GAY2T2A.js";
|
|
5
|
+
import "../../chunk-G2Q4TI3Q.js";
|
|
6
|
+
import "../../chunk-AIH3F7JV.js";
|
|
7
|
+
import "../../chunk-A2XAOU55.js";
|
|
8
|
+
import "../../chunk-K25ICPU4.js";
|
|
9
|
+
import "../../chunk-2QH66EVQ.js";
|
|
10
|
+
import "../../chunk-ORMEWXMH.js";
|
|
11
|
+
export {
|
|
12
|
+
createMeHandler
|
|
13
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createOAuthAuthorizeHandler
|
|
3
|
+
} from "../../chunk-6JY6NUR6.js";
|
|
4
|
+
import "../../chunk-HZLJYEOO.js";
|
|
5
|
+
import "../../chunk-T4MDCVUQ.js";
|
|
6
|
+
import "../../chunk-2QQNL4ND.js";
|
|
7
|
+
import "../../chunk-GBLNXNEH.js";
|
|
8
|
+
import "../../chunk-RVL5ROWQ.js";
|
|
9
|
+
import "../../chunk-ITGUSYUH.js";
|
|
10
|
+
import "../../chunk-YZXGOOFC.js";
|
|
11
|
+
import "../../chunk-AIH3F7JV.js";
|
|
12
|
+
import "../../chunk-ORMEWXMH.js";
|
|
13
|
+
export {
|
|
14
|
+
createOAuthAuthorizeHandler
|
|
15
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createOAuthCallbackHandler
|
|
3
|
+
} from "../../chunk-S7OQWKUJ.js";
|
|
4
|
+
import "../../chunk-6B7VU6RZ.js";
|
|
5
|
+
import "../../chunk-HZLJYEOO.js";
|
|
6
|
+
import "../../chunk-T4MDCVUQ.js";
|
|
7
|
+
import "../../chunk-2QQNL4ND.js";
|
|
8
|
+
import "../../chunk-GBLNXNEH.js";
|
|
9
|
+
import "../../chunk-RVL5ROWQ.js";
|
|
10
|
+
import "../../chunk-ITGUSYUH.js";
|
|
11
|
+
import "../../chunk-YZXGOOFC.js";
|
|
12
|
+
import "../../chunk-3GAY2T2A.js";
|
|
13
|
+
import "../../chunk-G2Q4TI3Q.js";
|
|
14
|
+
import "../../chunk-AIH3F7JV.js";
|
|
15
|
+
import "../../chunk-A2XAOU55.js";
|
|
16
|
+
import "../../chunk-K25ICPU4.js";
|
|
17
|
+
import "../../chunk-2QH66EVQ.js";
|
|
18
|
+
import "../../chunk-ORMEWXMH.js";
|
|
19
|
+
export {
|
|
20
|
+
createOAuthCallbackHandler
|
|
21
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createRefreshHandler
|
|
3
|
+
} from "../../chunk-FI46LV42.js";
|
|
4
|
+
import "../../chunk-JQFQT4S2.js";
|
|
5
|
+
import "../../chunk-3GAY2T2A.js";
|
|
6
|
+
import "../../chunk-G2Q4TI3Q.js";
|
|
7
|
+
import "../../chunk-AIH3F7JV.js";
|
|
8
|
+
import "../../chunk-A2XAOU55.js";
|
|
9
|
+
import "../../chunk-K25ICPU4.js";
|
|
10
|
+
import "../../chunk-2QH66EVQ.js";
|
|
11
|
+
import "../../chunk-ORMEWXMH.js";
|
|
12
|
+
export {
|
|
13
|
+
createRefreshHandler
|
|
14
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createRegisterHandler
|
|
3
|
+
} from "../../chunk-Q7VFOUFI.js";
|
|
4
|
+
import "../../chunk-ETMTDHK2.js";
|
|
5
|
+
import "../../chunk-GDWEDUHO.js";
|
|
6
|
+
import "../../chunk-ITGUSYUH.js";
|
|
7
|
+
import "../../chunk-YZXGOOFC.js";
|
|
8
|
+
import "../../chunk-AIH3F7JV.js";
|
|
9
|
+
import "../../chunk-ORMEWXMH.js";
|
|
10
|
+
export {
|
|
11
|
+
createRegisterHandler
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createResetPasswordHandler
|
|
3
|
+
} from "../../chunk-TFZOOP3V.js";
|
|
4
|
+
import "../../chunk-WC2IYFGC.js";
|
|
5
|
+
import "../../chunk-GDWEDUHO.js";
|
|
6
|
+
import "../../chunk-ITGUSYUH.js";
|
|
7
|
+
import "../../chunk-YZXGOOFC.js";
|
|
8
|
+
import "../../chunk-AIH3F7JV.js";
|
|
9
|
+
import "../../chunk-ORMEWXMH.js";
|
|
10
|
+
export {
|
|
11
|
+
createResetPasswordHandler
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createVerifyEmailHandler
|
|
3
|
+
} from "../../chunk-QYXI45KH.js";
|
|
4
|
+
import "../../chunk-N6TMHITU.js";
|
|
5
|
+
import "../../chunk-GDWEDUHO.js";
|
|
6
|
+
import "../../chunk-ITGUSYUH.js";
|
|
7
|
+
import "../../chunk-YZXGOOFC.js";
|
|
8
|
+
import "../../chunk-AIH3F7JV.js";
|
|
9
|
+
import "../../chunk-ORMEWXMH.js";
|
|
10
|
+
export {
|
|
11
|
+
createVerifyEmailHandler
|
|
12
|
+
};
|
package/dist/auth/index.js
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
DEFAULT_PASSWORD_CONFIG,
|
|
3
|
+
createPasswordHasher,
|
|
4
|
+
createPasswordSchema,
|
|
5
|
+
createPasswordValidator,
|
|
6
|
+
getPasswordStrength,
|
|
7
|
+
passwordValidator,
|
|
8
|
+
validatePassword
|
|
9
|
+
} from "../chunk-G26T2PRQ.js";
|
|
10
|
+
import {
|
|
11
|
+
PasswordHasher,
|
|
12
|
+
PasswordValidator,
|
|
13
|
+
defaultPasswordSchema,
|
|
14
|
+
strongPasswordSchema
|
|
15
|
+
} from "../chunk-IHXRF3BH.js";
|
|
4
16
|
import {
|
|
5
17
|
JWTClientManager,
|
|
6
18
|
clearStoredTokens,
|
|
@@ -31,30 +43,19 @@ import {
|
|
|
31
43
|
GoogleOAuthProvider
|
|
32
44
|
} from "../chunk-RVL5ROWQ.js";
|
|
33
45
|
import {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
createPasswordSchema,
|
|
37
|
-
createPasswordValidator,
|
|
38
|
-
getPasswordStrength,
|
|
39
|
-
passwordValidator,
|
|
40
|
-
validatePassword
|
|
41
|
-
} from "../chunk-G26T2PRQ.js";
|
|
42
|
-
import {
|
|
43
|
-
PasswordHasher,
|
|
44
|
-
PasswordValidator,
|
|
45
|
-
defaultPasswordSchema,
|
|
46
|
-
strongPasswordSchema
|
|
47
|
-
} from "../chunk-IHXRF3BH.js";
|
|
46
|
+
TokenGenerator
|
|
47
|
+
} from "../chunk-GDWEDUHO.js";
|
|
48
48
|
import {
|
|
49
49
|
OAUTH_PROVIDERS,
|
|
50
50
|
PasswordStrength,
|
|
51
51
|
TokenType
|
|
52
|
-
} from "../chunk-
|
|
52
|
+
} from "../chunk-ITGUSYUH.js";
|
|
53
|
+
import "../chunk-YZXGOOFC.js";
|
|
53
54
|
import {
|
|
54
55
|
JWTManager,
|
|
55
56
|
JWTService
|
|
56
57
|
} from "../chunk-3GAY2T2A.js";
|
|
57
|
-
import "../chunk-
|
|
58
|
+
import "../chunk-G2Q4TI3Q.js";
|
|
58
59
|
import {
|
|
59
60
|
AUTH_ERROR_CODES,
|
|
60
61
|
AuthError,
|
|
@@ -63,9 +64,9 @@ import {
|
|
|
63
64
|
OAuthError,
|
|
64
65
|
PasswordError
|
|
65
66
|
} from "../chunk-AIH3F7JV.js";
|
|
66
|
-
import "../chunk-
|
|
67
|
-
import "../chunk-2QH66EVQ.js";
|
|
67
|
+
import "../chunk-A2XAOU55.js";
|
|
68
68
|
import "../chunk-K25ICPU4.js";
|
|
69
|
+
import "../chunk-2QH66EVQ.js";
|
|
69
70
|
import "../chunk-ORMEWXMH.js";
|
|
70
71
|
export {
|
|
71
72
|
AUTH_ERROR_CODES,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { UserRepository, EmailTokenRepository, EmailSender, Logger } from '../types';
|
|
2
|
+
export interface EmailVerificationServiceConfig {
|
|
3
|
+
userRepository: UserRepository;
|
|
4
|
+
emailTokenRepository: EmailTokenRepository;
|
|
5
|
+
emailSender: EmailSender;
|
|
6
|
+
tokenExpiryHours?: number;
|
|
7
|
+
logger?: Logger;
|
|
8
|
+
}
|
|
9
|
+
export declare class EmailVerificationService {
|
|
10
|
+
private userRepo;
|
|
11
|
+
private tokenRepo;
|
|
12
|
+
private emailSender;
|
|
13
|
+
private tokenExpiryHours;
|
|
14
|
+
private logger;
|
|
15
|
+
constructor(config: EmailVerificationServiceConfig);
|
|
16
|
+
verify(email: string, token: string): Promise<void>;
|
|
17
|
+
resend(email: string): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EmailVerificationService
|
|
3
|
+
} from "../../chunk-N6TMHITU.js";
|
|
4
|
+
import "../../chunk-GDWEDUHO.js";
|
|
5
|
+
import "../../chunk-ITGUSYUH.js";
|
|
6
|
+
import "../../chunk-YZXGOOFC.js";
|
|
7
|
+
import "../../chunk-AIH3F7JV.js";
|
|
8
|
+
import "../../chunk-ORMEWXMH.js";
|
|
9
|
+
export {
|
|
10
|
+
EmailVerificationService
|
|
11
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { LoginService } from './login.service';
|
|
2
|
+
export type { LoginServiceConfig, LoginResult } from './login.service';
|
|
3
|
+
export { RegisterService } from './register.service';
|
|
4
|
+
export type { RegisterServiceConfig, RegisterInput, RegisterResult } from './register.service';
|
|
5
|
+
export { OAuthCallbackService } from './oauth-callback.service';
|
|
6
|
+
export type { OAuthCallbackServiceConfig, OAuthCallbackInput, OAuthCallbackResult } from './oauth-callback.service';
|
|
7
|
+
export { TokenRefreshService } from './token-refresh.service';
|
|
8
|
+
export type { TokenRefreshServiceConfig, RefreshResult } from './token-refresh.service';
|
|
9
|
+
export { PasswordResetService } from './password-reset.service';
|
|
10
|
+
export type { PasswordResetServiceConfig } from './password-reset.service';
|
|
11
|
+
export { EmailVerificationService } from './email-verification.service';
|
|
12
|
+
export type { EmailVerificationServiceConfig } from './email-verification.service';
|