@withwiz/toolkit 0.4.0 → 0.5.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 (165) hide show
  1. package/dist/auth/adapters/prisma/index.d.ts +20 -4
  2. package/dist/auth/adapters/prisma/index.js +51 -61
  3. package/dist/auth/config.js +2 -2
  4. package/dist/auth/core/jwt/cookie.d.ts +1 -0
  5. package/dist/auth/core/jwt/cookie.js +4 -1
  6. package/dist/auth/core/jwt/index.d.ts +1 -1
  7. package/dist/auth/core/jwt/index.js +4 -1
  8. package/dist/auth/core/jwt/types.js +5 -7
  9. package/dist/auth/core/oauth/index.d.ts +17 -27
  10. package/dist/auth/core/oauth/index.js +18 -5
  11. package/dist/auth/core/oauth/providers/github.d.ts +12 -0
  12. package/dist/auth/core/oauth/providers/github.js +8 -0
  13. package/dist/auth/core/oauth/providers/google.d.ts +12 -0
  14. package/dist/auth/core/oauth/providers/google.js +8 -0
  15. package/dist/auth/core/oauth/providers/index.d.ts +3 -0
  16. package/dist/auth/core/oauth/providers/index.js +17 -0
  17. package/dist/auth/core/oauth/providers/kakao.d.ts +12 -0
  18. package/dist/auth/core/oauth/providers/kakao.js +8 -0
  19. package/dist/auth/core/password/client-helper.js +1 -1
  20. package/dist/auth/core/password/index.js +1 -1
  21. package/dist/auth/index.d.ts +2 -3
  22. package/dist/auth/index.js +27 -13
  23. package/dist/auth/types/index.d.ts +31 -31
  24. package/dist/auth/types/index.js +5 -7
  25. package/dist/cache/cache-config.d.ts +0 -32
  26. package/dist/cache/cache-config.js +6 -6
  27. package/dist/cache/cache-defaults.d.ts +2 -28
  28. package/dist/cache/cache-defaults.js +1 -1
  29. package/dist/cache/cache-env.js +5 -5
  30. package/dist/cache/cache-factory.js +14 -14
  31. package/dist/cache/cache-invalidation.js +15 -15
  32. package/dist/cache/cache-redis.js +8 -8
  33. package/dist/cache/cache-wrapper.js +15 -15
  34. package/dist/cache/cache.js +22 -26
  35. package/dist/cache/config.d.ts +0 -8
  36. package/dist/cache/config.js +2 -2
  37. package/dist/cache/hybrid-cache-manager.js +10 -10
  38. package/dist/cache/index.d.ts +0 -1
  39. package/dist/cache/index.js +22 -26
  40. package/dist/cache/inmemory-cache-manager.js +5 -5
  41. package/dist/cache/noop-cache-manager.d.ts +2 -2
  42. package/dist/cache/noop-cache-manager.js +7 -7
  43. package/dist/cache/redis-cache-manager.d.ts +2 -2
  44. package/dist/cache/redis-cache-manager.js +9 -9
  45. package/dist/chunk-2QQNL4ND.js +62 -0
  46. package/dist/{chunk-YP5SAHAP.js → chunk-3OZH2AMD.js} +10 -10
  47. package/dist/{chunk-WMQE2YK7.js → chunk-3WS5MO6P.js} +1 -1
  48. package/dist/{chunk-BYCFXGQL.js → chunk-4OCGUJL5.js} +4 -4
  49. package/dist/{chunk-IQQKKUAV.js → chunk-57W32BFZ.js} +4 -30
  50. package/dist/{chunk-VF4EVAMV.js → chunk-5HSGNXQ3.js} +1 -1
  51. package/dist/{chunk-KZUBO2IL.js → chunk-6OYE5XKI.js} +5 -5
  52. package/dist/{chunk-FD2TXDTO.js → chunk-6WI4HNAF.js} +2 -2
  53. package/dist/{chunk-J4TTSXDN.js → chunk-6XDE62WQ.js} +1 -1
  54. package/dist/{chunk-TO5CMMQC.js → chunk-7ZQQ6PJ4.js} +4 -17
  55. package/dist/{chunk-JLLMTTQ4.js → chunk-C4TSQUFA.js} +0 -7
  56. package/dist/{chunk-SV7X6HEN.js → chunk-D46PE6MU.js} +4 -4
  57. package/dist/{chunk-2F6KNGOD.js → chunk-DANUXNQU.js} +1 -1
  58. package/dist/{chunk-FDRIFPG6.js → chunk-DSRRNRZW.js} +4 -4
  59. package/dist/{chunk-XI4MRH5P.js → chunk-ET6RH4LB.js} +12 -40
  60. package/dist/{chunk-OIRAH57Y.js → chunk-FNKFQFZJ.js} +1 -1
  61. package/dist/{chunk-S5UCZ2T3.js → chunk-G5WP3MJG.js} +1 -1
  62. package/dist/chunk-GBLNXNEH.js +64 -0
  63. package/dist/{chunk-HHCDMWEF.js → chunk-GCR4PGRY.js} +1 -1
  64. package/dist/{chunk-4HBAPPB2.js → chunk-HGLQXH4D.js} +2 -2
  65. package/dist/chunk-HZLJYEOO.js +92 -0
  66. package/dist/{chunk-LX2EYD74.js → chunk-I7NVWJ72.js} +2 -2
  67. package/dist/{chunk-AXCB7SKY.js → chunk-IEFYARHC.js} +16 -16
  68. package/dist/{chunk-3YUKCYHI.js → chunk-JY62DSMP.js} +8 -8
  69. package/dist/{chunk-G5OMETUS.js → chunk-LCKQOHXI.js} +1 -1
  70. package/dist/{chunk-7IN4WRSO.js → chunk-MF4CWGMB.js} +12 -12
  71. package/dist/{chunk-J5AISIJS.js → chunk-NDET73GO.js} +22 -18
  72. package/dist/{chunk-JOM3N4EJ.js → chunk-NGV527RO.js} +1 -1
  73. package/dist/{chunk-RWVGJUON.js → chunk-OSDAP24S.js} +4 -4
  74. package/dist/{chunk-CUZPD3BF.js → chunk-PAYLVMZN.js} +2 -2
  75. package/dist/{chunk-6SOQUYOU.js → chunk-PYTRCD33.js} +2 -2
  76. package/dist/{chunk-6D3HHYER.js → chunk-QKC73SWB.js} +6 -12
  77. package/dist/{chunk-LFQ3IQQB.js → chunk-QO27AXIH.js} +2 -2
  78. package/dist/chunk-RVL5ROWQ.js +62 -0
  79. package/dist/{chunk-AQJAY5FA.js → chunk-S5KJZZKU.js} +1 -1
  80. package/dist/{chunk-K3HAYBWX.js → chunk-SNKCKED5.js} +1 -1
  81. package/dist/{chunk-AJLUPYCQ.js → chunk-SUA4WQRN.js} +20 -8
  82. package/dist/chunk-T4MDCVUQ.js +0 -0
  83. package/dist/{chunk-L6AU74EI.js → chunk-TOVBPLHD.js} +3 -3
  84. package/dist/{chunk-TFD3DSM2.js → chunk-UCIUAZQT.js} +14 -18
  85. package/dist/chunk-VIWM2ZZH.js +45 -0
  86. package/dist/{chunk-KGHWGLED.js → chunk-W3IVVPS5.js} +4 -4
  87. package/dist/{chunk-WNF2RKFA.js → chunk-WBU53USI.js} +13 -13
  88. package/dist/{chunk-FPESPW6P.js → chunk-XA32Z2OV.js} +1 -1
  89. package/dist/{chunk-GQVBWZLH.js → chunk-Y22GDIM6.js} +2 -2
  90. package/dist/{chunk-OIVXOT2X.js → chunk-YUBXS7YI.js} +2 -3
  91. package/dist/{chunk-VDXB5DCY.js → chunk-ZRDPJORV.js} +0 -10
  92. package/dist/components/ui/DataTable.js +5 -5
  93. package/dist/components/ui/data-table/DataTable.js +5 -5
  94. package/dist/components/ui/data-table/DataTableFilters.js +2 -2
  95. package/dist/components/ui/data-table/DataTableSearch.js +2 -2
  96. package/dist/config/common.js +2 -2
  97. package/dist/constants/index.js +11 -13
  98. package/dist/constants/pagination.d.ts +0 -5
  99. package/dist/constants/pagination.js +1 -1
  100. package/dist/constants/security.d.ts +0 -6
  101. package/dist/constants/security.js +1 -3
  102. package/dist/constants/validation.d.ts +1 -3
  103. package/dist/error/error-display.js +2 -2
  104. package/dist/error/error-handler.js +5 -5
  105. package/dist/error/index.js +15 -15
  106. package/dist/geolocation/batch-processor.js +5 -5
  107. package/dist/geolocation/config.js +2 -2
  108. package/dist/geolocation/index.js +9 -9
  109. package/dist/geolocation/providers/index.js +5 -5
  110. package/dist/geolocation/providers/ipgeolocation-provider.js +3 -3
  111. package/dist/geolocation/providers/maxmind-provider.js +3 -3
  112. package/dist/initialize.js +12 -12
  113. package/dist/logger/config.js +2 -2
  114. package/dist/logger/logger.js +4 -4
  115. package/dist/middleware/auth.d.ts +1 -0
  116. package/dist/middleware/auth.js +9 -7
  117. package/dist/middleware/cors-config.js +2 -2
  118. package/dist/middleware/cors.js +6 -6
  119. package/dist/middleware/error-handler.js +7 -7
  120. package/dist/middleware/index.d.ts +1 -1
  121. package/dist/middleware/index.js +22 -20
  122. package/dist/middleware/middleware-chain.js +5 -5
  123. package/dist/middleware/rate-limit.d.ts +3 -7
  124. package/dist/middleware/rate-limit.js +5 -5
  125. package/dist/middleware/response-logger.js +5 -5
  126. package/dist/middleware/security.js +5 -5
  127. package/dist/middleware/types.d.ts +1 -1
  128. package/dist/middleware/wrappers.js +17 -17
  129. package/dist/storage/config.js +2 -2
  130. package/dist/storage/r2-storage.js +2 -2
  131. package/dist/system/cpu.js +6 -6
  132. package/dist/system/disk.js +6 -6
  133. package/dist/system/environment.js +10 -10
  134. package/dist/system/health-check.js +9 -9
  135. package/dist/system/index.js +16 -16
  136. package/dist/system/memory.js +6 -6
  137. package/dist/system/network.js +6 -6
  138. package/dist/system/utils.js +5 -5
  139. package/dist/types/env.d.ts +2 -13
  140. package/dist/types/geoip.d.ts +4 -4
  141. package/dist/types/qr-code.d.ts +20 -20
  142. package/dist/types/qr-code.js +4 -4
  143. package/dist/utils/cors.d.ts +6 -4
  144. package/dist/utils/cors.js +4 -4
  145. package/dist/utils/csv-export.js +5 -5
  146. package/dist/utils/error-message-formatter.js +1 -1
  147. package/dist/utils/error-processor.js +5 -5
  148. package/dist/utils/index.js +8 -8
  149. package/dist/utils/optimistic-lock.d.ts +4 -4
  150. package/package.json +5 -1
  151. package/dist/cache/cache-keys-legacy.d.ts +0 -35
  152. package/dist/cache/cache-keys-legacy.js +0 -7
  153. package/dist/chunk-JBCDEAMW.js +0 -35
  154. package/dist/chunk-O7CK3CKJ.js +0 -84
  155. package/dist/chunk-V5K5FYU7.js +0 -200
  156. package/dist/{chunk-GFWGLWTS.js → chunk-23LXAAMU.js} +3 -3
  157. package/dist/{chunk-3CBGGMIY.js → chunk-2VNDWG6P.js} +3 -3
  158. package/dist/{chunk-OZE5KUS3.js → chunk-52BIDTZH.js} +3 -3
  159. package/dist/{chunk-OHBAELPZ.js → chunk-6O3I4ORK.js} +3 -3
  160. package/dist/{chunk-QMCOX3DP.js → chunk-EBUEBEJX.js} +0 -0
  161. package/dist/{chunk-BJSEYZBH.js → chunk-I4UEUKSB.js} +3 -3
  162. package/dist/{chunk-SEZJN4TC.js → chunk-LJEGM4OO.js} +3 -3
  163. package/dist/{chunk-AYZJN32D.js → chunk-PL33DK2X.js} +3 -3
  164. package/dist/{chunk-KHYY4KCV.js → chunk-TH45RVP7.js} +3 -3
  165. package/dist/{chunk-SFPMFVSD.js → chunk-XICTHSUH.js} +3 -3
@@ -1,200 +0,0 @@
1
- import {
2
- OAuthError
3
- } from "./chunk-AIH3F7JV.js";
4
-
5
- // src/auth/core/oauth/index.ts
6
- var OAuthManager = class {
7
- constructor(config, logger) {
8
- this.config = config;
9
- this.logger = logger;
10
- }
11
- /**
12
- * OAuth 로그인 URL 생성
13
- */
14
- getLoginUrl(provider, state) {
15
- if (provider === "google" /* GOOGLE */) {
16
- return this.getGoogleLoginUrl(state);
17
- } else if (provider === "github" /* GITHUB */) {
18
- return this.getGitHubLoginUrl(state);
19
- }
20
- throw new OAuthError(`Unsupported OAuth provider: ${provider}`, "UNSUPPORTED_PROVIDER");
21
- }
22
- /**
23
- * Google OAuth 로그인 URL
24
- */
25
- getGoogleLoginUrl(state) {
26
- if (!this.config.google) {
27
- throw new OAuthError("Google OAuth not configured", "GOOGLE_NOT_CONFIGURED");
28
- }
29
- const params = new URLSearchParams({
30
- client_id: this.config.google.clientId,
31
- redirect_uri: this.config.google.redirectUri,
32
- response_type: "code",
33
- scope: "openid email profile",
34
- state,
35
- access_type: "offline",
36
- prompt: "select_account consent"
37
- });
38
- return `https://accounts.google.com/o/oauth2/v2/auth?${params.toString()}`;
39
- }
40
- /**
41
- * GitHub OAuth 로그인 URL
42
- */
43
- getGitHubLoginUrl(state) {
44
- if (!this.config.github) {
45
- throw new OAuthError("GitHub OAuth not configured", "GITHUB_NOT_CONFIGURED");
46
- }
47
- const params = new URLSearchParams({
48
- client_id: this.config.github.clientId,
49
- redirect_uri: this.config.github.redirectUri,
50
- scope: "read:user user:email",
51
- state
52
- });
53
- return `https://github.com/login/oauth/authorize?${params.toString()}`;
54
- }
55
- /**
56
- * 인증 코드를 액세스 토큰으로 교환
57
- */
58
- async exchangeCodeForToken(provider, code) {
59
- if (provider === "google" /* GOOGLE */) {
60
- return this.exchangeGoogleCode(code);
61
- } else if (provider === "github" /* GITHUB */) {
62
- return this.exchangeGitHubCode(code);
63
- }
64
- throw new OAuthError(`Unsupported OAuth provider: ${provider}`, "UNSUPPORTED_PROVIDER");
65
- }
66
- /**
67
- * Google 코드 교환
68
- */
69
- async exchangeGoogleCode(code) {
70
- if (!this.config.google) {
71
- throw new OAuthError("Google OAuth not configured", "GOOGLE_NOT_CONFIGURED");
72
- }
73
- try {
74
- const response = await fetch("https://oauth2.googleapis.com/token", {
75
- method: "POST",
76
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
77
- body: new URLSearchParams({
78
- client_id: this.config.google.clientId,
79
- client_secret: this.config.google.clientSecret,
80
- code,
81
- grant_type: "authorization_code",
82
- redirect_uri: this.config.google.redirectUri
83
- })
84
- });
85
- if (!response.ok) {
86
- const errorData = await response.text();
87
- this.logger.error("Google token exchange failed", { status: response.status, errorData });
88
- throw new OAuthError("Failed to exchange Google code for token", "TOKEN_EXCHANGE_FAILED");
89
- }
90
- const data = await response.json();
91
- this.logger.debug("Google token exchange successful");
92
- return data.access_token;
93
- } catch (error) {
94
- this.logger.error("Google token exchange error", { error: error.message });
95
- throw new OAuthError("Google token exchange failed", "TOKEN_EXCHANGE_FAILED");
96
- }
97
- }
98
- /**
99
- * GitHub 코드 교환
100
- */
101
- async exchangeGitHubCode(code) {
102
- if (!this.config.github) {
103
- throw new OAuthError("GitHub OAuth not configured", "GITHUB_NOT_CONFIGURED");
104
- }
105
- try {
106
- const response = await fetch("https://github.com/login/oauth/access_token", {
107
- method: "POST",
108
- headers: {
109
- "Content-Type": "application/json",
110
- Accept: "application/json"
111
- },
112
- body: JSON.stringify({
113
- client_id: this.config.github.clientId,
114
- client_secret: this.config.github.clientSecret,
115
- code,
116
- redirect_uri: this.config.github.redirectUri
117
- })
118
- });
119
- if (!response.ok) {
120
- const errorData = await response.text();
121
- this.logger.error("GitHub token exchange failed", { status: response.status, errorData });
122
- throw new OAuthError("Failed to exchange GitHub code for token", "TOKEN_EXCHANGE_FAILED");
123
- }
124
- const data = await response.json();
125
- this.logger.debug("GitHub token exchange successful");
126
- return data.access_token;
127
- } catch (error) {
128
- this.logger.error("GitHub token exchange error", { error: error.message });
129
- throw new OAuthError("GitHub token exchange failed", "TOKEN_EXCHANGE_FAILED");
130
- }
131
- }
132
- /**
133
- * 사용자 정보 가져오기
134
- */
135
- async getUserInfo(provider, accessToken) {
136
- if (provider === "google" /* GOOGLE */) {
137
- return this.getGoogleUserInfo(accessToken);
138
- } else if (provider === "github" /* GITHUB */) {
139
- return this.getGitHubUserInfo(accessToken);
140
- }
141
- throw new OAuthError(`Unsupported OAuth provider: ${provider}`, "UNSUPPORTED_PROVIDER");
142
- }
143
- /**
144
- * Google 사용자 정보
145
- */
146
- async getGoogleUserInfo(accessToken) {
147
- try {
148
- const response = await fetch("https://www.googleapis.com/oauth2/v2/userinfo", {
149
- headers: { Authorization: `Bearer ${accessToken}` }
150
- });
151
- if (!response.ok) {
152
- throw new OAuthError("Failed to get Google user info", "USER_INFO_FAILED");
153
- }
154
- const data = await response.json();
155
- this.logger.debug("Google user info retrieved", { userId: data.id, email: data.email });
156
- return {
157
- id: data.id,
158
- email: data.email,
159
- name: data.name || null,
160
- image: data.picture || null,
161
- emailVerified: data.verified_email || false
162
- };
163
- } catch (error) {
164
- this.logger.error("Google user info error", { error: error.message });
165
- throw new OAuthError("Failed to retrieve Google user info", "USER_INFO_FAILED");
166
- }
167
- }
168
- /**
169
- * GitHub 사용자 정보
170
- */
171
- async getGitHubUserInfo(accessToken) {
172
- try {
173
- const response = await fetch("https://api.github.com/user", {
174
- headers: {
175
- Authorization: `Bearer ${accessToken}`,
176
- "User-Agent": "Auth-Module"
177
- }
178
- });
179
- if (!response.ok) {
180
- throw new OAuthError("Failed to get GitHub user info", "USER_INFO_FAILED");
181
- }
182
- const data = await response.json();
183
- this.logger.debug("GitHub user info retrieved", { userId: data.id, login: data.login });
184
- return {
185
- id: data.id.toString(),
186
- email: data.email,
187
- name: data.name || null,
188
- image: data.avatar_url || null,
189
- emailVerified: !!data.email
190
- };
191
- } catch (error) {
192
- this.logger.error("GitHub user info error", { error: error.message });
193
- throw new OAuthError("Failed to retrieve GitHub user info", "USER_INFO_FAILED");
194
- }
195
- }
196
- };
197
-
198
- export {
199
- OAuthManager
200
- };
@@ -1,9 +1,9 @@
1
- import {
2
- configWarn
3
- } from "./chunk-K25ICPU4.js";
4
1
  import {
5
2
  ConfigurationError
6
3
  } from "./chunk-2QH66EVQ.js";
4
+ import {
5
+ configWarn
6
+ } from "./chunk-K25ICPU4.js";
7
7
 
8
8
  // src/middleware/cors-config.ts
9
9
  var GLOBAL_KEY = "__withwiz_cors_config";
@@ -1,9 +1,9 @@
1
- import {
2
- configWarn
3
- } from "./chunk-K25ICPU4.js";
4
1
  import {
5
2
  ConfigurationError
6
3
  } from "./chunk-2QH66EVQ.js";
4
+ import {
5
+ configWarn
6
+ } from "./chunk-K25ICPU4.js";
7
7
 
8
8
  // src/geolocation/config.ts
9
9
  var GLOBAL_KEY = "__withwiz_geolocation_config";
@@ -1,9 +1,9 @@
1
- import {
2
- configWarn
3
- } from "./chunk-K25ICPU4.js";
4
1
  import {
5
2
  ConfigurationError
6
3
  } from "./chunk-2QH66EVQ.js";
4
+ import {
5
+ configWarn
6
+ } from "./chunk-K25ICPU4.js";
7
7
 
8
8
  // src/auth/config.ts
9
9
  var GLOBAL_KEY = "__withwiz_auth_config";
@@ -1,9 +1,9 @@
1
- import {
2
- configWarn
3
- } from "./chunk-K25ICPU4.js";
4
1
  import {
5
2
  ConfigurationError
6
3
  } from "./chunk-2QH66EVQ.js";
4
+ import {
5
+ configWarn
6
+ } from "./chunk-K25ICPU4.js";
7
7
 
8
8
  // src/logger/config.ts
9
9
  var GLOBAL_KEY = "__withwiz_logger_config";
File without changes
@@ -1,10 +1,10 @@
1
- import {
2
- AppError
3
- } from "./chunk-EOEMOXNT.js";
4
1
  import {
5
2
  getErrorDisplayInfo,
6
3
  getFriendlyMessage
7
4
  } from "./chunk-7VTBRP5M.js";
5
+ import {
6
+ AppError
7
+ } from "./chunk-EOEMOXNT.js";
8
8
  import {
9
9
  getErrorCategory
10
10
  } from "./chunk-SNTLJ646.js";
@@ -1,6 +1,3 @@
1
- import {
2
- Input
3
- } from "./chunk-RJUVBBZG.js";
4
1
  import {
5
2
  Label
6
3
  } from "./chunk-IJEZ7G7S.js";
@@ -14,6 +11,9 @@ import {
14
11
  import {
15
12
  Button
16
13
  } from "./chunk-L25BNU3E.js";
14
+ import {
15
+ Input
16
+ } from "./chunk-RJUVBBZG.js";
17
17
  import {
18
18
  cn
19
19
  } from "./chunk-62FLBG6B.js";
@@ -1,9 +1,9 @@
1
- import {
2
- configWarn
3
- } from "./chunk-K25ICPU4.js";
4
1
  import {
5
2
  ConfigurationError
6
3
  } from "./chunk-2QH66EVQ.js";
4
+ import {
5
+ configWarn
6
+ } from "./chunk-K25ICPU4.js";
7
7
 
8
8
  // src/storage/config.ts
9
9
  var GLOBAL_KEY = "__withwiz_storage_config";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  formatLabel
3
3
  } from "./chunk-NY5QXT33.js";
4
- import {
5
- Input
6
- } from "./chunk-RJUVBBZG.js";
7
4
  import {
8
5
  Button
9
6
  } from "./chunk-L25BNU3E.js";
7
+ import {
8
+ Input
9
+ } from "./chunk-RJUVBBZG.js";
10
10
 
11
11
  // src/components/ui/data-table/DataTableSearch.tsx
12
12
  import { isValidElement } from "react";
@@ -1,9 +1,9 @@
1
- import {
2
- configWarn
3
- } from "./chunk-K25ICPU4.js";
4
1
  import {
5
2
  ConfigurationError
6
3
  } from "./chunk-2QH66EVQ.js";
4
+ import {
5
+ configWarn
6
+ } from "./chunk-K25ICPU4.js";
7
7
 
8
8
  // src/config/common.ts
9
9
  var GLOBAL_KEY = "__withwiz_common_config";