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
@@ -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,18 +0,0 @@
1
- import { BAD_REQUEST, CREATED, UNAUTHORIZED } from "../../../../http-kit";
2
- export const authRefreshHandler = async (request, { AUTH, }) => {
3
- const refreshToken = request?.headers.get("Authorization")?.replace("Bearer ", "") ||
4
- (await AUTH.getRefreshTokenFromCookies(request));
5
- if (!refreshToken) {
6
- return BAD_REQUEST();
7
- }
8
- try {
9
- const accessToken = await AUTH.refreshAccessToken(refreshToken);
10
- return CREATED({ accessToken });
11
- }
12
- catch (e) {
13
- if (e instanceof Error) {
14
- return UNAUTHORIZED(e.message);
15
- }
16
- throw e;
17
- }
18
- };
@@ -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?.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?.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,34 +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: {
30
- ...headers,
31
- Location: new URL(`/r?redirectUrl=${encodeURIComponent(redirectUrl)}`, request.url).toString(),
32
- },
33
- });
34
- };
@@ -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,275 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- export function configSEO(config) {
3
- return {
4
- config,
5
- async init(props = {}) {
6
- const canonicalPath = props.canonicalPath;
7
- const url = canonicalPath
8
- ? `${config.origin}${canonicalPath}`
9
- : `${config.origin}${props.path || ""}`;
10
- const pageTitle = props.title
11
- ? `${props.title} | ${config.siteName}`
12
- : config.siteName;
13
- const description = props.description || config.description;
14
- const keywords = props.keywords || config.keywords;
15
- const websiteSchemaId = `${config.origin}/#website`;
16
- const websiteSchema = {
17
- "@type": "WebSite",
18
- "@id": websiteSchemaId,
19
- url: config.origin,
20
- name: config.siteName,
21
- alternateName: config.siteName,
22
- description: config.description,
23
- inLanguage: "ko",
24
- };
25
- const thumbnailSchemaId = `${url}/#thumbnail`;
26
- const thumbnail = props.thumbnail ||
27
- (typeof config.thumbnail === "function"
28
- ? await config.thumbnail()
29
- : config.thumbnail);
30
- const thumbnailUrl = thumbnail?.url;
31
- const socialImage = thumbnail
32
- ? [
33
- typeof thumbnail === "string"
34
- ? {
35
- url: thumbnail,
36
- alt: `${props.title} 대표 이미지`,
37
- }
38
- : thumbnail,
39
- ]
40
- : [];
41
- const images = [
42
- ...(thumbnailUrl
43
- ? [
44
- {
45
- id: thumbnailSchemaId,
46
- url: thumbnailUrl,
47
- alt: `${props.title} 대표 이미지`,
48
- },
49
- ]
50
- : []),
51
- ...(props.images || []),
52
- ...(props.collection?.map((portfolio) => portfolio.thumbnail) || []),
53
- ].filter(Boolean);
54
- const image = images
55
- .filter((file) => file.id)
56
- .map((file) => ({
57
- "@type": "ImageObject",
58
- "@id": `${url}/#${file.id}`,
59
- }));
60
- const breadcrumbSchemaId = `${url}#breadcrumb`;
61
- const updatedAt = props.updatedAt;
62
- const createdAt = props.createdAt;
63
- const meta = () => {
64
- return [
65
- { title: pageTitle },
66
- { name: "description", content: description },
67
- { name: "keywords", content: keywords?.join(", ") || "" },
68
- {
69
- tagName: "link",
70
- rel: "canonical",
71
- href: url,
72
- },
73
- { property: "og:type", content: props.type || "website" },
74
- { property: "og:title", content: pageTitle },
75
- { property: "og:description", content: description },
76
- { property: "og:url", content: url },
77
- { property: "og:site_name", content: config.siteName },
78
- ...socialImage.map((file) => ({
79
- property: "og:image",
80
- content: file.url,
81
- })),
82
- {
83
- property: "twitter:card",
84
- content: socialImage.length > 0 ? "summary_large_image" : "summary",
85
- },
86
- { property: "twitter:title", content: pageTitle },
87
- { property: "twitter:description", content: description },
88
- ...socialImage.map((file) => ({
89
- property: "twitter:image",
90
- content: file.url,
91
- })),
92
- ];
93
- };
94
- const additionalStructedData = [
95
- ...(typeof props.structedData === "function"
96
- ? await props.structedData()
97
- : props.structedData || []),
98
- ...(typeof config.structedData === "function"
99
- ? await config.structedData()
100
- : config.structedData || []),
101
- ];
102
- function getStructedData() {
103
- const collectionMainEntity = props.collection
104
- ? {
105
- "@type": "ItemList",
106
- numberOfItems: props.collection.length,
107
- itemListElement: props.collection.map((item, index) => ({
108
- "@type": "ListItem",
109
- position: index + 1,
110
- url: item.url,
111
- item: {
112
- "@type": "WebPage",
113
- "@id": `${item.url}#webpage`,
114
- url: item.url,
115
- name: item.title,
116
- thumbnailUrl: item.thumbnail?.url,
117
- dateModified: item.updatedAt?.toISOString(),
118
- dateCreated: item.createdAt?.toISOString(),
119
- datePublished: item.createdAt?.toISOString(),
120
- },
121
- })),
122
- }
123
- : undefined;
124
- return {
125
- "@context": "https://schema.org",
126
- "@graph": [
127
- {
128
- "@type": "WebPage",
129
- "@id": `${url}#webpage`,
130
- url,
131
- name: pageTitle,
132
- description,
133
- keywords: keywords,
134
- dateModified: updatedAt?.toISOString(),
135
- datePublished: createdAt?.toISOString(),
136
- dateCreated: createdAt?.toISOString(),
137
- primaryImageOfPage: thumbnail
138
- ? {
139
- "@id": thumbnailSchemaId,
140
- }
141
- : undefined,
142
- isPartOf: {
143
- "@id": websiteSchemaId,
144
- },
145
- inLanguage: "ko",
146
- breadcrumb: props.breadcrumbs && props.breadcrumbs.length > 0
147
- ? {
148
- "@id": breadcrumbSchemaId,
149
- }
150
- : undefined,
151
- image,
152
- mainEntity: collectionMainEntity,
153
- },
154
- props.article &&
155
- {
156
- "@type": "Article",
157
- "@id": `${url}#article`,
158
- url,
159
- name: pageTitle,
160
- description,
161
- keywords: keywords,
162
- headline: pageTitle,
163
- dateModified: updatedAt?.toISOString(),
164
- datePublished: createdAt?.toISOString(),
165
- dateCreated: createdAt?.toISOString(),
166
- isPartOf: {
167
- "@id": websiteSchemaId,
168
- },
169
- inLanguage: "ko",
170
- image,
171
- },
172
- props.blogPosting &&
173
- {
174
- "@type": "BlogPosting",
175
- "@id": `${url}/#blogposting`,
176
- url,
177
- headline: pageTitle,
178
- description: description,
179
- thumbnailUrl,
180
- datePublished: createdAt?.toISOString(),
181
- dateModified: updatedAt?.toISOString(),
182
- isPartOf: { "@id": websiteSchemaId },
183
- image,
184
- },
185
- props.creativeWork &&
186
- {
187
- "@type": "CreativeWork",
188
- "@id": `${url}/#creativework`,
189
- url,
190
- name: pageTitle,
191
- description: description,
192
- datePublished: createdAt?.toISOString(),
193
- dateModified: updatedAt?.toISOString(),
194
- isPartOf: { "@id": websiteSchemaId },
195
- thumbnailUrl,
196
- image,
197
- },
198
- props.visualArtwork &&
199
- {
200
- "@type": "VisualArtwork",
201
- "@id": `${url}/#visualartwork`,
202
- url,
203
- name: pageTitle,
204
- description: description,
205
- datePublished: createdAt?.toISOString(),
206
- dateModified: updatedAt?.toISOString(),
207
- isPartOf: { "@id": websiteSchemaId },
208
- thumbnailUrl,
209
- image,
210
- },
211
- props.collection &&
212
- {
213
- "@type": "CollectionPage",
214
- "@id": `${url}/#collectionpage`,
215
- url: url,
216
- name: pageTitle,
217
- description: description,
218
- isPartOf: { "@id": websiteSchemaId },
219
- image,
220
- inLanguage: "ko-KR",
221
- breadcrumb: props.breadcrumbs && props.breadcrumbs.length > 0
222
- ? {
223
- "@id": `${url}/#breadcrumb`,
224
- }
225
- : undefined,
226
- mainEntity: collectionMainEntity,
227
- },
228
- websiteSchema,
229
- props.breadcrumbs &&
230
- props.breadcrumbs.length > 0 &&
231
- {
232
- "@id": breadcrumbSchemaId,
233
- "@type": "BreadcrumbList",
234
- itemListElement: props.breadcrumbs.map((breadcrumb, index) => ({
235
- "@type": "ListItem",
236
- position: index + 1,
237
- name: breadcrumb.label,
238
- item: `${config.origin}${breadcrumb.href}`,
239
- })),
240
- },
241
- ...additionalStructedData,
242
- ...images.map((file) => {
243
- return {
244
- "@type": "ImageObject",
245
- "@id": `${url}/#${file.id}`,
246
- url: file.url,
247
- contentUrl: file.url,
248
- name: file.alt,
249
- description: file.alt,
250
- width: file?.width?.toString(),
251
- height: file?.height?.toString(),
252
- creditText: config.copyright,
253
- license: `${config.origin}/terms`,
254
- copyrightNotice: config.copyright,
255
- acquireLicensePage: `${config.origin}/terms`,
256
- };
257
- }),
258
- ].filter(Boolean),
259
- };
260
- }
261
- function generateJSONLD() {
262
- const structedData = getStructedData();
263
- return (_jsx("script", { type: "application/ld+json", dangerouslySetInnerHTML: {
264
- __html: JSON.stringify(structedData).replace(/</g, "\\u003c"),
265
- } }));
266
- }
267
- return {
268
- config,
269
- props,
270
- meta,
271
- generateJSONLD,
272
- };
273
- },
274
- };
275
- }
@@ -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<import("react/jsx-runtime").JSX.Element>;
10
- getData(): U;
11
- wrap<V>(mapper: (props: U) => V | Promise<V>): (props: T) => Promise<V>;
12
- };
@@ -1,12 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { createLoader } from "./loader";
3
- export function createSEOLoader(fn = () => ({})) {
4
- const loader = createLoader(fn);
5
- return {
6
- ...loader,
7
- meta: loader.wrap((data) => data.seo.meta),
8
- Page(Fc) {
9
- return loader.wrap((data) => (_jsxs(_Fragment, { children: [data.seo?.generateJSONLD(), _jsx(Fc, { ...data })] })));
10
- },
11
- };
12
- }
@@ -1 +0,0 @@
1
- export declare function singleton<T>(name: string, fn: () => T): T;
@@ -1,9 +0,0 @@
1
- export function singleton(name, fn) {
2
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3
- const globalAny = globalThis;
4
- globalAny.__singletons = globalAny.__singletons || {};
5
- if (!globalAny.__singletons[name]) {
6
- globalAny.__singletons[name] = fn();
7
- }
8
- return globalAny.__singletons[name];
9
- }
@@ -1 +0,0 @@
1
- export declare const toSlug: (str: string) => string;
package/dist/esm/slug.js DELETED
@@ -1,6 +0,0 @@
1
- export const toSlug = (str) => {
2
- return str
3
- .toLowerCase()
4
- .replace(/[^a-zA-Z0-9가-힣ㄱ-ㅎㅏ-ㅣ]+/g, "-")
5
- .replace(/^-|-$/g, "");
6
- };