dn-react-router-toolkit 0.1.12 → 0.2.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.
Files changed (195) hide show
  1. package/dist/auth/apple_auth.d.mts +38 -0
  2. package/dist/auth/apple_auth.d.ts +38 -0
  3. package/dist/{auth-kit → auth}/apple_auth.js +31 -18
  4. package/dist/auth/apple_auth.mjs +63 -0
  5. package/dist/{auth-kit/repository.d.mts → auth/auth_repository.d.mts} +10 -11
  6. package/dist/{auth-kit/repository.d.ts → auth/auth_repository.d.ts} +10 -11
  7. package/dist/{file-kit/repository.js → auth/auth_repository.js} +3 -3
  8. package/dist/{auth-kit → auth}/auth_service.d.mts +12 -23
  9. package/dist/{auth-kit → auth}/auth_service.d.ts +12 -23
  10. package/dist/{auth-kit → auth}/auth_service.js +24 -77
  11. package/dist/{auth-kit → auth}/auth_service.mjs +24 -77
  12. package/dist/auth/client/google_login_button.d.mts +7 -0
  13. package/dist/auth/client/google_login_button.d.ts +7 -0
  14. package/dist/{auth-kit → auth}/client/google_login_button.js +24 -19
  15. package/dist/auth/client/google_login_button.mjs +37 -0
  16. package/dist/auth/client/provider.d.mts +26 -0
  17. package/dist/auth/client/provider.d.ts +26 -0
  18. package/dist/auth/client/provider.js +152 -0
  19. package/dist/auth/client/provider.mjs +116 -0
  20. package/dist/{auth-kit → auth}/client/redirect_page.js +1 -1
  21. package/dist/{auth-kit → auth}/client/redirect_page.mjs +1 -1
  22. package/dist/auth/google_auth.d.mts +33 -0
  23. package/dist/auth/google_auth.d.ts +33 -0
  24. package/dist/{auth-kit → auth}/google_auth.js +23 -32
  25. package/dist/{auth-kit → auth}/google_auth.mjs +22 -31
  26. package/dist/auth/handlers/find_auth.d.mts +13 -0
  27. package/dist/auth/handlers/find_auth.d.ts +13 -0
  28. package/dist/{route/api/auth/route.js → auth/handlers/find_auth.js} +10 -10
  29. package/dist/{route/api/auth/route.mjs → auth/handlers/find_auth.mjs} +5 -5
  30. package/dist/auth/handlers/login.d.mts +13 -0
  31. package/dist/auth/handlers/login.d.ts +13 -0
  32. package/dist/{route/api/auth/login/route.js → auth/handlers/login.js} +17 -17
  33. package/dist/{route/api/auth/login/route.mjs → auth/handlers/login.mjs} +12 -12
  34. package/dist/auth/handlers/login_with_thirdparty.d.mts +15 -0
  35. package/dist/auth/handlers/login_with_thirdparty.d.ts +15 -0
  36. package/dist/{route/api/auth/login/[provider]/route.js → auth/handlers/login_with_thirdparty.js} +12 -27
  37. package/dist/{route/api/auth/login/[provider]/route.mjs → auth/handlers/login_with_thirdparty.mjs} +7 -22
  38. package/dist/auth/handlers/logout.d.mts +13 -0
  39. package/dist/auth/handlers/logout.d.ts +13 -0
  40. package/dist/{route/api/auth/logout/route.js → auth/handlers/logout.js} +15 -11
  41. package/dist/{route/api/auth/logout/route.mjs → auth/handlers/logout.mjs} +11 -7
  42. package/dist/auth/handlers/refresh.d.mts +13 -0
  43. package/dist/auth/handlers/refresh.d.ts +13 -0
  44. package/dist/{route/api/auth/refresh/route.js → auth/handlers/refresh.js} +12 -12
  45. package/dist/{route/api/auth/refresh/route.mjs → auth/handlers/refresh.mjs} +7 -7
  46. package/dist/auth/handlers/request_password_reset.d.mts +10 -0
  47. package/dist/auth/handlers/request_password_reset.d.ts +10 -0
  48. package/dist/auth/handlers/request_password_reset.js +87 -0
  49. package/dist/auth/handlers/request_password_reset.mjs +60 -0
  50. package/dist/auth/handlers/reset_password.d.mts +10 -0
  51. package/dist/auth/handlers/reset_password.d.ts +10 -0
  52. package/dist/auth/handlers/reset_password.js +88 -0
  53. package/dist/auth/handlers/reset_password.mjs +61 -0
  54. package/dist/auth/handlers/signup.d.mts +15 -0
  55. package/dist/auth/handlers/signup.d.ts +15 -0
  56. package/dist/auth/handlers/signup.js +147 -0
  57. package/dist/auth/handlers/signup.mjs +112 -0
  58. package/dist/auth/handlers/signup_with_thirdparty.d.mts +17 -0
  59. package/dist/auth/handlers/signup_with_thirdparty.d.ts +17 -0
  60. package/dist/auth/handlers/signup_with_thirdparty.js +123 -0
  61. package/dist/auth/handlers/signup_with_thirdparty.mjs +98 -0
  62. package/dist/auth/handlers/thirdparty_auth_callback.d.mts +16 -0
  63. package/dist/auth/handlers/thirdparty_auth_callback.d.ts +16 -0
  64. package/dist/{route/auth/callback/[provider]/route.js → auth/handlers/thirdparty_auth_callback.js} +54 -45
  65. package/dist/{route/auth/callback/[provider]/route.mjs → auth/handlers/thirdparty_auth_callback.mjs} +49 -40
  66. package/dist/{auth-kit/jwt.d.mts → auth/jwt_manager.d.mts} +11 -1
  67. package/dist/{auth-kit/jwt.d.ts → auth/jwt_manager.d.ts} +11 -1
  68. package/dist/{auth-kit/jwt.js → auth/jwt_manager.js} +25 -11
  69. package/dist/{auth-kit/jwt.mjs → auth/jwt_manager.mjs} +22 -8
  70. package/dist/auth/kakao_auth.d.mts +27 -0
  71. package/dist/auth/kakao_auth.d.ts +27 -0
  72. package/dist/auth/kakao_auth.js +56 -0
  73. package/dist/auth/kakao_auth.mjs +31 -0
  74. package/dist/auth/password_recovery.d.mts +34 -0
  75. package/dist/auth/password_recovery.d.ts +34 -0
  76. package/dist/auth/password_recovery.js +169 -0
  77. package/dist/auth/password_recovery.mjs +134 -0
  78. package/dist/auth/thirdparty_auth.d.mts +41 -0
  79. package/dist/auth/thirdparty_auth.d.ts +41 -0
  80. package/dist/{auth-kit/kakao_auth.js → auth/thirdparty_auth.js} +31 -33
  81. package/dist/{auth-kit/kakao_auth.mjs → auth/thirdparty_auth.mjs} +26 -28
  82. package/dist/{auth-kit → auth}/with_auth.d.mts +5 -6
  83. package/dist/{auth-kit → auth}/with_auth.d.ts +5 -6
  84. package/dist/{auth-kit → auth}/with_auth.js +26 -10
  85. package/dist/auth/with_auth.mjs +63 -0
  86. package/dist/date.d.mts +2 -0
  87. package/dist/date.d.ts +2 -0
  88. package/dist/date.js +4 -2
  89. package/dist/date.mjs +2 -1
  90. package/dist/{file-kit → file}/cdn.js +1 -1
  91. package/dist/{file-kit → file}/cdn.mjs +1 -1
  92. package/dist/{file-kit → file}/client/drop_file_input.js +3 -3
  93. package/dist/{file-kit → file}/client/drop_file_input.mjs +3 -3
  94. package/dist/{file-kit → file}/client/file_upload_button.js +1 -1
  95. package/dist/{file-kit → file}/client/file_upload_button.mjs +1 -1
  96. package/dist/{file-kit → file}/client/file_uploader.js +3 -3
  97. package/dist/{file-kit → file}/client/file_uploader.mjs +2 -2
  98. package/dist/{file-kit → file}/client/format_size.js +1 -1
  99. package/dist/{file-kit → file}/client/format_size.mjs +1 -1
  100. package/dist/{file-kit → file}/client/metadata.js +1 -1
  101. package/dist/{file-kit → file}/client/metadata.mjs +1 -1
  102. package/dist/{file-kit/repository.d.mts → file/file_repository.d.mts} +4 -4
  103. package/dist/{file-kit/repository.d.ts → file/file_repository.d.ts} +4 -4
  104. package/dist/{auth-kit/repository.js → file/file_repository.js} +3 -3
  105. package/dist/file/file_service.d.mts +32 -0
  106. package/dist/file/file_service.d.ts +32 -0
  107. package/dist/{file-kit → file}/file_service.js +27 -21
  108. package/dist/file/file_service.mjs +41 -0
  109. package/dist/file/handlers/delete_file.d.mts +17 -0
  110. package/dist/file/handlers/delete_file.d.ts +17 -0
  111. package/dist/{route/api/files/[fileId]/route.js → file/handlers/delete_file.js} +15 -15
  112. package/dist/{route/api/files/[fileId]/route.mjs → file/handlers/delete_file.mjs} +10 -10
  113. package/dist/file/handlers/upload_file.d.mts +16 -0
  114. package/dist/file/handlers/upload_file.d.ts +16 -0
  115. package/dist/{route/api/files/route.js → file/handlers/upload_file.js} +13 -13
  116. package/dist/{route/api/files/route.mjs → file/handlers/upload_file.mjs} +8 -8
  117. package/dist/{file-kit → file}/object_storage.d.mts +3 -1
  118. package/dist/{file-kit → file}/object_storage.d.ts +3 -1
  119. package/dist/{file-kit → file}/object_storage.js +2 -2
  120. package/dist/{file-kit → file}/object_storage.mjs +2 -2
  121. package/dist/{file-kit → file}/responsive_image.d.mts +4 -4
  122. package/dist/{file-kit → file}/responsive_image.d.ts +4 -4
  123. package/dist/{file-kit → file}/responsive_image.js +18 -9
  124. package/dist/{file-kit → file}/responsive_image.mjs +18 -9
  125. package/dist/{http-kit → http}/index.js +5 -5
  126. package/dist/{http-kit → http}/index.mjs +1 -1
  127. package/dist/{http-kit → http}/response.js +1 -1
  128. package/dist/{http-kit → http}/response.mjs +1 -1
  129. package/dist/index.d.mts +1 -0
  130. package/dist/index.d.ts +1 -0
  131. package/dist/index.js +2 -0
  132. package/dist/index.mjs +1 -0
  133. package/dist/route/api.d.mts +17 -25
  134. package/dist/route/api.d.ts +17 -25
  135. package/dist/route/api.js +367 -178
  136. package/dist/route/api.mjs +356 -177
  137. package/dist/{seo-kit → seo}/seo.js +1 -1
  138. package/dist/{seo-kit → seo}/seo.mjs +1 -1
  139. package/package.json +76 -74
  140. package/dist/auth-kit/apple_auth.d.mts +0 -24
  141. package/dist/auth-kit/apple_auth.d.ts +0 -24
  142. package/dist/auth-kit/apple_auth.mjs +0 -50
  143. package/dist/auth-kit/client/google_login_button.d.mts +0 -9
  144. package/dist/auth-kit/client/google_login_button.d.ts +0 -9
  145. package/dist/auth-kit/client/google_login_button.mjs +0 -32
  146. package/dist/auth-kit/client/logout.d.mts +0 -3
  147. package/dist/auth-kit/client/logout.d.ts +0 -3
  148. package/dist/auth-kit/client/logout.js +0 -49
  149. package/dist/auth-kit/client/logout.mjs +0 -24
  150. package/dist/auth-kit/google_auth.d.mts +0 -27
  151. package/dist/auth-kit/google_auth.d.ts +0 -27
  152. package/dist/auth-kit/kakao_auth.d.mts +0 -24
  153. package/dist/auth-kit/kakao_auth.d.ts +0 -24
  154. package/dist/auth-kit/with_auth.mjs +0 -47
  155. package/dist/file-kit/file_service.d.mts +0 -26
  156. package/dist/file-kit/file_service.d.ts +0 -26
  157. package/dist/file-kit/file_service.mjs +0 -35
  158. package/dist/route/api/auth/login/_provider_/route.d.mts +0 -20
  159. package/dist/route/api/auth/login/_provider_/route.d.ts +0 -20
  160. package/dist/route/api/auth/login/route.d.mts +0 -14
  161. package/dist/route/api/auth/login/route.d.ts +0 -14
  162. package/dist/route/api/auth/logout/route.d.mts +0 -14
  163. package/dist/route/api/auth/logout/route.d.ts +0 -14
  164. package/dist/route/api/auth/refresh/route.d.mts +0 -13
  165. package/dist/route/api/auth/refresh/route.d.ts +0 -13
  166. package/dist/route/api/auth/route.d.mts +0 -13
  167. package/dist/route/api/auth/route.d.ts +0 -13
  168. package/dist/route/api/files/_fileId_/route.d.mts +0 -17
  169. package/dist/route/api/files/_fileId_/route.d.ts +0 -17
  170. package/dist/route/api/files/route.d.mts +0 -16
  171. package/dist/route/api/files/route.d.ts +0 -16
  172. package/dist/route/auth/callback/_provider_/route.d.mts +0 -20
  173. package/dist/route/auth/callback/_provider_/route.d.ts +0 -20
  174. /package/dist/{auth-kit/repository.mjs → auth/auth_repository.mjs} +0 -0
  175. /package/dist/{auth-kit → auth}/client/redirect_page.d.mts +0 -0
  176. /package/dist/{auth-kit → auth}/client/redirect_page.d.ts +0 -0
  177. /package/dist/{file-kit → file}/cdn.d.mts +0 -0
  178. /package/dist/{file-kit → file}/cdn.d.ts +0 -0
  179. /package/dist/{file-kit → file}/client/drop_file_input.d.mts +0 -0
  180. /package/dist/{file-kit → file}/client/drop_file_input.d.ts +0 -0
  181. /package/dist/{file-kit → file}/client/file_upload_button.d.mts +0 -0
  182. /package/dist/{file-kit → file}/client/file_upload_button.d.ts +0 -0
  183. /package/dist/{file-kit → file}/client/file_uploader.d.mts +0 -0
  184. /package/dist/{file-kit → file}/client/file_uploader.d.ts +0 -0
  185. /package/dist/{file-kit → file}/client/format_size.d.mts +0 -0
  186. /package/dist/{file-kit → file}/client/format_size.d.ts +0 -0
  187. /package/dist/{file-kit → file}/client/metadata.d.mts +0 -0
  188. /package/dist/{file-kit → file}/client/metadata.d.ts +0 -0
  189. /package/dist/{file-kit/repository.mjs → file/file_repository.mjs} +0 -0
  190. /package/dist/{http-kit → http}/index.d.mts +0 -0
  191. /package/dist/{http-kit → http}/index.d.ts +0 -0
  192. /package/dist/{http-kit → http}/response.d.mts +0 -0
  193. /package/dist/{http-kit → http}/response.d.ts +0 -0
  194. /package/dist/{seo-kit → seo}/seo.d.mts +0 -0
  195. /package/dist/{seo-kit → seo}/seo.d.ts +0 -0
@@ -0,0 +1,33 @@
1
+ import { ThirdpartyAuth, ThirdpartyAuthService } from './thirdparty_auth.js';
2
+ import './auth_service.js';
3
+ import 'jose';
4
+ import 'react-router';
5
+ import './jwt_manager.js';
6
+ import '../file/object_storage.js';
7
+ import '@aws-sdk/client-s3';
8
+ import './auth_repository.js';
9
+
10
+ declare class GoogleAuth implements ThirdpartyAuth {
11
+ thirdpartyAuth: ThirdpartyAuthService;
12
+ googleClientId: string;
13
+ googleClientSecret: string;
14
+ googleRedirectUri: string;
15
+ constructor({ thirdpartyAuth, googleClientId, googleClientSecret, googleRedirectUri, }: {
16
+ thirdpartyAuth: ThirdpartyAuthService;
17
+ googleClientId: string;
18
+ googleClientSecret: string;
19
+ googleRedirectUri: string;
20
+ });
21
+ login(code: string): Promise<{
22
+ user: {
23
+ id: string;
24
+ role: string;
25
+ name: string;
26
+ refreshToken: string | null;
27
+ };
28
+ accessToken: string;
29
+ refreshToken: string;
30
+ }>;
31
+ }
32
+
33
+ export { GoogleAuth };
@@ -17,14 +17,14 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/auth-kit/google_auth.tsx
20
+ // src/auth/google_auth.tsx
21
21
  var google_auth_exports = {};
22
22
  __export(google_auth_exports, {
23
23
  GoogleAuth: () => GoogleAuth
24
24
  });
25
25
  module.exports = __toCommonJS(google_auth_exports);
26
26
 
27
- // src/http-kit/response.ts
27
+ // src/http/response.ts
28
28
  var createJsonResponse = (status) => {
29
29
  return (data = {}, init) => {
30
30
  return Response.json(data, { status, ...init });
@@ -68,19 +68,24 @@ var INTERNAL_SERVER_ERROR = createException(
68
68
  "\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
69
69
  );
70
70
 
71
- // src/auth-kit/google_auth.tsx
71
+ // src/auth/google_auth.tsx
72
72
  var GoogleAuth = class {
73
- AUTH;
74
- GOOGLE_CLIENT_ID;
75
- GOOGLE_CLIENT_SECRET;
76
- GOOGLE_REDIRECT_URI;
77
- constructor(AUTH, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_REDIRECT_URI) {
78
- this.GOOGLE_CLIENT_ID = GOOGLE_CLIENT_ID;
79
- this.GOOGLE_CLIENT_SECRET = GOOGLE_CLIENT_SECRET;
80
- this.GOOGLE_REDIRECT_URI = GOOGLE_REDIRECT_URI;
81
- this.AUTH = AUTH;
73
+ thirdpartyAuth;
74
+ googleClientId;
75
+ googleClientSecret;
76
+ googleRedirectUri;
77
+ constructor({
78
+ thirdpartyAuth,
79
+ googleClientId,
80
+ googleClientSecret,
81
+ googleRedirectUri
82
+ }) {
83
+ this.thirdpartyAuth = thirdpartyAuth;
84
+ this.googleClientId = googleClientId;
85
+ this.googleClientSecret = googleClientSecret;
86
+ this.googleRedirectUri = googleRedirectUri;
82
87
  }
83
- async signIn(code) {
88
+ async login(code) {
84
89
  const tokenRes = await fetch("https://oauth2.googleapis.com/token", {
85
90
  method: "POST",
86
91
  headers: {
@@ -88,9 +93,9 @@ var GoogleAuth = class {
88
93
  },
89
94
  body: new URLSearchParams({
90
95
  code,
91
- client_id: this.GOOGLE_CLIENT_ID,
92
- client_secret: this.GOOGLE_CLIENT_SECRET,
93
- redirect_uri: this.GOOGLE_REDIRECT_URI,
96
+ client_id: this.googleClientId,
97
+ client_secret: this.googleClientSecret,
98
+ redirect_uri: this.googleRedirectUri,
94
99
  grant_type: "authorization_code"
95
100
  })
96
101
  });
@@ -115,27 +120,13 @@ var GoogleAuth = class {
115
120
  throw BAD_REQUEST("\uC720\uC800 \uC815\uBCF4\uB97C \uAC00\uC838\uC624\uB294\uB370 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.");
116
121
  }
117
122
  const { id, email, name, picture } = await userRes.json();
118
- const user = await this.AUTH.findUser("google", {
123
+ const payload = {
119
124
  id,
120
125
  email,
121
126
  name,
122
127
  picture
123
- });
124
- if (!user) {
125
- throw createJsonResponse(404)({
126
- provider: "google",
127
- id,
128
- name,
129
- picture,
130
- message: "\uC0AC\uC6A9\uC790\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
131
- });
132
- }
133
- const { accessToken, refreshToken } = await this.AUTH.issueTokenPair(user);
134
- return {
135
- user,
136
- accessToken,
137
- refreshToken
138
128
  };
129
+ return this.thirdpartyAuth.issueTokensIfUserFound("google", payload);
139
130
  }
140
131
  };
141
132
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,4 +1,4 @@
1
- // src/http-kit/response.ts
1
+ // src/http/response.ts
2
2
  var createJsonResponse = (status) => {
3
3
  return (data = {}, init) => {
4
4
  return Response.json(data, { status, ...init });
@@ -42,19 +42,24 @@ var INTERNAL_SERVER_ERROR = createException(
42
42
  "\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
43
43
  );
44
44
 
45
- // src/auth-kit/google_auth.tsx
45
+ // src/auth/google_auth.tsx
46
46
  var GoogleAuth = class {
47
- AUTH;
48
- GOOGLE_CLIENT_ID;
49
- GOOGLE_CLIENT_SECRET;
50
- GOOGLE_REDIRECT_URI;
51
- constructor(AUTH, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_REDIRECT_URI) {
52
- this.GOOGLE_CLIENT_ID = GOOGLE_CLIENT_ID;
53
- this.GOOGLE_CLIENT_SECRET = GOOGLE_CLIENT_SECRET;
54
- this.GOOGLE_REDIRECT_URI = GOOGLE_REDIRECT_URI;
55
- this.AUTH = AUTH;
47
+ thirdpartyAuth;
48
+ googleClientId;
49
+ googleClientSecret;
50
+ googleRedirectUri;
51
+ constructor({
52
+ thirdpartyAuth,
53
+ googleClientId,
54
+ googleClientSecret,
55
+ googleRedirectUri
56
+ }) {
57
+ this.thirdpartyAuth = thirdpartyAuth;
58
+ this.googleClientId = googleClientId;
59
+ this.googleClientSecret = googleClientSecret;
60
+ this.googleRedirectUri = googleRedirectUri;
56
61
  }
57
- async signIn(code) {
62
+ async login(code) {
58
63
  const tokenRes = await fetch("https://oauth2.googleapis.com/token", {
59
64
  method: "POST",
60
65
  headers: {
@@ -62,9 +67,9 @@ var GoogleAuth = class {
62
67
  },
63
68
  body: new URLSearchParams({
64
69
  code,
65
- client_id: this.GOOGLE_CLIENT_ID,
66
- client_secret: this.GOOGLE_CLIENT_SECRET,
67
- redirect_uri: this.GOOGLE_REDIRECT_URI,
70
+ client_id: this.googleClientId,
71
+ client_secret: this.googleClientSecret,
72
+ redirect_uri: this.googleRedirectUri,
68
73
  grant_type: "authorization_code"
69
74
  })
70
75
  });
@@ -89,27 +94,13 @@ var GoogleAuth = class {
89
94
  throw BAD_REQUEST("\uC720\uC800 \uC815\uBCF4\uB97C \uAC00\uC838\uC624\uB294\uB370 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.");
90
95
  }
91
96
  const { id, email, name, picture } = await userRes.json();
92
- const user = await this.AUTH.findUser("google", {
97
+ const payload = {
93
98
  id,
94
99
  email,
95
100
  name,
96
101
  picture
97
- });
98
- if (!user) {
99
- throw createJsonResponse(404)({
100
- provider: "google",
101
- id,
102
- name,
103
- picture,
104
- message: "\uC0AC\uC6A9\uC790\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
105
- });
106
- }
107
- const { accessToken, refreshToken } = await this.AUTH.issueTokenPair(user);
108
- return {
109
- user,
110
- accessToken,
111
- refreshToken
112
102
  };
103
+ return this.thirdpartyAuth.issueTokensIfUserFound("google", payload);
113
104
  }
114
105
  };
115
106
  export {
@@ -0,0 +1,13 @@
1
+ import { AuthService } from '../auth_service.mjs';
2
+ import 'jose';
3
+ import 'react-router';
4
+ import '../jwt_manager.mjs';
5
+ import '../../file/object_storage.mjs';
6
+ import '@aws-sdk/client-s3';
7
+ import '../auth_repository.mjs';
8
+
9
+ declare const findAuthHandler: (request: Request, { authService }: {
10
+ authService: AuthService;
11
+ }) => Promise<Response>;
12
+
13
+ export { findAuthHandler };
@@ -0,0 +1,13 @@
1
+ import { AuthService } from '../auth_service.js';
2
+ import 'jose';
3
+ import 'react-router';
4
+ import '../jwt_manager.js';
5
+ import '../../file/object_storage.js';
6
+ import '@aws-sdk/client-s3';
7
+ import '../auth_repository.js';
8
+
9
+ declare const findAuthHandler: (request: Request, { authService }: {
10
+ authService: AuthService;
11
+ }) => Promise<Response>;
12
+
13
+ export { findAuthHandler };
@@ -17,14 +17,14 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/route/api/auth/route.ts
21
- var route_exports = {};
22
- __export(route_exports, {
23
- getAuthHandler: () => getAuthHandler
20
+ // src/auth/handlers/find_auth.ts
21
+ var find_auth_exports = {};
22
+ __export(find_auth_exports, {
23
+ findAuthHandler: () => findAuthHandler
24
24
  });
25
- module.exports = __toCommonJS(route_exports);
25
+ module.exports = __toCommonJS(find_auth_exports);
26
26
 
27
- // src/http-kit/response.ts
27
+ // src/http/response.ts
28
28
  var createJsonResponse = (status) => {
29
29
  return (data = {}, init) => {
30
30
  return Response.json(data, { status, ...init });
@@ -68,9 +68,9 @@ var INTERNAL_SERVER_ERROR = createException(
68
68
  "\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
69
69
  );
70
70
 
71
- // src/route/api/auth/route.ts
72
- var getAuthHandler = async (request, { AUTH }) => {
73
- const auth = await AUTH.verifyOrRefresh(request);
71
+ // src/auth/handlers/find_auth.ts
72
+ var findAuthHandler = async (request, { authService }) => {
73
+ const auth = await authService.verifyOrRefresh(request);
74
74
  if (!auth) {
75
75
  return UNAUTHORIZED();
76
76
  }
@@ -78,5 +78,5 @@ var getAuthHandler = async (request, { AUTH }) => {
78
78
  };
79
79
  // Annotate the CommonJS export names for ESM import in node:
80
80
  0 && (module.exports = {
81
- getAuthHandler
81
+ findAuthHandler
82
82
  });
@@ -1,4 +1,4 @@
1
- // src/http-kit/response.ts
1
+ // src/http/response.ts
2
2
  var createJsonResponse = (status) => {
3
3
  return (data = {}, init) => {
4
4
  return Response.json(data, { status, ...init });
@@ -42,14 +42,14 @@ var INTERNAL_SERVER_ERROR = createException(
42
42
  "\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
43
43
  );
44
44
 
45
- // src/route/api/auth/route.ts
46
- var getAuthHandler = async (request, { AUTH }) => {
47
- const auth = await AUTH.verifyOrRefresh(request);
45
+ // src/auth/handlers/find_auth.ts
46
+ var findAuthHandler = async (request, { authService }) => {
47
+ const auth = await authService.verifyOrRefresh(request);
48
48
  if (!auth) {
49
49
  return UNAUTHORIZED();
50
50
  }
51
51
  return OK(auth);
52
52
  };
53
53
  export {
54
- getAuthHandler
54
+ findAuthHandler
55
55
  };
@@ -0,0 +1,13 @@
1
+ import { AuthService } from '../auth_service.mjs';
2
+ import 'jose';
3
+ import 'react-router';
4
+ import '../jwt_manager.mjs';
5
+ import '../../file/object_storage.mjs';
6
+ import '@aws-sdk/client-s3';
7
+ import '../auth_repository.mjs';
8
+
9
+ declare const loginHandler: (request: Request, { authService, }: {
10
+ authService: AuthService;
11
+ }) => Promise<Response>;
12
+
13
+ export { loginHandler };
@@ -0,0 +1,13 @@
1
+ import { AuthService } from '../auth_service.js';
2
+ import 'jose';
3
+ import 'react-router';
4
+ import '../jwt_manager.js';
5
+ import '../../file/object_storage.js';
6
+ import '@aws-sdk/client-s3';
7
+ import '../auth_repository.js';
8
+
9
+ declare const loginHandler: (request: Request, { authService, }: {
10
+ authService: AuthService;
11
+ }) => Promise<Response>;
12
+
13
+ export { loginHandler };
@@ -17,14 +17,14 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/route/api/auth/login/route.ts
21
- var route_exports = {};
22
- __export(route_exports, {
23
- loginCredentialHandler: () => loginCredentialHandler
20
+ // src/auth/handlers/login.ts
21
+ var login_exports = {};
22
+ __export(login_exports, {
23
+ loginHandler: () => loginHandler
24
24
  });
25
- module.exports = __toCommonJS(route_exports);
25
+ module.exports = __toCommonJS(login_exports);
26
26
 
27
- // src/http-kit/response.ts
27
+ // src/http/response.ts
28
28
  var createJsonResponse = (status) => {
29
29
  return (data = {}, init) => {
30
30
  return Response.json(data, { status, ...init });
@@ -68,26 +68,26 @@ var INTERNAL_SERVER_ERROR = createException(
68
68
  "\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
69
69
  );
70
70
 
71
- // src/route/api/auth/login/route.ts
72
- var loginCredentialHandler = async (request, {
73
- AUTH,
74
- JWT_MANAGER
71
+ // src/auth/handlers/login.ts
72
+ var loginHandler = async (request, {
73
+ authService
75
74
  }) => {
76
- const searchParams = new URL(request.url).searchParams;
77
75
  const { id, password } = await request.json();
78
76
  try {
79
- const { accessToken, refreshToken } = await AUTH.signIn({
77
+ const { accessToken, refreshToken } = await authService.login({
80
78
  id,
81
79
  password
82
80
  });
83
- if (searchParams.get("type") === "json") {
81
+ const searchParams = new URL(request.url).searchParams;
82
+ const type = searchParams.get("type");
83
+ if (type === "json") {
84
84
  return CREATED({ accessToken, refreshToken });
85
85
  }
86
86
  const [accessTokenSetCookie, refreshTokenSetCookie] = await Promise.all([
87
- AUTH.getAccessTokenSetCookie(accessToken),
88
- AUTH.getRefreshTokenSetCookie(refreshToken)
87
+ authService.getAccessTokenSetCookie(accessToken),
88
+ authService.getRefreshTokenSetCookie(refreshToken)
89
89
  ]);
90
- const payload = JWT_MANAGER.decode(accessToken);
90
+ const payload = authService.jwtManager.decode(accessToken);
91
91
  const headers = new Headers();
92
92
  headers.append("Set-Cookie", accessTokenSetCookie);
93
93
  headers.append("Set-Cookie", refreshTokenSetCookie);
@@ -103,5 +103,5 @@ var loginCredentialHandler = async (request, {
103
103
  };
104
104
  // Annotate the CommonJS export names for ESM import in node:
105
105
  0 && (module.exports = {
106
- loginCredentialHandler
106
+ loginHandler
107
107
  });
@@ -1,4 +1,4 @@
1
- // src/http-kit/response.ts
1
+ // src/http/response.ts
2
2
  var createJsonResponse = (status) => {
3
3
  return (data = {}, init) => {
4
4
  return Response.json(data, { status, ...init });
@@ -42,26 +42,26 @@ var INTERNAL_SERVER_ERROR = createException(
42
42
  "\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
43
43
  );
44
44
 
45
- // src/route/api/auth/login/route.ts
46
- var loginCredentialHandler = async (request, {
47
- AUTH,
48
- JWT_MANAGER
45
+ // src/auth/handlers/login.ts
46
+ var loginHandler = async (request, {
47
+ authService
49
48
  }) => {
50
- const searchParams = new URL(request.url).searchParams;
51
49
  const { id, password } = await request.json();
52
50
  try {
53
- const { accessToken, refreshToken } = await AUTH.signIn({
51
+ const { accessToken, refreshToken } = await authService.login({
54
52
  id,
55
53
  password
56
54
  });
57
- if (searchParams.get("type") === "json") {
55
+ const searchParams = new URL(request.url).searchParams;
56
+ const type = searchParams.get("type");
57
+ if (type === "json") {
58
58
  return CREATED({ accessToken, refreshToken });
59
59
  }
60
60
  const [accessTokenSetCookie, refreshTokenSetCookie] = await Promise.all([
61
- AUTH.getAccessTokenSetCookie(accessToken),
62
- AUTH.getRefreshTokenSetCookie(refreshToken)
61
+ authService.getAccessTokenSetCookie(accessToken),
62
+ authService.getRefreshTokenSetCookie(refreshToken)
63
63
  ]);
64
- const payload = JWT_MANAGER.decode(accessToken);
64
+ const payload = authService.jwtManager.decode(accessToken);
65
65
  const headers = new Headers();
66
66
  headers.append("Set-Cookie", accessTokenSetCookie);
67
67
  headers.append("Set-Cookie", refreshTokenSetCookie);
@@ -76,5 +76,5 @@ var loginCredentialHandler = async (request, {
76
76
  }
77
77
  };
78
78
  export {
79
- loginCredentialHandler
79
+ loginHandler
80
80
  };
@@ -0,0 +1,15 @@
1
+ import { ThirdpartyAuth } from '../thirdparty_auth.mjs';
2
+ import '../auth_service.mjs';
3
+ import 'jose';
4
+ import 'react-router';
5
+ import '../jwt_manager.mjs';
6
+ import '../../file/object_storage.mjs';
7
+ import '@aws-sdk/client-s3';
8
+ import '../auth_repository.mjs';
9
+
10
+ declare const loginWithThirdPartyHandler: (request: Request, { provider, getThirdPartyAuth, }: {
11
+ provider: string;
12
+ getThirdPartyAuth: (provider: string) => ThirdpartyAuth;
13
+ }) => Promise<Response>;
14
+
15
+ export { loginWithThirdPartyHandler };
@@ -0,0 +1,15 @@
1
+ import { ThirdpartyAuth } from '../thirdparty_auth.js';
2
+ import '../auth_service.js';
3
+ import 'jose';
4
+ import 'react-router';
5
+ import '../jwt_manager.js';
6
+ import '../../file/object_storage.js';
7
+ import '@aws-sdk/client-s3';
8
+ import '../auth_repository.js';
9
+
10
+ declare const loginWithThirdPartyHandler: (request: Request, { provider, getThirdPartyAuth, }: {
11
+ provider: string;
12
+ getThirdPartyAuth: (provider: string) => ThirdpartyAuth;
13
+ }) => Promise<Response>;
14
+
15
+ export { loginWithThirdPartyHandler };
@@ -17,14 +17,14 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/route/api/auth/login/[provider]/route.ts
21
- var route_exports = {};
22
- __export(route_exports, {
23
- loginThirdPartyHandler: () => loginThirdPartyHandler
20
+ // src/auth/handlers/login_with_thirdparty.ts
21
+ var login_with_thirdparty_exports = {};
22
+ __export(login_with_thirdparty_exports, {
23
+ loginWithThirdPartyHandler: () => loginWithThirdPartyHandler
24
24
  });
25
- module.exports = __toCommonJS(route_exports);
25
+ module.exports = __toCommonJS(login_with_thirdparty_exports);
26
26
 
27
- // src/http-kit/response.ts
27
+ // src/http/response.ts
28
28
  var createJsonResponse = (status) => {
29
29
  return (data = {}, init) => {
30
30
  return Response.json(data, { status, ...init });
@@ -68,34 +68,19 @@ var INTERNAL_SERVER_ERROR = createException(
68
68
  "\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
69
69
  );
70
70
 
71
- // src/route/api/auth/login/[provider]/route.ts
72
- var loginThirdPartyHandler = async (request, {
73
- provider
74
- }, {
75
- GOOGLE_AUTH,
76
- APPLE_AUTH,
77
- KAKAO_AUTH
71
+ // src/auth/handlers/login_with_thirdparty.ts
72
+ var loginWithThirdPartyHandler = async (request, {
73
+ provider,
74
+ getThirdPartyAuth
78
75
  }) => {
79
76
  const { code } = await request.json();
80
77
  if (!code) {
81
78
  return BAD_REQUEST("\uCF54\uB4DC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
82
79
  }
83
- const getThirdPartyAuth = (provider2) => {
84
- switch (provider2) {
85
- case "google":
86
- return GOOGLE_AUTH;
87
- case "apple":
88
- return APPLE_AUTH;
89
- case "kakao":
90
- return KAKAO_AUTH;
91
- default:
92
- throw BAD_REQUEST("\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC778\uC99D \uC81C\uACF5\uC790\uC785\uB2C8\uB2E4.");
93
- }
94
- };
95
80
  try {
96
81
  const { accessToken, refreshToken } = await getThirdPartyAuth(
97
82
  provider
98
- ).signIn(code);
83
+ ).login(code);
99
84
  return CREATED({
100
85
  accessToken,
101
86
  refreshToken
@@ -109,5 +94,5 @@ var loginThirdPartyHandler = async (request, {
109
94
  };
110
95
  // Annotate the CommonJS export names for ESM import in node:
111
96
  0 && (module.exports = {
112
- loginThirdPartyHandler
97
+ loginWithThirdPartyHandler
113
98
  });
@@ -1,4 +1,4 @@
1
- // src/http-kit/response.ts
1
+ // src/http/response.ts
2
2
  var createJsonResponse = (status) => {
3
3
  return (data = {}, init) => {
4
4
  return Response.json(data, { status, ...init });
@@ -42,34 +42,19 @@ var INTERNAL_SERVER_ERROR = createException(
42
42
  "\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
43
43
  );
44
44
 
45
- // src/route/api/auth/login/[provider]/route.ts
46
- var loginThirdPartyHandler = async (request, {
47
- provider
48
- }, {
49
- GOOGLE_AUTH,
50
- APPLE_AUTH,
51
- KAKAO_AUTH
45
+ // src/auth/handlers/login_with_thirdparty.ts
46
+ var loginWithThirdPartyHandler = async (request, {
47
+ provider,
48
+ getThirdPartyAuth
52
49
  }) => {
53
50
  const { code } = await request.json();
54
51
  if (!code) {
55
52
  return BAD_REQUEST("\uCF54\uB4DC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
56
53
  }
57
- const getThirdPartyAuth = (provider2) => {
58
- switch (provider2) {
59
- case "google":
60
- return GOOGLE_AUTH;
61
- case "apple":
62
- return APPLE_AUTH;
63
- case "kakao":
64
- return KAKAO_AUTH;
65
- default:
66
- throw BAD_REQUEST("\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC778\uC99D \uC81C\uACF5\uC790\uC785\uB2C8\uB2E4.");
67
- }
68
- };
69
54
  try {
70
55
  const { accessToken, refreshToken } = await getThirdPartyAuth(
71
56
  provider
72
- ).signIn(code);
57
+ ).login(code);
73
58
  return CREATED({
74
59
  accessToken,
75
60
  refreshToken
@@ -82,5 +67,5 @@ var loginThirdPartyHandler = async (request, {
82
67
  }
83
68
  };
84
69
  export {
85
- loginThirdPartyHandler
70
+ loginWithThirdPartyHandler
86
71
  };
@@ -0,0 +1,13 @@
1
+ import { AuthService } from '../auth_service.mjs';
2
+ import 'jose';
3
+ import 'react-router';
4
+ import '../jwt_manager.mjs';
5
+ import '../../file/object_storage.mjs';
6
+ import '@aws-sdk/client-s3';
7
+ import '../auth_repository.mjs';
8
+
9
+ declare const logoutHandler: (request: Request, { authService }: {
10
+ authService: AuthService;
11
+ }) => Promise<Response>;
12
+
13
+ export { logoutHandler };
@@ -0,0 +1,13 @@
1
+ import { AuthService } from '../auth_service.js';
2
+ import 'jose';
3
+ import 'react-router';
4
+ import '../jwt_manager.js';
5
+ import '../../file/object_storage.js';
6
+ import '@aws-sdk/client-s3';
7
+ import '../auth_repository.js';
8
+
9
+ declare const logoutHandler: (request: Request, { authService }: {
10
+ authService: AuthService;
11
+ }) => Promise<Response>;
12
+
13
+ export { logoutHandler };