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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dn-react-router-toolkit",
3
- "version": "0.2.7",
3
+ "version": "0.3.2",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.mjs",
6
6
  "module": "./dist/index.js",
@@ -10,40 +10,65 @@
10
10
  "import": "./dist/index.mjs",
11
11
  "require": "./dist/index.js"
12
12
  },
13
- "./auth/*": {
14
- "types": "./dist/auth/*.d.ts",
15
- "import": "./dist/auth/*.mjs",
16
- "require": "./dist/auth/*.js"
13
+ "./auth": {
14
+ "types": "./dist/auth/index.d.ts",
15
+ "import": "./dist/auth/index.mjs",
16
+ "require": "./dist/auth/index.js"
17
17
  },
18
- "./file/*": {
19
- "types": "./dist/file/*.d.ts",
20
- "import": "./dist/file/*.mjs",
21
- "require": "./dist/file/*.js"
18
+ "./auth/server": {
19
+ "types": "./dist/auth/server/index.d.ts",
20
+ "import": "./dist/auth/server/index.mjs",
21
+ "require": "./dist/auth/server/index.js"
22
22
  },
23
- "./route/*": {
24
- "types": "./dist/route/*.d.ts",
25
- "import": "./dist/route/*.mjs",
26
- "require": "./dist/route/*.js"
23
+ "./auth/client": {
24
+ "types": "./dist/auth/client/index.d.ts",
25
+ "import": "./dist/auth/client/index.mjs",
26
+ "require": "./dist/auth/client/index.js"
27
27
  },
28
- "./components/*": {
29
- "types": "./dist/components/*.d.ts",
30
- "import": "./dist/components/*.mjs",
31
- "require": "./dist/components/*.js"
28
+ "./file": {
29
+ "types": "./dist/file/index.d.ts",
30
+ "import": "./dist/file/index.mjs",
31
+ "require": "./dist/file/index.js"
32
32
  },
33
- "./http/*": {
34
- "types": "./dist/http/*.d.ts",
35
- "import": "./dist/http/*.mjs",
36
- "require": "./dist/http/*.js"
33
+ "./file/server": {
34
+ "types": "./dist/file/server/index.d.ts",
35
+ "import": "./dist/file/server/index.mjs",
36
+ "require": "./dist/file/server/index.js"
37
37
  },
38
- "./seo/*": {
39
- "types": "./dist/seo/*.d.ts",
40
- "import": "./dist/seo/*.mjs",
41
- "require": "./dist/seo/*.js"
38
+ "./file/client": {
39
+ "types": "./dist/file/client/index.d.ts",
40
+ "import": "./dist/file/client/index.mjs",
41
+ "require": "./dist/file/client/index.js"
42
42
  },
43
- "./text_editor/*": {
44
- "types": "./dist/text_editor/*.d.ts",
45
- "import": "./dist/text_editor/*.mjs",
46
- "require": "./dist/text_editor/*.js"
43
+ "./api": {
44
+ "types": "./dist/api/index.d.ts",
45
+ "import": "./dist/api/index.mjs",
46
+ "require": "./dist/api/index.js"
47
+ },
48
+ "./client": {
49
+ "types": "./dist/client/index.d.ts",
50
+ "import": "./dist/client/index.mjs",
51
+ "require": "./dist/client/index.js"
52
+ },
53
+ "./modal": {
54
+ "types": "./dist/modal/index.d.ts",
55
+ "import": "./dist/modal/index.mjs",
56
+ "require": "./dist/modal/index.js"
57
+ },
58
+ "./http": {
59
+ "types": "./dist/http/index.d.ts",
60
+ "import": "./dist/http/index.mjs",
61
+ "require": "./dist/http/index.js"
62
+ },
63
+ "./seo": {
64
+ "types": "./dist/seo/index.d.ts",
65
+ "import": "./dist/seo/index.mjs",
66
+ "require": "./dist/seo/index.js"
67
+ },
68
+ "./text_editor": {
69
+ "types": "./dist/text_editor/index.d.ts",
70
+ "import": "./dist/text_editor/index.mjs",
71
+ "require": "./dist/text_editor/index.js"
47
72
  }
48
73
  },
49
74
  "scripts": {
@@ -75,18 +100,19 @@
75
100
  "@aws-sdk/client-s3": "^3.940.0",
76
101
  "@aws-sdk/s3-request-presigner": "^3.940.0",
77
102
  "bcryptjs": "^3.0.3",
103
+ "dn-react-toolkit": "0.2.0",
78
104
  "jose": "^6.1.2",
79
105
  "moment-timezone": "^0.6.0",
80
106
  "nodemailer": "^7.0.11",
81
- "react-icons": "^5.5.0",
82
- "uuid": "^13.0.0",
83
107
  "prosemirror-commands": "^1.7.1",
84
108
  "prosemirror-history": "^1.5.0",
85
109
  "prosemirror-keymap": "^1.2.3",
86
110
  "prosemirror-model": "^1.25.4",
87
111
  "prosemirror-schema-list": "^1.5.1",
88
112
  "prosemirror-state": "^1.4.4",
89
- "prosemirror-view": "^1.41.3"
113
+ "prosemirror-view": "^1.41.3",
114
+ "react-icons": "^5.5.0",
115
+ "uuid": "^13.0.0"
90
116
  },
91
117
  "peerDependencies": {
92
118
  "drizzle-orm": "^0.44",
@@ -1,38 +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 AppleAuth implements ThirdpartyAuth {
11
- thirdpartyAuth: ThirdpartyAuthService;
12
- appleAuthKey: string;
13
- appleClientId: string;
14
- appleTeamId: string;
15
- appleKeyId: string;
16
- appleServiceId: string;
17
- constructor({ thirdpartyAuth, appleAuthKey, appleClientId, appleTeamId, appleKeyId, appleServiceId, }: {
18
- thirdpartyAuth: ThirdpartyAuthService;
19
- appleAuthKey: string;
20
- appleClientId: string;
21
- appleTeamId: string;
22
- appleKeyId: string;
23
- appleServiceId: string;
24
- });
25
- login(code: string, type?: "web" | "app"): Promise<{
26
- user: {
27
- id: string;
28
- role: string;
29
- name: string;
30
- refreshToken: string | null;
31
- };
32
- accessToken: string;
33
- refreshToken: string;
34
- }>;
35
- private generateAppleClientSecret;
36
- }
37
-
38
- export { AppleAuth };
@@ -1,38 +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 AppleAuth implements ThirdpartyAuth {
11
- thirdpartyAuth: ThirdpartyAuthService;
12
- appleAuthKey: string;
13
- appleClientId: string;
14
- appleTeamId: string;
15
- appleKeyId: string;
16
- appleServiceId: string;
17
- constructor({ thirdpartyAuth, appleAuthKey, appleClientId, appleTeamId, appleKeyId, appleServiceId, }: {
18
- thirdpartyAuth: ThirdpartyAuthService;
19
- appleAuthKey: string;
20
- appleClientId: string;
21
- appleTeamId: string;
22
- appleKeyId: string;
23
- appleServiceId: string;
24
- });
25
- login(code: string, type?: "web" | "app"): Promise<{
26
- user: {
27
- id: string;
28
- role: string;
29
- name: string;
30
- refreshToken: string | null;
31
- };
32
- accessToken: string;
33
- refreshToken: string;
34
- }>;
35
- private generateAppleClientSecret;
36
- }
37
-
38
- export { AppleAuth };
@@ -1,88 +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/apple_auth.ts
21
- var apple_auth_exports = {};
22
- __export(apple_auth_exports, {
23
- AppleAuth: () => AppleAuth
24
- });
25
- module.exports = __toCommonJS(apple_auth_exports);
26
- var import_jose = require("jose");
27
- var AppleAuth = class {
28
- thirdpartyAuth;
29
- appleAuthKey;
30
- appleClientId;
31
- appleTeamId;
32
- appleKeyId;
33
- appleServiceId;
34
- constructor({
35
- thirdpartyAuth,
36
- appleAuthKey,
37
- appleClientId,
38
- appleTeamId,
39
- appleKeyId,
40
- appleServiceId
41
- }) {
42
- this.thirdpartyAuth = thirdpartyAuth;
43
- this.appleAuthKey = appleAuthKey;
44
- this.appleClientId = appleClientId;
45
- this.appleTeamId = appleTeamId;
46
- this.appleKeyId = appleKeyId;
47
- this.appleServiceId = appleServiceId;
48
- }
49
- async login(code, type = "web") {
50
- const url = "https://appleid.apple.com/auth/token";
51
- const client_secret = await this.generateAppleClientSecret(type);
52
- const res = await fetch(url, {
53
- method: "POST",
54
- headers: {
55
- "Content-Type": "application/x-www-form-urlencoded"
56
- },
57
- body: new URLSearchParams({
58
- client_id: type === "web" ? this.appleServiceId : this.appleClientId,
59
- client_secret,
60
- code,
61
- grant_type: "authorization_code"
62
- })
63
- });
64
- if (!res.ok) {
65
- console.error(await res.text());
66
- throw new Error("Apple \uC778\uC99D\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.");
67
- }
68
- const data = await res.json();
69
- const { id_token } = data;
70
- const appleAuth = (0, import_jose.decodeJwt)(id_token);
71
- const { sub, email, name } = appleAuth;
72
- const payload = {
73
- id: sub,
74
- email,
75
- name
76
- };
77
- return this.thirdpartyAuth.issueTokensIfUserFound("apple", payload);
78
- }
79
- async generateAppleClientSecret(type = "web") {
80
- const clientId = type === "web" ? this.appleServiceId : this.appleClientId;
81
- const keyObject = await (0, import_jose.importPKCS8)(this.appleAuthKey, "ES256");
82
- return new import_jose.SignJWT().setProtectedHeader({ alg: "ES256", kid: this.appleKeyId }).setIssuedAt().setIssuer(this.appleTeamId).setExpirationTime("1h").setAudience("https://appleid.apple.com").setSubject(clientId).sign(keyObject);
83
- }
84
- };
85
- // Annotate the CommonJS export names for ESM import in node:
86
- 0 && (module.exports = {
87
- AppleAuth
88
- });
@@ -1,63 +0,0 @@
1
- // src/auth/apple_auth.ts
2
- import { decodeJwt, importPKCS8, SignJWT } from "jose";
3
- var AppleAuth = class {
4
- thirdpartyAuth;
5
- appleAuthKey;
6
- appleClientId;
7
- appleTeamId;
8
- appleKeyId;
9
- appleServiceId;
10
- constructor({
11
- thirdpartyAuth,
12
- appleAuthKey,
13
- appleClientId,
14
- appleTeamId,
15
- appleKeyId,
16
- appleServiceId
17
- }) {
18
- this.thirdpartyAuth = thirdpartyAuth;
19
- this.appleAuthKey = appleAuthKey;
20
- this.appleClientId = appleClientId;
21
- this.appleTeamId = appleTeamId;
22
- this.appleKeyId = appleKeyId;
23
- this.appleServiceId = appleServiceId;
24
- }
25
- async login(code, type = "web") {
26
- const url = "https://appleid.apple.com/auth/token";
27
- const client_secret = await this.generateAppleClientSecret(type);
28
- const res = await fetch(url, {
29
- method: "POST",
30
- headers: {
31
- "Content-Type": "application/x-www-form-urlencoded"
32
- },
33
- body: new URLSearchParams({
34
- client_id: type === "web" ? this.appleServiceId : this.appleClientId,
35
- client_secret,
36
- code,
37
- grant_type: "authorization_code"
38
- })
39
- });
40
- if (!res.ok) {
41
- console.error(await res.text());
42
- throw new Error("Apple \uC778\uC99D\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.");
43
- }
44
- const data = await res.json();
45
- const { id_token } = data;
46
- const appleAuth = decodeJwt(id_token);
47
- const { sub, email, name } = appleAuth;
48
- const payload = {
49
- id: sub,
50
- email,
51
- name
52
- };
53
- return this.thirdpartyAuth.issueTokensIfUserFound("apple", payload);
54
- }
55
- async generateAppleClientSecret(type = "web") {
56
- const clientId = type === "web" ? this.appleServiceId : this.appleClientId;
57
- const keyObject = await importPKCS8(this.appleAuthKey, "ES256");
58
- return new SignJWT().setProtectedHeader({ alg: "ES256", kid: this.appleKeyId }).setIssuedAt().setIssuer(this.appleTeamId).setExpirationTime("1h").setAudience("https://appleid.apple.com").setSubject(clientId).sign(keyObject);
59
- }
60
- };
61
- export {
62
- AppleAuth
63
- };
@@ -1,41 +0,0 @@
1
- interface AuthRepository<TFile = unknown> {
2
- findCredentialById(id: string): Promise<{
3
- id: string;
4
- password: string;
5
- userId: string;
6
- } | undefined>;
7
- createCredential(params: {
8
- id: string;
9
- password: string;
10
- userId: string;
11
- }): Promise<void>;
12
- updatePassword(id: string, hashedPassword: string): Promise<void>;
13
- findUserById(userId: string): Promise<{
14
- id: string;
15
- role: string;
16
- name: string;
17
- refreshToken: string | null;
18
- } | undefined>;
19
- updateUserRefreshToken(userId: string, hashedRefreshToken: string | null): Promise<void>;
20
- createUser(userData: {
21
- id: string;
22
- role: string;
23
- name: string;
24
- email: string;
25
- profileImage?: TFile;
26
- }): Promise<{
27
- id: string;
28
- role: string;
29
- name: string;
30
- }>;
31
- findThirdPartyAuth(provider: string, providerId: string): Promise<{
32
- userId: string;
33
- } | undefined>;
34
- createThirdPartyAuth(params: {
35
- id: string;
36
- provider: string;
37
- userId: string;
38
- }): Promise<void>;
39
- }
40
-
41
- export type { AuthRepository };
@@ -1,41 +0,0 @@
1
- interface AuthRepository<TFile = unknown> {
2
- findCredentialById(id: string): Promise<{
3
- id: string;
4
- password: string;
5
- userId: string;
6
- } | undefined>;
7
- createCredential(params: {
8
- id: string;
9
- password: string;
10
- userId: string;
11
- }): Promise<void>;
12
- updatePassword(id: string, hashedPassword: string): Promise<void>;
13
- findUserById(userId: string): Promise<{
14
- id: string;
15
- role: string;
16
- name: string;
17
- refreshToken: string | null;
18
- } | undefined>;
19
- updateUserRefreshToken(userId: string, hashedRefreshToken: string | null): Promise<void>;
20
- createUser(userData: {
21
- id: string;
22
- role: string;
23
- name: string;
24
- email: string;
25
- profileImage?: TFile;
26
- }): Promise<{
27
- id: string;
28
- role: string;
29
- name: string;
30
- }>;
31
- findThirdPartyAuth(provider: string, providerId: string): Promise<{
32
- userId: string;
33
- } | undefined>;
34
- createThirdPartyAuth(params: {
35
- id: string;
36
- provider: string;
37
- userId: string;
38
- }): Promise<void>;
39
- }
40
-
41
- export type { AuthRepository };
@@ -1,18 +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 __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
-
16
- // src/auth/auth_repository.ts
17
- var auth_repository_exports = {};
18
- module.exports = __toCommonJS(auth_repository_exports);
File without changes
@@ -1,63 +0,0 @@
1
- import * as jose from 'jose';
2
- import { JWTManager, AccessTokenPayload } from './jwt_manager.mjs';
3
- import * as react_router from 'react-router';
4
- import { ObjectStorage } from '../file/object_storage.mjs';
5
- import { AuthRepository } from './auth_repository.mjs';
6
- import '@aws-sdk/client-s3';
7
-
8
- declare const ACCESS_TOKEN_KEY = "access_token";
9
- declare const REFRESH_TOKEN_KEY = "refresh_token";
10
- declare const ACCESS_TOKEN_COOKIE: react_router.Cookie;
11
- declare const REFRESH_TOKEN_COOKIE: react_router.Cookie;
12
- declare class AuthService<TFile = unknown> {
13
- authRepository: AuthRepository<TFile>;
14
- jwtManager: JWTManager;
15
- objectStorage: ObjectStorage;
16
- constructor({ authRepository, jwtManager, objectStorage, }: {
17
- authRepository: AuthRepository<TFile>;
18
- jwtManager: JWTManager;
19
- objectStorage: ObjectStorage;
20
- });
21
- verify(request: Request): Promise<AccessTokenPayload | undefined>;
22
- verifyOrRefresh(request: Request): Promise<jose.JWTPayload | AccessTokenPayload | undefined>;
23
- getAccessTokenFromRequest(request: Request): Promise<any>;
24
- getAccessTokenFromCookies(request: Request): Promise<any>;
25
- getRefreshTokenFromCookies(request: Request): Promise<any>;
26
- refresh(request: Request): Promise<jose.JWTPayload | undefined>;
27
- login({ id, password }: {
28
- id: string;
29
- password: string;
30
- }): Promise<{
31
- accessToken: string;
32
- refreshToken: string;
33
- }>;
34
- issueAccessToken(user: {
35
- id: string;
36
- role: string;
37
- name: string;
38
- }): Promise<string>;
39
- issueTokenPair(user: {
40
- id: string;
41
- role: string;
42
- name: string;
43
- }): Promise<{
44
- refreshToken: string;
45
- accessToken: string;
46
- }>;
47
- refreshAccessToken(refreshToken: string): Promise<string>;
48
- getAccessTokenSetCookie(accessToken: string | null): Promise<string>;
49
- getRefreshTokenSetCookie(refreshToken: string | null): Promise<string>;
50
- findUser(provider: string, info: {
51
- id: string;
52
- email: string;
53
- name?: string;
54
- picture?: string;
55
- }): Promise<{
56
- id: string;
57
- role: string;
58
- name: string;
59
- refreshToken: string | null;
60
- } | undefined>;
61
- }
62
-
63
- export { ACCESS_TOKEN_COOKIE, ACCESS_TOKEN_KEY, AuthService, REFRESH_TOKEN_COOKIE, REFRESH_TOKEN_KEY };
@@ -1,63 +0,0 @@
1
- import * as jose from 'jose';
2
- import { JWTManager, AccessTokenPayload } from './jwt_manager.js';
3
- import * as react_router from 'react-router';
4
- import { ObjectStorage } from '../file/object_storage.js';
5
- import { AuthRepository } from './auth_repository.js';
6
- import '@aws-sdk/client-s3';
7
-
8
- declare const ACCESS_TOKEN_KEY = "access_token";
9
- declare const REFRESH_TOKEN_KEY = "refresh_token";
10
- declare const ACCESS_TOKEN_COOKIE: react_router.Cookie;
11
- declare const REFRESH_TOKEN_COOKIE: react_router.Cookie;
12
- declare class AuthService<TFile = unknown> {
13
- authRepository: AuthRepository<TFile>;
14
- jwtManager: JWTManager;
15
- objectStorage: ObjectStorage;
16
- constructor({ authRepository, jwtManager, objectStorage, }: {
17
- authRepository: AuthRepository<TFile>;
18
- jwtManager: JWTManager;
19
- objectStorage: ObjectStorage;
20
- });
21
- verify(request: Request): Promise<AccessTokenPayload | undefined>;
22
- verifyOrRefresh(request: Request): Promise<jose.JWTPayload | AccessTokenPayload | undefined>;
23
- getAccessTokenFromRequest(request: Request): Promise<any>;
24
- getAccessTokenFromCookies(request: Request): Promise<any>;
25
- getRefreshTokenFromCookies(request: Request): Promise<any>;
26
- refresh(request: Request): Promise<jose.JWTPayload | undefined>;
27
- login({ id, password }: {
28
- id: string;
29
- password: string;
30
- }): Promise<{
31
- accessToken: string;
32
- refreshToken: string;
33
- }>;
34
- issueAccessToken(user: {
35
- id: string;
36
- role: string;
37
- name: string;
38
- }): Promise<string>;
39
- issueTokenPair(user: {
40
- id: string;
41
- role: string;
42
- name: string;
43
- }): Promise<{
44
- refreshToken: string;
45
- accessToken: string;
46
- }>;
47
- refreshAccessToken(refreshToken: string): Promise<string>;
48
- getAccessTokenSetCookie(accessToken: string | null): Promise<string>;
49
- getRefreshTokenSetCookie(refreshToken: string | null): Promise<string>;
50
- findUser(provider: string, info: {
51
- id: string;
52
- email: string;
53
- name?: string;
54
- picture?: string;
55
- }): Promise<{
56
- id: string;
57
- role: string;
58
- name: string;
59
- refreshToken: string | null;
60
- } | undefined>;
61
- }
62
-
63
- export { ACCESS_TOKEN_COOKIE, ACCESS_TOKEN_KEY, AuthService, REFRESH_TOKEN_COOKIE, REFRESH_TOKEN_KEY };