dn-react-router-toolkit 0.1.1 → 0.1.3

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 (284) hide show
  1. package/dist/auth-kit/apple_auth.d.mts +24 -0
  2. package/dist/{esm/auth-kit → auth-kit}/apple_auth.d.ts +11 -2
  3. package/dist/auth-kit/apple_auth.js +75 -0
  4. package/dist/auth-kit/apple_auth.mjs +50 -0
  5. package/dist/auth-kit/auth_service.d.mts +73 -0
  6. package/dist/{esm/auth-kit → auth-kit}/auth_service.d.ts +17 -11
  7. package/dist/auth-kit/auth_service.js +257 -0
  8. package/dist/auth-kit/auth_service.mjs +218 -0
  9. package/dist/auth-kit/client/google_login_button.d.mts +9 -0
  10. package/dist/auth-kit/client/google_login_button.d.ts +9 -0
  11. package/dist/auth-kit/client/google_login_button.js +67 -0
  12. package/dist/auth-kit/client/google_login_button.mjs +32 -0
  13. package/dist/auth-kit/client/redirect_page.d.mts +5 -0
  14. package/dist/auth-kit/client/redirect_page.d.ts +5 -0
  15. package/dist/auth-kit/client/redirect_page.js +53 -0
  16. package/dist/auth-kit/client/redirect_page.mjs +18 -0
  17. package/dist/auth-kit/google_auth.d.mts +27 -0
  18. package/dist/{esm/auth-kit → auth-kit}/google_auth.d.ts +11 -2
  19. package/dist/auth-kit/google_auth.js +144 -0
  20. package/dist/auth-kit/google_auth.mjs +117 -0
  21. package/dist/auth-kit/jwt.d.mts +18 -0
  22. package/dist/{esm/auth-kit → auth-kit}/jwt.d.ts +5 -2
  23. package/dist/auth-kit/jwt.js +76 -0
  24. package/dist/auth-kit/jwt.mjs +51 -0
  25. package/dist/auth-kit/kakao_auth.d.mts +24 -0
  26. package/dist/{esm/auth-kit → auth-kit}/kakao_auth.d.ts +11 -2
  27. package/dist/auth-kit/kakao_auth.js +115 -0
  28. package/dist/auth-kit/kakao_auth.mjs +88 -0
  29. package/dist/auth-kit/repository.d.mts +42 -0
  30. package/dist/{esm/auth-kit → auth-kit}/repository.d.ts +3 -1
  31. package/dist/auth-kit/repository.js +18 -0
  32. package/dist/auth-kit/repository.mjs +0 -0
  33. package/dist/auth-kit/with_auth.d.mts +17 -0
  34. package/dist/auth-kit/with_auth.d.ts +17 -0
  35. package/dist/auth-kit/with_auth.js +106 -0
  36. package/dist/auth-kit/with_auth.mjs +69 -0
  37. package/dist/cn.d.mts +3 -0
  38. package/dist/cn.d.ts +3 -0
  39. package/dist/cn.js +32 -0
  40. package/dist/cn.mjs +7 -0
  41. package/dist/components/index.d.mts +5 -0
  42. package/dist/components/index.d.ts +5 -0
  43. package/dist/components/index.js +261 -0
  44. package/dist/components/index.mjs +219 -0
  45. package/dist/components/modal/fullscreen_container.d.mts +7 -0
  46. package/dist/components/modal/fullscreen_container.d.ts +7 -0
  47. package/dist/components/modal/fullscreen_container.js +102 -0
  48. package/dist/components/modal/fullscreen_container.mjs +68 -0
  49. package/dist/components/modal/hooks.d.mts +18 -0
  50. package/dist/components/modal/hooks.d.ts +18 -0
  51. package/dist/components/modal/hooks.js +236 -0
  52. package/dist/components/modal/hooks.mjs +204 -0
  53. package/dist/components/modal/index.d.mts +4 -0
  54. package/dist/components/modal/index.d.ts +4 -0
  55. package/dist/components/modal/index.js +238 -0
  56. package/dist/components/modal/index.mjs +203 -0
  57. package/dist/components/modal/modal.d.mts +13 -0
  58. package/dist/components/modal/modal.d.ts +13 -0
  59. package/dist/components/modal/modal.js +155 -0
  60. package/dist/components/modal/modal.mjs +130 -0
  61. package/dist/components/styles.d.mts +9 -0
  62. package/dist/components/styles.d.ts +9 -0
  63. package/dist/components/styles.js +48 -0
  64. package/dist/components/styles.mjs +17 -0
  65. package/dist/date.d.mts +3 -0
  66. package/dist/date.d.ts +3 -0
  67. package/dist/date.js +63 -0
  68. package/dist/date.mjs +28 -0
  69. package/dist/file-kit/cdn.d.mts +5 -0
  70. package/dist/file-kit/cdn.d.ts +5 -0
  71. package/dist/file-kit/cdn.js +34 -0
  72. package/dist/file-kit/cdn.mjs +9 -0
  73. package/dist/file-kit/client/drop_file_input.d.mts +33 -0
  74. package/dist/{esm/file-kit → file-kit}/client/drop_file_input.d.ts +10 -8
  75. package/dist/file-kit/client/drop_file_input.js +235 -0
  76. package/dist/file-kit/client/drop_file_input.mjs +205 -0
  77. package/dist/file-kit/client/file_uploader.d.mts +13 -0
  78. package/dist/{esm/file-kit → file-kit}/client/file_uploader.d.ts +4 -2
  79. package/dist/file-kit/client/file_uploader.js +115 -0
  80. package/dist/file-kit/client/file_uploader.mjs +90 -0
  81. package/dist/file-kit/file_service.d.mts +26 -0
  82. package/dist/{esm/file-kit → file-kit}/file_service.d.ts +7 -4
  83. package/dist/file-kit/file_service.js +60 -0
  84. package/dist/file-kit/file_service.mjs +35 -0
  85. package/dist/file-kit/object_storage.d.mts +17 -0
  86. package/dist/{esm/file-kit → file-kit}/object_storage.d.ts +6 -2
  87. package/dist/file-kit/object_storage.js +78 -0
  88. package/dist/file-kit/object_storage.mjs +57 -0
  89. package/dist/file-kit/repository.d.mts +16 -0
  90. package/dist/{esm/file-kit → file-kit}/repository.d.ts +3 -1
  91. package/dist/file-kit/repository.js +18 -0
  92. package/dist/file-kit/repository.mjs +0 -0
  93. package/dist/file-kit/responsive_image.d.mts +20 -0
  94. package/dist/file-kit/responsive_image.d.ts +20 -0
  95. package/dist/file-kit/responsive_image.js +123 -0
  96. package/dist/file-kit/responsive_image.mjs +87 -0
  97. package/dist/http-kit/index.d.mts +1 -0
  98. package/dist/http-kit/index.d.ts +1 -0
  99. package/dist/http-kit/index.js +111 -0
  100. package/dist/http-kit/index.mjs +68 -0
  101. package/dist/http-kit/response.d.mts +19 -0
  102. package/dist/http-kit/response.d.ts +19 -0
  103. package/dist/http-kit/response.js +109 -0
  104. package/dist/http-kit/response.mjs +68 -0
  105. package/dist/index.d.mts +4 -0
  106. package/dist/index.d.ts +4 -0
  107. package/dist/index.js +91 -0
  108. package/dist/index.mjs +51 -0
  109. package/dist/route/api/auth/login/[provider]/route.js +113 -0
  110. package/dist/route/api/auth/login/[provider]/route.mjs +86 -0
  111. package/dist/route/api/auth/login/_provider_/route.d.mts +20 -0
  112. package/dist/route/api/auth/login/_provider_/route.d.ts +20 -0
  113. package/dist/route/api/auth/login/route.d.mts +14 -0
  114. package/dist/route/api/auth/login/route.d.ts +14 -0
  115. package/dist/route/api/auth/login/route.js +107 -0
  116. package/dist/route/api/auth/login/route.mjs +80 -0
  117. package/dist/route/api/auth/logout/route.d.mts +14 -0
  118. package/dist/route/api/auth/logout/route.d.ts +14 -0
  119. package/dist/route/api/auth/logout/route.js +98 -0
  120. package/dist/route/api/auth/logout/route.mjs +71 -0
  121. package/dist/route/api/auth/refresh/route.d.mts +13 -0
  122. package/dist/route/api/auth/refresh/route.d.ts +13 -0
  123. package/dist/route/api/auth/refresh/route.js +92 -0
  124. package/dist/route/api/auth/refresh/route.mjs +65 -0
  125. package/dist/route/api/auth/route.d.mts +13 -0
  126. package/dist/route/api/auth/route.d.ts +13 -0
  127. package/dist/route/api/auth/route.js +82 -0
  128. package/dist/route/api/auth/route.mjs +55 -0
  129. package/dist/route/api/files/[fileId]/route.js +99 -0
  130. package/dist/route/api/files/[fileId]/route.mjs +72 -0
  131. package/dist/route/api/files/_fileId_/route.d.mts +17 -0
  132. package/dist/route/api/files/_fileId_/route.d.ts +17 -0
  133. package/dist/route/api/files/route.d.mts +16 -0
  134. package/dist/route/api/files/route.d.ts +16 -0
  135. package/dist/route/api/files/route.js +106 -0
  136. package/dist/route/api/files/route.mjs +79 -0
  137. package/dist/route/api.d.mts +29 -0
  138. package/dist/route/api.d.ts +29 -0
  139. package/dist/route/api.js +395 -0
  140. package/dist/route/api.mjs +368 -0
  141. package/dist/route/auth/callback/[provider]/route.js +120 -0
  142. package/dist/route/auth/callback/[provider]/route.mjs +93 -0
  143. package/dist/route/auth/callback/_provider_/route.d.mts +20 -0
  144. package/dist/route/auth/callback/_provider_/route.d.ts +20 -0
  145. package/dist/seo-kit/index.d.mts +6 -0
  146. package/dist/seo-kit/index.d.ts +6 -0
  147. package/dist/seo-kit/index.js +321 -0
  148. package/dist/seo-kit/index.mjs +282 -0
  149. package/dist/seo-kit/loader.d.mts +7 -0
  150. package/dist/seo-kit/loader.d.ts +7 -0
  151. package/dist/seo-kit/loader.js +43 -0
  152. package/dist/seo-kit/loader.mjs +18 -0
  153. package/dist/seo-kit/seo.d.mts +103 -0
  154. package/dist/{esm/seo-kit → seo-kit}/seo.d.ts +10 -6
  155. package/dist/seo-kit/seo.js +286 -0
  156. package/dist/seo-kit/seo.mjs +251 -0
  157. package/dist/seo-kit/seo_loader.d.mts +16 -0
  158. package/dist/seo-kit/seo_loader.d.ts +16 -0
  159. package/dist/seo-kit/seo_loader.js +68 -0
  160. package/dist/seo-kit/seo_loader.mjs +31 -0
  161. package/dist/singleton.d.mts +3 -0
  162. package/dist/singleton.d.ts +3 -0
  163. package/dist/singleton.js +37 -0
  164. package/dist/singleton.mjs +12 -0
  165. package/dist/slug.d.mts +3 -0
  166. package/dist/slug.d.ts +3 -0
  167. package/dist/slug.js +32 -0
  168. package/dist/slug.mjs +7 -0
  169. package/package.json +36 -34
  170. package/tsup.config.ts +9 -0
  171. package/dist/cjs/auth-kit/apple_auth.js +0 -61
  172. package/dist/cjs/auth-kit/auth_service.js +0 -204
  173. package/dist/cjs/auth-kit/client/google_login_button.js +0 -19
  174. package/dist/cjs/auth-kit/client/redirect_page.js +0 -18
  175. package/dist/cjs/auth-kit/google_auth.js +0 -69
  176. package/dist/cjs/auth-kit/jwt.js +0 -54
  177. package/dist/cjs/auth-kit/kakao_auth.js +0 -43
  178. package/dist/cjs/auth-kit/repository.js +0 -2
  179. package/dist/cjs/auth-kit/with_auth.js +0 -46
  180. package/dist/cjs/cn.js +0 -6
  181. package/dist/cjs/components/index.js +0 -18
  182. package/dist/cjs/components/modal/fullscreen_container.js +0 -49
  183. package/dist/cjs/components/modal/hooks.js +0 -76
  184. package/dist/cjs/components/modal/index.js +0 -19
  185. package/dist/cjs/components/modal/modal.js +0 -79
  186. package/dist/cjs/components/styles.js +0 -10
  187. package/dist/cjs/date.js +0 -31
  188. package/dist/cjs/file-kit/cdn.js +0 -9
  189. package/dist/cjs/file-kit/client/drop_file_input.js +0 -148
  190. package/dist/cjs/file-kit/client/file_uploader.js +0 -88
  191. package/dist/cjs/file-kit/file_service.js +0 -32
  192. package/dist/cjs/file-kit/object_storage.js +0 -51
  193. package/dist/cjs/file-kit/repository.js +0 -2
  194. package/dist/cjs/file-kit/responsive_image.js +0 -63
  195. package/dist/cjs/http-kit/index.js +0 -17
  196. package/dist/cjs/http-kit/response.js +0 -37
  197. package/dist/cjs/index.js +0 -20
  198. package/dist/cjs/route/api/auth/login/[provider]/route.js +0 -36
  199. package/dist/cjs/route/api/auth/login/route.js +0 -35
  200. package/dist/cjs/route/api/auth/logout/route.js +0 -22
  201. package/dist/cjs/route/api/auth/refresh/route.js +0 -22
  202. package/dist/cjs/route/api/auth/route.js +0 -12
  203. package/dist/cjs/route/api/files/[fileId]/route.js +0 -20
  204. package/dist/cjs/route/api/files/route.js +0 -34
  205. package/dist/cjs/route/auth/callback/[provider]/route.js +0 -38
  206. package/dist/cjs/route/index.js +0 -80
  207. package/dist/cjs/seo-kit/index.js +0 -19
  208. package/dist/cjs/seo-kit/loader.js +0 -17
  209. package/dist/cjs/seo-kit/seo.js +0 -278
  210. package/dist/cjs/seo-kit/seo_loader.js +0 -15
  211. package/dist/cjs/singleton.js +0 -12
  212. package/dist/cjs/slug.js +0 -10
  213. package/dist/esm/auth-kit/apple_auth.js +0 -57
  214. package/dist/esm/auth-kit/auth_service.js +0 -197
  215. package/dist/esm/auth-kit/client/google_login_button.d.ts +0 -5
  216. package/dist/esm/auth-kit/client/google_login_button.js +0 -16
  217. package/dist/esm/auth-kit/client/redirect_page.d.ts +0 -1
  218. package/dist/esm/auth-kit/client/redirect_page.js +0 -15
  219. package/dist/esm/auth-kit/google_auth.js +0 -65
  220. package/dist/esm/auth-kit/jwt.js +0 -50
  221. package/dist/esm/auth-kit/kakao_auth.js +0 -39
  222. package/dist/esm/auth-kit/repository.js +0 -1
  223. package/dist/esm/auth-kit/with_auth.d.ts +0 -12
  224. package/dist/esm/auth-kit/with_auth.js +0 -43
  225. package/dist/esm/cn.d.ts +0 -1
  226. package/dist/esm/cn.js +0 -3
  227. package/dist/esm/components/index.d.ts +0 -2
  228. package/dist/esm/components/index.js +0 -2
  229. package/dist/esm/components/modal/fullscreen_container.d.ts +0 -5
  230. package/dist/esm/components/modal/fullscreen_container.js +0 -45
  231. package/dist/esm/components/modal/hooks.d.ts +0 -15
  232. package/dist/esm/components/modal/hooks.js +0 -67
  233. package/dist/esm/components/modal/index.d.ts +0 -3
  234. package/dist/esm/components/modal/index.js +0 -3
  235. package/dist/esm/components/modal/modal.d.ts +0 -10
  236. package/dist/esm/components/modal/modal.js +0 -43
  237. package/dist/esm/components/styles.d.ts +0 -7
  238. package/dist/esm/components/styles.js +0 -7
  239. package/dist/esm/date.d.ts +0 -1
  240. package/dist/esm/date.js +0 -24
  241. package/dist/esm/file-kit/cdn.d.ts +0 -3
  242. package/dist/esm/file-kit/cdn.js +0 -5
  243. package/dist/esm/file-kit/client/drop_file_input.js +0 -144
  244. package/dist/esm/file-kit/client/file_uploader.js +0 -84
  245. package/dist/esm/file-kit/file_service.js +0 -28
  246. package/dist/esm/file-kit/object_storage.js +0 -47
  247. package/dist/esm/file-kit/repository.js +0 -1
  248. package/dist/esm/file-kit/responsive_image.d.ts +0 -17
  249. package/dist/esm/file-kit/responsive_image.js +0 -58
  250. package/dist/esm/http-kit/index.d.ts +0 -1
  251. package/dist/esm/http-kit/index.js +0 -1
  252. package/dist/esm/http-kit/response.d.ts +0 -17
  253. package/dist/esm/http-kit/response.js +0 -31
  254. package/dist/esm/index.d.ts +0 -4
  255. package/dist/esm/index.js +0 -4
  256. package/dist/esm/route/api/auth/login/[provider]/route.d.ts +0 -10
  257. package/dist/esm/route/api/auth/login/[provider]/route.js +0 -32
  258. package/dist/esm/route/api/auth/login/route.d.ts +0 -6
  259. package/dist/esm/route/api/auth/login/route.js +0 -31
  260. package/dist/esm/route/api/auth/logout/route.d.ts +0 -6
  261. package/dist/esm/route/api/auth/logout/route.js +0 -18
  262. package/dist/esm/route/api/auth/refresh/route.d.ts +0 -4
  263. package/dist/esm/route/api/auth/refresh/route.js +0 -18
  264. package/dist/esm/route/api/auth/route.d.ts +0 -4
  265. package/dist/esm/route/api/auth/route.js +0 -8
  266. package/dist/esm/route/api/files/[fileId]/route.d.ts +0 -8
  267. package/dist/esm/route/api/files/[fileId]/route.js +0 -16
  268. package/dist/esm/route/api/files/route.d.ts +0 -6
  269. package/dist/esm/route/api/files/route.js +0 -30
  270. package/dist/esm/route/auth/callback/[provider]/route.d.ts +0 -11
  271. package/dist/esm/route/auth/callback/[provider]/route.js +0 -34
  272. package/dist/esm/route/index.d.ts +0 -22
  273. package/dist/esm/route/index.js +0 -76
  274. package/dist/esm/seo-kit/index.d.ts +0 -3
  275. package/dist/esm/seo-kit/index.js +0 -3
  276. package/dist/esm/seo-kit/loader.d.ts +0 -5
  277. package/dist/esm/seo-kit/loader.js +0 -14
  278. package/dist/esm/seo-kit/seo.js +0 -275
  279. package/dist/esm/seo-kit/seo_loader.d.ts +0 -12
  280. package/dist/esm/seo-kit/seo_loader.js +0 -12
  281. package/dist/esm/singleton.d.ts +0 -1
  282. package/dist/esm/singleton.js +0 -9
  283. package/dist/esm/slug.d.ts +0 -1
  284. package/dist/esm/slug.js +0 -6
@@ -0,0 +1,117 @@
1
+ // src/http-kit/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-kit/google_auth.tsx
46
+ var GoogleAuth = class {
47
+ AUTH;
48
+ GOOGLE_CLIENT_ID;
49
+ GOOGLE_CLIENT_SECRET;
50
+ GOOGLE_REDIRECT_URI;
51
+ constructor(AUTH, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_REDIRECT_URI) {
52
+ this.GOOGLE_CLIENT_ID = GOOGLE_CLIENT_ID;
53
+ this.GOOGLE_CLIENT_SECRET = GOOGLE_CLIENT_SECRET;
54
+ this.GOOGLE_REDIRECT_URI = GOOGLE_REDIRECT_URI;
55
+ this.AUTH = AUTH;
56
+ }
57
+ async signIn(code) {
58
+ const tokenRes = await fetch("https://oauth2.googleapis.com/token", {
59
+ method: "POST",
60
+ headers: {
61
+ "Content-Type": "application/x-www-form-urlencoded"
62
+ },
63
+ body: new URLSearchParams({
64
+ code,
65
+ client_id: this.GOOGLE_CLIENT_ID,
66
+ client_secret: this.GOOGLE_CLIENT_SECRET,
67
+ redirect_uri: this.GOOGLE_REDIRECT_URI,
68
+ grant_type: "authorization_code"
69
+ })
70
+ });
71
+ if (!tokenRes.ok) {
72
+ if (process.env.NODE_ENV === "development") {
73
+ throw INTERNAL_SERVER_ERROR(
74
+ `\uAD6C\uAE00 \uD1A0\uD070 \uBC1C\uAE09\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4. status: ${tokenRes.status}, message: ${await tokenRes.text()}`
75
+ );
76
+ }
77
+ throw INTERNAL_SERVER_ERROR("\uC778\uC99D\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.");
78
+ }
79
+ const { access_token } = await tokenRes.json();
80
+ const userRes = await fetch(
81
+ "https://www.googleapis.com/oauth2/v1/userinfo",
82
+ {
83
+ headers: {
84
+ Authorization: `Bearer ${access_token}`
85
+ }
86
+ }
87
+ );
88
+ if (!userRes.ok) {
89
+ throw BAD_REQUEST("\uC720\uC800 \uC815\uBCF4\uB97C \uAC00\uC838\uC624\uB294\uB370 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.");
90
+ }
91
+ const { id, email, name, picture } = await userRes.json();
92
+ const user = await this.AUTH.findUser("google", {
93
+ id,
94
+ email,
95
+ name,
96
+ picture
97
+ });
98
+ if (!user) {
99
+ throw createJsonResponse(404)({
100
+ provider: "google",
101
+ id,
102
+ name,
103
+ picture,
104
+ message: "\uC0AC\uC6A9\uC790\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
105
+ });
106
+ }
107
+ const { accessToken, refreshToken } = await this.AUTH.issueTokenPair(user);
108
+ return {
109
+ user,
110
+ accessToken,
111
+ refreshToken
112
+ };
113
+ }
114
+ };
115
+ export {
116
+ GoogleAuth
117
+ };
@@ -0,0 +1,18 @@
1
+ import { JWTPayload } from 'jose';
2
+
3
+ declare class JWTManager {
4
+ siteOrigin?: string;
5
+ constructor(siteOrigin?: string);
6
+ verify(token: string, secret: string): Promise<JWTPayload | undefined>;
7
+ verifyAccessToken(token: string): Promise<JWTPayload | undefined>;
8
+ verifyRefreshToken(token: string): Promise<JWTPayload | undefined>;
9
+ sign(payload: JWTPayload, secret: string, { expiresIn }?: {
10
+ expiresIn?: string;
11
+ }): Promise<string>;
12
+ signAccessToken(payload: JWTPayload): Promise<string>;
13
+ signRefreshToken(payload: JWTPayload): Promise<string>;
14
+ decode(token: string): JWTPayload;
15
+ getExpirationTime(token: string): Date;
16
+ }
17
+
18
+ export { JWTManager };
@@ -1,5 +1,6 @@
1
- import { type JWTPayload } from "jose";
2
- export declare class JWTManager {
1
+ import { JWTPayload } from 'jose';
2
+
3
+ declare class JWTManager {
3
4
  siteOrigin?: string;
4
5
  constructor(siteOrigin?: string);
5
6
  verify(token: string, secret: string): Promise<JWTPayload | undefined>;
@@ -13,3 +14,5 @@ export declare class JWTManager {
13
14
  decode(token: string): JWTPayload;
14
15
  getExpirationTime(token: string): Date;
15
16
  }
17
+
18
+ export { JWTManager };
@@ -0,0 +1,76 @@
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-kit/jwt.ts
21
+ var jwt_exports = {};
22
+ __export(jwt_exports, {
23
+ JWTManager: () => JWTManager
24
+ });
25
+ module.exports = __toCommonJS(jwt_exports);
26
+ var import_jose = require("jose");
27
+ var JWTManager = class {
28
+ siteOrigin;
29
+ constructor(siteOrigin) {
30
+ this.siteOrigin = siteOrigin;
31
+ }
32
+ async verify(token, secret) {
33
+ try {
34
+ const result = await (0, import_jose.jwtVerify)(token, new TextEncoder().encode(secret));
35
+ return result.payload;
36
+ } catch (_) {
37
+ return;
38
+ }
39
+ }
40
+ async verifyAccessToken(token) {
41
+ return this.verify(token, process.env.ACCESS_TOKEN_SECRET);
42
+ }
43
+ async verifyRefreshToken(token) {
44
+ return this.verify(token, process.env.REFRESH_TOKEN_SECRET);
45
+ }
46
+ async sign(payload, secret, { expiresIn } = {}) {
47
+ let builder = new import_jose.SignJWT(payload).setProtectedHeader({ alg: "HS256", typ: "JWT" }).setIssuedAt();
48
+ if (this.siteOrigin) {
49
+ builder = builder.setIssuer(this.siteOrigin);
50
+ }
51
+ if (expiresIn) {
52
+ builder = builder.setExpirationTime(expiresIn);
53
+ }
54
+ return builder.sign(new TextEncoder().encode(secret));
55
+ }
56
+ async signAccessToken(payload) {
57
+ return this.sign(payload, process.env.ACCESS_TOKEN_SECRET, {
58
+ expiresIn: process.env.ACCESS_TOKEN_EXPIRES_IN || "10s"
59
+ });
60
+ }
61
+ async signRefreshToken(payload) {
62
+ return this.sign(payload, process.env.REFRESH_TOKEN_SECRET, {
63
+ expiresIn: process.env.REFRESH_TOKEN_EXPIRES_IN || "1d"
64
+ });
65
+ }
66
+ decode(token) {
67
+ return (0, import_jose.decodeJwt)(token);
68
+ }
69
+ getExpirationTime(token) {
70
+ return new Date(Number((0, import_jose.decodeJwt)(token).exp) * 1e3);
71
+ }
72
+ };
73
+ // Annotate the CommonJS export names for ESM import in node:
74
+ 0 && (module.exports = {
75
+ JWTManager
76
+ });
@@ -0,0 +1,51 @@
1
+ // src/auth-kit/jwt.ts
2
+ import { SignJWT, decodeJwt, jwtVerify } from "jose";
3
+ var JWTManager = class {
4
+ siteOrigin;
5
+ constructor(siteOrigin) {
6
+ this.siteOrigin = siteOrigin;
7
+ }
8
+ async verify(token, secret) {
9
+ try {
10
+ const result = await jwtVerify(token, new TextEncoder().encode(secret));
11
+ return result.payload;
12
+ } catch (_) {
13
+ return;
14
+ }
15
+ }
16
+ async verifyAccessToken(token) {
17
+ return this.verify(token, process.env.ACCESS_TOKEN_SECRET);
18
+ }
19
+ async verifyRefreshToken(token) {
20
+ return this.verify(token, process.env.REFRESH_TOKEN_SECRET);
21
+ }
22
+ async sign(payload, secret, { expiresIn } = {}) {
23
+ let builder = new SignJWT(payload).setProtectedHeader({ alg: "HS256", typ: "JWT" }).setIssuedAt();
24
+ if (this.siteOrigin) {
25
+ builder = builder.setIssuer(this.siteOrigin);
26
+ }
27
+ if (expiresIn) {
28
+ builder = builder.setExpirationTime(expiresIn);
29
+ }
30
+ return builder.sign(new TextEncoder().encode(secret));
31
+ }
32
+ async signAccessToken(payload) {
33
+ return this.sign(payload, process.env.ACCESS_TOKEN_SECRET, {
34
+ expiresIn: process.env.ACCESS_TOKEN_EXPIRES_IN || "10s"
35
+ });
36
+ }
37
+ async signRefreshToken(payload) {
38
+ return this.sign(payload, process.env.REFRESH_TOKEN_SECRET, {
39
+ expiresIn: process.env.REFRESH_TOKEN_EXPIRES_IN || "1d"
40
+ });
41
+ }
42
+ decode(token) {
43
+ return decodeJwt(token);
44
+ }
45
+ getExpirationTime(token) {
46
+ return new Date(Number(decodeJwt(token).exp) * 1e3);
47
+ }
48
+ };
49
+ export {
50
+ JWTManager
51
+ };
@@ -0,0 +1,24 @@
1
+ import { AuthService } from './auth_service.mjs';
2
+ import 'jose';
3
+ import 'react-router';
4
+ import './jwt.mjs';
5
+ import '../file-kit/object_storage.mjs';
6
+ import '@aws-sdk/client-s3';
7
+ import './repository.mjs';
8
+
9
+ declare class KakaoAuth {
10
+ AUTH: AuthService;
11
+ constructor(AUTH: AuthService);
12
+ signIn(kakaoAccessToken: string): Promise<{
13
+ user: {
14
+ id: string;
15
+ role: string;
16
+ name: string;
17
+ refreshToken: string | null;
18
+ };
19
+ accessToken: string;
20
+ refreshToken: string;
21
+ }>;
22
+ }
23
+
24
+ export { KakaoAuth };
@@ -1,5 +1,12 @@
1
- import { AuthService } from "./auth_service";
2
- export declare class KakaoAuth {
1
+ import { AuthService } from './auth_service.js';
2
+ import 'jose';
3
+ import 'react-router';
4
+ import './jwt.js';
5
+ import '../file-kit/object_storage.js';
6
+ import '@aws-sdk/client-s3';
7
+ import './repository.js';
8
+
9
+ declare class KakaoAuth {
3
10
  AUTH: AuthService;
4
11
  constructor(AUTH: AuthService);
5
12
  signIn(kakaoAccessToken: string): Promise<{
@@ -13,3 +20,5 @@ export declare class KakaoAuth {
13
20
  refreshToken: string;
14
21
  }>;
15
22
  }
23
+
24
+ export { KakaoAuth };
@@ -0,0 +1,115 @@
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-kit/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
+
27
+ // src/http-kit/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-kit/kakao_auth.ts
72
+ var KakaoAuth = class {
73
+ AUTH;
74
+ constructor(AUTH) {
75
+ this.AUTH = AUTH;
76
+ }
77
+ async signIn(kakaoAccessToken) {
78
+ const userRes = await fetch("https://kapi.kakao.com/v2/user/me", {
79
+ headers: {
80
+ Authorization: `Bearer ${kakaoAccessToken}`
81
+ }
82
+ });
83
+ if (!userRes.ok) {
84
+ throw new Error("\uC720\uC800 \uC815\uBCF4\uB97C \uAC00\uC838\uC624\uB294\uB370 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.");
85
+ }
86
+ const { id, kakao_account } = await userRes.json();
87
+ const { email, profile } = kakao_account;
88
+ const payload = {
89
+ id,
90
+ email,
91
+ name: profile.nickname,
92
+ picture: profile.thumbnail_image_url
93
+ };
94
+ const user = await this.AUTH.findUser("kakao", payload);
95
+ if (!user) {
96
+ throw createJsonResponse(404)({
97
+ provider: "kakao",
98
+ ...payload,
99
+ message: "\uC0AC\uC6A9\uC790\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
100
+ });
101
+ }
102
+ const { accessToken, refreshToken } = await this.AUTH.issueTokenPair(
103
+ user
104
+ );
105
+ return {
106
+ user,
107
+ accessToken,
108
+ refreshToken
109
+ };
110
+ }
111
+ };
112
+ // Annotate the CommonJS export names for ESM import in node:
113
+ 0 && (module.exports = {
114
+ KakaoAuth
115
+ });
@@ -0,0 +1,88 @@
1
+ // src/http-kit/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-kit/kakao_auth.ts
46
+ var KakaoAuth = class {
47
+ AUTH;
48
+ constructor(AUTH) {
49
+ this.AUTH = AUTH;
50
+ }
51
+ async signIn(kakaoAccessToken) {
52
+ const userRes = await fetch("https://kapi.kakao.com/v2/user/me", {
53
+ headers: {
54
+ Authorization: `Bearer ${kakaoAccessToken}`
55
+ }
56
+ });
57
+ if (!userRes.ok) {
58
+ throw new Error("\uC720\uC800 \uC815\uBCF4\uB97C \uAC00\uC838\uC624\uB294\uB370 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.");
59
+ }
60
+ const { id, kakao_account } = await userRes.json();
61
+ const { email, profile } = kakao_account;
62
+ const payload = {
63
+ id,
64
+ email,
65
+ name: profile.nickname,
66
+ picture: profile.thumbnail_image_url
67
+ };
68
+ const user = await this.AUTH.findUser("kakao", payload);
69
+ if (!user) {
70
+ throw createJsonResponse(404)({
71
+ provider: "kakao",
72
+ ...payload,
73
+ message: "\uC0AC\uC6A9\uC790\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
74
+ });
75
+ }
76
+ const { accessToken, refreshToken } = await this.AUTH.issueTokenPair(
77
+ user
78
+ );
79
+ return {
80
+ user,
81
+ accessToken,
82
+ refreshToken
83
+ };
84
+ }
85
+ };
86
+ export {
87
+ KakaoAuth
88
+ };
@@ -0,0 +1,42 @@
1
+ interface AuthRepository {
2
+ findCredentialById(id: string): Promise<{
3
+ password: string;
4
+ userId: string;
5
+ } | undefined>;
6
+ findUserById(userId: string): Promise<{
7
+ id: string;
8
+ role: string;
9
+ name: string;
10
+ refreshToken: string | null;
11
+ } | undefined>;
12
+ updateUserRefreshToken(userId: string, hashedRefreshToken: string | null): Promise<void>;
13
+ createUser(userData: {
14
+ id: string;
15
+ role: string;
16
+ profileImageId: string | null;
17
+ name: string;
18
+ email: string;
19
+ }): Promise<{
20
+ id: string;
21
+ role: string;
22
+ name: string;
23
+ }>;
24
+ findThirdPartyAuth(provider: string, providerId: string): Promise<{
25
+ userId: string;
26
+ } | undefined>;
27
+ createThirdPartyAuth(authData: {
28
+ id: string;
29
+ provider: string;
30
+ userId: string;
31
+ }): Promise<void>;
32
+ createFile(fileData: {
33
+ id: string;
34
+ name: string;
35
+ type: string;
36
+ key: string;
37
+ size: number;
38
+ metadata: Record<string, any>;
39
+ }): Promise<void>;
40
+ }
41
+
42
+ export type { AuthRepository };
@@ -1,4 +1,4 @@
1
- export interface AuthRepository {
1
+ interface AuthRepository {
2
2
  findCredentialById(id: string): Promise<{
3
3
  password: string;
4
4
  userId: string;
@@ -38,3 +38,5 @@ export interface AuthRepository {
38
38
  metadata: Record<string, any>;
39
39
  }): Promise<void>;
40
40
  }
41
+
42
+ export type { AuthRepository };
@@ -0,0 +1,18 @@
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-kit/repository.ts
17
+ var repository_exports = {};
18
+ module.exports = __toCommonJS(repository_exports);
File without changes
@@ -0,0 +1,17 @@
1
+ import { LoaderFunctionArgs, ActionFunctionArgs } from 'react-router';
2
+ import { AuthService } from './auth_service.mjs';
3
+ import { JWTManager } from './jwt.mjs';
4
+ import { JWTPayload } from 'jose';
5
+ import '../file-kit/object_storage.mjs';
6
+ import '@aws-sdk/client-s3';
7
+ import './repository.mjs';
8
+
9
+ type Fn<T extends LoaderFunctionArgs | ActionFunctionArgs> = (arg: T) => Promise<unknown> | unknown;
10
+ type InputFN = (auth?: JWTPayload) => Fn<LoaderFunctionArgs> | Fn<ActionFunctionArgs>;
11
+ type WithAuthHandler<T extends LoaderFunctionArgs | ActionFunctionArgs> = (fn: InputFN) => Fn<T>;
12
+ declare function createWithAuthHandler<T extends LoaderFunctionArgs | ActionFunctionArgs>({ JWT_MANAGER, AUTH, }: {
13
+ JWT_MANAGER: JWTManager;
14
+ AUTH: AuthService;
15
+ }): WithAuthHandler<T>;
16
+
17
+ export { type WithAuthHandler, createWithAuthHandler };
@@ -0,0 +1,17 @@
1
+ import { LoaderFunctionArgs, ActionFunctionArgs } from 'react-router';
2
+ import { AuthService } from './auth_service.js';
3
+ import { JWTManager } from './jwt.js';
4
+ import { JWTPayload } from 'jose';
5
+ import '../file-kit/object_storage.js';
6
+ import '@aws-sdk/client-s3';
7
+ import './repository.js';
8
+
9
+ type Fn<T extends LoaderFunctionArgs | ActionFunctionArgs> = (arg: T) => Promise<unknown> | unknown;
10
+ type InputFN = (auth?: JWTPayload) => Fn<LoaderFunctionArgs> | Fn<ActionFunctionArgs>;
11
+ type WithAuthHandler<T extends LoaderFunctionArgs | ActionFunctionArgs> = (fn: InputFN) => Fn<T>;
12
+ declare function createWithAuthHandler<T extends LoaderFunctionArgs | ActionFunctionArgs>({ JWT_MANAGER, AUTH, }: {
13
+ JWT_MANAGER: JWTManager;
14
+ AUTH: AuthService;
15
+ }): WithAuthHandler<T>;
16
+
17
+ export { type WithAuthHandler, createWithAuthHandler };