dn-react-router-toolkit 0.1.1 → 0.1.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 (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 +108 -0
  36. package/dist/auth-kit/with_auth.mjs +71 -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,29 @@
1
+ import { AuthService } from '../auth-kit/auth_service.mjs';
2
+ import { GoogleAuth } from '../auth-kit/google_auth.mjs';
3
+ import { AppleAuth } from '../auth-kit/apple_auth.mjs';
4
+ import { FileRepository } from '../file-kit/repository.mjs';
5
+ import { FileService } from '../file-kit/file_service.mjs';
6
+ import { JWTManager } from '../auth-kit/jwt.mjs';
7
+ import { AuthRepository } from '../auth-kit/repository.mjs';
8
+ import { KakaoAuth } from '../auth-kit/kakao_auth.mjs';
9
+ import 'jose';
10
+ import 'react-router';
11
+ import '../file-kit/object_storage.mjs';
12
+ import '@aws-sdk/client-s3';
13
+
14
+ declare const createAuthAPIHandler: <TFile>({ AUTH, GOOGLE_AUTH, APPLE_AUTH, KAKAO_AUTH, JWT_MANAGER, FILE_SERVICE, SITE_ORIGIN, authRepository, fileRepository, }: {
15
+ SITE_ORIGIN: string;
16
+ JWT_MANAGER: JWTManager;
17
+ AUTH: AuthService;
18
+ GOOGLE_AUTH: GoogleAuth;
19
+ APPLE_AUTH: AppleAuth;
20
+ KAKAO_AUTH: KakaoAuth;
21
+ FILE_SERVICE: FileService<TFile>;
22
+ authRepository: AuthRepository;
23
+ fileRepository: FileRepository<TFile>;
24
+ }) => ({ request, params, }: {
25
+ request: Request;
26
+ params: any;
27
+ }) => Promise<Response>;
28
+
29
+ export { createAuthAPIHandler };
@@ -0,0 +1,29 @@
1
+ import { AuthService } from '../auth-kit/auth_service.js';
2
+ import { GoogleAuth } from '../auth-kit/google_auth.js';
3
+ import { AppleAuth } from '../auth-kit/apple_auth.js';
4
+ import { FileRepository } from '../file-kit/repository.js';
5
+ import { FileService } from '../file-kit/file_service.js';
6
+ import { JWTManager } from '../auth-kit/jwt.js';
7
+ import { AuthRepository } from '../auth-kit/repository.js';
8
+ import { KakaoAuth } from '../auth-kit/kakao_auth.js';
9
+ import 'jose';
10
+ import 'react-router';
11
+ import '../file-kit/object_storage.js';
12
+ import '@aws-sdk/client-s3';
13
+
14
+ declare const createAuthAPIHandler: <TFile>({ AUTH, GOOGLE_AUTH, APPLE_AUTH, KAKAO_AUTH, JWT_MANAGER, FILE_SERVICE, SITE_ORIGIN, authRepository, fileRepository, }: {
15
+ SITE_ORIGIN: string;
16
+ JWT_MANAGER: JWTManager;
17
+ AUTH: AuthService;
18
+ GOOGLE_AUTH: GoogleAuth;
19
+ APPLE_AUTH: AppleAuth;
20
+ KAKAO_AUTH: KakaoAuth;
21
+ FILE_SERVICE: FileService<TFile>;
22
+ authRepository: AuthRepository;
23
+ fileRepository: FileRepository<TFile>;
24
+ }) => ({ request, params, }: {
25
+ request: Request;
26
+ params: any;
27
+ }) => Promise<Response>;
28
+
29
+ export { createAuthAPIHandler };
@@ -0,0 +1,395 @@
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/route/api.ts
21
+ var api_exports = {};
22
+ __export(api_exports, {
23
+ createAuthAPIHandler: () => createAuthAPIHandler
24
+ });
25
+ module.exports = __toCommonJS(api_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 NO_CONTENT = (init) => {
37
+ return new Response(null, {
38
+ ...init,
39
+ status: 204
40
+ });
41
+ };
42
+ var createException = (status, defaultMessage = "\uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.") => {
43
+ return (message = defaultMessage, init) => {
44
+ return createJsonResponse(status)({ message }, init);
45
+ };
46
+ };
47
+ var BAD_REQUEST = createException(400, "\uC694\uCCAD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.");
48
+ var UNAUTHORIZED = createException(401, "\uC778\uC99D\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.");
49
+ var FORBIDDEN = createException(403, "\uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.");
50
+ var NOT_FOUND = createException(
51
+ 404,
52
+ "\uC694\uCCAD\uD55C \uB9AC\uC18C\uC2A4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
53
+ );
54
+ var METHOD_NOT_ALLOWED = createException(
55
+ 405,
56
+ "\uBA54\uC11C\uB4DC\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
57
+ );
58
+ var NOT_ACCEPTABLE = createException(
59
+ 406,
60
+ "\uC694\uCCAD\uD55C \uD615\uC2DD\uC744 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
61
+ );
62
+ var REQUEST_TIMEOUT = createException(
63
+ 408,
64
+ "\uC694\uCCAD \uC2DC\uAC04\uC774 \uCD08\uACFC\uB418\uC5C8\uC2B5\uB2C8\uB2E4."
65
+ );
66
+ var CONFLICT = createException(409, "\uC694\uCCAD\uC774 \uCDA9\uB3CC\uD588\uC2B5\uB2C8\uB2E4.");
67
+ var UNPROCESSABLE_ENTITY = createException(
68
+ 422,
69
+ "\uCC98\uB9AC\uD560 \uC218 \uC5C6\uB294 \uC5D4\uD2F0\uD2F0\uC785\uB2C8\uB2E4."
70
+ );
71
+ var TOO_MANY_REQUESTS = createException(429, "\uC694\uCCAD\uC774 \uB108\uBB34 \uB9CE\uC2B5\uB2C8\uB2E4.");
72
+ var INTERNAL_SERVER_ERROR = createException(
73
+ 500,
74
+ "\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
75
+ );
76
+
77
+ // src/route/auth/callback/[provider]/route.tsx
78
+ var thirdPartyAuthCallbackHandler = async (request, {
79
+ provider
80
+ }, {
81
+ AUTH,
82
+ GOOGLE_AUTH,
83
+ APPLE_AUTH,
84
+ SITE_ORIGIN
85
+ }) => {
86
+ const url = new URL(request.url);
87
+ const code = url.searchParams.get("code");
88
+ if (!code) {
89
+ throw BAD_REQUEST("\uCF54\uB4DC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
90
+ }
91
+ const getThirdPartyAuth = (provider2) => {
92
+ switch (provider2) {
93
+ case "google":
94
+ return GOOGLE_AUTH;
95
+ case "apple":
96
+ return APPLE_AUTH;
97
+ default:
98
+ throw BAD_REQUEST("\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC778\uC99D \uC81C\uACF5\uC790\uC785\uB2C8\uB2E4.");
99
+ }
100
+ };
101
+ const { accessToken, refreshToken } = await getThirdPartyAuth(
102
+ provider
103
+ ).signIn(code);
104
+ const [accessTokenSetCookie, refreshTokenSetCookie] = await Promise.all([
105
+ AUTH.getAccessTokenSetCookie(accessToken),
106
+ AUTH.getRefreshTokenSetCookie(refreshToken)
107
+ ]);
108
+ const headers = new Headers();
109
+ headers.append("Set-Cookie", accessTokenSetCookie);
110
+ headers.append("Set-Cookie", refreshTokenSetCookie);
111
+ const redirectUrl = url.searchParams.get("state") || SITE_ORIGIN;
112
+ return new Response("Temporary Redirect", {
113
+ status: 307,
114
+ headers: {
115
+ ...headers,
116
+ Location: new URL(
117
+ `/r?redirectUrl=${encodeURIComponent(redirectUrl)}`,
118
+ request.url
119
+ ).toString()
120
+ }
121
+ });
122
+ };
123
+
124
+ // src/route/api/files/route.ts
125
+ var fileUploadHandler = async (request, {
126
+ AUTH,
127
+ FILE_SERVICE
128
+ }) => {
129
+ const auth = await AUTH.verifyOrRefresh(request);
130
+ const { name, type, size, metadata } = await request.json();
131
+ const headers = {
132
+ "Access-Control-Allow-Origin": "*"
133
+ };
134
+ if (typeof name !== "string") {
135
+ return BAD_REQUEST("\uD30C\uC77C \uC774\uB984\uC774 \uD544\uC694\uD574\uC694.", { headers });
136
+ }
137
+ if (typeof type !== "string") {
138
+ return BAD_REQUEST("\uD30C\uC77C \uD0C0\uC785\uC774 \uD544\uC694\uD574\uC694.", { headers });
139
+ }
140
+ try {
141
+ const result = await FILE_SERVICE.generateSignedUrl({
142
+ userId: auth?.userId,
143
+ name,
144
+ type,
145
+ size,
146
+ metadata
147
+ });
148
+ return CREATED(result, { headers });
149
+ } catch (e) {
150
+ if (e instanceof Error) {
151
+ return INTERNAL_SERVER_ERROR(e.message, { headers });
152
+ }
153
+ return INTERNAL_SERVER_ERROR(e, { headers });
154
+ }
155
+ };
156
+
157
+ // src/route/api/files/[fileId]/route.ts
158
+ var fileDeleteHandler = async (request, { fileId }, {
159
+ AUTH,
160
+ repository
161
+ }) => {
162
+ const auth = await AUTH.verifyOrRefresh(request);
163
+ const file = await repository.findFileById(fileId);
164
+ const headers = {
165
+ "Access-Control-Allow-Origin": "*"
166
+ };
167
+ if (!file) {
168
+ return NOT_FOUND("\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.", { headers });
169
+ }
170
+ if (!repository.hasPermission(file, auth?.userId)) {
171
+ return FORBIDDEN("\uD30C\uC77C\uC744 \uC0AD\uC81C\uD560 \uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.", { headers });
172
+ }
173
+ await repository.deleteFile(fileId);
174
+ return NO_CONTENT({ headers });
175
+ };
176
+
177
+ // src/route/api/auth/route.ts
178
+ var getAuthHandler = async (request, { AUTH }) => {
179
+ const auth = await AUTH.verifyOrRefresh(request);
180
+ if (!auth) {
181
+ return UNAUTHORIZED();
182
+ }
183
+ return OK(auth);
184
+ };
185
+
186
+ // src/route/api/auth/login/[provider]/route.ts
187
+ var loginThirdPartyHandler = async (request, {
188
+ provider
189
+ }, {
190
+ GOOGLE_AUTH,
191
+ APPLE_AUTH,
192
+ KAKAO_AUTH
193
+ }) => {
194
+ const { code } = await request.json();
195
+ if (!code) {
196
+ return BAD_REQUEST("\uCF54\uB4DC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
197
+ }
198
+ const getThirdPartyAuth = (provider2) => {
199
+ switch (provider2) {
200
+ case "google":
201
+ return GOOGLE_AUTH;
202
+ case "apple":
203
+ return APPLE_AUTH;
204
+ case "kakao":
205
+ return KAKAO_AUTH;
206
+ default:
207
+ throw BAD_REQUEST("\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC778\uC99D \uC81C\uACF5\uC790\uC785\uB2C8\uB2E4.");
208
+ }
209
+ };
210
+ try {
211
+ const { accessToken, refreshToken } = await getThirdPartyAuth(
212
+ provider
213
+ ).signIn(code);
214
+ return CREATED({
215
+ accessToken,
216
+ refreshToken
217
+ });
218
+ } catch (error) {
219
+ if (error instanceof Response) {
220
+ return error;
221
+ }
222
+ throw INTERNAL_SERVER_ERROR();
223
+ }
224
+ };
225
+
226
+ // src/route/api/auth/login/route.ts
227
+ var loginCredentialHandler = async (request, {
228
+ AUTH,
229
+ JWT_MANAGER
230
+ }) => {
231
+ const searchParams = new URL(request.url).searchParams;
232
+ const { id, password } = await request.json();
233
+ try {
234
+ const { accessToken, refreshToken } = await AUTH.signIn({
235
+ id,
236
+ password
237
+ });
238
+ if (searchParams.get("type") === "json") {
239
+ return CREATED({ accessToken, refreshToken });
240
+ }
241
+ const [accessTokenSetCookie, refreshTokenSetCookie] = await Promise.all([
242
+ AUTH.getAccessTokenSetCookie(accessToken),
243
+ AUTH.getRefreshTokenSetCookie(refreshToken)
244
+ ]);
245
+ const payload = JWT_MANAGER.decode(accessToken);
246
+ const headers = new Headers();
247
+ headers.append("Set-Cookie", accessTokenSetCookie);
248
+ headers.append("Set-Cookie", refreshTokenSetCookie);
249
+ return CREATED(payload, {
250
+ headers
251
+ });
252
+ } catch (e) {
253
+ if (e instanceof Error) {
254
+ return UNAUTHORIZED(e.message);
255
+ }
256
+ throw e;
257
+ }
258
+ };
259
+
260
+ // src/route/api/auth/logout/route.ts
261
+ var logoutHandler = async (request, { AUTH, repository }) => {
262
+ const auth = await AUTH.verifyOrRefresh(request);
263
+ if (!auth) {
264
+ return UNAUTHORIZED();
265
+ }
266
+ await repository.updateUserRefreshToken(auth.userId, null);
267
+ const headers = new Headers();
268
+ const [accessTokenSetCookie, refreshTokenSetCookie] = await Promise.all([
269
+ AUTH.getAccessTokenSetCookie(null),
270
+ AUTH.getRefreshTokenSetCookie(null)
271
+ ]);
272
+ headers.append("Set-Cookie", accessTokenSetCookie);
273
+ headers.append("Set-Cookie", refreshTokenSetCookie);
274
+ return NO_CONTENT({
275
+ headers
276
+ });
277
+ };
278
+
279
+ // src/route/api/auth/refresh/route.ts
280
+ var authRefreshHandler = async (request, {
281
+ AUTH
282
+ }) => {
283
+ const refreshToken = request?.headers.get("Authorization")?.replace("Bearer ", "") || await AUTH.getRefreshTokenFromCookies(request);
284
+ if (!refreshToken) {
285
+ return BAD_REQUEST();
286
+ }
287
+ try {
288
+ const accessToken = await AUTH.refreshAccessToken(refreshToken);
289
+ return CREATED({ accessToken });
290
+ } catch (e) {
291
+ if (e instanceof Error) {
292
+ return UNAUTHORIZED(e.message);
293
+ }
294
+ throw e;
295
+ }
296
+ };
297
+
298
+ // src/route/api.ts
299
+ var createAuthAPIHandler = ({
300
+ AUTH,
301
+ GOOGLE_AUTH,
302
+ APPLE_AUTH,
303
+ KAKAO_AUTH,
304
+ JWT_MANAGER,
305
+ FILE_SERVICE,
306
+ SITE_ORIGIN,
307
+ authRepository,
308
+ fileRepository
309
+ }) => {
310
+ const handler = async ({
311
+ request,
312
+ params
313
+ }) => {
314
+ const method = request.method.toUpperCase();
315
+ const slug = params["*"].split("/");
316
+ if (slug[0] === "auth") {
317
+ if (!slug[1]) {
318
+ if (method === "GET") {
319
+ return getAuthHandler(request, { AUTH });
320
+ }
321
+ }
322
+ if (slug[1] === "login") {
323
+ if (slug[2]) {
324
+ const provider = slug[2];
325
+ if (method === "POST") {
326
+ return loginThirdPartyHandler(
327
+ request,
328
+ { provider },
329
+ { GOOGLE_AUTH, KAKAO_AUTH, APPLE_AUTH }
330
+ );
331
+ }
332
+ }
333
+ if (method === "POST") {
334
+ return loginCredentialHandler(request, {
335
+ AUTH,
336
+ JWT_MANAGER
337
+ });
338
+ }
339
+ }
340
+ if (slug[1] === "logout") {
341
+ if (method === "POST") {
342
+ return logoutHandler(request, {
343
+ AUTH,
344
+ repository: authRepository
345
+ });
346
+ }
347
+ }
348
+ if (slug[1] === "refresh") {
349
+ if (method === "GET") {
350
+ return authRefreshHandler(request, { AUTH });
351
+ }
352
+ }
353
+ if (slug[1] === "callback") {
354
+ if (slug[2]) {
355
+ const provider = slug[2];
356
+ if (method === "GET") {
357
+ return thirdPartyAuthCallbackHandler(
358
+ request,
359
+ { provider },
360
+ {
361
+ AUTH,
362
+ GOOGLE_AUTH,
363
+ APPLE_AUTH,
364
+ SITE_ORIGIN
365
+ }
366
+ );
367
+ }
368
+ }
369
+ }
370
+ }
371
+ if (slug[0] === "files") {
372
+ if (!slug[1]) {
373
+ if (method === "POST") {
374
+ return fileUploadHandler(request, { AUTH, FILE_SERVICE });
375
+ }
376
+ }
377
+ if (slug[1]) {
378
+ if (method === "DELETE") {
379
+ const fileId = slug[1];
380
+ return fileDeleteHandler(
381
+ request,
382
+ { fileId },
383
+ { AUTH, repository: fileRepository }
384
+ );
385
+ }
386
+ }
387
+ }
388
+ return new Response("Not Found", { status: 404 });
389
+ };
390
+ return handler;
391
+ };
392
+ // Annotate the CommonJS export names for ESM import in node:
393
+ 0 && (module.exports = {
394
+ createAuthAPIHandler
395
+ });