dn-react-router-toolkit 0.2.6 → 0.3.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 (278) hide show
  1. package/dist/api/create_handler.d.mts +13 -0
  2. package/dist/api/create_handler.d.ts +13 -0
  3. package/dist/api/create_handler.js +276 -0
  4. package/dist/api/create_handler.mjs +282 -0
  5. package/dist/api/index.d.mts +4 -0
  6. package/dist/api/index.d.ts +4 -0
  7. package/dist/api/index.js +276 -0
  8. package/dist/api/index.mjs +282 -0
  9. package/dist/auth/client/index.d.mts +3 -0
  10. package/dist/auth/client/index.d.ts +3 -0
  11. package/dist/{date.js → auth/client/index.js} +25 -32
  12. package/dist/auth/client/index.mjs +21 -0
  13. package/dist/auth/client/redirect_page.d.mts +1 -0
  14. package/dist/auth/client/redirect_page.d.ts +1 -0
  15. package/dist/auth/index.d.mts +4 -0
  16. package/dist/auth/index.d.ts +4 -0
  17. package/dist/auth/index.js +116 -0
  18. package/dist/auth/index.mjs +89 -0
  19. package/dist/auth/server/index.d.mts +1 -0
  20. package/dist/auth/server/index.d.ts +1 -0
  21. package/dist/{slug.js → auth/server/index.js} +6 -14
  22. package/dist/auth/server/index.mjs +2 -0
  23. package/dist/auth/with_auth.d.mts +2 -6
  24. package/dist/auth/with_auth.d.ts +2 -6
  25. package/dist/auth/with_auth.js +3 -0
  26. package/dist/auth/with_auth.mjs +3 -0
  27. package/dist/{components → client}/client_env.d.mts +1 -1
  28. package/dist/{components → client}/client_env.d.ts +1 -1
  29. package/dist/{components → client}/client_env.js +6 -2
  30. package/dist/{components → client}/client_env.mjs +2 -2
  31. package/dist/client/index.d.mts +3 -0
  32. package/dist/client/index.d.ts +3 -0
  33. package/dist/{auth/client/google_login_button.js → client/index.js} +30 -33
  34. package/dist/client/index.mjs +31 -0
  35. package/dist/client/use_user_agent.d.mts +8 -0
  36. package/dist/client/use_user_agent.d.ts +8 -0
  37. package/dist/{file/client/format_size.js → client/use_user_agent.js} +14 -14
  38. package/dist/client/use_user_agent.mjs +13 -0
  39. package/dist/file/client/index.d.mts +1 -0
  40. package/dist/file/client/index.d.ts +1 -0
  41. package/dist/file/{cdn.js → client/index.js} +6 -16
  42. package/dist/file/client/index.mjs +2 -0
  43. package/dist/file/index.d.mts +1 -0
  44. package/dist/file/index.d.ts +1 -0
  45. package/dist/{cn.js → file/index.js} +6 -14
  46. package/dist/file/index.mjs +2 -0
  47. package/dist/file/server/index.d.mts +1 -0
  48. package/dist/file/server/index.d.ts +1 -0
  49. package/dist/file/server/index.js +24 -0
  50. package/dist/file/server/index.mjs +2 -0
  51. package/dist/http/index.d.mts +1 -1
  52. package/dist/http/index.d.ts +1 -1
  53. package/dist/http/index.js +3 -90
  54. package/dist/http/index.mjs +2 -68
  55. package/dist/index.d.mts +8 -6
  56. package/dist/index.d.ts +8 -6
  57. package/dist/index.js +3 -79
  58. package/dist/index.mjs +2 -58
  59. package/dist/modal/index.d.mts +1 -0
  60. package/dist/modal/index.d.ts +1 -0
  61. package/dist/{sleep.js → modal/index.js} +6 -14
  62. package/dist/modal/index.mjs +2 -0
  63. package/dist/seo/index.d.mts +4 -0
  64. package/dist/seo/index.d.ts +4 -0
  65. package/dist/seo/index.js +304 -0
  66. package/dist/seo/index.mjs +267 -0
  67. package/dist/seo/seo.js +9 -1
  68. package/dist/seo/seo.mjs +9 -1
  69. package/dist/text_editor/index.d.mts +1 -0
  70. package/dist/text_editor/index.d.ts +1 -0
  71. package/dist/text_editor/index.js +24 -0
  72. package/dist/text_editor/index.mjs +2 -0
  73. package/package.json +58 -32
  74. package/dist/auth/apple_auth.d.mts +0 -38
  75. package/dist/auth/apple_auth.d.ts +0 -38
  76. package/dist/auth/apple_auth.js +0 -88
  77. package/dist/auth/apple_auth.mjs +0 -63
  78. package/dist/auth/auth_repository.d.mts +0 -41
  79. package/dist/auth/auth_repository.d.ts +0 -41
  80. package/dist/auth/auth_repository.js +0 -18
  81. package/dist/auth/auth_repository.mjs +0 -0
  82. package/dist/auth/auth_service.d.mts +0 -63
  83. package/dist/auth/auth_service.d.ts +0 -63
  84. package/dist/auth/auth_service.js +0 -210
  85. package/dist/auth/auth_service.mjs +0 -171
  86. package/dist/auth/client/google_login_button.d.mts +0 -7
  87. package/dist/auth/client/google_login_button.d.ts +0 -7
  88. package/dist/auth/client/google_login_button.mjs +0 -37
  89. package/dist/auth/client/provider.d.mts +0 -24
  90. package/dist/auth/client/provider.d.ts +0 -24
  91. package/dist/auth/client/provider.js +0 -154
  92. package/dist/auth/client/provider.mjs +0 -118
  93. package/dist/auth/google_auth.d.mts +0 -33
  94. package/dist/auth/google_auth.d.ts +0 -33
  95. package/dist/auth/google_auth.js +0 -135
  96. package/dist/auth/google_auth.mjs +0 -108
  97. package/dist/auth/handlers/find_auth.d.mts +0 -13
  98. package/dist/auth/handlers/find_auth.d.ts +0 -13
  99. package/dist/auth/handlers/find_auth.js +0 -82
  100. package/dist/auth/handlers/find_auth.mjs +0 -55
  101. package/dist/auth/handlers/login.d.mts +0 -13
  102. package/dist/auth/handlers/login.d.ts +0 -13
  103. package/dist/auth/handlers/login.js +0 -107
  104. package/dist/auth/handlers/login.mjs +0 -80
  105. package/dist/auth/handlers/login_with_thirdparty.d.mts +0 -15
  106. package/dist/auth/handlers/login_with_thirdparty.d.ts +0 -15
  107. package/dist/auth/handlers/login_with_thirdparty.js +0 -98
  108. package/dist/auth/handlers/login_with_thirdparty.mjs +0 -71
  109. package/dist/auth/handlers/logout.d.mts +0 -13
  110. package/dist/auth/handlers/logout.d.ts +0 -13
  111. package/dist/auth/handlers/logout.js +0 -102
  112. package/dist/auth/handlers/logout.mjs +0 -75
  113. package/dist/auth/handlers/refresh.d.mts +0 -13
  114. package/dist/auth/handlers/refresh.d.ts +0 -13
  115. package/dist/auth/handlers/refresh.js +0 -92
  116. package/dist/auth/handlers/refresh.mjs +0 -65
  117. package/dist/auth/handlers/request_password_reset.d.mts +0 -10
  118. package/dist/auth/handlers/request_password_reset.d.ts +0 -10
  119. package/dist/auth/handlers/request_password_reset.js +0 -87
  120. package/dist/auth/handlers/request_password_reset.mjs +0 -60
  121. package/dist/auth/handlers/reset_password.d.mts +0 -10
  122. package/dist/auth/handlers/reset_password.d.ts +0 -10
  123. package/dist/auth/handlers/reset_password.js +0 -88
  124. package/dist/auth/handlers/reset_password.mjs +0 -61
  125. package/dist/auth/handlers/signup.d.mts +0 -15
  126. package/dist/auth/handlers/signup.d.ts +0 -15
  127. package/dist/auth/handlers/signup.js +0 -147
  128. package/dist/auth/handlers/signup.mjs +0 -112
  129. package/dist/auth/handlers/signup_with_thirdparty.d.mts +0 -17
  130. package/dist/auth/handlers/signup_with_thirdparty.d.ts +0 -17
  131. package/dist/auth/handlers/signup_with_thirdparty.js +0 -123
  132. package/dist/auth/handlers/signup_with_thirdparty.mjs +0 -98
  133. package/dist/auth/handlers/thirdparty_auth_callback.d.mts +0 -16
  134. package/dist/auth/handlers/thirdparty_auth_callback.d.ts +0 -16
  135. package/dist/auth/handlers/thirdparty_auth_callback.js +0 -129
  136. package/dist/auth/handlers/thirdparty_auth_callback.mjs +0 -102
  137. package/dist/auth/jwt_manager.d.mts +0 -38
  138. package/dist/auth/jwt_manager.d.ts +0 -38
  139. package/dist/auth/jwt_manager.js +0 -90
  140. package/dist/auth/jwt_manager.mjs +0 -65
  141. package/dist/auth/kakao_auth.d.mts +0 -27
  142. package/dist/auth/kakao_auth.d.ts +0 -27
  143. package/dist/auth/kakao_auth.js +0 -56
  144. package/dist/auth/kakao_auth.mjs +0 -31
  145. package/dist/auth/password_recovery.d.mts +0 -34
  146. package/dist/auth/password_recovery.d.ts +0 -34
  147. package/dist/auth/password_recovery.js +0 -169
  148. package/dist/auth/password_recovery.mjs +0 -134
  149. package/dist/auth/thirdparty_auth.d.mts +0 -41
  150. package/dist/auth/thirdparty_auth.d.ts +0 -41
  151. package/dist/auth/thirdparty_auth.js +0 -113
  152. package/dist/auth/thirdparty_auth.mjs +0 -86
  153. package/dist/cn.d.mts +0 -3
  154. package/dist/cn.d.ts +0 -3
  155. package/dist/cn.mjs +0 -7
  156. package/dist/components/index.d.mts +0 -5
  157. package/dist/components/index.d.ts +0 -5
  158. package/dist/components/index.js +0 -261
  159. package/dist/components/index.mjs +0 -219
  160. package/dist/components/modal/fullscreen_container.d.mts +0 -7
  161. package/dist/components/modal/fullscreen_container.d.ts +0 -7
  162. package/dist/components/modal/fullscreen_container.js +0 -102
  163. package/dist/components/modal/fullscreen_container.mjs +0 -68
  164. package/dist/components/modal/hooks.d.mts +0 -18
  165. package/dist/components/modal/hooks.d.ts +0 -18
  166. package/dist/components/modal/hooks.js +0 -236
  167. package/dist/components/modal/hooks.mjs +0 -204
  168. package/dist/components/modal/index.d.mts +0 -4
  169. package/dist/components/modal/index.d.ts +0 -4
  170. package/dist/components/modal/index.js +0 -238
  171. package/dist/components/modal/index.mjs +0 -203
  172. package/dist/components/modal/modal.d.mts +0 -13
  173. package/dist/components/modal/modal.d.ts +0 -13
  174. package/dist/components/modal/modal.js +0 -155
  175. package/dist/components/modal/modal.mjs +0 -130
  176. package/dist/components/styles.d.mts +0 -9
  177. package/dist/components/styles.d.ts +0 -9
  178. package/dist/components/styles.js +0 -48
  179. package/dist/components/styles.mjs +0 -17
  180. package/dist/date.d.mts +0 -5
  181. package/dist/date.d.ts +0 -5
  182. package/dist/date.mjs +0 -29
  183. package/dist/file/cdn.d.mts +0 -6
  184. package/dist/file/cdn.d.ts +0 -6
  185. package/dist/file/cdn.mjs +0 -9
  186. package/dist/file/client/drop_file_input.d.mts +0 -36
  187. package/dist/file/client/drop_file_input.d.ts +0 -36
  188. package/dist/file/client/drop_file_input.js +0 -323
  189. package/dist/file/client/drop_file_input.mjs +0 -294
  190. package/dist/file/client/file_upload_button.d.mts +0 -10
  191. package/dist/file/client/file_upload_button.d.ts +0 -10
  192. package/dist/file/client/file_upload_button.js +0 -89
  193. package/dist/file/client/file_upload_button.mjs +0 -58
  194. package/dist/file/client/file_uploader.d.mts +0 -13
  195. package/dist/file/client/file_uploader.d.ts +0 -13
  196. package/dist/file/client/file_uploader.js +0 -163
  197. package/dist/file/client/file_uploader.mjs +0 -136
  198. package/dist/file/client/format_size.d.mts +0 -3
  199. package/dist/file/client/format_size.d.ts +0 -3
  200. package/dist/file/client/format_size.mjs +0 -13
  201. package/dist/file/client/metadata.d.mts +0 -7
  202. package/dist/file/client/metadata.d.ts +0 -7
  203. package/dist/file/client/metadata.js +0 -85
  204. package/dist/file/client/metadata.mjs +0 -60
  205. package/dist/file/file_repository.d.mts +0 -16
  206. package/dist/file/file_repository.d.ts +0 -16
  207. package/dist/file/file_repository.js +0 -18
  208. package/dist/file/file_repository.mjs +0 -0
  209. package/dist/file/file_service.d.mts +0 -32
  210. package/dist/file/file_service.d.ts +0 -32
  211. package/dist/file/file_service.js +0 -66
  212. package/dist/file/file_service.mjs +0 -41
  213. package/dist/file/handlers/delete_file.d.mts +0 -17
  214. package/dist/file/handlers/delete_file.d.ts +0 -17
  215. package/dist/file/handlers/delete_file.js +0 -99
  216. package/dist/file/handlers/delete_file.mjs +0 -72
  217. package/dist/file/handlers/upload_file.d.mts +0 -16
  218. package/dist/file/handlers/upload_file.d.ts +0 -16
  219. package/dist/file/handlers/upload_file.js +0 -106
  220. package/dist/file/handlers/upload_file.mjs +0 -79
  221. package/dist/file/object_storage.d.mts +0 -19
  222. package/dist/file/object_storage.d.ts +0 -19
  223. package/dist/file/object_storage.js +0 -78
  224. package/dist/file/object_storage.mjs +0 -57
  225. package/dist/file/responsive_image.d.mts +0 -20
  226. package/dist/file/responsive_image.d.ts +0 -20
  227. package/dist/file/responsive_image.js +0 -132
  228. package/dist/file/responsive_image.mjs +0 -96
  229. package/dist/http/response.d.mts +0 -19
  230. package/dist/http/response.d.ts +0 -19
  231. package/dist/http/response.js +0 -109
  232. package/dist/http/response.mjs +0 -68
  233. package/dist/route/api.d.mts +0 -21
  234. package/dist/route/api.d.ts +0 -21
  235. package/dist/route/api.js +0 -584
  236. package/dist/route/api.mjs +0 -547
  237. package/dist/singleton.d.mts +0 -3
  238. package/dist/singleton.d.ts +0 -3
  239. package/dist/singleton.js +0 -37
  240. package/dist/singleton.mjs +0 -12
  241. package/dist/sleep.d.mts +0 -3
  242. package/dist/sleep.d.ts +0 -3
  243. package/dist/sleep.mjs +0 -7
  244. package/dist/slug.d.mts +0 -3
  245. package/dist/slug.d.ts +0 -3
  246. package/dist/slug.mjs +0 -7
  247. package/dist/text_editor/attach_media.d.mts +0 -16
  248. package/dist/text_editor/attach_media.d.ts +0 -16
  249. package/dist/text_editor/attach_media.js +0 -237
  250. package/dist/text_editor/attach_media.mjs +0 -210
  251. package/dist/text_editor/plugins/drag_and_drop.d.mts +0 -13
  252. package/dist/text_editor/plugins/drag_and_drop.d.ts +0 -13
  253. package/dist/text_editor/plugins/drag_and_drop.js +0 -59
  254. package/dist/text_editor/plugins/drag_and_drop.mjs +0 -34
  255. package/dist/text_editor/plugins/keymap.d.mts +0 -5
  256. package/dist/text_editor/plugins/keymap.d.ts +0 -5
  257. package/dist/text_editor/plugins/keymap.js +0 -40
  258. package/dist/text_editor/plugins/keymap.mjs +0 -15
  259. package/dist/text_editor/plugins/placehoder.d.mts +0 -5
  260. package/dist/text_editor/plugins/placehoder.d.ts +0 -5
  261. package/dist/text_editor/plugins/placehoder.js +0 -112
  262. package/dist/text_editor/plugins/placehoder.mjs +0 -87
  263. package/dist/text_editor/plugins/trailing_paragraph.d.mts +0 -5
  264. package/dist/text_editor/plugins/trailing_paragraph.d.ts +0 -5
  265. package/dist/text_editor/plugins/trailing_paragraph.js +0 -46
  266. package/dist/text_editor/plugins/trailing_paragraph.mjs +0 -21
  267. package/dist/text_editor/plugins/upload_placeholder.d.mts +0 -7
  268. package/dist/text_editor/plugins/upload_placeholder.d.ts +0 -7
  269. package/dist/text_editor/plugins/upload_placeholder.js +0 -94
  270. package/dist/text_editor/plugins/upload_placeholder.mjs +0 -68
  271. package/dist/text_editor/schema.d.mts +0 -9
  272. package/dist/text_editor/schema.d.ts +0 -9
  273. package/dist/text_editor/schema.js +0 -354
  274. package/dist/text_editor/schema.mjs +0 -319
  275. package/dist/text_editor/text_editor.d.mts +0 -44
  276. package/dist/text_editor/text_editor.d.ts +0 -44
  277. package/dist/text_editor/text_editor.js +0 -830
  278. package/dist/text_editor/text_editor.mjs +0 -802
@@ -1,118 +0,0 @@
1
- // src/auth/client/provider.tsx
2
- import React from "react";
3
- import { createContext, useContext } from "react";
4
- import { useNavigate, useRouteLoaderData } from "react-router";
5
- var AuthContext = createContext({});
6
- var useAuth = () => {
7
- return useContext(AuthContext);
8
- };
9
- function AuthProvider({
10
- children,
11
- googleAuth
12
- }) {
13
- const data = useRouteLoaderData("root");
14
- const auth = data?.AUTH;
15
- const navigate = useNavigate();
16
- const login = async (id, password) => {
17
- const res = await fetch("/api/auth/login", {
18
- method: "POST",
19
- headers: {
20
- "Content-Type": "application/json"
21
- },
22
- body: JSON.stringify({ id, password })
23
- });
24
- if (!res.ok) {
25
- const { message } = await res.json();
26
- throw new Error(message);
27
- }
28
- return res.json();
29
- };
30
- const loginWithGoogle = async (redirectUrl = "/") => {
31
- if (!googleAuth) {
32
- alert("\uAD6C\uAE00 \uB85C\uADF8\uC778 \uC124\uC815\uC774 \uB418\uC5B4\uC788\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.");
33
- return;
34
- }
35
- const { googleClientId, googleRedirectUrl } = googleAuth;
36
- const href = new URL("https://accounts.google.com/o/oauth2/v2/auth");
37
- href.searchParams.append("client_id", googleClientId);
38
- href.searchParams.append("redirect_uri", googleRedirectUrl);
39
- href.searchParams.append("response_type", "code");
40
- href.searchParams.append("scope", "email profile");
41
- href.searchParams.append("state", redirectUrl);
42
- window.location.href = href.toString();
43
- };
44
- const logout = async () => {
45
- const ok = confirm("\uC815\uB9D0 \uB85C\uADF8\uC544\uC6C3 \uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?");
46
- if (!ok) {
47
- return;
48
- }
49
- const res = await fetch("/api/auth/logout", {
50
- method: "POST"
51
- });
52
- if (res.ok) {
53
- navigate("/");
54
- } else {
55
- const { message } = await res.json();
56
- alert(message);
57
- }
58
- };
59
- const signup = async (email, password, passwordConfirm) => {
60
- const response = await fetch("/api/auth/signup", {
61
- method: "POST",
62
- headers: {
63
- "Content-Type": "application/json"
64
- },
65
- body: JSON.stringify({ email, password, passwordConfirm })
66
- });
67
- if (!response.ok) {
68
- const { message } = await response.json();
69
- throw new Error(message);
70
- }
71
- return response.json();
72
- };
73
- const requestResetPassword = async (email) => {
74
- const response = await fetch("/api/auth/request-password-reset", {
75
- method: "POST",
76
- headers: {
77
- "Content-Type": "application/json"
78
- },
79
- body: JSON.stringify({ email })
80
- });
81
- if (!response.ok) {
82
- const { message } = await response.json();
83
- alert(message);
84
- return false;
85
- }
86
- return true;
87
- };
88
- const resetPassword = async (token, password, passwordConfirm) => {
89
- const response = await fetch("/api/auth/reset-password", {
90
- method: "POST",
91
- headers: {
92
- "Content-Type": "application/json"
93
- },
94
- body: JSON.stringify({ token, password, passwordConfirm })
95
- });
96
- if (!response.ok) {
97
- const { message } = await response.json();
98
- alert(message);
99
- return false;
100
- }
101
- return true;
102
- };
103
- const authContextValue = {
104
- auth,
105
- login,
106
- logout,
107
- loginWithGoogle,
108
- signup,
109
- requestResetPassword,
110
- resetPassword
111
- };
112
- return /* @__PURE__ */ React.createElement(AuthContext.Provider, { value: authContextValue }, children);
113
- }
114
- export {
115
- AuthContext,
116
- AuthProvider as default,
117
- useAuth
118
- };
@@ -1,33 +0,0 @@
1
- import { ThirdpartyAuth, ThirdpartyAuthService } from './thirdparty_auth.mjs';
2
- import './auth_service.mjs';
3
- import 'jose';
4
- import './jwt_manager.mjs';
5
- import 'react-router';
6
- import '../file/object_storage.mjs';
7
- import '@aws-sdk/client-s3';
8
- import './auth_repository.mjs';
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 };
@@ -1,33 +0,0 @@
1
- import { ThirdpartyAuth, ThirdpartyAuthService } from './thirdparty_auth.js';
2
- import './auth_service.js';
3
- import 'jose';
4
- import './jwt_manager.js';
5
- import 'react-router';
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 };
@@ -1,135 +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/google_auth.tsx
21
- var google_auth_exports = {};
22
- __export(google_auth_exports, {
23
- GoogleAuth: () => GoogleAuth
24
- });
25
- module.exports = __toCommonJS(google_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/google_auth.tsx
72
- var GoogleAuth = class {
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;
87
- }
88
- async login(code) {
89
- const tokenRes = await fetch("https://oauth2.googleapis.com/token", {
90
- method: "POST",
91
- headers: {
92
- "Content-Type": "application/x-www-form-urlencoded"
93
- },
94
- body: new URLSearchParams({
95
- code,
96
- client_id: this.googleClientId,
97
- client_secret: this.googleClientSecret,
98
- redirect_uri: this.googleRedirectUri,
99
- grant_type: "authorization_code"
100
- })
101
- });
102
- if (!tokenRes.ok) {
103
- if (process.env.NODE_ENV === "development") {
104
- throw INTERNAL_SERVER_ERROR(
105
- `\uAD6C\uAE00 \uD1A0\uD070 \uBC1C\uAE09\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4. status: ${tokenRes.status}, message: ${await tokenRes.text()}`
106
- );
107
- }
108
- throw INTERNAL_SERVER_ERROR("\uC778\uC99D\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.");
109
- }
110
- const { access_token } = await tokenRes.json();
111
- const userRes = await fetch(
112
- "https://www.googleapis.com/oauth2/v1/userinfo",
113
- {
114
- headers: {
115
- Authorization: `Bearer ${access_token}`
116
- }
117
- }
118
- );
119
- if (!userRes.ok) {
120
- throw BAD_REQUEST("\uC720\uC800 \uC815\uBCF4\uB97C \uAC00\uC838\uC624\uB294\uB370 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.");
121
- }
122
- const { id, email, name, picture } = await userRes.json();
123
- const payload = {
124
- id,
125
- email,
126
- name,
127
- picture
128
- };
129
- return this.thirdpartyAuth.issueTokensIfUserFound("google", payload);
130
- }
131
- };
132
- // Annotate the CommonJS export names for ESM import in node:
133
- 0 && (module.exports = {
134
- GoogleAuth
135
- });
@@ -1,108 +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/google_auth.tsx
46
- var GoogleAuth = class {
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;
61
- }
62
- async login(code) {
63
- const tokenRes = await fetch("https://oauth2.googleapis.com/token", {
64
- method: "POST",
65
- headers: {
66
- "Content-Type": "application/x-www-form-urlencoded"
67
- },
68
- body: new URLSearchParams({
69
- code,
70
- client_id: this.googleClientId,
71
- client_secret: this.googleClientSecret,
72
- redirect_uri: this.googleRedirectUri,
73
- grant_type: "authorization_code"
74
- })
75
- });
76
- if (!tokenRes.ok) {
77
- if (process.env.NODE_ENV === "development") {
78
- throw INTERNAL_SERVER_ERROR(
79
- `\uAD6C\uAE00 \uD1A0\uD070 \uBC1C\uAE09\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4. status: ${tokenRes.status}, message: ${await tokenRes.text()}`
80
- );
81
- }
82
- throw INTERNAL_SERVER_ERROR("\uC778\uC99D\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.");
83
- }
84
- const { access_token } = await tokenRes.json();
85
- const userRes = await fetch(
86
- "https://www.googleapis.com/oauth2/v1/userinfo",
87
- {
88
- headers: {
89
- Authorization: `Bearer ${access_token}`
90
- }
91
- }
92
- );
93
- if (!userRes.ok) {
94
- throw BAD_REQUEST("\uC720\uC800 \uC815\uBCF4\uB97C \uAC00\uC838\uC624\uB294\uB370 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.");
95
- }
96
- const { id, email, name, picture } = await userRes.json();
97
- const payload = {
98
- id,
99
- email,
100
- name,
101
- picture
102
- };
103
- return this.thirdpartyAuth.issueTokensIfUserFound("google", payload);
104
- }
105
- };
106
- export {
107
- GoogleAuth
108
- };
@@ -1,13 +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
- declare const findAuthHandler: (request: Request, { authService }: {
10
- authService: AuthService;
11
- }) => Promise<Response>;
12
-
13
- export { findAuthHandler };
@@ -1,13 +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
- declare const findAuthHandler: (request: Request, { authService }: {
10
- authService: AuthService;
11
- }) => Promise<Response>;
12
-
13
- export { findAuthHandler };
@@ -1,82 +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/handlers/find_auth.ts
21
- var find_auth_exports = {};
22
- __export(find_auth_exports, {
23
- findAuthHandler: () => findAuthHandler
24
- });
25
- module.exports = __toCommonJS(find_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/handlers/find_auth.ts
72
- var findAuthHandler = async (request, { authService }) => {
73
- const auth = await authService.verifyOrRefresh(request);
74
- if (!auth) {
75
- return UNAUTHORIZED();
76
- }
77
- return OK(auth);
78
- };
79
- // Annotate the CommonJS export names for ESM import in node:
80
- 0 && (module.exports = {
81
- findAuthHandler
82
- });
@@ -1,55 +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/handlers/find_auth.ts
46
- var findAuthHandler = async (request, { authService }) => {
47
- const auth = await authService.verifyOrRefresh(request);
48
- if (!auth) {
49
- return UNAUTHORIZED();
50
- }
51
- return OK(auth);
52
- };
53
- export {
54
- findAuthHandler
55
- };
@@ -1,13 +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
- declare const loginHandler: (request: Request, { authService, }: {
10
- authService: AuthService;
11
- }) => Promise<Response>;
12
-
13
- export { loginHandler };
@@ -1,13 +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
- declare const loginHandler: (request: Request, { authService, }: {
10
- authService: AuthService;
11
- }) => Promise<Response>;
12
-
13
- export { loginHandler };