dn-react-router-toolkit 0.1.0 → 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 +9 -7
  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 +9 -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 -60
  172. package/dist/cjs/auth-kit/auth_service.js +0 -204
  173. package/dist/cjs/auth-kit/client/google_login_button.js +0 -25
  174. package/dist/cjs/auth-kit/client/redirect_page.js +0 -21
  175. package/dist/cjs/auth-kit/google_auth.js +0 -65
  176. package/dist/cjs/auth-kit/jwt.js +0 -53
  177. package/dist/cjs/auth-kit/kakao_auth.js +0 -38
  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 -64
  183. package/dist/cjs/components/modal/hooks.js +0 -78
  184. package/dist/cjs/components/modal/index.js +0 -19
  185. package/dist/cjs/components/modal/modal.js +0 -91
  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 -195
  190. package/dist/cjs/file-kit/client/file_uploader.js +0 -78
  191. package/dist/cjs/file-kit/file_service.js +0 -29
  192. package/dist/cjs/file-kit/object_storage.js +0 -50
  193. package/dist/cjs/file-kit/repository.js +0 -2
  194. package/dist/cjs/file-kit/responsive_image.js +0 -78
  195. package/dist/cjs/http-kit/index.js +0 -17
  196. package/dist/cjs/http-kit/response.js +0 -34
  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 -23
  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 -35
  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 -286
  210. package/dist/cjs/seo-kit/seo_loader.js +0 -19
  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 -56
  214. package/dist/esm/auth-kit/auth_service.js +0 -197
  215. package/dist/esm/auth-kit/client/google_login_button.d.ts +0 -6
  216. package/dist/esm/auth-kit/client/google_login_button.js +0 -19
  217. package/dist/esm/auth-kit/client/redirect_page.d.ts +0 -2
  218. package/dist/esm/auth-kit/client/redirect_page.js +0 -15
  219. package/dist/esm/auth-kit/google_auth.js +0 -61
  220. package/dist/esm/auth-kit/jwt.js +0 -49
  221. package/dist/esm/auth-kit/kakao_auth.js +0 -34
  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 -57
  231. package/dist/esm/components/modal/hooks.d.ts +0 -15
  232. package/dist/esm/components/modal/hooks.js +0 -69
  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 -55
  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 -158
  244. package/dist/esm/file-kit/client/file_uploader.js +0 -74
  245. package/dist/esm/file-kit/file_service.js +0 -25
  246. package/dist/esm/file-kit/object_storage.js +0 -46
  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 -70
  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 -28
  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 -19
  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 -31
  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 -280
  279. package/dist/esm/seo-kit/seo_loader.d.ts +0 -12
  280. package/dist/esm/seo-kit/seo_loader.js +0 -13
  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
@@ -1,31 +0,0 @@
1
- import { CREATED, UNAUTHORIZED } from "../../../../http-kit";
2
- export const loginCredentialHandler = async (request, { AUTH, JWT_MANAGER, }) => {
3
- const searchParams = new URL(request.url).searchParams;
4
- const { id, password } = await request.json();
5
- try {
6
- const { accessToken, refreshToken } = await AUTH.signIn({
7
- id,
8
- password,
9
- });
10
- if (searchParams.get("type") === "json") {
11
- return CREATED({ accessToken, refreshToken });
12
- }
13
- const [accessTokenSetCookie, refreshTokenSetCookie] = await Promise.all([
14
- AUTH.getAccessTokenSetCookie(accessToken),
15
- AUTH.getRefreshTokenSetCookie(refreshToken),
16
- ]);
17
- const payload = JWT_MANAGER.decode(accessToken);
18
- const headers = new Headers();
19
- headers.append("Set-Cookie", accessTokenSetCookie);
20
- headers.append("Set-Cookie", refreshTokenSetCookie);
21
- return CREATED(payload, {
22
- headers,
23
- });
24
- }
25
- catch (e) {
26
- if (e instanceof Error) {
27
- return UNAUTHORIZED(e.message);
28
- }
29
- throw e;
30
- }
31
- };
@@ -1,6 +0,0 @@
1
- import { AuthService } from "../../../../auth-kit/auth_service";
2
- import { type AuthRepository } from "../../../../auth-kit/repository";
3
- export declare const logoutHandler: (request: Request, { AUTH, repository }: {
4
- AUTH: AuthService;
5
- repository: AuthRepository;
6
- }) => Promise<Response>;
@@ -1,18 +0,0 @@
1
- import { NO_CONTENT, UNAUTHORIZED } from "../../../../http-kit";
2
- export const logoutHandler = async (request, { AUTH, repository }) => {
3
- const auth = await AUTH.verifyOrRefresh(request);
4
- if (!auth) {
5
- return UNAUTHORIZED();
6
- }
7
- await repository.updateUserRefreshToken(auth.userId, null);
8
- const headers = new Headers();
9
- const [accessTokenSetCookie, refreshTokenSetCookie] = await Promise.all([
10
- AUTH.getAccessTokenSetCookie(null),
11
- AUTH.getRefreshTokenSetCookie(null),
12
- ]);
13
- headers.append("Set-Cookie", accessTokenSetCookie);
14
- headers.append("Set-Cookie", refreshTokenSetCookie);
15
- return NO_CONTENT({
16
- headers,
17
- });
18
- };
@@ -1,4 +0,0 @@
1
- import { AuthService } from "../../../../auth-kit/auth_service";
2
- export declare const authRefreshHandler: (request: Request, { AUTH, }: {
3
- AUTH: AuthService;
4
- }) => Promise<Response>;
@@ -1,19 +0,0 @@
1
- import { BAD_REQUEST, CREATED, UNAUTHORIZED } from "../../../../http-kit";
2
- export const authRefreshHandler = async (request, { AUTH, }) => {
3
- var _a;
4
- const refreshToken = ((_a = request === null || request === void 0 ? void 0 : request.headers.get("Authorization")) === null || _a === void 0 ? void 0 : _a.replace("Bearer ", "")) ||
5
- (await AUTH.getRefreshTokenFromCookies(request));
6
- if (!refreshToken) {
7
- return BAD_REQUEST();
8
- }
9
- try {
10
- const accessToken = await AUTH.refreshAccessToken(refreshToken);
11
- return CREATED({ accessToken });
12
- }
13
- catch (e) {
14
- if (e instanceof Error) {
15
- return UNAUTHORIZED(e.message);
16
- }
17
- throw e;
18
- }
19
- };
@@ -1,4 +0,0 @@
1
- import { AuthService } from "../../../auth-kit/auth_service";
2
- export declare const getAuthHandler: (request: Request, { AUTH }: {
3
- AUTH: AuthService;
4
- }) => Promise<Response>;
@@ -1,8 +0,0 @@
1
- import { OK, UNAUTHORIZED } from "../../../http-kit";
2
- export const getAuthHandler = async (request, { AUTH }) => {
3
- const auth = await AUTH.verifyOrRefresh(request);
4
- if (!auth) {
5
- return UNAUTHORIZED();
6
- }
7
- return OK(auth);
8
- };
@@ -1,8 +0,0 @@
1
- import { AuthService } from "../../../../auth-kit/auth_service";
2
- import { type FileRepository } from "../../../../file-kit/repository";
3
- export declare const fileDeleteHandler: <TFile>(request: Request, { fileId }: {
4
- fileId: string;
5
- }, { AUTH, repository, }: {
6
- AUTH: AuthService;
7
- repository: FileRepository<TFile>;
8
- }) => Promise<Response>;
@@ -1,16 +0,0 @@
1
- import { FORBIDDEN, NO_CONTENT, NOT_FOUND } from "../../../../http-kit";
2
- export const fileDeleteHandler = async (request, { fileId }, { AUTH, repository, }) => {
3
- const auth = await AUTH.verifyOrRefresh(request);
4
- const file = await repository.findFileById(fileId);
5
- const headers = {
6
- "Access-Control-Allow-Origin": "*",
7
- };
8
- if (!file) {
9
- return NOT_FOUND("파일을 찾을 수 없습니다.", { headers });
10
- }
11
- if (!repository.hasPermission(file, auth === null || auth === void 0 ? void 0 : auth.userId)) {
12
- return FORBIDDEN("파일을 삭제할 권한이 없습니다.", { headers });
13
- }
14
- await repository.deleteFile(fileId);
15
- return NO_CONTENT({ headers });
16
- };
@@ -1,6 +0,0 @@
1
- import { AuthService } from "../../../auth-kit/auth_service";
2
- import { FileService } from "../../../file-kit/file_service";
3
- export declare const fileUploadHandler: <TFile>(request: Request, { AUTH, FILE_SERVICE, }: {
4
- AUTH: AuthService;
5
- FILE_SERVICE: FileService<TFile>;
6
- }) => Promise<Response>;
@@ -1,30 +0,0 @@
1
- import { BAD_REQUEST, CREATED, INTERNAL_SERVER_ERROR } from "../../../http-kit";
2
- export const fileUploadHandler = async (request, { AUTH, FILE_SERVICE, }) => {
3
- const auth = await AUTH.verifyOrRefresh(request);
4
- const { name, type, size, metadata } = await request.json();
5
- const headers = {
6
- "Access-Control-Allow-Origin": "*",
7
- };
8
- if (typeof name !== "string") {
9
- return BAD_REQUEST("파일 이름이 필요해요.", { headers });
10
- }
11
- if (typeof type !== "string") {
12
- return BAD_REQUEST("파일 타입이 필요해요.", { headers });
13
- }
14
- try {
15
- const result = await FILE_SERVICE.generateSignedUrl({
16
- userId: auth === null || auth === void 0 ? void 0 : auth.userId,
17
- name,
18
- type,
19
- size,
20
- metadata,
21
- });
22
- return CREATED(result, { headers });
23
- }
24
- catch (e) {
25
- if (e instanceof Error) {
26
- return INTERNAL_SERVER_ERROR(e.message, { headers });
27
- }
28
- return INTERNAL_SERVER_ERROR(e, { headers });
29
- }
30
- };
@@ -1,11 +0,0 @@
1
- import { AuthService } from "../../../../auth-kit/auth_service";
2
- import { GoogleAuth } from "../../../../auth-kit/google_auth";
3
- import { AppleAuth } from "../../../../auth-kit/apple_auth";
4
- export declare const thirdPartyAuthCallbackHandler: (request: Request, { provider, }: {
5
- provider: string;
6
- }, { AUTH, GOOGLE_AUTH, APPLE_AUTH, SITE_ORIGIN, }: {
7
- AUTH: AuthService;
8
- GOOGLE_AUTH: GoogleAuth;
9
- APPLE_AUTH: AppleAuth;
10
- SITE_ORIGIN: string;
11
- }) => Promise<Response>;
@@ -1,31 +0,0 @@
1
- import { BAD_REQUEST } from "../../../../http-kit";
2
- export const thirdPartyAuthCallbackHandler = async (request, { provider, }, { AUTH, GOOGLE_AUTH, APPLE_AUTH, SITE_ORIGIN, }) => {
3
- const url = new URL(request.url);
4
- const code = url.searchParams.get("code");
5
- if (!code) {
6
- throw BAD_REQUEST("코드가 없습니다.");
7
- }
8
- const getThirdPartyAuth = (provider) => {
9
- switch (provider) {
10
- case "google":
11
- return GOOGLE_AUTH;
12
- case "apple":
13
- return APPLE_AUTH;
14
- default:
15
- throw BAD_REQUEST("지원하지 않는 인증 제공자입니다.");
16
- }
17
- };
18
- const { accessToken, refreshToken } = await getThirdPartyAuth(provider).signIn(code);
19
- const [accessTokenSetCookie, refreshTokenSetCookie] = await Promise.all([
20
- AUTH.getAccessTokenSetCookie(accessToken),
21
- AUTH.getRefreshTokenSetCookie(refreshToken),
22
- ]);
23
- const headers = new Headers();
24
- headers.append("Set-Cookie", accessTokenSetCookie);
25
- headers.append("Set-Cookie", refreshTokenSetCookie);
26
- const redirectUrl = url.searchParams.get("state") || SITE_ORIGIN;
27
- return new Response("Temporary Redirect", {
28
- status: 307,
29
- headers: Object.assign(Object.assign({}, headers), { Location: new URL(`/r?redirectUrl=${encodeURIComponent(redirectUrl)}`, request.url).toString() }),
30
- });
31
- };
@@ -1,22 +0,0 @@
1
- import { AuthService } from "../auth-kit/auth_service";
2
- import { GoogleAuth } from "../auth-kit/google_auth";
3
- import { AppleAuth } from "../auth-kit/apple_auth";
4
- import { type FileRepository } from "../file-kit/repository";
5
- import { FileService } from "../file-kit/file_service";
6
- import { JWTManager } from "../auth-kit/jwt";
7
- import { type AuthRepository } from "../auth-kit/repository";
8
- import { KakaoAuth } from "../auth-kit/kakao_auth";
9
- export declare const createAuthAPIHandler: <TFile>({ AUTH, GOOGLE_AUTH, APPLE_AUTH, KAKAO_AUTH, JWT_MANAGER, FILE_SERVICE, SITE_ORIGIN, authRepository, fileRepository, }: {
10
- SITE_ORIGIN: string;
11
- JWT_MANAGER: JWTManager;
12
- AUTH: AuthService;
13
- GOOGLE_AUTH: GoogleAuth;
14
- APPLE_AUTH: AppleAuth;
15
- KAKAO_AUTH: KakaoAuth;
16
- FILE_SERVICE: FileService<TFile>;
17
- authRepository: AuthRepository;
18
- fileRepository: FileRepository<TFile>;
19
- }) => ({ request, params, }: {
20
- request: Request;
21
- params: any;
22
- }) => Promise<Response>;
@@ -1,76 +0,0 @@
1
- import { thirdPartyAuthCallbackHandler } from "./auth/callback/[provider]/route";
2
- import { fileUploadHandler } from "./api/files/route";
3
- import { fileDeleteHandler } from "./api/files/[fileId]/route";
4
- import { getAuthHandler } from "./api/auth/route";
5
- import { loginThirdPartyHandler } from "./api/auth/login/[provider]/route";
6
- import { loginCredentialHandler } from "./api/auth/login/route";
7
- import { logoutHandler } from "./api/auth/logout/route";
8
- import { authRefreshHandler } from "./api/auth/refresh/route";
9
- export const createAuthAPIHandler = ({ AUTH, GOOGLE_AUTH, APPLE_AUTH, KAKAO_AUTH, JWT_MANAGER, FILE_SERVICE, SITE_ORIGIN, authRepository, fileRepository, }) => {
10
- const handler = async ({ request, params, }) => {
11
- const method = request.method.toUpperCase();
12
- const slug = params["*"].split("/");
13
- if (slug[0] === "auth") {
14
- if (!slug[1]) {
15
- if (method === "GET") {
16
- return getAuthHandler(request, { AUTH });
17
- }
18
- }
19
- if (slug[1] === "login") {
20
- if (slug[2]) {
21
- const provider = slug[2];
22
- if (method === "POST") {
23
- return loginThirdPartyHandler(request, { provider }, { GOOGLE_AUTH, KAKAO_AUTH, APPLE_AUTH });
24
- }
25
- }
26
- if (method === "POST") {
27
- return loginCredentialHandler(request, {
28
- AUTH,
29
- JWT_MANAGER,
30
- });
31
- }
32
- }
33
- if (slug[1] === "logout") {
34
- if (method === "POST") {
35
- return logoutHandler(request, {
36
- AUTH,
37
- repository: authRepository,
38
- });
39
- }
40
- }
41
- if (slug[1] === "refresh") {
42
- if (method === "GET") {
43
- return authRefreshHandler(request, { AUTH });
44
- }
45
- }
46
- if (slug[1] === "callback") {
47
- if (slug[2]) {
48
- const provider = slug[2];
49
- if (method === "GET") {
50
- return thirdPartyAuthCallbackHandler(request, { provider }, {
51
- AUTH,
52
- GOOGLE_AUTH,
53
- APPLE_AUTH,
54
- SITE_ORIGIN,
55
- });
56
- }
57
- }
58
- }
59
- }
60
- if (slug[0] === "files") {
61
- if (!slug[1]) {
62
- if (method === "POST") {
63
- return fileUploadHandler(request, { AUTH, FILE_SERVICE });
64
- }
65
- }
66
- if (slug[1]) {
67
- if (method === "DELETE") {
68
- const fileId = slug[1];
69
- return fileDeleteHandler(request, { fileId }, { AUTH, repository: fileRepository });
70
- }
71
- }
72
- }
73
- return new Response("Not Found", { status: 404 });
74
- };
75
- return handler;
76
- };
@@ -1,3 +0,0 @@
1
- export * from "./loader";
2
- export * from "./seo_loader";
3
- export * from "./seo";
@@ -1,3 +0,0 @@
1
- export * from "./loader";
2
- export * from "./seo_loader";
3
- export * from "./seo";
@@ -1,5 +0,0 @@
1
- export type LoaderFn<T, U> = (props: T) => U | Promise<U>;
2
- export declare function createLoader<T, U = void>(fn?: LoaderFn<T, U>): {
3
- getData(): U;
4
- wrap<V>(mapper: (props: U) => V | Promise<V>): (props: T) => Promise<V>;
5
- };
@@ -1,14 +0,0 @@
1
- export function createLoader(fn = () => ({})) {
2
- let loadedData;
3
- return {
4
- getData() {
5
- return loadedData;
6
- },
7
- wrap(mapper) {
8
- return async function Thing(props) {
9
- loadedData = await fn(props);
10
- return mapper(loadedData);
11
- };
12
- },
13
- };
14
- }
@@ -1,280 +0,0 @@
1
- import React from "react";
2
- export function configSEO(config) {
3
- return {
4
- config,
5
- async init(props = {}) {
6
- var _a;
7
- const canonicalPath = props.canonicalPath;
8
- const url = canonicalPath
9
- ? `${config.origin}${canonicalPath}`
10
- : `${config.origin}${props.path || ""}`;
11
- const pageTitle = props.title
12
- ? `${props.title} | ${config.siteName}`
13
- : config.siteName;
14
- const description = props.description || config.description;
15
- const keywords = props.keywords || config.keywords;
16
- const websiteSchemaId = `${config.origin}/#website`;
17
- const websiteSchema = {
18
- "@type": "WebSite",
19
- "@id": websiteSchemaId,
20
- url: config.origin,
21
- name: config.siteName,
22
- alternateName: config.siteName,
23
- description: config.description,
24
- inLanguage: "ko",
25
- };
26
- const thumbnailSchemaId = `${url}/#thumbnail`;
27
- const thumbnail = props.thumbnail ||
28
- (typeof config.thumbnail === "function"
29
- ? await config.thumbnail()
30
- : config.thumbnail);
31
- const thumbnailUrl = thumbnail === null || thumbnail === void 0 ? void 0 : thumbnail.url;
32
- const socialImage = thumbnail
33
- ? [
34
- typeof thumbnail === "string"
35
- ? {
36
- url: thumbnail,
37
- alt: `${props.title} 대표 이미지`,
38
- }
39
- : thumbnail,
40
- ]
41
- : [];
42
- const images = [
43
- ...(thumbnailUrl
44
- ? [
45
- {
46
- id: thumbnailSchemaId,
47
- url: thumbnailUrl,
48
- alt: `${props.title} 대표 이미지`,
49
- },
50
- ]
51
- : []),
52
- ...(props.images || []),
53
- ...(((_a = props.collection) === null || _a === void 0 ? void 0 : _a.map((portfolio) => portfolio.thumbnail)) || []),
54
- ].filter(Boolean);
55
- const image = images
56
- .filter((file) => file.id)
57
- .map((file) => ({
58
- "@type": "ImageObject",
59
- "@id": `${url}/#${file.id}`,
60
- }));
61
- const breadcrumbSchemaId = `${url}#breadcrumb`;
62
- const updatedAt = props.updatedAt;
63
- const createdAt = props.createdAt;
64
- const meta = () => {
65
- return [
66
- { title: pageTitle },
67
- { name: "description", content: description },
68
- { name: "keywords", content: (keywords === null || keywords === void 0 ? void 0 : keywords.join(", ")) || "" },
69
- {
70
- tagName: "link",
71
- rel: "canonical",
72
- href: url,
73
- },
74
- { property: "og:type", content: props.type || "website" },
75
- { property: "og:title", content: pageTitle },
76
- { property: "og:description", content: description },
77
- { property: "og:url", content: url },
78
- { property: "og:site_name", content: config.siteName },
79
- ...socialImage.map((file) => ({
80
- property: "og:image",
81
- content: file.url,
82
- })),
83
- {
84
- property: "twitter:card",
85
- content: socialImage.length > 0 ? "summary_large_image" : "summary",
86
- },
87
- { property: "twitter:title", content: pageTitle },
88
- { property: "twitter:description", content: description },
89
- ...socialImage.map((file) => ({
90
- property: "twitter:image",
91
- content: file.url,
92
- })),
93
- ];
94
- };
95
- const additionalStructedData = [
96
- ...(typeof props.structedData === "function"
97
- ? await props.structedData()
98
- : props.structedData || []),
99
- ...(typeof config.structedData === "function"
100
- ? await config.structedData()
101
- : config.structedData || []),
102
- ];
103
- function getStructedData() {
104
- const collectionMainEntity = props.collection
105
- ? {
106
- "@type": "ItemList",
107
- numberOfItems: props.collection.length,
108
- itemListElement: props.collection.map((item, index) => {
109
- var _a, _b, _c, _d;
110
- return ({
111
- "@type": "ListItem",
112
- position: index + 1,
113
- url: item.url,
114
- item: {
115
- "@type": "WebPage",
116
- "@id": `${item.url}#webpage`,
117
- url: item.url,
118
- name: item.title,
119
- thumbnailUrl: (_a = item.thumbnail) === null || _a === void 0 ? void 0 : _a.url,
120
- dateModified: (_b = item.updatedAt) === null || _b === void 0 ? void 0 : _b.toISOString(),
121
- dateCreated: (_c = item.createdAt) === null || _c === void 0 ? void 0 : _c.toISOString(),
122
- datePublished: (_d = item.createdAt) === null || _d === void 0 ? void 0 : _d.toISOString(),
123
- },
124
- });
125
- }),
126
- }
127
- : undefined;
128
- return {
129
- "@context": "https://schema.org",
130
- "@graph": [
131
- {
132
- "@type": "WebPage",
133
- "@id": `${url}#webpage`,
134
- url,
135
- name: pageTitle,
136
- description,
137
- keywords: keywords,
138
- dateModified: updatedAt === null || updatedAt === void 0 ? void 0 : updatedAt.toISOString(),
139
- datePublished: createdAt === null || createdAt === void 0 ? void 0 : createdAt.toISOString(),
140
- dateCreated: createdAt === null || createdAt === void 0 ? void 0 : createdAt.toISOString(),
141
- primaryImageOfPage: thumbnail
142
- ? {
143
- "@id": thumbnailSchemaId,
144
- }
145
- : undefined,
146
- isPartOf: {
147
- "@id": websiteSchemaId,
148
- },
149
- inLanguage: "ko",
150
- breadcrumb: props.breadcrumbs && props.breadcrumbs.length > 0
151
- ? {
152
- "@id": breadcrumbSchemaId,
153
- }
154
- : undefined,
155
- image,
156
- mainEntity: collectionMainEntity,
157
- },
158
- props.article &&
159
- {
160
- "@type": "Article",
161
- "@id": `${url}#article`,
162
- url,
163
- name: pageTitle,
164
- description,
165
- keywords: keywords,
166
- headline: pageTitle,
167
- dateModified: updatedAt === null || updatedAt === void 0 ? void 0 : updatedAt.toISOString(),
168
- datePublished: createdAt === null || createdAt === void 0 ? void 0 : createdAt.toISOString(),
169
- dateCreated: createdAt === null || createdAt === void 0 ? void 0 : createdAt.toISOString(),
170
- isPartOf: {
171
- "@id": websiteSchemaId,
172
- },
173
- inLanguage: "ko",
174
- image,
175
- },
176
- props.blogPosting &&
177
- {
178
- "@type": "BlogPosting",
179
- "@id": `${url}/#blogposting`,
180
- url,
181
- headline: pageTitle,
182
- description: description,
183
- thumbnailUrl,
184
- datePublished: createdAt === null || createdAt === void 0 ? void 0 : createdAt.toISOString(),
185
- dateModified: updatedAt === null || updatedAt === void 0 ? void 0 : updatedAt.toISOString(),
186
- isPartOf: { "@id": websiteSchemaId },
187
- image,
188
- },
189
- props.creativeWork &&
190
- {
191
- "@type": "CreativeWork",
192
- "@id": `${url}/#creativework`,
193
- url,
194
- name: pageTitle,
195
- description: description,
196
- datePublished: createdAt === null || createdAt === void 0 ? void 0 : createdAt.toISOString(),
197
- dateModified: updatedAt === null || updatedAt === void 0 ? void 0 : updatedAt.toISOString(),
198
- isPartOf: { "@id": websiteSchemaId },
199
- thumbnailUrl,
200
- image,
201
- },
202
- props.visualArtwork &&
203
- {
204
- "@type": "VisualArtwork",
205
- "@id": `${url}/#visualartwork`,
206
- url,
207
- name: pageTitle,
208
- description: description,
209
- datePublished: createdAt === null || createdAt === void 0 ? void 0 : createdAt.toISOString(),
210
- dateModified: updatedAt === null || updatedAt === void 0 ? void 0 : updatedAt.toISOString(),
211
- isPartOf: { "@id": websiteSchemaId },
212
- thumbnailUrl,
213
- image,
214
- },
215
- props.collection &&
216
- {
217
- "@type": "CollectionPage",
218
- "@id": `${url}/#collectionpage`,
219
- url: url,
220
- name: pageTitle,
221
- description: description,
222
- isPartOf: { "@id": websiteSchemaId },
223
- image,
224
- inLanguage: "ko-KR",
225
- breadcrumb: props.breadcrumbs && props.breadcrumbs.length > 0
226
- ? {
227
- "@id": `${url}/#breadcrumb`,
228
- }
229
- : undefined,
230
- mainEntity: collectionMainEntity,
231
- },
232
- websiteSchema,
233
- props.breadcrumbs &&
234
- props.breadcrumbs.length > 0 &&
235
- {
236
- "@id": breadcrumbSchemaId,
237
- "@type": "BreadcrumbList",
238
- itemListElement: props.breadcrumbs.map((breadcrumb, index) => ({
239
- "@type": "ListItem",
240
- position: index + 1,
241
- name: breadcrumb.label,
242
- item: `${config.origin}${breadcrumb.href}`,
243
- })),
244
- },
245
- ...additionalStructedData,
246
- ...images.map((file) => {
247
- var _a, _b;
248
- return {
249
- "@type": "ImageObject",
250
- "@id": `${url}/#${file.id}`,
251
- url: file.url,
252
- contentUrl: file.url,
253
- name: file.alt,
254
- description: file.alt,
255
- width: (_a = file === null || file === void 0 ? void 0 : file.width) === null || _a === void 0 ? void 0 : _a.toString(),
256
- height: (_b = file === null || file === void 0 ? void 0 : file.height) === null || _b === void 0 ? void 0 : _b.toString(),
257
- creditText: config.copyright,
258
- license: `${config.origin}/terms`,
259
- copyrightNotice: config.copyright,
260
- acquireLicensePage: `${config.origin}/terms`,
261
- };
262
- }),
263
- ].filter(Boolean),
264
- };
265
- }
266
- function generateJSONLD() {
267
- const structedData = getStructedData();
268
- return (React.createElement("script", { type: "application/ld+json", dangerouslySetInnerHTML: {
269
- __html: JSON.stringify(structedData).replace(/</g, "\\u003c"),
270
- } }));
271
- }
272
- return {
273
- config,
274
- props,
275
- meta,
276
- generateJSONLD,
277
- };
278
- },
279
- };
280
- }
@@ -1,12 +0,0 @@
1
- import { type LoaderFn } from "./loader";
2
- import { type JSX } from "react";
3
- import { type SEO } from "./seo";
4
- import React from "react";
5
- export declare function createSEOLoader<T, U extends JSX.IntrinsicAttributes & {
6
- seo: SEO;
7
- }>(fn?: LoaderFn<T, U>): {
8
- meta: (props: T) => Promise<import("react-router").MetaFunction<unknown, Record<string, unknown>>>;
9
- Page(Fc: React.FC<U>): (props: T) => Promise<JSX.Element>;
10
- getData(): U;
11
- wrap<V>(mapper: (props: U) => V | Promise<V>): (props: T) => Promise<V>;
12
- };
@@ -1,13 +0,0 @@
1
- import { createLoader } from "./loader";
2
- import React from "react";
3
- export function createSEOLoader(fn = () => ({})) {
4
- const loader = createLoader(fn);
5
- return Object.assign(Object.assign({}, loader), { meta: loader.wrap((data) => data.seo.meta), Page(Fc) {
6
- return loader.wrap((data) => {
7
- var _a;
8
- return (React.createElement(React.Fragment, null, (_a = data.seo) === null || _a === void 0 ? void 0 :
9
- _a.generateJSONLD(),
10
- React.createElement(Fc, Object.assign({}, data))));
11
- });
12
- } });
13
- }
@@ -1 +0,0 @@
1
- export declare function singleton<T>(name: string, fn: () => T): T;