dn-react-router-toolkit 0.1.12 → 0.2.1

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 (195) hide show
  1. package/dist/auth/apple_auth.d.mts +38 -0
  2. package/dist/auth/apple_auth.d.ts +38 -0
  3. package/dist/{auth-kit → auth}/apple_auth.js +31 -18
  4. package/dist/auth/apple_auth.mjs +63 -0
  5. package/dist/{auth-kit/repository.d.mts → auth/auth_repository.d.mts} +10 -11
  6. package/dist/{auth-kit/repository.d.ts → auth/auth_repository.d.ts} +10 -11
  7. package/dist/{file-kit/repository.js → auth/auth_repository.js} +3 -3
  8. package/dist/{auth-kit → auth}/auth_service.d.mts +12 -23
  9. package/dist/{auth-kit → auth}/auth_service.d.ts +12 -23
  10. package/dist/{auth-kit → auth}/auth_service.js +24 -77
  11. package/dist/{auth-kit → auth}/auth_service.mjs +24 -77
  12. package/dist/auth/client/google_login_button.d.mts +7 -0
  13. package/dist/auth/client/google_login_button.d.ts +7 -0
  14. package/dist/{auth-kit → auth}/client/google_login_button.js +24 -19
  15. package/dist/auth/client/google_login_button.mjs +37 -0
  16. package/dist/auth/client/provider.d.mts +26 -0
  17. package/dist/auth/client/provider.d.ts +26 -0
  18. package/dist/auth/client/provider.js +152 -0
  19. package/dist/auth/client/provider.mjs +116 -0
  20. package/dist/{auth-kit → auth}/client/redirect_page.js +1 -1
  21. package/dist/{auth-kit → auth}/client/redirect_page.mjs +1 -1
  22. package/dist/auth/google_auth.d.mts +33 -0
  23. package/dist/auth/google_auth.d.ts +33 -0
  24. package/dist/{auth-kit → auth}/google_auth.js +23 -32
  25. package/dist/{auth-kit → auth}/google_auth.mjs +22 -31
  26. package/dist/auth/handlers/find_auth.d.mts +13 -0
  27. package/dist/auth/handlers/find_auth.d.ts +13 -0
  28. package/dist/{route/api/auth/route.js → auth/handlers/find_auth.js} +10 -10
  29. package/dist/{route/api/auth/route.mjs → auth/handlers/find_auth.mjs} +5 -5
  30. package/dist/auth/handlers/login.d.mts +13 -0
  31. package/dist/auth/handlers/login.d.ts +13 -0
  32. package/dist/{route/api/auth/login/route.js → auth/handlers/login.js} +17 -17
  33. package/dist/{route/api/auth/login/route.mjs → auth/handlers/login.mjs} +12 -12
  34. package/dist/auth/handlers/login_with_thirdparty.d.mts +15 -0
  35. package/dist/auth/handlers/login_with_thirdparty.d.ts +15 -0
  36. package/dist/{route/api/auth/login/[provider]/route.js → auth/handlers/login_with_thirdparty.js} +12 -27
  37. package/dist/{route/api/auth/login/[provider]/route.mjs → auth/handlers/login_with_thirdparty.mjs} +7 -22
  38. package/dist/auth/handlers/logout.d.mts +13 -0
  39. package/dist/auth/handlers/logout.d.ts +13 -0
  40. package/dist/{route/api/auth/logout/route.js → auth/handlers/logout.js} +15 -11
  41. package/dist/{route/api/auth/logout/route.mjs → auth/handlers/logout.mjs} +11 -7
  42. package/dist/auth/handlers/refresh.d.mts +13 -0
  43. package/dist/auth/handlers/refresh.d.ts +13 -0
  44. package/dist/{route/api/auth/refresh/route.js → auth/handlers/refresh.js} +12 -12
  45. package/dist/{route/api/auth/refresh/route.mjs → auth/handlers/refresh.mjs} +7 -7
  46. package/dist/auth/handlers/request_password_reset.d.mts +10 -0
  47. package/dist/auth/handlers/request_password_reset.d.ts +10 -0
  48. package/dist/auth/handlers/request_password_reset.js +87 -0
  49. package/dist/auth/handlers/request_password_reset.mjs +60 -0
  50. package/dist/auth/handlers/reset_password.d.mts +10 -0
  51. package/dist/auth/handlers/reset_password.d.ts +10 -0
  52. package/dist/auth/handlers/reset_password.js +88 -0
  53. package/dist/auth/handlers/reset_password.mjs +61 -0
  54. package/dist/auth/handlers/signup.d.mts +15 -0
  55. package/dist/auth/handlers/signup.d.ts +15 -0
  56. package/dist/auth/handlers/signup.js +147 -0
  57. package/dist/auth/handlers/signup.mjs +112 -0
  58. package/dist/auth/handlers/signup_with_thirdparty.d.mts +17 -0
  59. package/dist/auth/handlers/signup_with_thirdparty.d.ts +17 -0
  60. package/dist/auth/handlers/signup_with_thirdparty.js +123 -0
  61. package/dist/auth/handlers/signup_with_thirdparty.mjs +98 -0
  62. package/dist/auth/handlers/thirdparty_auth_callback.d.mts +16 -0
  63. package/dist/auth/handlers/thirdparty_auth_callback.d.ts +16 -0
  64. package/dist/{route/auth/callback/[provider]/route.js → auth/handlers/thirdparty_auth_callback.js} +54 -45
  65. package/dist/{route/auth/callback/[provider]/route.mjs → auth/handlers/thirdparty_auth_callback.mjs} +49 -40
  66. package/dist/{auth-kit/jwt.d.mts → auth/jwt_manager.d.mts} +11 -1
  67. package/dist/{auth-kit/jwt.d.ts → auth/jwt_manager.d.ts} +11 -1
  68. package/dist/{auth-kit/jwt.js → auth/jwt_manager.js} +25 -11
  69. package/dist/{auth-kit/jwt.mjs → auth/jwt_manager.mjs} +22 -8
  70. package/dist/auth/kakao_auth.d.mts +27 -0
  71. package/dist/auth/kakao_auth.d.ts +27 -0
  72. package/dist/auth/kakao_auth.js +56 -0
  73. package/dist/auth/kakao_auth.mjs +31 -0
  74. package/dist/auth/password_recovery.d.mts +34 -0
  75. package/dist/auth/password_recovery.d.ts +34 -0
  76. package/dist/auth/password_recovery.js +169 -0
  77. package/dist/auth/password_recovery.mjs +134 -0
  78. package/dist/auth/thirdparty_auth.d.mts +41 -0
  79. package/dist/auth/thirdparty_auth.d.ts +41 -0
  80. package/dist/{auth-kit/kakao_auth.js → auth/thirdparty_auth.js} +31 -33
  81. package/dist/{auth-kit/kakao_auth.mjs → auth/thirdparty_auth.mjs} +26 -28
  82. package/dist/{auth-kit → auth}/with_auth.d.mts +5 -6
  83. package/dist/{auth-kit → auth}/with_auth.d.ts +5 -6
  84. package/dist/{auth-kit → auth}/with_auth.js +26 -10
  85. package/dist/auth/with_auth.mjs +63 -0
  86. package/dist/date.d.mts +2 -0
  87. package/dist/date.d.ts +2 -0
  88. package/dist/date.js +4 -2
  89. package/dist/date.mjs +2 -1
  90. package/dist/{file-kit → file}/cdn.js +1 -1
  91. package/dist/{file-kit → file}/cdn.mjs +1 -1
  92. package/dist/{file-kit → file}/client/drop_file_input.js +3 -3
  93. package/dist/{file-kit → file}/client/drop_file_input.mjs +3 -3
  94. package/dist/{file-kit → file}/client/file_upload_button.js +1 -1
  95. package/dist/{file-kit → file}/client/file_upload_button.mjs +1 -1
  96. package/dist/{file-kit → file}/client/file_uploader.js +3 -3
  97. package/dist/{file-kit → file}/client/file_uploader.mjs +2 -2
  98. package/dist/{file-kit → file}/client/format_size.js +1 -1
  99. package/dist/{file-kit → file}/client/format_size.mjs +1 -1
  100. package/dist/{file-kit → file}/client/metadata.js +1 -1
  101. package/dist/{file-kit → file}/client/metadata.mjs +1 -1
  102. package/dist/{file-kit/repository.d.mts → file/file_repository.d.mts} +4 -4
  103. package/dist/{file-kit/repository.d.ts → file/file_repository.d.ts} +4 -4
  104. package/dist/{auth-kit/repository.js → file/file_repository.js} +3 -3
  105. package/dist/file/file_service.d.mts +32 -0
  106. package/dist/file/file_service.d.ts +32 -0
  107. package/dist/{file-kit → file}/file_service.js +27 -21
  108. package/dist/file/file_service.mjs +41 -0
  109. package/dist/file/handlers/delete_file.d.mts +17 -0
  110. package/dist/file/handlers/delete_file.d.ts +17 -0
  111. package/dist/{route/api/files/[fileId]/route.js → file/handlers/delete_file.js} +15 -15
  112. package/dist/{route/api/files/[fileId]/route.mjs → file/handlers/delete_file.mjs} +10 -10
  113. package/dist/file/handlers/upload_file.d.mts +16 -0
  114. package/dist/file/handlers/upload_file.d.ts +16 -0
  115. package/dist/{route/api/files/route.js → file/handlers/upload_file.js} +13 -13
  116. package/dist/{route/api/files/route.mjs → file/handlers/upload_file.mjs} +8 -8
  117. package/dist/{file-kit → file}/object_storage.d.mts +3 -1
  118. package/dist/{file-kit → file}/object_storage.d.ts +3 -1
  119. package/dist/{file-kit → file}/object_storage.js +2 -2
  120. package/dist/{file-kit → file}/object_storage.mjs +2 -2
  121. package/dist/{file-kit → file}/responsive_image.d.mts +4 -4
  122. package/dist/{file-kit → file}/responsive_image.d.ts +4 -4
  123. package/dist/{file-kit → file}/responsive_image.js +18 -9
  124. package/dist/{file-kit → file}/responsive_image.mjs +18 -9
  125. package/dist/{http-kit → http}/index.js +5 -5
  126. package/dist/{http-kit → http}/index.mjs +1 -1
  127. package/dist/{http-kit → http}/response.js +1 -1
  128. package/dist/{http-kit → http}/response.mjs +1 -1
  129. package/dist/index.d.mts +1 -0
  130. package/dist/index.d.ts +1 -0
  131. package/dist/index.js +2 -0
  132. package/dist/index.mjs +1 -0
  133. package/dist/route/api.d.mts +17 -25
  134. package/dist/route/api.d.ts +17 -25
  135. package/dist/route/api.js +367 -178
  136. package/dist/route/api.mjs +356 -177
  137. package/dist/{seo-kit → seo}/seo.js +1 -1
  138. package/dist/{seo-kit → seo}/seo.mjs +1 -1
  139. package/package.json +76 -74
  140. package/dist/auth-kit/apple_auth.d.mts +0 -24
  141. package/dist/auth-kit/apple_auth.d.ts +0 -24
  142. package/dist/auth-kit/apple_auth.mjs +0 -50
  143. package/dist/auth-kit/client/google_login_button.d.mts +0 -9
  144. package/dist/auth-kit/client/google_login_button.d.ts +0 -9
  145. package/dist/auth-kit/client/google_login_button.mjs +0 -32
  146. package/dist/auth-kit/client/logout.d.mts +0 -3
  147. package/dist/auth-kit/client/logout.d.ts +0 -3
  148. package/dist/auth-kit/client/logout.js +0 -49
  149. package/dist/auth-kit/client/logout.mjs +0 -24
  150. package/dist/auth-kit/google_auth.d.mts +0 -27
  151. package/dist/auth-kit/google_auth.d.ts +0 -27
  152. package/dist/auth-kit/kakao_auth.d.mts +0 -24
  153. package/dist/auth-kit/kakao_auth.d.ts +0 -24
  154. package/dist/auth-kit/with_auth.mjs +0 -47
  155. package/dist/file-kit/file_service.d.mts +0 -26
  156. package/dist/file-kit/file_service.d.ts +0 -26
  157. package/dist/file-kit/file_service.mjs +0 -35
  158. package/dist/route/api/auth/login/_provider_/route.d.mts +0 -20
  159. package/dist/route/api/auth/login/_provider_/route.d.ts +0 -20
  160. package/dist/route/api/auth/login/route.d.mts +0 -14
  161. package/dist/route/api/auth/login/route.d.ts +0 -14
  162. package/dist/route/api/auth/logout/route.d.mts +0 -14
  163. package/dist/route/api/auth/logout/route.d.ts +0 -14
  164. package/dist/route/api/auth/refresh/route.d.mts +0 -13
  165. package/dist/route/api/auth/refresh/route.d.ts +0 -13
  166. package/dist/route/api/auth/route.d.mts +0 -13
  167. package/dist/route/api/auth/route.d.ts +0 -13
  168. package/dist/route/api/files/_fileId_/route.d.mts +0 -17
  169. package/dist/route/api/files/_fileId_/route.d.ts +0 -17
  170. package/dist/route/api/files/route.d.mts +0 -16
  171. package/dist/route/api/files/route.d.ts +0 -16
  172. package/dist/route/auth/callback/_provider_/route.d.mts +0 -20
  173. package/dist/route/auth/callback/_provider_/route.d.ts +0 -20
  174. /package/dist/{auth-kit/repository.mjs → auth/auth_repository.mjs} +0 -0
  175. /package/dist/{auth-kit → auth}/client/redirect_page.d.mts +0 -0
  176. /package/dist/{auth-kit → auth}/client/redirect_page.d.ts +0 -0
  177. /package/dist/{file-kit → file}/cdn.d.mts +0 -0
  178. /package/dist/{file-kit → file}/cdn.d.ts +0 -0
  179. /package/dist/{file-kit → file}/client/drop_file_input.d.mts +0 -0
  180. /package/dist/{file-kit → file}/client/drop_file_input.d.ts +0 -0
  181. /package/dist/{file-kit → file}/client/file_upload_button.d.mts +0 -0
  182. /package/dist/{file-kit → file}/client/file_upload_button.d.ts +0 -0
  183. /package/dist/{file-kit → file}/client/file_uploader.d.mts +0 -0
  184. /package/dist/{file-kit → file}/client/file_uploader.d.ts +0 -0
  185. /package/dist/{file-kit → file}/client/format_size.d.mts +0 -0
  186. /package/dist/{file-kit → file}/client/format_size.d.ts +0 -0
  187. /package/dist/{file-kit → file}/client/metadata.d.mts +0 -0
  188. /package/dist/{file-kit → file}/client/metadata.d.ts +0 -0
  189. /package/dist/{file-kit/repository.mjs → file/file_repository.mjs} +0 -0
  190. /package/dist/{http-kit → http}/index.d.mts +0 -0
  191. /package/dist/{http-kit → http}/index.d.ts +0 -0
  192. /package/dist/{http-kit → http}/response.d.mts +0 -0
  193. /package/dist/{http-kit → http}/response.d.ts +0 -0
  194. /package/dist/{seo-kit → seo}/seo.d.mts +0 -0
  195. /package/dist/{seo-kit → seo}/seo.d.ts +0 -0
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/auth/handlers/signup.ts
31
+ var signup_exports = {};
32
+ __export(signup_exports, {
33
+ signupHandler: () => signupHandler
34
+ });
35
+ module.exports = __toCommonJS(signup_exports);
36
+ var import_uuid = require("uuid");
37
+ var bcrypt = __toESM(require("bcryptjs"));
38
+
39
+ // src/http/response.ts
40
+ var createJsonResponse = (status) => {
41
+ return (data = {}, init) => {
42
+ return Response.json(data, { status, ...init });
43
+ };
44
+ };
45
+ var OK = createJsonResponse(200);
46
+ var CREATED = createJsonResponse(201);
47
+ var ACCEPTED = createJsonResponse(202);
48
+ var createException = (status, defaultMessage = "\uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.") => {
49
+ return (message = defaultMessage, init) => {
50
+ return createJsonResponse(status)({ message }, init);
51
+ };
52
+ };
53
+ var BAD_REQUEST = createException(400, "\uC694\uCCAD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.");
54
+ var UNAUTHORIZED = createException(401, "\uC778\uC99D\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.");
55
+ var FORBIDDEN = createException(403, "\uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.");
56
+ var NOT_FOUND = createException(
57
+ 404,
58
+ "\uC694\uCCAD\uD55C \uB9AC\uC18C\uC2A4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
59
+ );
60
+ var METHOD_NOT_ALLOWED = createException(
61
+ 405,
62
+ "\uBA54\uC11C\uB4DC\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
63
+ );
64
+ var NOT_ACCEPTABLE = createException(
65
+ 406,
66
+ "\uC694\uCCAD\uD55C \uD615\uC2DD\uC744 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
67
+ );
68
+ var REQUEST_TIMEOUT = createException(
69
+ 408,
70
+ "\uC694\uCCAD \uC2DC\uAC04\uC774 \uCD08\uACFC\uB418\uC5C8\uC2B5\uB2C8\uB2E4."
71
+ );
72
+ var CONFLICT = createException(409, "\uC694\uCCAD\uC774 \uCDA9\uB3CC\uD588\uC2B5\uB2C8\uB2E4.");
73
+ var UNPROCESSABLE_ENTITY = createException(
74
+ 422,
75
+ "\uCC98\uB9AC\uD560 \uC218 \uC5C6\uB294 \uC5D4\uD2F0\uD2F0\uC785\uB2C8\uB2E4."
76
+ );
77
+ var TOO_MANY_REQUESTS = createException(429, "\uC694\uCCAD\uC774 \uB108\uBB34 \uB9CE\uC2B5\uB2C8\uB2E4.");
78
+ var INTERNAL_SERVER_ERROR = createException(
79
+ 500,
80
+ "\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
81
+ );
82
+
83
+ // src/auth/handlers/signup.ts
84
+ var signupHandler = async (request, {
85
+ authService,
86
+ fileRepository
87
+ }) => {
88
+ const body = await request.json();
89
+ const {
90
+ email,
91
+ password,
92
+ passwordConfirm,
93
+ name,
94
+ profileImageId
95
+ } = body;
96
+ if (!email) {
97
+ return BAD_REQUEST("\uC774\uBA54\uC77C\uC744 \uC785\uB825\uD574\uC8FC\uC138\uC694.");
98
+ }
99
+ if (!password) {
100
+ return BAD_REQUEST("\uBE44\uBC00\uBC88\uD638\uB97C \uC785\uB825\uD574\uC8FC\uC138\uC694.");
101
+ }
102
+ if (!passwordConfirm) {
103
+ return BAD_REQUEST("\uBE44\uBC00\uBC88\uD638 \uD655\uC778\uC744 \uC785\uB825\uD574\uC8FC\uC138\uC694.");
104
+ }
105
+ const existing = await authService.authRepository.findCredentialById(email);
106
+ if (existing) {
107
+ return CONFLICT("\uC774\uBBF8 \uAC00\uC785\uD55C \uC774\uBA54\uC77C\uC785\uB2C8\uB2E4.");
108
+ }
109
+ if (password !== passwordConfirm) {
110
+ return BAD_REQUEST("\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.");
111
+ }
112
+ const profileImage = profileImageId ? await fileRepository.findFileById(profileImageId) : void 0;
113
+ const userId = (0, import_uuid.v5)(email, import_uuid.v5.DNS);
114
+ const user = await authService.authRepository.createUser({
115
+ id: userId,
116
+ name,
117
+ role: "user",
118
+ email,
119
+ profileImage
120
+ });
121
+ await authService.authRepository.createCredential({
122
+ id: email,
123
+ userId,
124
+ password: bcrypt.hashSync(password, 10)
125
+ });
126
+ const { accessToken, refreshToken } = await authService.issueTokenPair(user);
127
+ const searchParams = new URL(request.url).searchParams;
128
+ const type = searchParams.get("type");
129
+ if (type === "json") {
130
+ return CREATED({ accessToken, refreshToken });
131
+ }
132
+ const [accessTokenSetCookie, refreshTokenSetCookie] = await Promise.all([
133
+ authService.getAccessTokenSetCookie(accessToken),
134
+ authService.getRefreshTokenSetCookie(refreshToken)
135
+ ]);
136
+ const payload = authService.jwtManager.decode(accessToken);
137
+ const headers = new Headers();
138
+ headers.append("Set-Cookie", accessTokenSetCookie);
139
+ headers.append("Set-Cookie", refreshTokenSetCookie);
140
+ return CREATED(payload, {
141
+ headers
142
+ });
143
+ };
144
+ // Annotate the CommonJS export names for ESM import in node:
145
+ 0 && (module.exports = {
146
+ signupHandler
147
+ });
@@ -0,0 +1,112 @@
1
+ // src/auth/handlers/signup.ts
2
+ import { v5 } from "uuid";
3
+ import * as bcrypt from "bcryptjs";
4
+
5
+ // src/http/response.ts
6
+ var createJsonResponse = (status) => {
7
+ return (data = {}, init) => {
8
+ return Response.json(data, { status, ...init });
9
+ };
10
+ };
11
+ var OK = createJsonResponse(200);
12
+ var CREATED = createJsonResponse(201);
13
+ var ACCEPTED = createJsonResponse(202);
14
+ var createException = (status, defaultMessage = "\uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.") => {
15
+ return (message = defaultMessage, init) => {
16
+ return createJsonResponse(status)({ message }, init);
17
+ };
18
+ };
19
+ var BAD_REQUEST = createException(400, "\uC694\uCCAD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.");
20
+ var UNAUTHORIZED = createException(401, "\uC778\uC99D\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.");
21
+ var FORBIDDEN = createException(403, "\uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.");
22
+ var NOT_FOUND = createException(
23
+ 404,
24
+ "\uC694\uCCAD\uD55C \uB9AC\uC18C\uC2A4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
25
+ );
26
+ var METHOD_NOT_ALLOWED = createException(
27
+ 405,
28
+ "\uBA54\uC11C\uB4DC\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
29
+ );
30
+ var NOT_ACCEPTABLE = createException(
31
+ 406,
32
+ "\uC694\uCCAD\uD55C \uD615\uC2DD\uC744 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
33
+ );
34
+ var REQUEST_TIMEOUT = createException(
35
+ 408,
36
+ "\uC694\uCCAD \uC2DC\uAC04\uC774 \uCD08\uACFC\uB418\uC5C8\uC2B5\uB2C8\uB2E4."
37
+ );
38
+ var CONFLICT = createException(409, "\uC694\uCCAD\uC774 \uCDA9\uB3CC\uD588\uC2B5\uB2C8\uB2E4.");
39
+ var UNPROCESSABLE_ENTITY = createException(
40
+ 422,
41
+ "\uCC98\uB9AC\uD560 \uC218 \uC5C6\uB294 \uC5D4\uD2F0\uD2F0\uC785\uB2C8\uB2E4."
42
+ );
43
+ var TOO_MANY_REQUESTS = createException(429, "\uC694\uCCAD\uC774 \uB108\uBB34 \uB9CE\uC2B5\uB2C8\uB2E4.");
44
+ var INTERNAL_SERVER_ERROR = createException(
45
+ 500,
46
+ "\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
47
+ );
48
+
49
+ // src/auth/handlers/signup.ts
50
+ var signupHandler = async (request, {
51
+ authService,
52
+ fileRepository
53
+ }) => {
54
+ const body = await request.json();
55
+ const {
56
+ email,
57
+ password,
58
+ passwordConfirm,
59
+ name,
60
+ profileImageId
61
+ } = body;
62
+ if (!email) {
63
+ return BAD_REQUEST("\uC774\uBA54\uC77C\uC744 \uC785\uB825\uD574\uC8FC\uC138\uC694.");
64
+ }
65
+ if (!password) {
66
+ return BAD_REQUEST("\uBE44\uBC00\uBC88\uD638\uB97C \uC785\uB825\uD574\uC8FC\uC138\uC694.");
67
+ }
68
+ if (!passwordConfirm) {
69
+ return BAD_REQUEST("\uBE44\uBC00\uBC88\uD638 \uD655\uC778\uC744 \uC785\uB825\uD574\uC8FC\uC138\uC694.");
70
+ }
71
+ const existing = await authService.authRepository.findCredentialById(email);
72
+ if (existing) {
73
+ return CONFLICT("\uC774\uBBF8 \uAC00\uC785\uD55C \uC774\uBA54\uC77C\uC785\uB2C8\uB2E4.");
74
+ }
75
+ if (password !== passwordConfirm) {
76
+ return BAD_REQUEST("\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.");
77
+ }
78
+ const profileImage = profileImageId ? await fileRepository.findFileById(profileImageId) : void 0;
79
+ const userId = v5(email, v5.DNS);
80
+ const user = await authService.authRepository.createUser({
81
+ id: userId,
82
+ name,
83
+ role: "user",
84
+ email,
85
+ profileImage
86
+ });
87
+ await authService.authRepository.createCredential({
88
+ id: email,
89
+ userId,
90
+ password: bcrypt.hashSync(password, 10)
91
+ });
92
+ const { accessToken, refreshToken } = await authService.issueTokenPair(user);
93
+ const searchParams = new URL(request.url).searchParams;
94
+ const type = searchParams.get("type");
95
+ if (type === "json") {
96
+ return CREATED({ accessToken, refreshToken });
97
+ }
98
+ const [accessTokenSetCookie, refreshTokenSetCookie] = await Promise.all([
99
+ authService.getAccessTokenSetCookie(accessToken),
100
+ authService.getRefreshTokenSetCookie(refreshToken)
101
+ ]);
102
+ const payload = authService.jwtManager.decode(accessToken);
103
+ const headers = new Headers();
104
+ headers.append("Set-Cookie", accessTokenSetCookie);
105
+ headers.append("Set-Cookie", refreshTokenSetCookie);
106
+ return CREATED(payload, {
107
+ headers
108
+ });
109
+ };
110
+ export {
111
+ signupHandler
112
+ };
@@ -0,0 +1,17 @@
1
+ import { AuthService } from '../auth_service.mjs';
2
+ import { FileService } from '../../file/file_service.mjs';
3
+ import 'jose';
4
+ import 'react-router';
5
+ import '../jwt_manager.mjs';
6
+ import '../../file/object_storage.mjs';
7
+ import '@aws-sdk/client-s3';
8
+ import '../auth_repository.mjs';
9
+ import '../../file/file_repository.mjs';
10
+
11
+ declare const signUpWithThirdpartyHandler: <TFile>(request: Request, { authService, fileService, signupTokenSecret, }: {
12
+ authService: AuthService<TFile>;
13
+ fileService: FileService<TFile>;
14
+ signupTokenSecret: string;
15
+ }) => Promise<Response>;
16
+
17
+ export { signUpWithThirdpartyHandler };
@@ -0,0 +1,17 @@
1
+ import { AuthService } from '../auth_service.js';
2
+ import { FileService } from '../../file/file_service.js';
3
+ import 'jose';
4
+ import 'react-router';
5
+ import '../jwt_manager.js';
6
+ import '../../file/object_storage.js';
7
+ import '@aws-sdk/client-s3';
8
+ import '../auth_repository.js';
9
+ import '../../file/file_repository.js';
10
+
11
+ declare const signUpWithThirdpartyHandler: <TFile>(request: Request, { authService, fileService, signupTokenSecret, }: {
12
+ authService: AuthService<TFile>;
13
+ fileService: FileService<TFile>;
14
+ signupTokenSecret: string;
15
+ }) => Promise<Response>;
16
+
17
+ export { signUpWithThirdpartyHandler };
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/auth/handlers/signup_with_thirdparty.ts
21
+ var signup_with_thirdparty_exports = {};
22
+ __export(signup_with_thirdparty_exports, {
23
+ signUpWithThirdpartyHandler: () => signUpWithThirdpartyHandler
24
+ });
25
+ module.exports = __toCommonJS(signup_with_thirdparty_exports);
26
+ var import_uuid = require("uuid");
27
+
28
+ // src/http/response.ts
29
+ var createJsonResponse = (status) => {
30
+ return (data = {}, init) => {
31
+ return Response.json(data, { status, ...init });
32
+ };
33
+ };
34
+ var OK = createJsonResponse(200);
35
+ var CREATED = createJsonResponse(201);
36
+ var ACCEPTED = createJsonResponse(202);
37
+ var createException = (status, defaultMessage = "\uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.") => {
38
+ return (message = defaultMessage, init) => {
39
+ return createJsonResponse(status)({ message }, init);
40
+ };
41
+ };
42
+ var BAD_REQUEST = createException(400, "\uC694\uCCAD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.");
43
+ var UNAUTHORIZED = createException(401, "\uC778\uC99D\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.");
44
+ var FORBIDDEN = createException(403, "\uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.");
45
+ var NOT_FOUND = createException(
46
+ 404,
47
+ "\uC694\uCCAD\uD55C \uB9AC\uC18C\uC2A4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
48
+ );
49
+ var METHOD_NOT_ALLOWED = createException(
50
+ 405,
51
+ "\uBA54\uC11C\uB4DC\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
52
+ );
53
+ var NOT_ACCEPTABLE = createException(
54
+ 406,
55
+ "\uC694\uCCAD\uD55C \uD615\uC2DD\uC744 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
56
+ );
57
+ var REQUEST_TIMEOUT = createException(
58
+ 408,
59
+ "\uC694\uCCAD \uC2DC\uAC04\uC774 \uCD08\uACFC\uB418\uC5C8\uC2B5\uB2C8\uB2E4."
60
+ );
61
+ var CONFLICT = createException(409, "\uC694\uCCAD\uC774 \uCDA9\uB3CC\uD588\uC2B5\uB2C8\uB2E4.");
62
+ var UNPROCESSABLE_ENTITY = createException(
63
+ 422,
64
+ "\uCC98\uB9AC\uD560 \uC218 \uC5C6\uB294 \uC5D4\uD2F0\uD2F0\uC785\uB2C8\uB2E4."
65
+ );
66
+ var TOO_MANY_REQUESTS = createException(429, "\uC694\uCCAD\uC774 \uB108\uBB34 \uB9CE\uC2B5\uB2C8\uB2E4.");
67
+ var INTERNAL_SERVER_ERROR = createException(
68
+ 500,
69
+ "\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
70
+ );
71
+
72
+ // src/auth/handlers/signup_with_thirdparty.ts
73
+ var signUpWithThirdpartyHandler = async (request, {
74
+ authService,
75
+ fileService,
76
+ signupTokenSecret
77
+ }) => {
78
+ const body = await request.json();
79
+ const {
80
+ token
81
+ } = body;
82
+ const payload = await authService.jwtManager.verify(token, signupTokenSecret);
83
+ const { provider, id: thirdpartyId, email, name, picture } = payload;
84
+ const existing = await authService.authRepository.findThirdPartyAuth(
85
+ provider,
86
+ thirdpartyId
87
+ );
88
+ if (existing) {
89
+ return CONFLICT("\uC774\uBBF8 \uAC00\uC785\uB41C \uC81C3\uC790 \uC778\uC99D \uC815\uBCF4\uC785\uB2C8\uB2E4.");
90
+ }
91
+ const userId = (0, import_uuid.v5)(thirdpartyId, import_uuid.v5.DNS);
92
+ const profileImage = await (async () => {
93
+ if (!picture) {
94
+ return;
95
+ }
96
+ const arrayBuffer = await fetch(picture).then((res) => res.arrayBuffer());
97
+ const { file } = await fileService.putFile(Buffer.from(arrayBuffer), {
98
+ userId,
99
+ name: "profile.jpg",
100
+ type: "image/jpeg",
101
+ size: arrayBuffer.byteLength
102
+ });
103
+ return file;
104
+ })();
105
+ const user = await authService.authRepository.createUser({
106
+ id: userId,
107
+ name,
108
+ role: "user",
109
+ email,
110
+ profileImage
111
+ });
112
+ await authService.authRepository.createThirdPartyAuth({
113
+ id: thirdpartyId,
114
+ provider,
115
+ userId
116
+ });
117
+ const { accessToken, refreshToken } = await authService.issueTokenPair(user);
118
+ return CREATED({ accessToken, refreshToken });
119
+ };
120
+ // Annotate the CommonJS export names for ESM import in node:
121
+ 0 && (module.exports = {
122
+ signUpWithThirdpartyHandler
123
+ });
@@ -0,0 +1,98 @@
1
+ // src/auth/handlers/signup_with_thirdparty.ts
2
+ import { v5 } from "uuid";
3
+
4
+ // src/http/response.ts
5
+ var createJsonResponse = (status) => {
6
+ return (data = {}, init) => {
7
+ return Response.json(data, { status, ...init });
8
+ };
9
+ };
10
+ var OK = createJsonResponse(200);
11
+ var CREATED = createJsonResponse(201);
12
+ var ACCEPTED = createJsonResponse(202);
13
+ var createException = (status, defaultMessage = "\uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.") => {
14
+ return (message = defaultMessage, init) => {
15
+ return createJsonResponse(status)({ message }, init);
16
+ };
17
+ };
18
+ var BAD_REQUEST = createException(400, "\uC694\uCCAD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.");
19
+ var UNAUTHORIZED = createException(401, "\uC778\uC99D\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.");
20
+ var FORBIDDEN = createException(403, "\uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.");
21
+ var NOT_FOUND = createException(
22
+ 404,
23
+ "\uC694\uCCAD\uD55C \uB9AC\uC18C\uC2A4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
24
+ );
25
+ var METHOD_NOT_ALLOWED = createException(
26
+ 405,
27
+ "\uBA54\uC11C\uB4DC\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
28
+ );
29
+ var NOT_ACCEPTABLE = createException(
30
+ 406,
31
+ "\uC694\uCCAD\uD55C \uD615\uC2DD\uC744 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
32
+ );
33
+ var REQUEST_TIMEOUT = createException(
34
+ 408,
35
+ "\uC694\uCCAD \uC2DC\uAC04\uC774 \uCD08\uACFC\uB418\uC5C8\uC2B5\uB2C8\uB2E4."
36
+ );
37
+ var CONFLICT = createException(409, "\uC694\uCCAD\uC774 \uCDA9\uB3CC\uD588\uC2B5\uB2C8\uB2E4.");
38
+ var UNPROCESSABLE_ENTITY = createException(
39
+ 422,
40
+ "\uCC98\uB9AC\uD560 \uC218 \uC5C6\uB294 \uC5D4\uD2F0\uD2F0\uC785\uB2C8\uB2E4."
41
+ );
42
+ var TOO_MANY_REQUESTS = createException(429, "\uC694\uCCAD\uC774 \uB108\uBB34 \uB9CE\uC2B5\uB2C8\uB2E4.");
43
+ var INTERNAL_SERVER_ERROR = createException(
44
+ 500,
45
+ "\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
46
+ );
47
+
48
+ // src/auth/handlers/signup_with_thirdparty.ts
49
+ var signUpWithThirdpartyHandler = async (request, {
50
+ authService,
51
+ fileService,
52
+ signupTokenSecret
53
+ }) => {
54
+ const body = await request.json();
55
+ const {
56
+ token
57
+ } = body;
58
+ const payload = await authService.jwtManager.verify(token, signupTokenSecret);
59
+ const { provider, id: thirdpartyId, email, name, picture } = payload;
60
+ const existing = await authService.authRepository.findThirdPartyAuth(
61
+ provider,
62
+ thirdpartyId
63
+ );
64
+ if (existing) {
65
+ return CONFLICT("\uC774\uBBF8 \uAC00\uC785\uB41C \uC81C3\uC790 \uC778\uC99D \uC815\uBCF4\uC785\uB2C8\uB2E4.");
66
+ }
67
+ const userId = v5(thirdpartyId, v5.DNS);
68
+ const profileImage = await (async () => {
69
+ if (!picture) {
70
+ return;
71
+ }
72
+ const arrayBuffer = await fetch(picture).then((res) => res.arrayBuffer());
73
+ const { file } = await fileService.putFile(Buffer.from(arrayBuffer), {
74
+ userId,
75
+ name: "profile.jpg",
76
+ type: "image/jpeg",
77
+ size: arrayBuffer.byteLength
78
+ });
79
+ return file;
80
+ })();
81
+ const user = await authService.authRepository.createUser({
82
+ id: userId,
83
+ name,
84
+ role: "user",
85
+ email,
86
+ profileImage
87
+ });
88
+ await authService.authRepository.createThirdPartyAuth({
89
+ id: thirdpartyId,
90
+ provider,
91
+ userId
92
+ });
93
+ const { accessToken, refreshToken } = await authService.issueTokenPair(user);
94
+ return CREATED({ accessToken, refreshToken });
95
+ };
96
+ export {
97
+ signUpWithThirdpartyHandler
98
+ };
@@ -0,0 +1,16 @@
1
+ import { AuthService } from '../auth_service.mjs';
2
+ import { ThirdpartyAuth } from '../thirdparty_auth.mjs';
3
+ import 'jose';
4
+ import 'react-router';
5
+ import '../jwt_manager.mjs';
6
+ import '../../file/object_storage.mjs';
7
+ import '@aws-sdk/client-s3';
8
+ import '../auth_repository.mjs';
9
+
10
+ declare const thirdpartyAuthCallbackHandler: (request: Request, { provider, authService, getThirdPartyAuth, }: {
11
+ provider: string;
12
+ authService: AuthService;
13
+ getThirdPartyAuth: (provider: string) => ThirdpartyAuth;
14
+ }) => Promise<Response>;
15
+
16
+ export { thirdpartyAuthCallbackHandler };
@@ -0,0 +1,16 @@
1
+ import { AuthService } from '../auth_service.js';
2
+ import { ThirdpartyAuth } from '../thirdparty_auth.js';
3
+ import 'jose';
4
+ import 'react-router';
5
+ import '../jwt_manager.js';
6
+ import '../../file/object_storage.js';
7
+ import '@aws-sdk/client-s3';
8
+ import '../auth_repository.js';
9
+
10
+ declare const thirdpartyAuthCallbackHandler: (request: Request, { provider, authService, getThirdPartyAuth, }: {
11
+ provider: string;
12
+ authService: AuthService;
13
+ getThirdPartyAuth: (provider: string) => ThirdpartyAuth;
14
+ }) => Promise<Response>;
15
+
16
+ export { thirdpartyAuthCallbackHandler };
@@ -17,14 +17,14 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/route/auth/callback/[provider]/route.tsx
21
- var route_exports = {};
22
- __export(route_exports, {
23
- thirdPartyAuthCallbackHandler: () => thirdPartyAuthCallbackHandler
20
+ // src/auth/handlers/thirdparty_auth_callback.tsx
21
+ var thirdparty_auth_callback_exports = {};
22
+ __export(thirdparty_auth_callback_exports, {
23
+ thirdpartyAuthCallbackHandler: () => thirdpartyAuthCallbackHandler
24
24
  });
25
- module.exports = __toCommonJS(route_exports);
25
+ module.exports = __toCommonJS(thirdparty_auth_callback_exports);
26
26
 
27
- // src/http-kit/response.ts
27
+ // src/http/response.ts
28
28
  var createJsonResponse = (status) => {
29
29
  return (data = {}, init) => {
30
30
  return Response.json(data, { status, ...init });
@@ -68,53 +68,62 @@ var INTERNAL_SERVER_ERROR = createException(
68
68
  "\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
69
69
  );
70
70
 
71
- // src/route/auth/callback/[provider]/route.tsx
72
- var thirdPartyAuthCallbackHandler = async (request, {
73
- provider
74
- }, {
75
- AUTH,
76
- GOOGLE_AUTH,
77
- APPLE_AUTH,
78
- SITE_ORIGIN
71
+ // src/auth/handlers/thirdparty_auth_callback.tsx
72
+ var thirdpartyAuthCallbackHandler = async (request, {
73
+ provider,
74
+ authService,
75
+ getThirdPartyAuth
79
76
  }) => {
80
77
  const url = new URL(request.url);
81
78
  const code = url.searchParams.get("code");
82
79
  if (!code) {
83
80
  throw BAD_REQUEST("\uCF54\uB4DC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
84
81
  }
85
- const getThirdPartyAuth = (provider2) => {
86
- switch (provider2) {
87
- case "google":
88
- return GOOGLE_AUTH;
89
- case "apple":
90
- return APPLE_AUTH;
91
- default:
92
- throw BAD_REQUEST("\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC778\uC99D \uC81C\uACF5\uC790\uC785\uB2C8\uB2E4.");
82
+ try {
83
+ const { accessToken, refreshToken } = await getThirdPartyAuth(
84
+ provider
85
+ ).login(code);
86
+ const [accessTokenSetCookie, refreshTokenSetCookie] = await Promise.all([
87
+ authService.getAccessTokenSetCookie(accessToken),
88
+ authService.getRefreshTokenSetCookie(refreshToken)
89
+ ]);
90
+ const headers = new Headers();
91
+ headers.append("Set-Cookie", accessTokenSetCookie);
92
+ headers.append("Set-Cookie", refreshTokenSetCookie);
93
+ const redirectUrl = url.searchParams.get("state") || "/";
94
+ return new Response("Temporary Redirect", {
95
+ status: 307,
96
+ headers: {
97
+ ...headers,
98
+ Location: new URL(
99
+ `/r?redirectUrl=${encodeURIComponent(redirectUrl)}`,
100
+ request.url
101
+ ).toString()
102
+ }
103
+ });
104
+ } catch (error) {
105
+ if (error instanceof Response) {
106
+ if (error.status == 404) {
107
+ const body = await error.json();
108
+ const token = body.token;
109
+ return new Response(
110
+ "Temporary Redirect",
111
+ {
112
+ status: 307,
113
+ headers: {
114
+ Location: new URL(
115
+ `/signup?token=${token}`,
116
+ request.url
117
+ ).toString()
118
+ }
119
+ }
120
+ );
121
+ }
93
122
  }
94
- };
95
- const { accessToken, refreshToken } = await getThirdPartyAuth(
96
- provider
97
- ).signIn(code);
98
- const [accessTokenSetCookie, refreshTokenSetCookie] = await Promise.all([
99
- AUTH.getAccessTokenSetCookie(accessToken),
100
- AUTH.getRefreshTokenSetCookie(refreshToken)
101
- ]);
102
- const headers = new Headers();
103
- headers.append("Set-Cookie", accessTokenSetCookie);
104
- headers.append("Set-Cookie", refreshTokenSetCookie);
105
- const redirectUrl = url.searchParams.get("state") || SITE_ORIGIN;
106
- return new Response("Temporary Redirect", {
107
- status: 307,
108
- headers: {
109
- ...headers,
110
- Location: new URL(
111
- `/r?redirectUrl=${encodeURIComponent(redirectUrl)}`,
112
- request.url
113
- ).toString()
114
- }
115
- });
123
+ throw error;
124
+ }
116
125
  };
117
126
  // Annotate the CommonJS export names for ESM import in node:
118
127
  0 && (module.exports = {
119
- thirdPartyAuthCallbackHandler
128
+ thirdpartyAuthCallbackHandler
120
129
  });