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.
Files changed (279) 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 +298 -0
  4. package/dist/api/create_handler.mjs +304 -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 +298 -0
  8. package/dist/api/index.mjs +304 -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/cookie_store.d.mts +13 -0
  16. package/dist/auth/cookie_store.d.ts +13 -0
  17. package/dist/{text_editor/plugins/keymap.js → auth/cookie_store.js} +24 -16
  18. package/dist/auth/cookie_store.mjs +23 -0
  19. package/dist/auth/index.d.mts +5 -0
  20. package/dist/auth/index.d.ts +5 -0
  21. package/dist/auth/index.js +139 -0
  22. package/dist/auth/index.mjs +111 -0
  23. package/dist/auth/server/index.d.mts +1 -0
  24. package/dist/auth/server/index.d.ts +1 -0
  25. package/dist/{slug.js → auth/server/index.js} +6 -14
  26. package/dist/auth/server/index.mjs +2 -0
  27. package/dist/auth/with_auth.d.mts +2 -6
  28. package/dist/auth/with_auth.d.ts +2 -6
  29. package/dist/auth/with_auth.js +3 -0
  30. package/dist/auth/with_auth.mjs +3 -0
  31. package/dist/{components → client}/client_env.d.mts +1 -1
  32. package/dist/{components → client}/client_env.d.ts +1 -1
  33. package/dist/{components → client}/client_env.js +6 -2
  34. package/dist/{components → client}/client_env.mjs +2 -2
  35. package/dist/client/index.d.mts +3 -0
  36. package/dist/client/index.d.ts +3 -0
  37. package/dist/{auth/client/google_login_button.js → client/index.js} +30 -33
  38. package/dist/client/index.mjs +31 -0
  39. package/dist/client/use_user_agent.d.mts +8 -0
  40. package/dist/client/use_user_agent.d.ts +8 -0
  41. package/dist/{file/client/format_size.js → client/use_user_agent.js} +14 -14
  42. package/dist/client/use_user_agent.mjs +13 -0
  43. package/dist/file/client/index.d.mts +1 -0
  44. package/dist/file/client/index.d.ts +1 -0
  45. package/dist/file/{cdn.js → client/index.js} +6 -16
  46. package/dist/file/client/index.mjs +2 -0
  47. package/dist/file/index.d.mts +1 -0
  48. package/dist/file/index.d.ts +1 -0
  49. package/dist/{cn.js → file/index.js} +6 -14
  50. package/dist/file/index.mjs +2 -0
  51. package/dist/file/server/index.d.mts +1 -0
  52. package/dist/file/server/index.d.ts +1 -0
  53. package/dist/file/server/index.js +24 -0
  54. package/dist/file/server/index.mjs +2 -0
  55. package/dist/http/index.d.mts +1 -1
  56. package/dist/http/index.d.ts +1 -1
  57. package/dist/http/index.js +3 -90
  58. package/dist/http/index.mjs +2 -68
  59. package/dist/index.d.mts +8 -6
  60. package/dist/index.d.ts +8 -6
  61. package/dist/index.js +3 -79
  62. package/dist/index.mjs +2 -58
  63. package/dist/modal/index.d.mts +1 -0
  64. package/dist/modal/index.d.ts +1 -0
  65. package/dist/{sleep.js → modal/index.js} +6 -14
  66. package/dist/modal/index.mjs +2 -0
  67. package/dist/seo/index.d.mts +4 -0
  68. package/dist/seo/index.d.ts +4 -0
  69. package/dist/seo/index.js +304 -0
  70. package/dist/seo/index.mjs +267 -0
  71. package/dist/text_editor/index.d.mts +1 -0
  72. package/dist/text_editor/index.d.ts +1 -0
  73. package/dist/text_editor/index.js +24 -0
  74. package/dist/text_editor/index.mjs +2 -0
  75. package/package.json +58 -32
  76. package/dist/auth/apple_auth.d.mts +0 -38
  77. package/dist/auth/apple_auth.d.ts +0 -38
  78. package/dist/auth/apple_auth.js +0 -88
  79. package/dist/auth/apple_auth.mjs +0 -63
  80. package/dist/auth/auth_repository.d.mts +0 -41
  81. package/dist/auth/auth_repository.d.ts +0 -41
  82. package/dist/auth/auth_repository.js +0 -18
  83. package/dist/auth/auth_repository.mjs +0 -0
  84. package/dist/auth/auth_service.d.mts +0 -63
  85. package/dist/auth/auth_service.d.ts +0 -63
  86. package/dist/auth/auth_service.js +0 -210
  87. package/dist/auth/auth_service.mjs +0 -171
  88. package/dist/auth/client/google_login_button.d.mts +0 -7
  89. package/dist/auth/client/google_login_button.d.ts +0 -7
  90. package/dist/auth/client/google_login_button.mjs +0 -37
  91. package/dist/auth/client/provider.d.mts +0 -24
  92. package/dist/auth/client/provider.d.ts +0 -24
  93. package/dist/auth/client/provider.js +0 -154
  94. package/dist/auth/client/provider.mjs +0 -118
  95. package/dist/auth/google_auth.d.mts +0 -33
  96. package/dist/auth/google_auth.d.ts +0 -33
  97. package/dist/auth/google_auth.js +0 -135
  98. package/dist/auth/google_auth.mjs +0 -108
  99. package/dist/auth/handlers/find_auth.d.mts +0 -13
  100. package/dist/auth/handlers/find_auth.d.ts +0 -13
  101. package/dist/auth/handlers/find_auth.js +0 -82
  102. package/dist/auth/handlers/find_auth.mjs +0 -55
  103. package/dist/auth/handlers/login.d.mts +0 -13
  104. package/dist/auth/handlers/login.d.ts +0 -13
  105. package/dist/auth/handlers/login.js +0 -107
  106. package/dist/auth/handlers/login.mjs +0 -80
  107. package/dist/auth/handlers/login_with_thirdparty.d.mts +0 -15
  108. package/dist/auth/handlers/login_with_thirdparty.d.ts +0 -15
  109. package/dist/auth/handlers/login_with_thirdparty.js +0 -98
  110. package/dist/auth/handlers/login_with_thirdparty.mjs +0 -71
  111. package/dist/auth/handlers/logout.d.mts +0 -13
  112. package/dist/auth/handlers/logout.d.ts +0 -13
  113. package/dist/auth/handlers/logout.js +0 -102
  114. package/dist/auth/handlers/logout.mjs +0 -75
  115. package/dist/auth/handlers/refresh.d.mts +0 -13
  116. package/dist/auth/handlers/refresh.d.ts +0 -13
  117. package/dist/auth/handlers/refresh.js +0 -92
  118. package/dist/auth/handlers/refresh.mjs +0 -65
  119. package/dist/auth/handlers/request_password_reset.d.mts +0 -10
  120. package/dist/auth/handlers/request_password_reset.d.ts +0 -10
  121. package/dist/auth/handlers/request_password_reset.js +0 -87
  122. package/dist/auth/handlers/request_password_reset.mjs +0 -60
  123. package/dist/auth/handlers/reset_password.d.mts +0 -10
  124. package/dist/auth/handlers/reset_password.d.ts +0 -10
  125. package/dist/auth/handlers/reset_password.js +0 -88
  126. package/dist/auth/handlers/reset_password.mjs +0 -61
  127. package/dist/auth/handlers/signup.d.mts +0 -15
  128. package/dist/auth/handlers/signup.d.ts +0 -15
  129. package/dist/auth/handlers/signup.js +0 -147
  130. package/dist/auth/handlers/signup.mjs +0 -112
  131. package/dist/auth/handlers/signup_with_thirdparty.d.mts +0 -17
  132. package/dist/auth/handlers/signup_with_thirdparty.d.ts +0 -17
  133. package/dist/auth/handlers/signup_with_thirdparty.js +0 -123
  134. package/dist/auth/handlers/signup_with_thirdparty.mjs +0 -98
  135. package/dist/auth/handlers/thirdparty_auth_callback.d.mts +0 -16
  136. package/dist/auth/handlers/thirdparty_auth_callback.d.ts +0 -16
  137. package/dist/auth/handlers/thirdparty_auth_callback.js +0 -129
  138. package/dist/auth/handlers/thirdparty_auth_callback.mjs +0 -102
  139. package/dist/auth/jwt_manager.d.mts +0 -38
  140. package/dist/auth/jwt_manager.d.ts +0 -38
  141. package/dist/auth/jwt_manager.js +0 -90
  142. package/dist/auth/jwt_manager.mjs +0 -65
  143. package/dist/auth/kakao_auth.d.mts +0 -27
  144. package/dist/auth/kakao_auth.d.ts +0 -27
  145. package/dist/auth/kakao_auth.js +0 -56
  146. package/dist/auth/kakao_auth.mjs +0 -31
  147. package/dist/auth/password_recovery.d.mts +0 -34
  148. package/dist/auth/password_recovery.d.ts +0 -34
  149. package/dist/auth/password_recovery.js +0 -169
  150. package/dist/auth/password_recovery.mjs +0 -134
  151. package/dist/auth/thirdparty_auth.d.mts +0 -41
  152. package/dist/auth/thirdparty_auth.d.ts +0 -41
  153. package/dist/auth/thirdparty_auth.js +0 -113
  154. package/dist/auth/thirdparty_auth.mjs +0 -86
  155. package/dist/cn.d.mts +0 -3
  156. package/dist/cn.d.ts +0 -3
  157. package/dist/cn.mjs +0 -7
  158. package/dist/components/index.d.mts +0 -5
  159. package/dist/components/index.d.ts +0 -5
  160. package/dist/components/index.js +0 -261
  161. package/dist/components/index.mjs +0 -219
  162. package/dist/components/modal/fullscreen_container.d.mts +0 -7
  163. package/dist/components/modal/fullscreen_container.d.ts +0 -7
  164. package/dist/components/modal/fullscreen_container.js +0 -102
  165. package/dist/components/modal/fullscreen_container.mjs +0 -68
  166. package/dist/components/modal/hooks.d.mts +0 -18
  167. package/dist/components/modal/hooks.d.ts +0 -18
  168. package/dist/components/modal/hooks.js +0 -236
  169. package/dist/components/modal/hooks.mjs +0 -204
  170. package/dist/components/modal/index.d.mts +0 -4
  171. package/dist/components/modal/index.d.ts +0 -4
  172. package/dist/components/modal/index.js +0 -238
  173. package/dist/components/modal/index.mjs +0 -203
  174. package/dist/components/modal/modal.d.mts +0 -13
  175. package/dist/components/modal/modal.d.ts +0 -13
  176. package/dist/components/modal/modal.js +0 -155
  177. package/dist/components/modal/modal.mjs +0 -130
  178. package/dist/components/styles.d.mts +0 -9
  179. package/dist/components/styles.d.ts +0 -9
  180. package/dist/components/styles.js +0 -48
  181. package/dist/components/styles.mjs +0 -17
  182. package/dist/date.d.mts +0 -5
  183. package/dist/date.d.ts +0 -5
  184. package/dist/date.mjs +0 -29
  185. package/dist/file/cdn.d.mts +0 -6
  186. package/dist/file/cdn.d.ts +0 -6
  187. package/dist/file/cdn.mjs +0 -9
  188. package/dist/file/client/drop_file_input.d.mts +0 -36
  189. package/dist/file/client/drop_file_input.d.ts +0 -36
  190. package/dist/file/client/drop_file_input.js +0 -323
  191. package/dist/file/client/drop_file_input.mjs +0 -294
  192. package/dist/file/client/file_upload_button.d.mts +0 -10
  193. package/dist/file/client/file_upload_button.d.ts +0 -10
  194. package/dist/file/client/file_upload_button.js +0 -89
  195. package/dist/file/client/file_upload_button.mjs +0 -58
  196. package/dist/file/client/file_uploader.d.mts +0 -13
  197. package/dist/file/client/file_uploader.d.ts +0 -13
  198. package/dist/file/client/file_uploader.js +0 -163
  199. package/dist/file/client/file_uploader.mjs +0 -136
  200. package/dist/file/client/format_size.d.mts +0 -3
  201. package/dist/file/client/format_size.d.ts +0 -3
  202. package/dist/file/client/format_size.mjs +0 -13
  203. package/dist/file/client/metadata.d.mts +0 -7
  204. package/dist/file/client/metadata.d.ts +0 -7
  205. package/dist/file/client/metadata.js +0 -85
  206. package/dist/file/client/metadata.mjs +0 -60
  207. package/dist/file/file_repository.d.mts +0 -16
  208. package/dist/file/file_repository.d.ts +0 -16
  209. package/dist/file/file_repository.js +0 -18
  210. package/dist/file/file_repository.mjs +0 -0
  211. package/dist/file/file_service.d.mts +0 -32
  212. package/dist/file/file_service.d.ts +0 -32
  213. package/dist/file/file_service.js +0 -66
  214. package/dist/file/file_service.mjs +0 -41
  215. package/dist/file/handlers/delete_file.d.mts +0 -17
  216. package/dist/file/handlers/delete_file.d.ts +0 -17
  217. package/dist/file/handlers/delete_file.js +0 -99
  218. package/dist/file/handlers/delete_file.mjs +0 -72
  219. package/dist/file/handlers/upload_file.d.mts +0 -16
  220. package/dist/file/handlers/upload_file.d.ts +0 -16
  221. package/dist/file/handlers/upload_file.js +0 -106
  222. package/dist/file/handlers/upload_file.mjs +0 -79
  223. package/dist/file/object_storage.d.mts +0 -20
  224. package/dist/file/object_storage.d.ts +0 -20
  225. package/dist/file/object_storage.js +0 -90
  226. package/dist/file/object_storage.mjs +0 -70
  227. package/dist/file/responsive_image.d.mts +0 -20
  228. package/dist/file/responsive_image.d.ts +0 -20
  229. package/dist/file/responsive_image.js +0 -132
  230. package/dist/file/responsive_image.mjs +0 -96
  231. package/dist/http/response.d.mts +0 -19
  232. package/dist/http/response.d.ts +0 -19
  233. package/dist/http/response.js +0 -109
  234. package/dist/http/response.mjs +0 -68
  235. package/dist/route/api.d.mts +0 -21
  236. package/dist/route/api.d.ts +0 -21
  237. package/dist/route/api.js +0 -584
  238. package/dist/route/api.mjs +0 -547
  239. package/dist/singleton.d.mts +0 -3
  240. package/dist/singleton.d.ts +0 -3
  241. package/dist/singleton.js +0 -37
  242. package/dist/singleton.mjs +0 -12
  243. package/dist/sleep.d.mts +0 -3
  244. package/dist/sleep.d.ts +0 -3
  245. package/dist/sleep.mjs +0 -7
  246. package/dist/slug.d.mts +0 -3
  247. package/dist/slug.d.ts +0 -3
  248. package/dist/slug.mjs +0 -7
  249. package/dist/text_editor/attach_media.d.mts +0 -16
  250. package/dist/text_editor/attach_media.d.ts +0 -16
  251. package/dist/text_editor/attach_media.js +0 -237
  252. package/dist/text_editor/attach_media.mjs +0 -210
  253. package/dist/text_editor/plugins/drag_and_drop.d.mts +0 -13
  254. package/dist/text_editor/plugins/drag_and_drop.d.ts +0 -13
  255. package/dist/text_editor/plugins/drag_and_drop.js +0 -59
  256. package/dist/text_editor/plugins/drag_and_drop.mjs +0 -34
  257. package/dist/text_editor/plugins/keymap.d.mts +0 -5
  258. package/dist/text_editor/plugins/keymap.d.ts +0 -5
  259. package/dist/text_editor/plugins/keymap.mjs +0 -15
  260. package/dist/text_editor/plugins/placehoder.d.mts +0 -5
  261. package/dist/text_editor/plugins/placehoder.d.ts +0 -5
  262. package/dist/text_editor/plugins/placehoder.js +0 -112
  263. package/dist/text_editor/plugins/placehoder.mjs +0 -87
  264. package/dist/text_editor/plugins/trailing_paragraph.d.mts +0 -5
  265. package/dist/text_editor/plugins/trailing_paragraph.d.ts +0 -5
  266. package/dist/text_editor/plugins/trailing_paragraph.js +0 -46
  267. package/dist/text_editor/plugins/trailing_paragraph.mjs +0 -21
  268. package/dist/text_editor/plugins/upload_placeholder.d.mts +0 -7
  269. package/dist/text_editor/plugins/upload_placeholder.d.ts +0 -7
  270. package/dist/text_editor/plugins/upload_placeholder.js +0 -94
  271. package/dist/text_editor/plugins/upload_placeholder.mjs +0 -68
  272. package/dist/text_editor/schema.d.mts +0 -9
  273. package/dist/text_editor/schema.d.ts +0 -9
  274. package/dist/text_editor/schema.js +0 -354
  275. package/dist/text_editor/schema.mjs +0 -319
  276. package/dist/text_editor/text_editor.d.mts +0 -45
  277. package/dist/text_editor/text_editor.d.ts +0 -45
  278. package/dist/text_editor/text_editor.js +0 -834
  279. package/dist/text_editor/text_editor.mjs +0 -806
@@ -1,38 +0,0 @@
1
- import { JWTPayload } from 'jose';
2
-
3
- type AccessTokenPayload = {
4
- userId: string;
5
- role: string;
6
- name: string;
7
- };
8
- type RefreshTokenPayload = {
9
- userId: string;
10
- role: string;
11
- name: string;
12
- };
13
- declare class JWTManager {
14
- siteOrigin?: string;
15
- accessTokenSecret: string;
16
- accessTokenExpiresIn: string;
17
- refreshTokenSecret: string;
18
- refreshTokenExpiresIn: string;
19
- constructor({ siteOrigin, accessTokenSecret, accessTokenExpiresIn, refreshTokenSecret, refreshTokenExpiresIn, }: {
20
- siteOrigin?: string;
21
- accessTokenSecret: string;
22
- accessTokenExpiresIn?: string;
23
- refreshTokenSecret: string;
24
- refreshTokenExpiresIn?: string;
25
- });
26
- verify(token: string, secret: string): Promise<JWTPayload | undefined>;
27
- verifyAccessToken(token: string): Promise<AccessTokenPayload | undefined>;
28
- verifyRefreshToken(token: string): Promise<RefreshTokenPayload | undefined>;
29
- sign(payload: JWTPayload, secret: string, { expiresIn }?: {
30
- expiresIn?: string;
31
- }): Promise<string>;
32
- signAccessToken(payload: AccessTokenPayload): Promise<string>;
33
- signRefreshToken(payload: RefreshTokenPayload): Promise<string>;
34
- decode(token: string): JWTPayload;
35
- getExpirationTime(token: string): Date;
36
- }
37
-
38
- export { type AccessTokenPayload, JWTManager, type RefreshTokenPayload };
@@ -1,90 +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/jwt_manager.ts
21
- var jwt_manager_exports = {};
22
- __export(jwt_manager_exports, {
23
- JWTManager: () => JWTManager
24
- });
25
- module.exports = __toCommonJS(jwt_manager_exports);
26
- var import_jose = require("jose");
27
- var JWTManager = class {
28
- siteOrigin;
29
- accessTokenSecret;
30
- accessTokenExpiresIn;
31
- refreshTokenSecret;
32
- refreshTokenExpiresIn;
33
- constructor({
34
- siteOrigin,
35
- accessTokenSecret,
36
- accessTokenExpiresIn = "1m",
37
- refreshTokenSecret,
38
- refreshTokenExpiresIn = "1y"
39
- }) {
40
- this.siteOrigin = siteOrigin;
41
- this.accessTokenSecret = accessTokenSecret;
42
- this.accessTokenExpiresIn = accessTokenExpiresIn;
43
- this.refreshTokenSecret = refreshTokenSecret;
44
- this.refreshTokenExpiresIn = refreshTokenExpiresIn;
45
- }
46
- async verify(token, secret) {
47
- try {
48
- const result = await (0, import_jose.jwtVerify)(token, new TextEncoder().encode(secret));
49
- return result.payload;
50
- } catch (_) {
51
- return;
52
- }
53
- }
54
- async verifyAccessToken(token) {
55
- return await this.verify(token, this.accessTokenSecret);
56
- }
57
- async verifyRefreshToken(token) {
58
- return await this.verify(token, this.refreshTokenSecret);
59
- }
60
- async sign(payload, secret, { expiresIn } = {}) {
61
- let builder = new import_jose.SignJWT(payload).setProtectedHeader({ alg: "HS256", typ: "JWT" }).setIssuedAt();
62
- if (this.siteOrigin) {
63
- builder = builder.setIssuer(this.siteOrigin);
64
- }
65
- if (expiresIn) {
66
- builder = builder.setExpirationTime(expiresIn);
67
- }
68
- return builder.sign(new TextEncoder().encode(secret));
69
- }
70
- async signAccessToken(payload) {
71
- return this.sign(payload, this.accessTokenSecret, {
72
- expiresIn: this.accessTokenExpiresIn
73
- });
74
- }
75
- async signRefreshToken(payload) {
76
- return this.sign(payload, this.refreshTokenSecret, {
77
- expiresIn: this.refreshTokenExpiresIn
78
- });
79
- }
80
- decode(token) {
81
- return (0, import_jose.decodeJwt)(token);
82
- }
83
- getExpirationTime(token) {
84
- return new Date(Number((0, import_jose.decodeJwt)(token).exp) * 1e3);
85
- }
86
- };
87
- // Annotate the CommonJS export names for ESM import in node:
88
- 0 && (module.exports = {
89
- JWTManager
90
- });
@@ -1,65 +0,0 @@
1
- // src/auth/jwt_manager.ts
2
- import { SignJWT, decodeJwt, jwtVerify } from "jose";
3
- var JWTManager = class {
4
- siteOrigin;
5
- accessTokenSecret;
6
- accessTokenExpiresIn;
7
- refreshTokenSecret;
8
- refreshTokenExpiresIn;
9
- constructor({
10
- siteOrigin,
11
- accessTokenSecret,
12
- accessTokenExpiresIn = "1m",
13
- refreshTokenSecret,
14
- refreshTokenExpiresIn = "1y"
15
- }) {
16
- this.siteOrigin = siteOrigin;
17
- this.accessTokenSecret = accessTokenSecret;
18
- this.accessTokenExpiresIn = accessTokenExpiresIn;
19
- this.refreshTokenSecret = refreshTokenSecret;
20
- this.refreshTokenExpiresIn = refreshTokenExpiresIn;
21
- }
22
- async verify(token, secret) {
23
- try {
24
- const result = await jwtVerify(token, new TextEncoder().encode(secret));
25
- return result.payload;
26
- } catch (_) {
27
- return;
28
- }
29
- }
30
- async verifyAccessToken(token) {
31
- return await this.verify(token, this.accessTokenSecret);
32
- }
33
- async verifyRefreshToken(token) {
34
- return await this.verify(token, this.refreshTokenSecret);
35
- }
36
- async sign(payload, secret, { expiresIn } = {}) {
37
- let builder = new SignJWT(payload).setProtectedHeader({ alg: "HS256", typ: "JWT" }).setIssuedAt();
38
- if (this.siteOrigin) {
39
- builder = builder.setIssuer(this.siteOrigin);
40
- }
41
- if (expiresIn) {
42
- builder = builder.setExpirationTime(expiresIn);
43
- }
44
- return builder.sign(new TextEncoder().encode(secret));
45
- }
46
- async signAccessToken(payload) {
47
- return this.sign(payload, this.accessTokenSecret, {
48
- expiresIn: this.accessTokenExpiresIn
49
- });
50
- }
51
- async signRefreshToken(payload) {
52
- return this.sign(payload, this.refreshTokenSecret, {
53
- expiresIn: this.refreshTokenExpiresIn
54
- });
55
- }
56
- decode(token) {
57
- return decodeJwt(token);
58
- }
59
- getExpirationTime(token) {
60
- return new Date(Number(decodeJwt(token).exp) * 1e3);
61
- }
62
- };
63
- export {
64
- JWTManager
65
- };
@@ -1,27 +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 KakaoAuth implements ThirdpartyAuth {
11
- thirdpartyAuth: ThirdpartyAuthService;
12
- constructor({ thirdpartyAuth, }: {
13
- thirdpartyAuth: ThirdpartyAuthService;
14
- });
15
- login(kakaoAccessToken: string): Promise<{
16
- user: {
17
- id: string;
18
- role: string;
19
- name: string;
20
- refreshToken: string | null;
21
- };
22
- accessToken: string;
23
- refreshToken: string;
24
- }>;
25
- }
26
-
27
- export { KakaoAuth };
@@ -1,27 +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 KakaoAuth implements ThirdpartyAuth {
11
- thirdpartyAuth: ThirdpartyAuthService;
12
- constructor({ thirdpartyAuth, }: {
13
- thirdpartyAuth: ThirdpartyAuthService;
14
- });
15
- login(kakaoAccessToken: string): Promise<{
16
- user: {
17
- id: string;
18
- role: string;
19
- name: string;
20
- refreshToken: string | null;
21
- };
22
- accessToken: string;
23
- refreshToken: string;
24
- }>;
25
- }
26
-
27
- export { KakaoAuth };
@@ -1,56 +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/kakao_auth.ts
21
- var kakao_auth_exports = {};
22
- __export(kakao_auth_exports, {
23
- KakaoAuth: () => KakaoAuth
24
- });
25
- module.exports = __toCommonJS(kakao_auth_exports);
26
- var KakaoAuth = class {
27
- thirdpartyAuth;
28
- constructor({
29
- thirdpartyAuth
30
- }) {
31
- this.thirdpartyAuth = thirdpartyAuth;
32
- }
33
- async login(kakaoAccessToken) {
34
- const userRes = await fetch("https://kapi.kakao.com/v2/user/me", {
35
- headers: {
36
- Authorization: `Bearer ${kakaoAccessToken}`
37
- }
38
- });
39
- if (!userRes.ok) {
40
- throw new Error("\uC720\uC800 \uC815\uBCF4\uB97C \uAC00\uC838\uC624\uB294\uB370 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.");
41
- }
42
- const { id, kakao_account } = await userRes.json();
43
- const { email, profile } = kakao_account;
44
- const payload = {
45
- id,
46
- email,
47
- name: profile.nickname,
48
- picture: profile.thumbnail_image_url
49
- };
50
- return this.thirdpartyAuth.issueTokensIfUserFound("kakao", payload);
51
- }
52
- };
53
- // Annotate the CommonJS export names for ESM import in node:
54
- 0 && (module.exports = {
55
- KakaoAuth
56
- });
@@ -1,31 +0,0 @@
1
- // src/auth/kakao_auth.ts
2
- var KakaoAuth = class {
3
- thirdpartyAuth;
4
- constructor({
5
- thirdpartyAuth
6
- }) {
7
- this.thirdpartyAuth = thirdpartyAuth;
8
- }
9
- async login(kakaoAccessToken) {
10
- const userRes = await fetch("https://kapi.kakao.com/v2/user/me", {
11
- headers: {
12
- Authorization: `Bearer ${kakaoAccessToken}`
13
- }
14
- });
15
- if (!userRes.ok) {
16
- throw new Error("\uC720\uC800 \uC815\uBCF4\uB97C \uAC00\uC838\uC624\uB294\uB370 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.");
17
- }
18
- const { id, kakao_account } = await userRes.json();
19
- const { email, profile } = kakao_account;
20
- const payload = {
21
- id,
22
- email,
23
- name: profile.nickname,
24
- picture: profile.thumbnail_image_url
25
- };
26
- return this.thirdpartyAuth.issueTokensIfUserFound("kakao", payload);
27
- }
28
- };
29
- export {
30
- KakaoAuth
31
- };
@@ -1,34 +0,0 @@
1
- import { AuthRepository } from './auth_repository.mjs';
2
- import { JWTManager } from './jwt_manager.mjs';
3
- import 'jose';
4
-
5
- declare class PasswordRecoveryService {
6
- siteOrigin: string;
7
- siteName: string;
8
- jwtManager: JWTManager;
9
- authRepository: AuthRepository;
10
- emailCredentials: {
11
- service: string;
12
- user: string;
13
- pass: string;
14
- };
15
- resetPasswordTokenSecret: string;
16
- resetPasswordTokenExpiresIn: string;
17
- constructor({ siteOrigin, siteName, jwtManager, authRepository, emailCredentials, resetPasswordTokenSecret, resetPasswordTokenExpiresIn, }: {
18
- siteOrigin: string;
19
- siteName: string;
20
- jwtManager: JWTManager;
21
- authRepository: AuthRepository;
22
- emailCredentials: {
23
- service: string;
24
- user: string;
25
- pass: string;
26
- };
27
- resetPasswordTokenSecret: string;
28
- resetPasswordTokenExpiresIn?: string;
29
- });
30
- requestPasswordReset(email: string): Promise<void>;
31
- resetPassword(token: string, password: string, passwordConfirm: string): Promise<void>;
32
- }
33
-
34
- export { PasswordRecoveryService };
@@ -1,34 +0,0 @@
1
- import { AuthRepository } from './auth_repository.js';
2
- import { JWTManager } from './jwt_manager.js';
3
- import 'jose';
4
-
5
- declare class PasswordRecoveryService {
6
- siteOrigin: string;
7
- siteName: string;
8
- jwtManager: JWTManager;
9
- authRepository: AuthRepository;
10
- emailCredentials: {
11
- service: string;
12
- user: string;
13
- pass: string;
14
- };
15
- resetPasswordTokenSecret: string;
16
- resetPasswordTokenExpiresIn: string;
17
- constructor({ siteOrigin, siteName, jwtManager, authRepository, emailCredentials, resetPasswordTokenSecret, resetPasswordTokenExpiresIn, }: {
18
- siteOrigin: string;
19
- siteName: string;
20
- jwtManager: JWTManager;
21
- authRepository: AuthRepository;
22
- emailCredentials: {
23
- service: string;
24
- user: string;
25
- pass: string;
26
- };
27
- resetPasswordTokenSecret: string;
28
- resetPasswordTokenExpiresIn?: string;
29
- });
30
- requestPasswordReset(email: string): Promise<void>;
31
- resetPassword(token: string, password: string, passwordConfirm: string): Promise<void>;
32
- }
33
-
34
- export { PasswordRecoveryService };
@@ -1,169 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/auth/password_recovery.ts
31
- var password_recovery_exports = {};
32
- __export(password_recovery_exports, {
33
- PasswordRecoveryService: () => PasswordRecoveryService
34
- });
35
- module.exports = __toCommonJS(password_recovery_exports);
36
- var import_nodemailer = __toESM(require("nodemailer"));
37
-
38
- // src/http/response.ts
39
- var createJsonResponse = (status) => {
40
- return (data = {}, init) => {
41
- return Response.json(data, { status, ...init });
42
- };
43
- };
44
- var OK = createJsonResponse(200);
45
- var CREATED = createJsonResponse(201);
46
- var ACCEPTED = createJsonResponse(202);
47
- var createException = (status, defaultMessage = "\uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.") => {
48
- return (message = defaultMessage, init) => {
49
- return createJsonResponse(status)({ message }, init);
50
- };
51
- };
52
- var BAD_REQUEST = createException(400, "\uC694\uCCAD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.");
53
- var UNAUTHORIZED = createException(401, "\uC778\uC99D\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.");
54
- var FORBIDDEN = createException(403, "\uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.");
55
- var NOT_FOUND = createException(
56
- 404,
57
- "\uC694\uCCAD\uD55C \uB9AC\uC18C\uC2A4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
58
- );
59
- var METHOD_NOT_ALLOWED = createException(
60
- 405,
61
- "\uBA54\uC11C\uB4DC\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
62
- );
63
- var NOT_ACCEPTABLE = createException(
64
- 406,
65
- "\uC694\uCCAD\uD55C \uD615\uC2DD\uC744 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
66
- );
67
- var REQUEST_TIMEOUT = createException(
68
- 408,
69
- "\uC694\uCCAD \uC2DC\uAC04\uC774 \uCD08\uACFC\uB418\uC5C8\uC2B5\uB2C8\uB2E4."
70
- );
71
- var CONFLICT = createException(409, "\uC694\uCCAD\uC774 \uCDA9\uB3CC\uD588\uC2B5\uB2C8\uB2E4.");
72
- var UNPROCESSABLE_ENTITY = createException(
73
- 422,
74
- "\uCC98\uB9AC\uD560 \uC218 \uC5C6\uB294 \uC5D4\uD2F0\uD2F0\uC785\uB2C8\uB2E4."
75
- );
76
- var TOO_MANY_REQUESTS = createException(429, "\uC694\uCCAD\uC774 \uB108\uBB34 \uB9CE\uC2B5\uB2C8\uB2E4.");
77
- var INTERNAL_SERVER_ERROR = createException(
78
- 500,
79
- "\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
80
- );
81
-
82
- // src/auth/password_recovery.ts
83
- var import_bcryptjs = __toESM(require("bcryptjs"));
84
- var PasswordRecoveryService = class {
85
- siteOrigin;
86
- siteName;
87
- jwtManager;
88
- authRepository;
89
- emailCredentials;
90
- resetPasswordTokenSecret;
91
- resetPasswordTokenExpiresIn;
92
- constructor({
93
- siteOrigin,
94
- siteName,
95
- jwtManager,
96
- authRepository,
97
- emailCredentials,
98
- resetPasswordTokenSecret,
99
- resetPasswordTokenExpiresIn = "1h"
100
- }) {
101
- this.siteOrigin = siteOrigin;
102
- this.siteName = siteName;
103
- this.jwtManager = jwtManager;
104
- this.authRepository = authRepository;
105
- this.emailCredentials = emailCredentials;
106
- this.resetPasswordTokenSecret = resetPasswordTokenSecret;
107
- this.resetPasswordTokenExpiresIn = resetPasswordTokenExpiresIn;
108
- }
109
- async requestPasswordReset(email) {
110
- const credential = await this.authRepository.findCredentialById(email);
111
- if (!credential) {
112
- throw NOT_FOUND("\uAC00\uC785\uB418\uC9C0 \uC54A\uC740 \uC774\uBA54\uC77C\uC785\uB2C8\uB2E4.");
113
- }
114
- const transporter = import_nodemailer.default.createTransport({
115
- service: this.emailCredentials.service,
116
- auth: {
117
- user: this.emailCredentials.user,
118
- pass: this.emailCredentials.pass
119
- }
120
- });
121
- const token = await this.jwtManager.sign(
122
- {
123
- id: credential.id
124
- },
125
- this.resetPasswordTokenSecret,
126
- {
127
- expiresIn: this.resetPasswordTokenExpiresIn
128
- }
129
- );
130
- const link = `${this.siteOrigin}/reset-password?token=${token}`;
131
- const mailOptions = {
132
- from: process.env.EMAIL_USER,
133
- to: email,
134
- subject: `${this.siteName} \uBE44\uBC00\uBC88\uD638 \uC7AC\uC124\uC815`,
135
- html: `<main>
136
- <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>
137
- <a href="${link}" target="_blank">${link}</a>
138
- </main>`
139
- };
140
- await transporter.sendMail(mailOptions);
141
- }
142
- async resetPassword(token, password, passwordConfirm) {
143
- const payload = await this.jwtManager.verify(
144
- token,
145
- this.resetPasswordTokenSecret
146
- );
147
- if (!payload) {
148
- throw UNAUTHORIZED("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uD1A0\uD070\uC785\uB2C8\uB2E4.");
149
- }
150
- if (typeof payload.id !== "string") {
151
- throw UNAUTHORIZED("\uD1A0\uD070\uC774 \uC704\uC870\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
152
- }
153
- const credential = await this.authRepository.findCredentialById(payload.id);
154
- if (!credential) {
155
- throw NOT_FOUND("\uC874\uC7AC\uD558\uC9C0 \uC54A\uB294 \uACC4\uC815\uC785\uB2C8\uB2E4.");
156
- }
157
- if (typeof password !== "string" || !password.trim()) {
158
- throw BAD_REQUEST("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uBE44\uBC00\uBC88\uD638\uC785\uB2C8\uB2E4.");
159
- }
160
- if (password !== passwordConfirm) {
161
- throw BAD_REQUEST("\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.");
162
- }
163
- await this.authRepository.updatePassword(credential.id, import_bcryptjs.default.hashSync(password, 10));
164
- }
165
- };
166
- // Annotate the CommonJS export names for ESM import in node:
167
- 0 && (module.exports = {
168
- PasswordRecoveryService
169
- });