dn-react-router-toolkit 0.1.11 → 0.2.0

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 (183) 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} +6 -9
  6. package/dist/{auth-kit/repository.d.ts → auth/auth_repository.d.ts} +6 -9
  7. package/dist/{file-kit/repository.js → auth/auth_repository.js} +3 -3
  8. package/dist/{auth-kit → auth}/auth_service.d.mts +12 -22
  9. package/dist/{auth-kit → auth}/auth_service.d.ts +12 -22
  10. package/dist/{auth-kit → auth}/auth_service.js +30 -77
  11. package/dist/{auth-kit → auth}/auth_service.mjs +30 -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 +23 -0
  17. package/dist/auth/client/provider.d.ts +23 -0
  18. package/dist/auth/client/provider.js +137 -0
  19. package/dist/auth/client/provider.mjs +101 -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/signup.d.mts +15 -0
  47. package/dist/auth/handlers/signup.d.ts +15 -0
  48. package/dist/auth/handlers/signup.js +135 -0
  49. package/dist/auth/handlers/signup.mjs +100 -0
  50. package/dist/auth/handlers/signup_with_thirdparty.d.mts +17 -0
  51. package/dist/auth/handlers/signup_with_thirdparty.d.ts +17 -0
  52. package/dist/auth/handlers/signup_with_thirdparty.js +123 -0
  53. package/dist/auth/handlers/signup_with_thirdparty.mjs +98 -0
  54. package/dist/auth/handlers/thirdparty_auth_callback.d.mts +16 -0
  55. package/dist/auth/handlers/thirdparty_auth_callback.d.ts +16 -0
  56. package/dist/{route/auth/callback/[provider]/route.js → auth/handlers/thirdparty_auth_callback.js} +54 -45
  57. package/dist/{route/auth/callback/[provider]/route.mjs → auth/handlers/thirdparty_auth_callback.mjs} +49 -40
  58. package/dist/{auth-kit/jwt.d.mts → auth/jwt_manager.d.mts} +11 -1
  59. package/dist/{auth-kit/jwt.d.ts → auth/jwt_manager.d.ts} +11 -1
  60. package/dist/{auth-kit/jwt.js → auth/jwt_manager.js} +25 -11
  61. package/dist/{auth-kit/jwt.mjs → auth/jwt_manager.mjs} +22 -8
  62. package/dist/auth/kakao_auth.d.mts +27 -0
  63. package/dist/auth/kakao_auth.d.ts +27 -0
  64. package/dist/auth/kakao_auth.js +56 -0
  65. package/dist/auth/kakao_auth.mjs +31 -0
  66. package/dist/auth/thirdparty_auth.d.mts +41 -0
  67. package/dist/auth/thirdparty_auth.d.ts +41 -0
  68. package/dist/{auth-kit/kakao_auth.js → auth/thirdparty_auth.js} +31 -33
  69. package/dist/{auth-kit/kakao_auth.mjs → auth/thirdparty_auth.mjs} +26 -28
  70. package/dist/{auth-kit → auth}/with_auth.d.mts +5 -6
  71. package/dist/{auth-kit → auth}/with_auth.d.ts +5 -6
  72. package/dist/{auth-kit → auth}/with_auth.js +26 -42
  73. package/dist/auth/with_auth.mjs +63 -0
  74. package/dist/date.d.mts +2 -0
  75. package/dist/date.d.ts +2 -0
  76. package/dist/date.js +4 -2
  77. package/dist/date.mjs +2 -1
  78. package/dist/{file-kit → file}/cdn.js +1 -1
  79. package/dist/{file-kit → file}/cdn.mjs +1 -1
  80. package/dist/{file-kit → file}/client/drop_file_input.js +3 -3
  81. package/dist/{file-kit → file}/client/drop_file_input.mjs +3 -3
  82. package/dist/{file-kit → file}/client/file_upload_button.js +1 -1
  83. package/dist/{file-kit → file}/client/file_upload_button.mjs +1 -1
  84. package/dist/{file-kit → file}/client/file_uploader.js +3 -3
  85. package/dist/{file-kit → file}/client/file_uploader.mjs +2 -2
  86. package/dist/{file-kit → file}/client/format_size.js +1 -1
  87. package/dist/{file-kit → file}/client/format_size.mjs +1 -1
  88. package/dist/{file-kit → file}/client/metadata.js +1 -1
  89. package/dist/{file-kit → file}/client/metadata.mjs +1 -1
  90. package/dist/{file-kit/repository.d.mts → file/file_repository.d.mts} +4 -4
  91. package/dist/{file-kit/repository.d.ts → file/file_repository.d.ts} +4 -4
  92. package/dist/{auth-kit/repository.js → file/file_repository.js} +3 -3
  93. package/dist/file/file_service.d.mts +32 -0
  94. package/dist/file/file_service.d.ts +32 -0
  95. package/dist/{file-kit → file}/file_service.js +27 -21
  96. package/dist/file/file_service.mjs +41 -0
  97. package/dist/file/handlers/delete_file.d.mts +17 -0
  98. package/dist/file/handlers/delete_file.d.ts +17 -0
  99. package/dist/{route/api/files/[fileId]/route.js → file/handlers/delete_file.js} +15 -15
  100. package/dist/{route/api/files/[fileId]/route.mjs → file/handlers/delete_file.mjs} +10 -10
  101. package/dist/file/handlers/upload_file.d.mts +16 -0
  102. package/dist/file/handlers/upload_file.d.ts +16 -0
  103. package/dist/{route/api/files/route.js → file/handlers/upload_file.js} +13 -13
  104. package/dist/{route/api/files/route.mjs → file/handlers/upload_file.mjs} +8 -8
  105. package/dist/{file-kit → file}/object_storage.d.mts +3 -1
  106. package/dist/{file-kit → file}/object_storage.d.ts +3 -1
  107. package/dist/{file-kit → file}/object_storage.js +2 -2
  108. package/dist/{file-kit → file}/object_storage.mjs +2 -2
  109. package/dist/{file-kit → file}/responsive_image.d.mts +4 -4
  110. package/dist/{file-kit → file}/responsive_image.d.ts +4 -4
  111. package/dist/{file-kit → file}/responsive_image.js +18 -9
  112. package/dist/{file-kit → file}/responsive_image.mjs +18 -9
  113. package/dist/{http-kit → http}/index.js +5 -5
  114. package/dist/{http-kit → http}/index.mjs +1 -1
  115. package/dist/{http-kit → http}/response.js +1 -1
  116. package/dist/{http-kit → http}/response.mjs +1 -1
  117. package/dist/index.d.mts +1 -0
  118. package/dist/index.d.ts +1 -0
  119. package/dist/index.js +2 -0
  120. package/dist/index.mjs +1 -0
  121. package/dist/route/api.d.mts +15 -25
  122. package/dist/route/api.d.ts +15 -25
  123. package/dist/route/api.js +325 -178
  124. package/dist/route/api.mjs +314 -177
  125. package/dist/{seo-kit → seo}/seo.js +1 -1
  126. package/dist/{seo-kit → seo}/seo.mjs +1 -1
  127. package/package.json +74 -74
  128. package/dist/auth-kit/apple_auth.d.mts +0 -24
  129. package/dist/auth-kit/apple_auth.d.ts +0 -24
  130. package/dist/auth-kit/apple_auth.mjs +0 -50
  131. package/dist/auth-kit/client/google_login_button.d.mts +0 -9
  132. package/dist/auth-kit/client/google_login_button.d.ts +0 -9
  133. package/dist/auth-kit/client/google_login_button.mjs +0 -32
  134. package/dist/auth-kit/client/logout.d.mts +0 -3
  135. package/dist/auth-kit/client/logout.d.ts +0 -3
  136. package/dist/auth-kit/client/logout.js +0 -49
  137. package/dist/auth-kit/client/logout.mjs +0 -24
  138. package/dist/auth-kit/google_auth.d.mts +0 -27
  139. package/dist/auth-kit/google_auth.d.ts +0 -27
  140. package/dist/auth-kit/kakao_auth.d.mts +0 -24
  141. package/dist/auth-kit/kakao_auth.d.ts +0 -24
  142. package/dist/auth-kit/with_auth.mjs +0 -67
  143. package/dist/file-kit/file_service.d.mts +0 -26
  144. package/dist/file-kit/file_service.d.ts +0 -26
  145. package/dist/file-kit/file_service.mjs +0 -35
  146. package/dist/route/api/auth/login/_provider_/route.d.mts +0 -20
  147. package/dist/route/api/auth/login/_provider_/route.d.ts +0 -20
  148. package/dist/route/api/auth/login/route.d.mts +0 -14
  149. package/dist/route/api/auth/login/route.d.ts +0 -14
  150. package/dist/route/api/auth/logout/route.d.mts +0 -14
  151. package/dist/route/api/auth/logout/route.d.ts +0 -14
  152. package/dist/route/api/auth/refresh/route.d.mts +0 -13
  153. package/dist/route/api/auth/refresh/route.d.ts +0 -13
  154. package/dist/route/api/auth/route.d.mts +0 -13
  155. package/dist/route/api/auth/route.d.ts +0 -13
  156. package/dist/route/api/files/_fileId_/route.d.mts +0 -17
  157. package/dist/route/api/files/_fileId_/route.d.ts +0 -17
  158. package/dist/route/api/files/route.d.mts +0 -16
  159. package/dist/route/api/files/route.d.ts +0 -16
  160. package/dist/route/auth/callback/_provider_/route.d.mts +0 -20
  161. package/dist/route/auth/callback/_provider_/route.d.ts +0 -20
  162. /package/dist/{auth-kit/repository.mjs → auth/auth_repository.mjs} +0 -0
  163. /package/dist/{auth-kit → auth}/client/redirect_page.d.mts +0 -0
  164. /package/dist/{auth-kit → auth}/client/redirect_page.d.ts +0 -0
  165. /package/dist/{file-kit → file}/cdn.d.mts +0 -0
  166. /package/dist/{file-kit → file}/cdn.d.ts +0 -0
  167. /package/dist/{file-kit → file}/client/drop_file_input.d.mts +0 -0
  168. /package/dist/{file-kit → file}/client/drop_file_input.d.ts +0 -0
  169. /package/dist/{file-kit → file}/client/file_upload_button.d.mts +0 -0
  170. /package/dist/{file-kit → file}/client/file_upload_button.d.ts +0 -0
  171. /package/dist/{file-kit → file}/client/file_uploader.d.mts +0 -0
  172. /package/dist/{file-kit → file}/client/file_uploader.d.ts +0 -0
  173. /package/dist/{file-kit → file}/client/format_size.d.mts +0 -0
  174. /package/dist/{file-kit → file}/client/format_size.d.ts +0 -0
  175. /package/dist/{file-kit → file}/client/metadata.d.mts +0 -0
  176. /package/dist/{file-kit → file}/client/metadata.d.ts +0 -0
  177. /package/dist/{file-kit/repository.mjs → file/file_repository.mjs} +0 -0
  178. /package/dist/{http-kit → http}/index.d.mts +0 -0
  179. /package/dist/{http-kit → http}/index.d.ts +0 -0
  180. /package/dist/{http-kit → http}/response.d.mts +0 -0
  181. /package/dist/{http-kit → http}/response.d.ts +0 -0
  182. /package/dist/{seo-kit → seo}/seo.d.mts +0 -0
  183. /package/dist/{seo-kit → seo}/seo.d.ts +0 -0
package/package.json CHANGED
@@ -1,83 +1,83 @@
1
1
  {
2
- "name": "dn-react-router-toolkit",
3
- "version": "0.1.11",
4
- "types": "./dist/index.d.ts",
5
- "main": "./dist/index.mjs",
6
- "module": "./dist/index.js",
7
- "exports": {
8
- ".": {
9
- "types": "./dist/index.d.ts",
10
- "import": "./dist/index.mjs",
11
- "require": "./dist/index.js"
2
+ "name": "dn-react-router-toolkit",
3
+ "version": "0.2.0",
4
+ "types": "./dist/index.d.ts",
5
+ "main": "./dist/index.mjs",
6
+ "module": "./dist/index.js",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.mjs",
11
+ "require": "./dist/index.js"
12
+ },
13
+ "./auth/*": {
14
+ "types": "./dist/auth/*.d.ts",
15
+ "import": "./dist/auth/*.mjs",
16
+ "require": "./dist/auth/*.js"
17
+ },
18
+ "./file/*": {
19
+ "types": "./dist/file/*.d.ts",
20
+ "import": "./dist/file/*.mjs",
21
+ "require": "./dist/file/*.js"
22
+ },
23
+ "./route/*": {
24
+ "types": "./dist/route/*.d.ts",
25
+ "import": "./dist/route/*.mjs",
26
+ "require": "./dist/route/*.js"
27
+ },
28
+ "./components/*": {
29
+ "types": "./dist/components/*.d.ts",
30
+ "import": "./dist/components/*.mjs",
31
+ "require": "./dist/components/*.js"
32
+ },
33
+ "./http/*": {
34
+ "types": "./dist/http/*.d.ts",
35
+ "import": "./dist/http/*.mjs",
36
+ "require": "./dist/http/*.js"
37
+ },
38
+ "./seo/*": {
39
+ "types": "./dist/seo/*.d.ts",
40
+ "import": "./dist/seo/*.mjs",
41
+ "require": "./dist/seo/*.js"
42
+ }
12
43
  },
13
- "./auth-kit/*": {
14
- "types": "./dist/auth-kit/*.d.ts",
15
- "import": "./dist/auth-kit/*.mjs",
16
- "require": "./dist/auth-kit/*.js"
44
+ "scripts": {
45
+ "build": "tsup",
46
+ "dev": "tsup --watch"
17
47
  },
18
- "./file-kit/*": {
19
- "types": "./dist/file-kit/*.d.ts",
20
- "import": "./dist/file-kit/*.mjs",
21
- "require": "./dist/file-kit/*.js"
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/dndnsoft/dn-react-router-toolkit.git"
22
51
  },
23
- "./route/*": {
24
- "types": "./dist/route/*.d.ts",
25
- "import": "./dist/route/*.mjs",
26
- "require": "./dist/route/*.js"
52
+ "author": "",
53
+ "license": "MIT",
54
+ "bugs": {
55
+ "url": "https://github.com/dndnsoft/dn-react-router-toolkit/issues"
27
56
  },
28
- "./components/*": {
29
- "types": "./dist/components/*.d.ts",
30
- "import": "./dist/components/*.mjs",
31
- "require": "./dist/components/*.js"
57
+ "homepage": "https://github.com/dndnsoft/dn-react-router-toolkit#readme",
58
+ "description": "",
59
+ "devDependencies": {
60
+ "@types/node": "^24.10.1",
61
+ "@types/react": "^19",
62
+ "@types/react-dom": "^19",
63
+ "rimraf": "^6.0.1",
64
+ "schema-dts": "^1.1.5",
65
+ "tsup": "^8.5.1",
66
+ "typescript": "^5.7.3"
32
67
  },
33
- "./http-kit/*": {
34
- "types": "./dist/http-kit/*.d.ts",
35
- "import": "./dist/http-kit/*.mjs",
36
- "require": "./dist/http-kit/*.js"
68
+ "dependencies": {
69
+ "@aws-sdk/client-s3": "^3.940.0",
70
+ "@aws-sdk/s3-request-presigner": "^3.940.0",
71
+ "bcryptjs": "^3.0.3",
72
+ "jose": "^6.1.2",
73
+ "moment-timezone": "^0.6.0",
74
+ "react-icons": "^5.5.0",
75
+ "uuid": "^13.0.0"
37
76
  },
38
- "./seo-kit/*": {
39
- "types": "./dist/seo-kit/*.d.ts",
40
- "import": "./dist/seo-kit/*.mjs",
41
- "require": "./dist/seo-kit/*.js"
77
+ "peerDependencies": {
78
+ "drizzle-orm": "^0.44",
79
+ "react": "^19",
80
+ "react-dom": "^19",
81
+ "react-router": "^7"
42
82
  }
43
- },
44
- "scripts": {
45
- "build": "tsup",
46
- "dev": "tsup --watch"
47
- },
48
- "repository": {
49
- "type": "git",
50
- "url": "git+https://github.com/dndnsoft/dn-react-router-toolkit.git"
51
- },
52
- "author": "",
53
- "license": "MIT",
54
- "bugs": {
55
- "url": "https://github.com/dndnsoft/dn-react-router-toolkit/issues"
56
- },
57
- "homepage": "https://github.com/dndnsoft/dn-react-router-toolkit#readme",
58
- "description": "",
59
- "devDependencies": {
60
- "@types/node": "^24.5.2",
61
- "@types/react": "^19",
62
- "@types/react-dom": "^19",
63
- "rimraf": "^6.0.1",
64
- "schema-dts": "^1.1.5",
65
- "tsup": "^8.5.1",
66
- "typescript": "^5.7.3"
67
- },
68
- "dependencies": {
69
- "@aws-sdk/client-s3": "^3.940.0",
70
- "@aws-sdk/s3-request-presigner": "^3.940.0",
71
- "bcryptjs": "^3.0.3",
72
- "jose": "^6.1.2",
73
- "moment-timezone": "^0.6.0",
74
- "react-icons": "^5.5.0",
75
- "uuid": "^13.0.0"
76
- },
77
- "peerDependencies": {
78
- "drizzle-orm": "^0.44",
79
- "react": "^19",
80
- "react-dom": "^19",
81
- "react-router": "^7"
82
- }
83
83
  }
@@ -1,24 +0,0 @@
1
- import { AuthService } from './auth_service.mjs';
2
- import 'jose';
3
- import 'react-router';
4
- import './jwt.mjs';
5
- import '../file-kit/object_storage.mjs';
6
- import '@aws-sdk/client-s3';
7
- import './repository.mjs';
8
-
9
- declare class AppleAuth {
10
- AUTH: AuthService;
11
- constructor(AUTH: AuthService);
12
- signIn(code: string, type?: "web" | "app"): Promise<{
13
- user: {
14
- id: string;
15
- role: string;
16
- name: string;
17
- };
18
- accessToken: string;
19
- refreshToken: string;
20
- }>;
21
- private generateAppleClientSecret;
22
- }
23
-
24
- export { AppleAuth };
@@ -1,24 +0,0 @@
1
- import { AuthService } from './auth_service.js';
2
- import 'jose';
3
- import 'react-router';
4
- import './jwt.js';
5
- import '../file-kit/object_storage.js';
6
- import '@aws-sdk/client-s3';
7
- import './repository.js';
8
-
9
- declare class AppleAuth {
10
- AUTH: AuthService;
11
- constructor(AUTH: AuthService);
12
- signIn(code: string, type?: "web" | "app"): Promise<{
13
- user: {
14
- id: string;
15
- role: string;
16
- name: string;
17
- };
18
- accessToken: string;
19
- refreshToken: string;
20
- }>;
21
- private generateAppleClientSecret;
22
- }
23
-
24
- export { AppleAuth };
@@ -1,50 +0,0 @@
1
- // src/auth-kit/apple_auth.ts
2
- import { decodeJwt, importPKCS8, SignJWT } from "jose";
3
- var AppleAuth = class {
4
- AUTH;
5
- constructor(AUTH) {
6
- this.AUTH = AUTH;
7
- }
8
- async signIn(code, type = "web") {
9
- const url = "https://appleid.apple.com/auth/token";
10
- const client_secret = await this.generateAppleClientSecret(type);
11
- const res = await fetch(url, {
12
- method: "POST",
13
- headers: {
14
- "Content-Type": "application/x-www-form-urlencoded"
15
- },
16
- body: new URLSearchParams({
17
- client_id: type === "web" ? process.env.APPLE_SERVICE_ID : process.env.APPLE_CLIENT_ID,
18
- client_secret,
19
- code,
20
- grant_type: "authorization_code"
21
- })
22
- });
23
- if (!res.ok) {
24
- console.error(await res.text());
25
- throw new Error("Apple \uC778\uC99D\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.");
26
- }
27
- const data = await res.json();
28
- const { id_token } = data;
29
- const payload = decodeJwt(id_token);
30
- const { sub, email, name } = payload;
31
- const user = await this.AUTH.getOrCreateUser("apple", {
32
- id: sub,
33
- email,
34
- name
35
- });
36
- const { accessToken, refreshToken } = await this.AUTH.issueTokenPair(user);
37
- return { user, accessToken, refreshToken };
38
- }
39
- async generateAppleClientSecret(type = "web") {
40
- const authKey = process.env.APPLE_AUTH_KEY;
41
- const teamId = process.env.APPLE_TEAM_ID;
42
- const keyId = process.env.APPLE_KEY_ID;
43
- const clientId = type === "web" ? process.env.APPLE_SERVICE_ID : process.env.APPLE_CLIENT_ID;
44
- const keyObject = await importPKCS8(authKey, "ES256");
45
- return new SignJWT().setProtectedHeader({ alg: "ES256", kid: keyId }).setIssuedAt().setIssuer(teamId).setExpirationTime("1h").setAudience("https://appleid.apple.com").setSubject(clientId).sign(keyObject);
46
- }
47
- };
48
- export {
49
- AppleAuth
50
- };
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
-
3
- declare function GoogleLoginButton({ className, GOOGLE_CLIENT_ID, GOOGLE_REDIRECT_URI, }: {
4
- className?: string;
5
- GOOGLE_CLIENT_ID: string;
6
- GOOGLE_REDIRECT_URI: string;
7
- }): React.JSX.Element;
8
-
9
- export { GoogleLoginButton };
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
-
3
- declare function GoogleLoginButton({ className, GOOGLE_CLIENT_ID, GOOGLE_REDIRECT_URI, }: {
4
- className?: string;
5
- GOOGLE_CLIENT_ID: string;
6
- GOOGLE_REDIRECT_URI: string;
7
- }): React.JSX.Element;
8
-
9
- export { GoogleLoginButton };
@@ -1,32 +0,0 @@
1
- // src/auth-kit/client/google_login_button.tsx
2
- import React from "react";
3
- import { FcGoogle } from "react-icons/fc";
4
- import { useSearchParams } from "react-router";
5
- function GoogleLoginButton({
6
- className = "max-w-[300px] w-full",
7
- GOOGLE_CLIENT_ID,
8
- GOOGLE_REDIRECT_URI
9
- }) {
10
- const [searchParams] = useSearchParams();
11
- const redirectUrl = searchParams.get("redirectUrl") || "";
12
- const googleClientId = GOOGLE_CLIENT_ID || "";
13
- const googleRedirectUrl = GOOGLE_REDIRECT_URI || "";
14
- const href = new URL("https://accounts.google.com/o/oauth2/v2/auth");
15
- href.searchParams.append("client_id", googleClientId);
16
- href.searchParams.append("redirect_uri", googleRedirectUrl);
17
- href.searchParams.append("response_type", "code");
18
- href.searchParams.append("scope", "email profile");
19
- href.searchParams.append("state", redirectUrl);
20
- return /* @__PURE__ */ React.createElement("div", { className }, /* @__PURE__ */ React.createElement(
21
- "a",
22
- {
23
- href: href.toString(),
24
- className: "relative flex items-center border border-neutral-300 px-4 py-3 no-underline hover:no-underline bg-white hover:bg-neutral-100 rounded"
25
- },
26
- /* @__PURE__ */ React.createElement(FcGoogle, null),
27
- /* @__PURE__ */ React.createElement("p", { className: "text-[14px] text-black absolute left-0 right-0 text-center" }, "\uAD6C\uAE00\uB85C \uACC4\uC18D\uD558\uAE30")
28
- ));
29
- }
30
- export {
31
- GoogleLoginButton
32
- };
@@ -1,3 +0,0 @@
1
- declare function useLogout(): () => Promise<void>;
2
-
3
- export { useLogout };
@@ -1,3 +0,0 @@
1
- declare function useLogout(): () => Promise<void>;
2
-
3
- export { useLogout };
@@ -1,49 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/auth-kit/client/logout.ts
21
- var logout_exports = {};
22
- __export(logout_exports, {
23
- useLogout: () => useLogout
24
- });
25
- module.exports = __toCommonJS(logout_exports);
26
- var import_react_router = require("react-router");
27
- function useLogout() {
28
- const navigate = (0, import_react_router.useNavigate)();
29
- const logout = async () => {
30
- const ok = confirm("\uC815\uB9D0 \uB85C\uADF8\uC544\uC6C3 \uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?");
31
- if (!ok) {
32
- return;
33
- }
34
- const res = await fetch("/api/auth/logout", {
35
- method: "POST"
36
- });
37
- if (res.ok) {
38
- navigate("/");
39
- } else {
40
- const { message } = await res.json();
41
- alert(message);
42
- }
43
- };
44
- return logout;
45
- }
46
- // Annotate the CommonJS export names for ESM import in node:
47
- 0 && (module.exports = {
48
- useLogout
49
- });
@@ -1,24 +0,0 @@
1
- // src/auth-kit/client/logout.ts
2
- import { useNavigate } from "react-router";
3
- function useLogout() {
4
- const navigate = useNavigate();
5
- const logout = async () => {
6
- const ok = confirm("\uC815\uB9D0 \uB85C\uADF8\uC544\uC6C3 \uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?");
7
- if (!ok) {
8
- return;
9
- }
10
- const res = await fetch("/api/auth/logout", {
11
- method: "POST"
12
- });
13
- if (res.ok) {
14
- navigate("/");
15
- } else {
16
- const { message } = await res.json();
17
- alert(message);
18
- }
19
- };
20
- return logout;
21
- }
22
- export {
23
- useLogout
24
- };
@@ -1,27 +0,0 @@
1
- import { AuthService } from './auth_service.mjs';
2
- import 'jose';
3
- import 'react-router';
4
- import './jwt.mjs';
5
- import '../file-kit/object_storage.mjs';
6
- import '@aws-sdk/client-s3';
7
- import './repository.mjs';
8
-
9
- declare class GoogleAuth {
10
- AUTH: AuthService;
11
- GOOGLE_CLIENT_ID: string;
12
- GOOGLE_CLIENT_SECRET: string;
13
- GOOGLE_REDIRECT_URI: string;
14
- constructor(AUTH: AuthService, GOOGLE_CLIENT_ID: string, GOOGLE_CLIENT_SECRET: string, GOOGLE_REDIRECT_URI: string);
15
- signIn(code: string): Promise<{
16
- user: {
17
- id: string;
18
- role: string;
19
- name: string;
20
- refreshToken: string | null;
21
- };
22
- accessToken: string;
23
- refreshToken: string;
24
- }>;
25
- }
26
-
27
- export { GoogleAuth };
@@ -1,27 +0,0 @@
1
- import { AuthService } from './auth_service.js';
2
- import 'jose';
3
- import 'react-router';
4
- import './jwt.js';
5
- import '../file-kit/object_storage.js';
6
- import '@aws-sdk/client-s3';
7
- import './repository.js';
8
-
9
- declare class GoogleAuth {
10
- AUTH: AuthService;
11
- GOOGLE_CLIENT_ID: string;
12
- GOOGLE_CLIENT_SECRET: string;
13
- GOOGLE_REDIRECT_URI: string;
14
- constructor(AUTH: AuthService, GOOGLE_CLIENT_ID: string, GOOGLE_CLIENT_SECRET: string, GOOGLE_REDIRECT_URI: string);
15
- signIn(code: string): Promise<{
16
- user: {
17
- id: string;
18
- role: string;
19
- name: string;
20
- refreshToken: string | null;
21
- };
22
- accessToken: string;
23
- refreshToken: string;
24
- }>;
25
- }
26
-
27
- export { GoogleAuth };
@@ -1,24 +0,0 @@
1
- import { AuthService } from './auth_service.mjs';
2
- import 'jose';
3
- import 'react-router';
4
- import './jwt.mjs';
5
- import '../file-kit/object_storage.mjs';
6
- import '@aws-sdk/client-s3';
7
- import './repository.mjs';
8
-
9
- declare class KakaoAuth {
10
- AUTH: AuthService;
11
- constructor(AUTH: AuthService);
12
- signIn(kakaoAccessToken: string): Promise<{
13
- user: {
14
- id: string;
15
- role: string;
16
- name: string;
17
- refreshToken: string | null;
18
- };
19
- accessToken: string;
20
- refreshToken: string;
21
- }>;
22
- }
23
-
24
- export { KakaoAuth };
@@ -1,24 +0,0 @@
1
- import { AuthService } from './auth_service.js';
2
- import 'jose';
3
- import 'react-router';
4
- import './jwt.js';
5
- import '../file-kit/object_storage.js';
6
- import '@aws-sdk/client-s3';
7
- import './repository.js';
8
-
9
- declare class KakaoAuth {
10
- AUTH: AuthService;
11
- constructor(AUTH: AuthService);
12
- signIn(kakaoAccessToken: string): Promise<{
13
- user: {
14
- id: string;
15
- role: string;
16
- name: string;
17
- refreshToken: string | null;
18
- };
19
- accessToken: string;
20
- refreshToken: string;
21
- }>;
22
- }
23
-
24
- export { KakaoAuth };
@@ -1,67 +0,0 @@
1
- // src/auth-kit/auth_service.ts
2
- import bcryptjs from "bcryptjs";
3
- import { v4 } from "uuid";
4
- import { createCookie } from "react-router";
5
- var ACCESS_TOKEN_KEY = "access_token";
6
- var REFRESH_TOKEN_KEY = "refresh_token";
7
- var ACCESS_TOKEN_COOKIE = createCookie(ACCESS_TOKEN_KEY, {
8
- path: "/",
9
- httpOnly: process.env.NODE_ENV === "production",
10
- secure: process.env.NODE_ENV === "production",
11
- sameSite: "strict"
12
- });
13
- var REFRESH_TOKEN_COOKIE = createCookie(REFRESH_TOKEN_KEY, {
14
- path: "/",
15
- httpOnly: process.env.NODE_ENV === "production",
16
- secure: process.env.NODE_ENV === "production",
17
- sameSite: "strict"
18
- });
19
-
20
- // src/auth-kit/with_auth.ts
21
- function createWithAuthHandler({ JWT_MANAGER, AUTH }) {
22
- return function(fn) {
23
- const handler = async function(arg) {
24
- const cookie = arg.request.headers.get("cookie");
25
- const accessToken = await ACCESS_TOKEN_COOKIE.parse(cookie);
26
- if (accessToken) {
27
- const payload = await JWT_MANAGER.verifyAccessToken(accessToken);
28
- if (payload) {
29
- return fn(payload)(arg);
30
- }
31
- }
32
- const refreshToken = await REFRESH_TOKEN_COOKIE.parse(cookie);
33
- if (refreshToken) {
34
- try {
35
- const newAccessToken = await AUTH.refreshAccessToken(refreshToken);
36
- const setCookieHeader = await AUTH.getAccessTokenSetCookie(
37
- newAccessToken
38
- );
39
- const headers = new Headers();
40
- headers.append("Set-Cookie", setCookieHeader);
41
- headers.append("Location", arg.request.url);
42
- return new Response("Temporary Redirect", {
43
- status: 307,
44
- headers
45
- });
46
- } catch (e) {
47
- if (e instanceof Error) {
48
- console.log(e.message);
49
- }
50
- const setCookieHeader = await AUTH.getRefreshTokenSetCookie(null);
51
- const headers = new Headers();
52
- headers.append("Set-Cookie", setCookieHeader);
53
- headers.append("Location", arg.request.url);
54
- return new Response("Temporary Redirect", {
55
- status: 307,
56
- headers
57
- });
58
- }
59
- }
60
- return fn(void 0)(arg);
61
- };
62
- return handler;
63
- };
64
- }
65
- export {
66
- createWithAuthHandler
67
- };
@@ -1,26 +0,0 @@
1
- import { ObjectStorage } from './object_storage.mjs';
2
- import { FileRepository } from './repository.mjs';
3
- import '@aws-sdk/client-s3';
4
-
5
- type Params = {
6
- userId?: string;
7
- name: string;
8
- type: string;
9
- size: number;
10
- metadata?: Record<string, any>;
11
- };
12
- declare class FileService<TFile> {
13
- prefix: string;
14
- repository: FileRepository<TFile>;
15
- OBJECT_STORAGE: ObjectStorage;
16
- constructor(prefix: string | undefined, { repository, OBJECT_STORAGE, }: {
17
- repository: FileRepository<TFile>;
18
- OBJECT_STORAGE: ObjectStorage;
19
- });
20
- generateSignedUrl({ userId, name, type, size, metadata }: Params): Promise<{
21
- file: Awaited<TFile>;
22
- signedUrl: string;
23
- }>;
24
- }
25
-
26
- export { FileService };
@@ -1,26 +0,0 @@
1
- import { ObjectStorage } from './object_storage.js';
2
- import { FileRepository } from './repository.js';
3
- import '@aws-sdk/client-s3';
4
-
5
- type Params = {
6
- userId?: string;
7
- name: string;
8
- type: string;
9
- size: number;
10
- metadata?: Record<string, any>;
11
- };
12
- declare class FileService<TFile> {
13
- prefix: string;
14
- repository: FileRepository<TFile>;
15
- OBJECT_STORAGE: ObjectStorage;
16
- constructor(prefix: string | undefined, { repository, OBJECT_STORAGE, }: {
17
- repository: FileRepository<TFile>;
18
- OBJECT_STORAGE: ObjectStorage;
19
- });
20
- generateSignedUrl({ userId, name, type, size, metadata }: Params): Promise<{
21
- file: Awaited<TFile>;
22
- signedUrl: string;
23
- }>;
24
- }
25
-
26
- export { FileService };
@@ -1,35 +0,0 @@
1
- // src/file-kit/file_service.ts
2
- import { v4 } from "uuid";
3
- var FileService = class {
4
- prefix;
5
- repository;
6
- OBJECT_STORAGE;
7
- constructor(prefix = "user", {
8
- repository,
9
- OBJECT_STORAGE
10
- }) {
11
- this.prefix = prefix;
12
- this.repository = repository;
13
- this.OBJECT_STORAGE = OBJECT_STORAGE;
14
- }
15
- async generateSignedUrl({ userId, name, type, size, metadata = {} }) {
16
- const id = v4();
17
- const key = `${this.prefix}/${id}/${name}`;
18
- const file = await this.repository.createFile({
19
- id,
20
- userId,
21
- name,
22
- type,
23
- size,
24
- metadata,
25
- key
26
- });
27
- const signedUrl = await this.OBJECT_STORAGE.generateSignedUrl(key, {
28
- contentType: type
29
- });
30
- return { file, signedUrl };
31
- }
32
- };
33
- export {
34
- FileService
35
- };