dn-react-router-toolkit 0.2.7 → 0.3.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/create_handler.d.mts +13 -0
- package/dist/api/create_handler.d.ts +13 -0
- package/dist/api/create_handler.js +298 -0
- package/dist/api/create_handler.mjs +304 -0
- package/dist/api/index.d.mts +4 -0
- package/dist/api/index.d.ts +4 -0
- package/dist/api/index.js +298 -0
- package/dist/api/index.mjs +304 -0
- package/dist/auth/client/index.d.mts +3 -0
- package/dist/auth/client/index.d.ts +3 -0
- package/dist/{date.js → auth/client/index.js} +25 -32
- package/dist/auth/client/index.mjs +21 -0
- package/dist/auth/client/redirect_page.d.mts +1 -0
- package/dist/auth/client/redirect_page.d.ts +1 -0
- package/dist/auth/cookie_store.d.mts +13 -0
- package/dist/auth/cookie_store.d.ts +13 -0
- package/dist/{text_editor/plugins/keymap.js → auth/cookie_store.js} +24 -16
- package/dist/auth/cookie_store.mjs +23 -0
- package/dist/auth/index.d.mts +5 -0
- package/dist/auth/index.d.ts +5 -0
- package/dist/auth/index.js +139 -0
- package/dist/auth/index.mjs +111 -0
- package/dist/auth/server/index.d.mts +1 -0
- package/dist/auth/server/index.d.ts +1 -0
- package/dist/{slug.js → auth/server/index.js} +6 -14
- package/dist/auth/server/index.mjs +2 -0
- package/dist/auth/with_auth.d.mts +2 -6
- package/dist/auth/with_auth.d.ts +2 -6
- package/dist/auth/with_auth.js +3 -0
- package/dist/auth/with_auth.mjs +3 -0
- package/dist/{components → client}/client_env.d.mts +1 -1
- package/dist/{components → client}/client_env.d.ts +1 -1
- package/dist/{components → client}/client_env.js +6 -2
- package/dist/{components → client}/client_env.mjs +2 -2
- package/dist/client/index.d.mts +3 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/{auth/client/google_login_button.js → client/index.js} +30 -33
- package/dist/client/index.mjs +31 -0
- package/dist/client/use_user_agent.d.mts +8 -0
- package/dist/client/use_user_agent.d.ts +8 -0
- package/dist/{file/client/format_size.js → client/use_user_agent.js} +14 -14
- package/dist/client/use_user_agent.mjs +13 -0
- package/dist/file/client/index.d.mts +1 -0
- package/dist/file/client/index.d.ts +1 -0
- package/dist/file/{cdn.js → client/index.js} +6 -16
- package/dist/file/client/index.mjs +2 -0
- package/dist/file/index.d.mts +1 -0
- package/dist/file/index.d.ts +1 -0
- package/dist/{cn.js → file/index.js} +6 -14
- package/dist/file/index.mjs +2 -0
- package/dist/file/server/index.d.mts +1 -0
- package/dist/file/server/index.d.ts +1 -0
- package/dist/file/server/index.js +24 -0
- package/dist/file/server/index.mjs +2 -0
- package/dist/http/index.d.mts +1 -1
- package/dist/http/index.d.ts +1 -1
- package/dist/http/index.js +3 -90
- package/dist/http/index.mjs +2 -68
- package/dist/index.d.mts +8 -6
- package/dist/index.d.ts +8 -6
- package/dist/index.js +3 -79
- package/dist/index.mjs +2 -58
- package/dist/modal/index.d.mts +1 -0
- package/dist/modal/index.d.ts +1 -0
- package/dist/{sleep.js → modal/index.js} +6 -14
- package/dist/modal/index.mjs +2 -0
- package/dist/seo/index.d.mts +4 -0
- package/dist/seo/index.d.ts +4 -0
- package/dist/seo/index.js +304 -0
- package/dist/seo/index.mjs +267 -0
- package/dist/text_editor/index.d.mts +1 -0
- package/dist/text_editor/index.d.ts +1 -0
- package/dist/text_editor/index.js +24 -0
- package/dist/text_editor/index.mjs +2 -0
- package/package.json +58 -32
- package/dist/auth/apple_auth.d.mts +0 -38
- package/dist/auth/apple_auth.d.ts +0 -38
- package/dist/auth/apple_auth.js +0 -88
- package/dist/auth/apple_auth.mjs +0 -63
- package/dist/auth/auth_repository.d.mts +0 -41
- package/dist/auth/auth_repository.d.ts +0 -41
- package/dist/auth/auth_repository.js +0 -18
- package/dist/auth/auth_repository.mjs +0 -0
- package/dist/auth/auth_service.d.mts +0 -63
- package/dist/auth/auth_service.d.ts +0 -63
- package/dist/auth/auth_service.js +0 -210
- package/dist/auth/auth_service.mjs +0 -171
- package/dist/auth/client/google_login_button.d.mts +0 -7
- package/dist/auth/client/google_login_button.d.ts +0 -7
- package/dist/auth/client/google_login_button.mjs +0 -37
- package/dist/auth/client/provider.d.mts +0 -24
- package/dist/auth/client/provider.d.ts +0 -24
- package/dist/auth/client/provider.js +0 -154
- package/dist/auth/client/provider.mjs +0 -118
- package/dist/auth/google_auth.d.mts +0 -33
- package/dist/auth/google_auth.d.ts +0 -33
- package/dist/auth/google_auth.js +0 -135
- package/dist/auth/google_auth.mjs +0 -108
- package/dist/auth/handlers/find_auth.d.mts +0 -13
- package/dist/auth/handlers/find_auth.d.ts +0 -13
- package/dist/auth/handlers/find_auth.js +0 -82
- package/dist/auth/handlers/find_auth.mjs +0 -55
- package/dist/auth/handlers/login.d.mts +0 -13
- package/dist/auth/handlers/login.d.ts +0 -13
- package/dist/auth/handlers/login.js +0 -107
- package/dist/auth/handlers/login.mjs +0 -80
- package/dist/auth/handlers/login_with_thirdparty.d.mts +0 -15
- package/dist/auth/handlers/login_with_thirdparty.d.ts +0 -15
- package/dist/auth/handlers/login_with_thirdparty.js +0 -98
- package/dist/auth/handlers/login_with_thirdparty.mjs +0 -71
- package/dist/auth/handlers/logout.d.mts +0 -13
- package/dist/auth/handlers/logout.d.ts +0 -13
- package/dist/auth/handlers/logout.js +0 -102
- package/dist/auth/handlers/logout.mjs +0 -75
- package/dist/auth/handlers/refresh.d.mts +0 -13
- package/dist/auth/handlers/refresh.d.ts +0 -13
- package/dist/auth/handlers/refresh.js +0 -92
- package/dist/auth/handlers/refresh.mjs +0 -65
- package/dist/auth/handlers/request_password_reset.d.mts +0 -10
- package/dist/auth/handlers/request_password_reset.d.ts +0 -10
- package/dist/auth/handlers/request_password_reset.js +0 -87
- package/dist/auth/handlers/request_password_reset.mjs +0 -60
- package/dist/auth/handlers/reset_password.d.mts +0 -10
- package/dist/auth/handlers/reset_password.d.ts +0 -10
- package/dist/auth/handlers/reset_password.js +0 -88
- package/dist/auth/handlers/reset_password.mjs +0 -61
- package/dist/auth/handlers/signup.d.mts +0 -15
- package/dist/auth/handlers/signup.d.ts +0 -15
- package/dist/auth/handlers/signup.js +0 -147
- package/dist/auth/handlers/signup.mjs +0 -112
- package/dist/auth/handlers/signup_with_thirdparty.d.mts +0 -17
- package/dist/auth/handlers/signup_with_thirdparty.d.ts +0 -17
- package/dist/auth/handlers/signup_with_thirdparty.js +0 -123
- package/dist/auth/handlers/signup_with_thirdparty.mjs +0 -98
- package/dist/auth/handlers/thirdparty_auth_callback.d.mts +0 -16
- package/dist/auth/handlers/thirdparty_auth_callback.d.ts +0 -16
- package/dist/auth/handlers/thirdparty_auth_callback.js +0 -129
- package/dist/auth/handlers/thirdparty_auth_callback.mjs +0 -102
- package/dist/auth/jwt_manager.d.mts +0 -38
- package/dist/auth/jwt_manager.d.ts +0 -38
- package/dist/auth/jwt_manager.js +0 -90
- package/dist/auth/jwt_manager.mjs +0 -65
- package/dist/auth/kakao_auth.d.mts +0 -27
- package/dist/auth/kakao_auth.d.ts +0 -27
- package/dist/auth/kakao_auth.js +0 -56
- package/dist/auth/kakao_auth.mjs +0 -31
- package/dist/auth/password_recovery.d.mts +0 -34
- package/dist/auth/password_recovery.d.ts +0 -34
- package/dist/auth/password_recovery.js +0 -169
- package/dist/auth/password_recovery.mjs +0 -134
- package/dist/auth/thirdparty_auth.d.mts +0 -41
- package/dist/auth/thirdparty_auth.d.ts +0 -41
- package/dist/auth/thirdparty_auth.js +0 -113
- package/dist/auth/thirdparty_auth.mjs +0 -86
- package/dist/cn.d.mts +0 -3
- package/dist/cn.d.ts +0 -3
- package/dist/cn.mjs +0 -7
- package/dist/components/index.d.mts +0 -5
- package/dist/components/index.d.ts +0 -5
- package/dist/components/index.js +0 -261
- package/dist/components/index.mjs +0 -219
- package/dist/components/modal/fullscreen_container.d.mts +0 -7
- package/dist/components/modal/fullscreen_container.d.ts +0 -7
- package/dist/components/modal/fullscreen_container.js +0 -102
- package/dist/components/modal/fullscreen_container.mjs +0 -68
- package/dist/components/modal/hooks.d.mts +0 -18
- package/dist/components/modal/hooks.d.ts +0 -18
- package/dist/components/modal/hooks.js +0 -236
- package/dist/components/modal/hooks.mjs +0 -204
- package/dist/components/modal/index.d.mts +0 -4
- package/dist/components/modal/index.d.ts +0 -4
- package/dist/components/modal/index.js +0 -238
- package/dist/components/modal/index.mjs +0 -203
- package/dist/components/modal/modal.d.mts +0 -13
- package/dist/components/modal/modal.d.ts +0 -13
- package/dist/components/modal/modal.js +0 -155
- package/dist/components/modal/modal.mjs +0 -130
- package/dist/components/styles.d.mts +0 -9
- package/dist/components/styles.d.ts +0 -9
- package/dist/components/styles.js +0 -48
- package/dist/components/styles.mjs +0 -17
- package/dist/date.d.mts +0 -5
- package/dist/date.d.ts +0 -5
- package/dist/date.mjs +0 -29
- package/dist/file/cdn.d.mts +0 -6
- package/dist/file/cdn.d.ts +0 -6
- package/dist/file/cdn.mjs +0 -9
- package/dist/file/client/drop_file_input.d.mts +0 -36
- package/dist/file/client/drop_file_input.d.ts +0 -36
- package/dist/file/client/drop_file_input.js +0 -323
- package/dist/file/client/drop_file_input.mjs +0 -294
- package/dist/file/client/file_upload_button.d.mts +0 -10
- package/dist/file/client/file_upload_button.d.ts +0 -10
- package/dist/file/client/file_upload_button.js +0 -89
- package/dist/file/client/file_upload_button.mjs +0 -58
- package/dist/file/client/file_uploader.d.mts +0 -13
- package/dist/file/client/file_uploader.d.ts +0 -13
- package/dist/file/client/file_uploader.js +0 -163
- package/dist/file/client/file_uploader.mjs +0 -136
- package/dist/file/client/format_size.d.mts +0 -3
- package/dist/file/client/format_size.d.ts +0 -3
- package/dist/file/client/format_size.mjs +0 -13
- package/dist/file/client/metadata.d.mts +0 -7
- package/dist/file/client/metadata.d.ts +0 -7
- package/dist/file/client/metadata.js +0 -85
- package/dist/file/client/metadata.mjs +0 -60
- package/dist/file/file_repository.d.mts +0 -16
- package/dist/file/file_repository.d.ts +0 -16
- package/dist/file/file_repository.js +0 -18
- package/dist/file/file_repository.mjs +0 -0
- package/dist/file/file_service.d.mts +0 -32
- package/dist/file/file_service.d.ts +0 -32
- package/dist/file/file_service.js +0 -66
- package/dist/file/file_service.mjs +0 -41
- package/dist/file/handlers/delete_file.d.mts +0 -17
- package/dist/file/handlers/delete_file.d.ts +0 -17
- package/dist/file/handlers/delete_file.js +0 -99
- package/dist/file/handlers/delete_file.mjs +0 -72
- package/dist/file/handlers/upload_file.d.mts +0 -16
- package/dist/file/handlers/upload_file.d.ts +0 -16
- package/dist/file/handlers/upload_file.js +0 -106
- package/dist/file/handlers/upload_file.mjs +0 -79
- package/dist/file/object_storage.d.mts +0 -20
- package/dist/file/object_storage.d.ts +0 -20
- package/dist/file/object_storage.js +0 -90
- package/dist/file/object_storage.mjs +0 -70
- package/dist/file/responsive_image.d.mts +0 -20
- package/dist/file/responsive_image.d.ts +0 -20
- package/dist/file/responsive_image.js +0 -132
- package/dist/file/responsive_image.mjs +0 -96
- package/dist/http/response.d.mts +0 -19
- package/dist/http/response.d.ts +0 -19
- package/dist/http/response.js +0 -109
- package/dist/http/response.mjs +0 -68
- package/dist/route/api.d.mts +0 -21
- package/dist/route/api.d.ts +0 -21
- package/dist/route/api.js +0 -584
- package/dist/route/api.mjs +0 -547
- package/dist/singleton.d.mts +0 -3
- package/dist/singleton.d.ts +0 -3
- package/dist/singleton.js +0 -37
- package/dist/singleton.mjs +0 -12
- package/dist/sleep.d.mts +0 -3
- package/dist/sleep.d.ts +0 -3
- package/dist/sleep.mjs +0 -7
- package/dist/slug.d.mts +0 -3
- package/dist/slug.d.ts +0 -3
- package/dist/slug.mjs +0 -7
- package/dist/text_editor/attach_media.d.mts +0 -16
- package/dist/text_editor/attach_media.d.ts +0 -16
- package/dist/text_editor/attach_media.js +0 -237
- package/dist/text_editor/attach_media.mjs +0 -210
- package/dist/text_editor/plugins/drag_and_drop.d.mts +0 -13
- package/dist/text_editor/plugins/drag_and_drop.d.ts +0 -13
- package/dist/text_editor/plugins/drag_and_drop.js +0 -59
- package/dist/text_editor/plugins/drag_and_drop.mjs +0 -34
- package/dist/text_editor/plugins/keymap.d.mts +0 -5
- package/dist/text_editor/plugins/keymap.d.ts +0 -5
- package/dist/text_editor/plugins/keymap.mjs +0 -15
- package/dist/text_editor/plugins/placehoder.d.mts +0 -5
- package/dist/text_editor/plugins/placehoder.d.ts +0 -5
- package/dist/text_editor/plugins/placehoder.js +0 -112
- package/dist/text_editor/plugins/placehoder.mjs +0 -87
- package/dist/text_editor/plugins/trailing_paragraph.d.mts +0 -5
- package/dist/text_editor/plugins/trailing_paragraph.d.ts +0 -5
- package/dist/text_editor/plugins/trailing_paragraph.js +0 -46
- package/dist/text_editor/plugins/trailing_paragraph.mjs +0 -21
- package/dist/text_editor/plugins/upload_placeholder.d.mts +0 -7
- package/dist/text_editor/plugins/upload_placeholder.d.ts +0 -7
- package/dist/text_editor/plugins/upload_placeholder.js +0 -94
- package/dist/text_editor/plugins/upload_placeholder.mjs +0 -68
- package/dist/text_editor/schema.d.mts +0 -9
- package/dist/text_editor/schema.d.ts +0 -9
- package/dist/text_editor/schema.js +0 -354
- package/dist/text_editor/schema.mjs +0 -319
- package/dist/text_editor/text_editor.d.mts +0 -45
- package/dist/text_editor/text_editor.d.ts +0 -45
- package/dist/text_editor/text_editor.js +0 -834
- package/dist/text_editor/text_editor.mjs +0 -806
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
// src/auth/password_recovery.ts
|
|
2
|
-
import nodemailer from "nodemailer";
|
|
3
|
-
|
|
4
|
-
// src/http/response.ts
|
|
5
|
-
var createJsonResponse = (status) => {
|
|
6
|
-
return (data = {}, init) => {
|
|
7
|
-
return Response.json(data, { status, ...init });
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
var OK = createJsonResponse(200);
|
|
11
|
-
var CREATED = createJsonResponse(201);
|
|
12
|
-
var ACCEPTED = createJsonResponse(202);
|
|
13
|
-
var createException = (status, defaultMessage = "\uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.") => {
|
|
14
|
-
return (message = defaultMessage, init) => {
|
|
15
|
-
return createJsonResponse(status)({ message }, init);
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
var BAD_REQUEST = createException(400, "\uC694\uCCAD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.");
|
|
19
|
-
var UNAUTHORIZED = createException(401, "\uC778\uC99D\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.");
|
|
20
|
-
var FORBIDDEN = createException(403, "\uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
21
|
-
var NOT_FOUND = createException(
|
|
22
|
-
404,
|
|
23
|
-
"\uC694\uCCAD\uD55C \uB9AC\uC18C\uC2A4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
24
|
-
);
|
|
25
|
-
var METHOD_NOT_ALLOWED = createException(
|
|
26
|
-
405,
|
|
27
|
-
"\uBA54\uC11C\uB4DC\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
28
|
-
);
|
|
29
|
-
var NOT_ACCEPTABLE = createException(
|
|
30
|
-
406,
|
|
31
|
-
"\uC694\uCCAD\uD55C \uD615\uC2DD\uC744 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
32
|
-
);
|
|
33
|
-
var REQUEST_TIMEOUT = createException(
|
|
34
|
-
408,
|
|
35
|
-
"\uC694\uCCAD \uC2DC\uAC04\uC774 \uCD08\uACFC\uB418\uC5C8\uC2B5\uB2C8\uB2E4."
|
|
36
|
-
);
|
|
37
|
-
var CONFLICT = createException(409, "\uC694\uCCAD\uC774 \uCDA9\uB3CC\uD588\uC2B5\uB2C8\uB2E4.");
|
|
38
|
-
var UNPROCESSABLE_ENTITY = createException(
|
|
39
|
-
422,
|
|
40
|
-
"\uCC98\uB9AC\uD560 \uC218 \uC5C6\uB294 \uC5D4\uD2F0\uD2F0\uC785\uB2C8\uB2E4."
|
|
41
|
-
);
|
|
42
|
-
var TOO_MANY_REQUESTS = createException(429, "\uC694\uCCAD\uC774 \uB108\uBB34 \uB9CE\uC2B5\uB2C8\uB2E4.");
|
|
43
|
-
var INTERNAL_SERVER_ERROR = createException(
|
|
44
|
-
500,
|
|
45
|
-
"\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
// src/auth/password_recovery.ts
|
|
49
|
-
import bcrypt from "bcryptjs";
|
|
50
|
-
var PasswordRecoveryService = class {
|
|
51
|
-
siteOrigin;
|
|
52
|
-
siteName;
|
|
53
|
-
jwtManager;
|
|
54
|
-
authRepository;
|
|
55
|
-
emailCredentials;
|
|
56
|
-
resetPasswordTokenSecret;
|
|
57
|
-
resetPasswordTokenExpiresIn;
|
|
58
|
-
constructor({
|
|
59
|
-
siteOrigin,
|
|
60
|
-
siteName,
|
|
61
|
-
jwtManager,
|
|
62
|
-
authRepository,
|
|
63
|
-
emailCredentials,
|
|
64
|
-
resetPasswordTokenSecret,
|
|
65
|
-
resetPasswordTokenExpiresIn = "1h"
|
|
66
|
-
}) {
|
|
67
|
-
this.siteOrigin = siteOrigin;
|
|
68
|
-
this.siteName = siteName;
|
|
69
|
-
this.jwtManager = jwtManager;
|
|
70
|
-
this.authRepository = authRepository;
|
|
71
|
-
this.emailCredentials = emailCredentials;
|
|
72
|
-
this.resetPasswordTokenSecret = resetPasswordTokenSecret;
|
|
73
|
-
this.resetPasswordTokenExpiresIn = resetPasswordTokenExpiresIn;
|
|
74
|
-
}
|
|
75
|
-
async requestPasswordReset(email) {
|
|
76
|
-
const credential = await this.authRepository.findCredentialById(email);
|
|
77
|
-
if (!credential) {
|
|
78
|
-
throw NOT_FOUND("\uAC00\uC785\uB418\uC9C0 \uC54A\uC740 \uC774\uBA54\uC77C\uC785\uB2C8\uB2E4.");
|
|
79
|
-
}
|
|
80
|
-
const transporter = nodemailer.createTransport({
|
|
81
|
-
service: this.emailCredentials.service,
|
|
82
|
-
auth: {
|
|
83
|
-
user: this.emailCredentials.user,
|
|
84
|
-
pass: this.emailCredentials.pass
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
const token = await this.jwtManager.sign(
|
|
88
|
-
{
|
|
89
|
-
id: credential.id
|
|
90
|
-
},
|
|
91
|
-
this.resetPasswordTokenSecret,
|
|
92
|
-
{
|
|
93
|
-
expiresIn: this.resetPasswordTokenExpiresIn
|
|
94
|
-
}
|
|
95
|
-
);
|
|
96
|
-
const link = `${this.siteOrigin}/reset-password?token=${token}`;
|
|
97
|
-
const mailOptions = {
|
|
98
|
-
from: process.env.EMAIL_USER,
|
|
99
|
-
to: email,
|
|
100
|
-
subject: `${this.siteName} \uBE44\uBC00\uBC88\uD638 \uC7AC\uC124\uC815`,
|
|
101
|
-
html: `<main>
|
|
102
|
-
<p>\uBE44\uBC00\uBC88\uD638 \uC7AC\uC124\uC815\uC744 \uC704\uD574 \uC544\uB798 \uB9C1\uD06C\uB97C \uD074\uB9AD\uD574 \uC8FC\uC138\uC694. \uB9C1\uD06C\uB294 \uD55C \uC2DC\uAC04 \uB3D9\uC548 \uC720\uD6A8\uD569\uB2C8\uB2E4. \uB2E4\uB978 \uC0AC\uB78C\uC5D0\uAC8C \uACF5\uC720\uD558\uC9C0 \uB9C8\uC138\uC694.</p>
|
|
103
|
-
<a href="${link}" target="_blank">${link}</a>
|
|
104
|
-
</main>`
|
|
105
|
-
};
|
|
106
|
-
await transporter.sendMail(mailOptions);
|
|
107
|
-
}
|
|
108
|
-
async resetPassword(token, password, passwordConfirm) {
|
|
109
|
-
const payload = await this.jwtManager.verify(
|
|
110
|
-
token,
|
|
111
|
-
this.resetPasswordTokenSecret
|
|
112
|
-
);
|
|
113
|
-
if (!payload) {
|
|
114
|
-
throw UNAUTHORIZED("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uD1A0\uD070\uC785\uB2C8\uB2E4.");
|
|
115
|
-
}
|
|
116
|
-
if (typeof payload.id !== "string") {
|
|
117
|
-
throw UNAUTHORIZED("\uD1A0\uD070\uC774 \uC704\uC870\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
|
|
118
|
-
}
|
|
119
|
-
const credential = await this.authRepository.findCredentialById(payload.id);
|
|
120
|
-
if (!credential) {
|
|
121
|
-
throw NOT_FOUND("\uC874\uC7AC\uD558\uC9C0 \uC54A\uB294 \uACC4\uC815\uC785\uB2C8\uB2E4.");
|
|
122
|
-
}
|
|
123
|
-
if (typeof password !== "string" || !password.trim()) {
|
|
124
|
-
throw BAD_REQUEST("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uBE44\uBC00\uBC88\uD638\uC785\uB2C8\uB2E4.");
|
|
125
|
-
}
|
|
126
|
-
if (password !== passwordConfirm) {
|
|
127
|
-
throw BAD_REQUEST("\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.");
|
|
128
|
-
}
|
|
129
|
-
await this.authRepository.updatePassword(credential.id, bcrypt.hashSync(password, 10));
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
export {
|
|
133
|
-
PasswordRecoveryService
|
|
134
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { AuthService } from './auth_service.mjs';
|
|
2
|
-
import 'jose';
|
|
3
|
-
import './jwt_manager.mjs';
|
|
4
|
-
import 'react-router';
|
|
5
|
-
import '../file/object_storage.mjs';
|
|
6
|
-
import '@aws-sdk/client-s3';
|
|
7
|
-
import './auth_repository.mjs';
|
|
8
|
-
|
|
9
|
-
interface ThirdpartyAuth {
|
|
10
|
-
login(code: string): Promise<{
|
|
11
|
-
accessToken: string;
|
|
12
|
-
refreshToken: string;
|
|
13
|
-
}>;
|
|
14
|
-
}
|
|
15
|
-
declare class ThirdpartyAuthService {
|
|
16
|
-
authService: AuthService;
|
|
17
|
-
signupTokenSecret: string;
|
|
18
|
-
signupTokenExpiresIn: string;
|
|
19
|
-
constructor({ authService, signupTokenSecret, signupTokenExpiresIn, }: {
|
|
20
|
-
authService: AuthService;
|
|
21
|
-
signupTokenSecret: string;
|
|
22
|
-
signupTokenExpiresIn?: string;
|
|
23
|
-
});
|
|
24
|
-
issueTokensIfUserFound(provider: string, payload: {
|
|
25
|
-
id: string;
|
|
26
|
-
email: string;
|
|
27
|
-
name?: string;
|
|
28
|
-
picture?: string;
|
|
29
|
-
}): Promise<{
|
|
30
|
-
user: {
|
|
31
|
-
id: string;
|
|
32
|
-
role: string;
|
|
33
|
-
name: string;
|
|
34
|
-
refreshToken: string | null;
|
|
35
|
-
};
|
|
36
|
-
accessToken: string;
|
|
37
|
-
refreshToken: string;
|
|
38
|
-
}>;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export { type ThirdpartyAuth, ThirdpartyAuthService };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { AuthService } from './auth_service.js';
|
|
2
|
-
import 'jose';
|
|
3
|
-
import './jwt_manager.js';
|
|
4
|
-
import 'react-router';
|
|
5
|
-
import '../file/object_storage.js';
|
|
6
|
-
import '@aws-sdk/client-s3';
|
|
7
|
-
import './auth_repository.js';
|
|
8
|
-
|
|
9
|
-
interface ThirdpartyAuth {
|
|
10
|
-
login(code: string): Promise<{
|
|
11
|
-
accessToken: string;
|
|
12
|
-
refreshToken: string;
|
|
13
|
-
}>;
|
|
14
|
-
}
|
|
15
|
-
declare class ThirdpartyAuthService {
|
|
16
|
-
authService: AuthService;
|
|
17
|
-
signupTokenSecret: string;
|
|
18
|
-
signupTokenExpiresIn: string;
|
|
19
|
-
constructor({ authService, signupTokenSecret, signupTokenExpiresIn, }: {
|
|
20
|
-
authService: AuthService;
|
|
21
|
-
signupTokenSecret: string;
|
|
22
|
-
signupTokenExpiresIn?: string;
|
|
23
|
-
});
|
|
24
|
-
issueTokensIfUserFound(provider: string, payload: {
|
|
25
|
-
id: string;
|
|
26
|
-
email: string;
|
|
27
|
-
name?: string;
|
|
28
|
-
picture?: string;
|
|
29
|
-
}): Promise<{
|
|
30
|
-
user: {
|
|
31
|
-
id: string;
|
|
32
|
-
role: string;
|
|
33
|
-
name: string;
|
|
34
|
-
refreshToken: string | null;
|
|
35
|
-
};
|
|
36
|
-
accessToken: string;
|
|
37
|
-
refreshToken: string;
|
|
38
|
-
}>;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export { type ThirdpartyAuth, ThirdpartyAuthService };
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/auth/thirdparty_auth.ts
|
|
21
|
-
var thirdparty_auth_exports = {};
|
|
22
|
-
__export(thirdparty_auth_exports, {
|
|
23
|
-
ThirdpartyAuthService: () => ThirdpartyAuthService
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(thirdparty_auth_exports);
|
|
26
|
-
|
|
27
|
-
// src/http/response.ts
|
|
28
|
-
var createJsonResponse = (status) => {
|
|
29
|
-
return (data = {}, init) => {
|
|
30
|
-
return Response.json(data, { status, ...init });
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
var OK = createJsonResponse(200);
|
|
34
|
-
var CREATED = createJsonResponse(201);
|
|
35
|
-
var ACCEPTED = createJsonResponse(202);
|
|
36
|
-
var createException = (status, defaultMessage = "\uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.") => {
|
|
37
|
-
return (message = defaultMessage, init) => {
|
|
38
|
-
return createJsonResponse(status)({ message }, init);
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
var BAD_REQUEST = createException(400, "\uC694\uCCAD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.");
|
|
42
|
-
var UNAUTHORIZED = createException(401, "\uC778\uC99D\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.");
|
|
43
|
-
var FORBIDDEN = createException(403, "\uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
44
|
-
var NOT_FOUND = createException(
|
|
45
|
-
404,
|
|
46
|
-
"\uC694\uCCAD\uD55C \uB9AC\uC18C\uC2A4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
47
|
-
);
|
|
48
|
-
var METHOD_NOT_ALLOWED = createException(
|
|
49
|
-
405,
|
|
50
|
-
"\uBA54\uC11C\uB4DC\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
51
|
-
);
|
|
52
|
-
var NOT_ACCEPTABLE = createException(
|
|
53
|
-
406,
|
|
54
|
-
"\uC694\uCCAD\uD55C \uD615\uC2DD\uC744 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
55
|
-
);
|
|
56
|
-
var REQUEST_TIMEOUT = createException(
|
|
57
|
-
408,
|
|
58
|
-
"\uC694\uCCAD \uC2DC\uAC04\uC774 \uCD08\uACFC\uB418\uC5C8\uC2B5\uB2C8\uB2E4."
|
|
59
|
-
);
|
|
60
|
-
var CONFLICT = createException(409, "\uC694\uCCAD\uC774 \uCDA9\uB3CC\uD588\uC2B5\uB2C8\uB2E4.");
|
|
61
|
-
var UNPROCESSABLE_ENTITY = createException(
|
|
62
|
-
422,
|
|
63
|
-
"\uCC98\uB9AC\uD560 \uC218 \uC5C6\uB294 \uC5D4\uD2F0\uD2F0\uC785\uB2C8\uB2E4."
|
|
64
|
-
);
|
|
65
|
-
var TOO_MANY_REQUESTS = createException(429, "\uC694\uCCAD\uC774 \uB108\uBB34 \uB9CE\uC2B5\uB2C8\uB2E4.");
|
|
66
|
-
var INTERNAL_SERVER_ERROR = createException(
|
|
67
|
-
500,
|
|
68
|
-
"\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
// src/auth/thirdparty_auth.ts
|
|
72
|
-
var ThirdpartyAuthService = class {
|
|
73
|
-
authService;
|
|
74
|
-
signupTokenSecret;
|
|
75
|
-
signupTokenExpiresIn;
|
|
76
|
-
constructor({
|
|
77
|
-
authService,
|
|
78
|
-
signupTokenSecret,
|
|
79
|
-
signupTokenExpiresIn = "1d"
|
|
80
|
-
}) {
|
|
81
|
-
this.authService = authService;
|
|
82
|
-
this.signupTokenSecret = signupTokenSecret;
|
|
83
|
-
this.signupTokenExpiresIn = signupTokenExpiresIn;
|
|
84
|
-
}
|
|
85
|
-
async issueTokensIfUserFound(provider, payload) {
|
|
86
|
-
const user = await this.authService.findUser(provider, payload);
|
|
87
|
-
if (!user) {
|
|
88
|
-
const token = await this.authService.jwtManager.sign(
|
|
89
|
-
{ provider, ...payload },
|
|
90
|
-
this.signupTokenSecret,
|
|
91
|
-
{
|
|
92
|
-
expiresIn: this.signupTokenExpiresIn
|
|
93
|
-
}
|
|
94
|
-
);
|
|
95
|
-
throw createJsonResponse(404)({
|
|
96
|
-
token,
|
|
97
|
-
message: "\uC0AC\uC6A9\uC790\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
const { accessToken, refreshToken } = await this.authService.issueTokenPair(
|
|
101
|
-
user
|
|
102
|
-
);
|
|
103
|
-
return {
|
|
104
|
-
user,
|
|
105
|
-
accessToken,
|
|
106
|
-
refreshToken
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
111
|
-
0 && (module.exports = {
|
|
112
|
-
ThirdpartyAuthService
|
|
113
|
-
});
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
// src/http/response.ts
|
|
2
|
-
var createJsonResponse = (status) => {
|
|
3
|
-
return (data = {}, init) => {
|
|
4
|
-
return Response.json(data, { status, ...init });
|
|
5
|
-
};
|
|
6
|
-
};
|
|
7
|
-
var OK = createJsonResponse(200);
|
|
8
|
-
var CREATED = createJsonResponse(201);
|
|
9
|
-
var ACCEPTED = createJsonResponse(202);
|
|
10
|
-
var createException = (status, defaultMessage = "\uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.") => {
|
|
11
|
-
return (message = defaultMessage, init) => {
|
|
12
|
-
return createJsonResponse(status)({ message }, init);
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
var BAD_REQUEST = createException(400, "\uC694\uCCAD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.");
|
|
16
|
-
var UNAUTHORIZED = createException(401, "\uC778\uC99D\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.");
|
|
17
|
-
var FORBIDDEN = createException(403, "\uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
18
|
-
var NOT_FOUND = createException(
|
|
19
|
-
404,
|
|
20
|
-
"\uC694\uCCAD\uD55C \uB9AC\uC18C\uC2A4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
21
|
-
);
|
|
22
|
-
var METHOD_NOT_ALLOWED = createException(
|
|
23
|
-
405,
|
|
24
|
-
"\uBA54\uC11C\uB4DC\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
25
|
-
);
|
|
26
|
-
var NOT_ACCEPTABLE = createException(
|
|
27
|
-
406,
|
|
28
|
-
"\uC694\uCCAD\uD55C \uD615\uC2DD\uC744 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
29
|
-
);
|
|
30
|
-
var REQUEST_TIMEOUT = createException(
|
|
31
|
-
408,
|
|
32
|
-
"\uC694\uCCAD \uC2DC\uAC04\uC774 \uCD08\uACFC\uB418\uC5C8\uC2B5\uB2C8\uB2E4."
|
|
33
|
-
);
|
|
34
|
-
var CONFLICT = createException(409, "\uC694\uCCAD\uC774 \uCDA9\uB3CC\uD588\uC2B5\uB2C8\uB2E4.");
|
|
35
|
-
var UNPROCESSABLE_ENTITY = createException(
|
|
36
|
-
422,
|
|
37
|
-
"\uCC98\uB9AC\uD560 \uC218 \uC5C6\uB294 \uC5D4\uD2F0\uD2F0\uC785\uB2C8\uB2E4."
|
|
38
|
-
);
|
|
39
|
-
var TOO_MANY_REQUESTS = createException(429, "\uC694\uCCAD\uC774 \uB108\uBB34 \uB9CE\uC2B5\uB2C8\uB2E4.");
|
|
40
|
-
var INTERNAL_SERVER_ERROR = createException(
|
|
41
|
-
500,
|
|
42
|
-
"\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
// src/auth/thirdparty_auth.ts
|
|
46
|
-
var ThirdpartyAuthService = class {
|
|
47
|
-
authService;
|
|
48
|
-
signupTokenSecret;
|
|
49
|
-
signupTokenExpiresIn;
|
|
50
|
-
constructor({
|
|
51
|
-
authService,
|
|
52
|
-
signupTokenSecret,
|
|
53
|
-
signupTokenExpiresIn = "1d"
|
|
54
|
-
}) {
|
|
55
|
-
this.authService = authService;
|
|
56
|
-
this.signupTokenSecret = signupTokenSecret;
|
|
57
|
-
this.signupTokenExpiresIn = signupTokenExpiresIn;
|
|
58
|
-
}
|
|
59
|
-
async issueTokensIfUserFound(provider, payload) {
|
|
60
|
-
const user = await this.authService.findUser(provider, payload);
|
|
61
|
-
if (!user) {
|
|
62
|
-
const token = await this.authService.jwtManager.sign(
|
|
63
|
-
{ provider, ...payload },
|
|
64
|
-
this.signupTokenSecret,
|
|
65
|
-
{
|
|
66
|
-
expiresIn: this.signupTokenExpiresIn
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
throw createJsonResponse(404)({
|
|
70
|
-
token,
|
|
71
|
-
message: "\uC0AC\uC6A9\uC790\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
const { accessToken, refreshToken } = await this.authService.issueTokenPair(
|
|
75
|
-
user
|
|
76
|
-
);
|
|
77
|
-
return {
|
|
78
|
-
user,
|
|
79
|
-
accessToken,
|
|
80
|
-
refreshToken
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
export {
|
|
85
|
-
ThirdpartyAuthService
|
|
86
|
-
};
|
package/dist/cn.d.mts
DELETED
package/dist/cn.d.ts
DELETED
package/dist/cn.mjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { Props, useFullscreen } from './modal/fullscreen_container.mjs';
|
|
2
|
-
export { ModalContext, ModalContextProps, useModal, useModalPortal, useModalRoot } from './modal/hooks.mjs';
|
|
3
|
-
export { ModalProps } from './modal/modal.mjs';
|
|
4
|
-
export { baseButtonStyle, dangerousButtonStyle, disabledButtonStyle, formInputStyle, inputBackgroundStyle, outlineButtonStyle, primaryButtonStyle } from './styles.mjs';
|
|
5
|
-
import 'react';
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { Props, useFullscreen } from './modal/fullscreen_container.js';
|
|
2
|
-
export { ModalContext, ModalContextProps, useModal, useModalPortal, useModalRoot } from './modal/hooks.js';
|
|
3
|
-
export { ModalProps } from './modal/modal.js';
|
|
4
|
-
export { baseButtonStyle, dangerousButtonStyle, disabledButtonStyle, formInputStyle, inputBackgroundStyle, outlineButtonStyle, primaryButtonStyle } from './styles.js';
|
|
5
|
-
import 'react';
|