@withwiz/toolkit 0.12.0 → 0.14.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.
- package/dist/{chunk-4OKAMI6O.js → chunk-5EUK6YWS.js} +1 -1
- package/dist/{chunk-2SV6VZOC.js → chunk-AQQ7JSS5.js} +1 -1
- package/dist/{chunk-3EEOZHIJ.js → chunk-DTADWVLS.js} +1 -1
- package/dist/{chunk-G4IGD3AZ.js → chunk-GPBNH2EZ.js} +11 -3
- package/dist/{chunk-YYTA6ERS.js → chunk-JL7CSV6G.js} +12 -1
- package/dist/{chunk-4OFL7KZ7.js → chunk-LJI4HDD6.js} +2 -2
- package/dist/{chunk-B2JZPUQ3.js → chunk-UTZ2XXGE.js} +2 -6
- package/dist/{chunk-ZLUID5BU.js → chunk-VVCT2A7O.js} +1 -1
- package/dist/chunk-WNOTRPZP.js +44 -0
- package/dist/{chunk-RWN47K7J.js → chunk-XIAZAHIL.js} +7 -3
- package/dist/{chunk-U2TGXJ3A.js → chunk-ZVGEGDYF.js} +1 -1
- package/dist/core/api-key/api-key.service.d.ts +6 -1
- package/dist/core/api-key/api-key.service.js +1 -1
- package/dist/core/api-key/index.js +1 -1
- package/dist/core/auth/index.js +20 -20
- package/dist/core/auth/oauth/index.js +4 -4
- package/dist/core/auth/oauth/providers/index.js +3 -3
- package/dist/core/cache/cache-factory.js +3 -3
- package/dist/core/cache/cache-invalidation.js +4 -4
- package/dist/core/cache/cache-wrapper.js +4 -4
- package/dist/core/cache/cache.js +5 -5
- package/dist/core/cache/hybrid-cache-manager.js +2 -2
- package/dist/core/cache/index.js +5 -5
- package/dist/core/cache/inmemory-cache-manager.js +1 -1
- package/dist/core/constants/index.js +6 -6
- package/dist/core/geolocation/index.js +7 -7
- package/dist/core/geolocation/providers/index.js +7 -7
- package/dist/core/system/environment.js +1 -1
- package/dist/core/system/health-check.js +1 -1
- package/dist/core/system/index.js +8 -8
- package/dist/core/utils/index.js +8 -8
- package/dist/core/utils/input-validation.js +23 -2
- package/dist/core/utils/startup-banner.d.ts +56 -0
- package/dist/core/utils/startup-banner.js +78 -0
- package/dist/initialize.js +3 -3
- package/dist/next/auth-handlers/index.js +6 -6
- package/dist/next/auth-handlers/logout.handler.d.ts +1 -1
- package/dist/next/auth-handlers/logout.handler.js +5 -1
- package/dist/next/auth-handlers/oauth-authorize.handler.js +3 -3
- package/dist/next/auth-handlers/oauth-callback.handler.js +3 -3
- package/dist/next/auth-handlers/refresh.handler.js +1 -1
- package/dist/next/auth-types/handler-types.d.ts +9 -0
- package/dist/next/middleware/index.js +5 -5
- package/dist/next/middleware/wrappers.js +3 -3
- package/dist/next/oapi/api-key-auth.js +1 -1
- package/dist/next/oapi/index.js +4 -4
- package/dist/next/utils/index.js +23 -23
- package/package.json +2 -1
- package/dist/chunk-6E2Q27EN.js +0 -17
- package/dist/{chunk-NT6URT4W.js → chunk-2HFLXCXJ.js} +3 -3
- package/dist/{chunk-ETXMWDXV.js → chunk-IE52LXR7.js} +0 -0
- package/dist/{chunk-VDRLJU6C.js → chunk-Q5RPNLET.js} +6 -6
- package/dist/{chunk-P7WHMKN5.js → chunk-V3GEYUBG.js} +3 -3
|
@@ -125,16 +125,24 @@ var ApiKeyService = class {
|
|
|
125
125
|
const { items, total } = await this.deps.repo.findMany(__spreadProps(__spreadValues({}, scoped), { page, pageSize }));
|
|
126
126
|
return { keys: items.map((r) => this.toInfo(r)), total, page, pageSize, hasMore: total > page * pageSize };
|
|
127
127
|
}
|
|
128
|
-
|
|
128
|
+
/**
|
|
129
|
+
* rate limit 상한 — generate 와 동일하게 플랜 한도로 클램프한다.
|
|
130
|
+
* `plan` 미전달 시 현재 저장된 rateLimit(생성 시 이미 플랜 한도로 클램프됨)을
|
|
131
|
+
* 상한으로 사용해, 수정 경로로 한도를 상향하는 것을 막는다.
|
|
132
|
+
*/
|
|
133
|
+
async updateApiKey(id, userId, data, isAdmin = false, plan) {
|
|
129
134
|
const rec = await this.requireOwned(id, userId, isAdmin);
|
|
135
|
+
const cap = plan !== void 0 ? await this.deps.planConfig.getRateLimit(plan) : rec.rateLimit;
|
|
136
|
+
const rateLimit = data.customRateLimit !== void 0 ? Math.min(data.customRateLimit, cap) : void 0;
|
|
137
|
+
const endpointLimits = data.endpointLimits !== void 0 ? Object.fromEntries(Object.entries(data.endpointLimits).map(([k, v]) => [k, Math.min(v, cap)])) : void 0;
|
|
130
138
|
const updated = await this.deps.repo.update(id, {
|
|
131
139
|
name: data.name,
|
|
132
140
|
description: data.description,
|
|
133
141
|
isActive: data.isActive,
|
|
134
142
|
permissions: data.permissions,
|
|
135
143
|
ipWhitelist: data.ipWhitelist,
|
|
136
|
-
rateLimit
|
|
137
|
-
endpointLimits
|
|
144
|
+
rateLimit,
|
|
145
|
+
endpointLimits
|
|
138
146
|
});
|
|
139
147
|
await this.deps.cache.invalidate(rec.key);
|
|
140
148
|
return this.toInfo(updated);
|
|
@@ -71,7 +71,18 @@ var InMemoryCacheManager = class _InMemoryCacheManager {
|
|
|
71
71
|
const fullKey = this.getFullKey(key);
|
|
72
72
|
const actualTTL = ttl != null ? ttl : this.config.defaultTTL;
|
|
73
73
|
const size = this.estimateSize(value);
|
|
74
|
-
|
|
74
|
+
const maxMemoryBytes = this.config.maxMemoryMB * 1024 * 1024;
|
|
75
|
+
if (this.config.maxSize <= 0 || size > maxMemoryBytes) {
|
|
76
|
+
logger.warn("[InMemoryCache] Item skipped: exceeds cache capacity", {
|
|
77
|
+
prefix: this.prefix,
|
|
78
|
+
key,
|
|
79
|
+
size,
|
|
80
|
+
maxMemoryBytes,
|
|
81
|
+
maxSize: this.config.maxSize
|
|
82
|
+
});
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
while (this.cache.size > 0 && this.needsEviction(size)) {
|
|
75
86
|
this.evict();
|
|
76
87
|
}
|
|
77
88
|
const existingEntry = this.cache.get(fullKey);
|
|
@@ -20,12 +20,8 @@ function checkEnvironmentVariables() {
|
|
|
20
20
|
const platform = getPlatform();
|
|
21
21
|
const results = [];
|
|
22
22
|
try {
|
|
23
|
-
|
|
24
|
-
results.push({
|
|
25
|
-
key: "JWT_SECRET",
|
|
26
|
-
ok: true,
|
|
27
|
-
value: auth.jwtSecret.length > 20 ? auth.jwtSecret.substring(0, 20) + "..." : auth.jwtSecret
|
|
28
|
-
});
|
|
23
|
+
getAuthConfig();
|
|
24
|
+
results.push({ key: "JWT_SECRET", ok: true, value: "***" });
|
|
29
25
|
} catch (e) {
|
|
30
26
|
results.push({ key: "JWT_SECRET", ok: false });
|
|
31
27
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TokenRefreshService
|
|
3
|
+
} from "./chunk-XAGPZLRK.js";
|
|
4
|
+
import {
|
|
5
|
+
getTokenDeliveryStrategy
|
|
6
|
+
} from "./chunk-HNFYO5XV.js";
|
|
7
|
+
import {
|
|
8
|
+
clearTokenCookies
|
|
9
|
+
} from "./chunk-DTRXWS7G.js";
|
|
10
|
+
|
|
11
|
+
// src/next/auth-handlers/logout.handler.ts
|
|
12
|
+
import { NextResponse } from "next/server";
|
|
13
|
+
function createLogoutHandler(options) {
|
|
14
|
+
const { dependencies, jwt, hooks, tokenDelivery, refreshTokenStore } = options;
|
|
15
|
+
const refreshService = refreshTokenStore ? new TokenRefreshService({
|
|
16
|
+
userRepository: dependencies.userRepository,
|
|
17
|
+
jwtSecret: jwt.secret,
|
|
18
|
+
accessTokenExpiry: jwt.accessTokenExpiry,
|
|
19
|
+
refreshTokenExpiry: jwt.refreshTokenExpiry,
|
|
20
|
+
isTokenBlacklisted: hooks == null ? void 0 : hooks.isTokenBlacklisted,
|
|
21
|
+
refreshTokenStore,
|
|
22
|
+
logger: dependencies.logger
|
|
23
|
+
}) : void 0;
|
|
24
|
+
return async (request) => {
|
|
25
|
+
var _a;
|
|
26
|
+
if (refreshService) {
|
|
27
|
+
try {
|
|
28
|
+
const refreshToken = await getTokenDeliveryStrategy(tokenDelivery).extractRefreshToken(request);
|
|
29
|
+
if (refreshToken) await refreshService.revokeByToken(refreshToken);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
(_a = dependencies.logger) == null ? void 0 : _a.debug("Logout: refresh token revoke skipped", {
|
|
32
|
+
reason: error instanceof Error ? error.message : String(error)
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const response = NextResponse.json({ success: true });
|
|
37
|
+
clearTokenCookies(response);
|
|
38
|
+
return response;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
createLogoutHandler
|
|
44
|
+
};
|
|
@@ -11,16 +11,18 @@ import {
|
|
|
11
11
|
// src/next/auth-handlers/refresh.handler.ts
|
|
12
12
|
import { NextResponse } from "next/server";
|
|
13
13
|
function createRefreshHandler(options) {
|
|
14
|
-
const { dependencies, jwt, hooks, cookie, tokenDelivery } = options;
|
|
14
|
+
const { dependencies, jwt, hooks, cookie, tokenDelivery, refreshTokenStore } = options;
|
|
15
15
|
const refreshService = new TokenRefreshService({
|
|
16
16
|
userRepository: dependencies.userRepository,
|
|
17
17
|
jwtSecret: jwt.secret,
|
|
18
18
|
accessTokenExpiry: jwt.accessTokenExpiry,
|
|
19
19
|
refreshTokenExpiry: jwt.refreshTokenExpiry,
|
|
20
20
|
isTokenBlacklisted: hooks == null ? void 0 : hooks.isTokenBlacklisted,
|
|
21
|
+
refreshTokenStore,
|
|
21
22
|
logger: dependencies.logger
|
|
22
23
|
});
|
|
23
24
|
return async (request) => {
|
|
25
|
+
var _a;
|
|
24
26
|
try {
|
|
25
27
|
const strategy = getTokenDeliveryStrategy(tokenDelivery);
|
|
26
28
|
const refreshToken = await strategy.extractRefreshToken(request);
|
|
@@ -32,15 +34,17 @@ function createRefreshHandler(options) {
|
|
|
32
34
|
if (hookResult instanceof Response) return hookResult;
|
|
33
35
|
}
|
|
34
36
|
const result = await refreshService.refresh(refreshToken);
|
|
37
|
+
const rotated = result.refreshToken !== void 0;
|
|
38
|
+
const nextRefreshToken = (_a = result.refreshToken) != null ? _a : refreshToken;
|
|
35
39
|
const response = NextResponse.json(
|
|
36
40
|
strategy.buildTokenResponse(
|
|
37
41
|
{ success: true, user: result.user },
|
|
38
|
-
{ accessToken: result.accessToken }
|
|
42
|
+
rotated ? { accessToken: result.accessToken, refreshToken: nextRefreshToken } : { accessToken: result.accessToken }
|
|
39
43
|
)
|
|
40
44
|
);
|
|
41
45
|
strategy.attachCookies(
|
|
42
46
|
response,
|
|
43
|
-
{ accessToken: result.accessToken, refreshToken },
|
|
47
|
+
{ accessToken: result.accessToken, refreshToken: nextRefreshToken },
|
|
44
48
|
{ secure: cookie == null ? void 0 : cookie.secure }
|
|
45
49
|
);
|
|
46
50
|
return response;
|
|
@@ -18,7 +18,12 @@ export declare class ApiKeyService {
|
|
|
18
18
|
validateApiKey(rawKey: string): Promise<ApiKeyValidationResult>;
|
|
19
19
|
getApiKey(id: string, userId: string, isAdmin?: boolean): Promise<ApiKeyInfo>;
|
|
20
20
|
getApiKeys(filters: ApiKeyFilters, requesterId: string, isAdmin?: boolean): Promise<ApiKeyListResponse>;
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* rate limit 상한 — generate 와 동일하게 플랜 한도로 클램프한다.
|
|
23
|
+
* `plan` 미전달 시 현재 저장된 rateLimit(생성 시 이미 플랜 한도로 클램프됨)을
|
|
24
|
+
* 상한으로 사용해, 수정 경로로 한도를 상향하는 것을 막는다.
|
|
25
|
+
*/
|
|
26
|
+
updateApiKey(id: string, userId: string, data: UpdateApiKeyData, isAdmin?: boolean, plan?: string): Promise<ApiKeyInfo>;
|
|
22
27
|
deleteApiKey(id: string, userId: string, isAdmin?: boolean): Promise<void>;
|
|
23
28
|
trackUsage(apiKeyId: string, ip?: string): Promise<void>;
|
|
24
29
|
regenerateApiKey(userId: string, apiKeyId: string, plan: string, options?: {
|
package/dist/core/auth/index.js
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
JWTClientManager,
|
|
3
|
-
clearStoredTokens,
|
|
4
|
-
clearTokens,
|
|
5
|
-
createApiHeaders,
|
|
6
|
-
createAuthHeader,
|
|
7
|
-
decodeJWTPayload,
|
|
8
|
-
extractUserFromToken,
|
|
9
|
-
getStoredTokens,
|
|
10
|
-
getTokenExpirationString,
|
|
11
|
-
getTokenIssuedAtString,
|
|
12
|
-
getTokenRemainingTime,
|
|
13
|
-
isTokenExpired,
|
|
14
|
-
isTokenExpiringSoon,
|
|
15
|
-
storeTokens
|
|
16
|
-
} from "../../chunk-5I3EQHR4.js";
|
|
17
1
|
import {
|
|
18
2
|
DEFAULT_PASSWORD_CONFIG,
|
|
19
3
|
createPasswordHasher,
|
|
@@ -34,10 +18,29 @@ import {
|
|
|
34
18
|
BcryptPasswordHasher,
|
|
35
19
|
MigratingPasswordHasher
|
|
36
20
|
} from "../../chunk-ILMPKSWS.js";
|
|
21
|
+
import {
|
|
22
|
+
JWTClientManager,
|
|
23
|
+
clearStoredTokens,
|
|
24
|
+
clearTokens,
|
|
25
|
+
createApiHeaders,
|
|
26
|
+
createAuthHeader,
|
|
27
|
+
decodeJWTPayload,
|
|
28
|
+
extractUserFromToken,
|
|
29
|
+
getStoredTokens,
|
|
30
|
+
getTokenExpirationString,
|
|
31
|
+
getTokenIssuedAtString,
|
|
32
|
+
getTokenRemainingTime,
|
|
33
|
+
isTokenExpired,
|
|
34
|
+
isTokenExpiringSoon,
|
|
35
|
+
storeTokens
|
|
36
|
+
} from "../../chunk-5I3EQHR4.js";
|
|
37
37
|
import {
|
|
38
38
|
OAuthManager
|
|
39
|
-
} from "../../chunk-
|
|
39
|
+
} from "../../chunk-V3GEYUBG.js";
|
|
40
40
|
import "../../chunk-CDALZTPN.js";
|
|
41
|
+
import {
|
|
42
|
+
GitHubOAuthProvider
|
|
43
|
+
} from "../../chunk-HIZ7USIF.js";
|
|
41
44
|
import {
|
|
42
45
|
GoogleOAuthProvider
|
|
43
46
|
} from "../../chunk-GF3DKZIW.js";
|
|
@@ -46,9 +49,6 @@ import {
|
|
|
46
49
|
} from "../../chunk-65HVR74O.js";
|
|
47
50
|
import "../../chunk-33RIHX7O.js";
|
|
48
51
|
import "../../chunk-GSSHHVHF.js";
|
|
49
|
-
import {
|
|
50
|
-
GitHubOAuthProvider
|
|
51
|
-
} from "../../chunk-HIZ7USIF.js";
|
|
52
52
|
import "../../chunk-JLRMET4V.js";
|
|
53
53
|
import {
|
|
54
54
|
TokenGenerator
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OAuthManager
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-V3GEYUBG.js";
|
|
4
4
|
import "../../../chunk-CDALZTPN.js";
|
|
5
|
+
import {
|
|
6
|
+
GitHubOAuthProvider
|
|
7
|
+
} from "../../../chunk-HIZ7USIF.js";
|
|
5
8
|
import {
|
|
6
9
|
GoogleOAuthProvider
|
|
7
10
|
} from "../../../chunk-GF3DKZIW.js";
|
|
@@ -14,9 +17,6 @@ import {
|
|
|
14
17
|
import {
|
|
15
18
|
MicrosoftOAuthProvider
|
|
16
19
|
} from "../../../chunk-GSSHHVHF.js";
|
|
17
|
-
import {
|
|
18
|
-
GitHubOAuthProvider
|
|
19
|
-
} from "../../../chunk-HIZ7USIF.js";
|
|
20
20
|
import {
|
|
21
21
|
OAUTH_STATE_COOKIE,
|
|
22
22
|
clearOAuthStateCookie,
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import "../../../../chunk-CDALZTPN.js";
|
|
2
|
+
import {
|
|
3
|
+
GitHubOAuthProvider
|
|
4
|
+
} from "../../../../chunk-HIZ7USIF.js";
|
|
2
5
|
import {
|
|
3
6
|
GoogleOAuthProvider
|
|
4
7
|
} from "../../../../chunk-GF3DKZIW.js";
|
|
@@ -11,9 +14,6 @@ import {
|
|
|
11
14
|
import {
|
|
12
15
|
MicrosoftOAuthProvider
|
|
13
16
|
} from "../../../../chunk-GSSHHVHF.js";
|
|
14
|
-
import {
|
|
15
|
-
GitHubOAuthProvider
|
|
16
|
-
} from "../../../../chunk-HIZ7USIF.js";
|
|
17
17
|
import "../../../../chunk-5GWGARXI.js";
|
|
18
18
|
import "../../../../chunk-N3ETBM74.js";
|
|
19
19
|
export {
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
geoCache,
|
|
4
4
|
getCacheManager,
|
|
5
5
|
getEffectiveCacheBackend
|
|
6
|
-
} from "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
6
|
+
} from "../../chunk-LJI4HDD6.js";
|
|
7
|
+
import "../../chunk-VVCT2A7O.js";
|
|
8
|
+
import "../../chunk-JL7CSV6G.js";
|
|
9
9
|
import "../../chunk-ZFBY2FNS.js";
|
|
10
10
|
import "../../chunk-F2FTS6H4.js";
|
|
11
11
|
import {
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
deletePatternFromCache,
|
|
4
4
|
deletePatternFromMultipleCaches,
|
|
5
5
|
invalidateCache
|
|
6
|
-
} from "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
6
|
+
} from "../../chunk-5EUK6YWS.js";
|
|
7
|
+
import "../../chunk-LJI4HDD6.js";
|
|
8
|
+
import "../../chunk-VVCT2A7O.js";
|
|
9
|
+
import "../../chunk-JL7CSV6G.js";
|
|
10
10
|
import "../../chunk-ZFBY2FNS.js";
|
|
11
11
|
import "../../chunk-F2FTS6H4.js";
|
|
12
12
|
import "../../chunk-MTRPUJ4B.js";
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
cacheMetrics,
|
|
3
3
|
getCacheBackendLabel,
|
|
4
4
|
withCache
|
|
5
|
-
} from "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
5
|
+
} from "../../chunk-DTADWVLS.js";
|
|
6
|
+
import "../../chunk-LJI4HDD6.js";
|
|
7
|
+
import "../../chunk-VVCT2A7O.js";
|
|
8
|
+
import "../../chunk-JL7CSV6G.js";
|
|
9
9
|
import "../../chunk-ZFBY2FNS.js";
|
|
10
10
|
import "../../chunk-F2FTS6H4.js";
|
|
11
11
|
import "../../chunk-MTRPUJ4B.js";
|
package/dist/core/cache/cache.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import "../../chunk-HH4ZKZHD.js";
|
|
2
2
|
import {
|
|
3
3
|
invalidateCache
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-5EUK6YWS.js";
|
|
5
5
|
import {
|
|
6
6
|
cacheMetrics,
|
|
7
7
|
withCache
|
|
8
|
-
} from "../../chunk-
|
|
8
|
+
} from "../../chunk-DTADWVLS.js";
|
|
9
9
|
import {
|
|
10
10
|
cache,
|
|
11
11
|
geoCache,
|
|
12
12
|
getCacheManager,
|
|
13
13
|
getEffectiveCacheBackend
|
|
14
|
-
} from "../../chunk-
|
|
14
|
+
} from "../../chunk-LJI4HDD6.js";
|
|
15
15
|
import {
|
|
16
16
|
HybridCacheManager
|
|
17
|
-
} from "../../chunk-
|
|
17
|
+
} from "../../chunk-VVCT2A7O.js";
|
|
18
18
|
import {
|
|
19
19
|
InMemoryCacheManager
|
|
20
|
-
} from "../../chunk-
|
|
20
|
+
} from "../../chunk-JL7CSV6G.js";
|
|
21
21
|
import {
|
|
22
22
|
NoopCacheManager
|
|
23
23
|
} from "../../chunk-ZFBY2FNS.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HybridCacheManager
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-VVCT2A7O.js";
|
|
4
|
+
import "../../chunk-JL7CSV6G.js";
|
|
5
5
|
import "../../chunk-MTRPUJ4B.js";
|
|
6
6
|
import "../../chunk-QAIN3WNN.js";
|
|
7
7
|
import "../../chunk-O4L6RI5S.js";
|
package/dist/core/cache/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import "../../chunk-HH4ZKZHD.js";
|
|
2
2
|
import {
|
|
3
3
|
invalidateCache
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-5EUK6YWS.js";
|
|
5
5
|
import {
|
|
6
6
|
cacheMetrics,
|
|
7
7
|
withCache
|
|
8
|
-
} from "../../chunk-
|
|
8
|
+
} from "../../chunk-DTADWVLS.js";
|
|
9
9
|
import {
|
|
10
10
|
cache,
|
|
11
11
|
geoCache,
|
|
12
12
|
getCacheManager,
|
|
13
13
|
getEffectiveCacheBackend
|
|
14
|
-
} from "../../chunk-
|
|
14
|
+
} from "../../chunk-LJI4HDD6.js";
|
|
15
15
|
import {
|
|
16
16
|
HybridCacheManager
|
|
17
|
-
} from "../../chunk-
|
|
17
|
+
} from "../../chunk-VVCT2A7O.js";
|
|
18
18
|
import {
|
|
19
19
|
InMemoryCacheManager
|
|
20
|
-
} from "../../chunk-
|
|
20
|
+
} from "../../chunk-JL7CSV6G.js";
|
|
21
21
|
import {
|
|
22
22
|
NoopCacheManager
|
|
23
23
|
} from "../../chunk-ZFBY2FNS.js";
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GENERIC_CONFIRM_MESSAGES,
|
|
3
|
-
GENERIC_ERROR_MESSAGES,
|
|
4
|
-
GENERIC_INFO_MESSAGES,
|
|
5
|
-
GENERIC_SUCCESS_MESSAGES
|
|
6
|
-
} from "../../chunk-THUQVCTI.js";
|
|
7
1
|
import {
|
|
8
2
|
DATE_RANGE,
|
|
9
3
|
FILTER_OPTIONS,
|
|
@@ -20,6 +14,12 @@ import {
|
|
|
20
14
|
URL,
|
|
21
15
|
USER_INPUT
|
|
22
16
|
} from "../../chunk-GTCCVI45.js";
|
|
17
|
+
import {
|
|
18
|
+
GENERIC_CONFIRM_MESSAGES,
|
|
19
|
+
GENERIC_ERROR_MESSAGES,
|
|
20
|
+
GENERIC_INFO_MESSAGES,
|
|
21
|
+
GENERIC_SUCCESS_MESSAGES
|
|
22
|
+
} from "../../chunk-THUQVCTI.js";
|
|
23
23
|
import {
|
|
24
24
|
ERROR_CODES,
|
|
25
25
|
HTTP_STATUS,
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GeoIPProviderFactory
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import {
|
|
5
|
-
IPApiProvider
|
|
6
|
-
} from "../../chunk-E27YZK7O.js";
|
|
7
|
-
import {
|
|
8
|
-
IPApiCoProvider
|
|
9
|
-
} from "../../chunk-MRNRC45L.js";
|
|
3
|
+
} from "../../chunk-Q5RPNLET.js";
|
|
10
4
|
import {
|
|
11
5
|
IPGeolocationProvider
|
|
12
6
|
} from "../../chunk-GJYHMHTU.js";
|
|
13
7
|
import {
|
|
14
8
|
MaxMindProvider
|
|
15
9
|
} from "../../chunk-R463CTX4.js";
|
|
10
|
+
import {
|
|
11
|
+
IPApiProvider
|
|
12
|
+
} from "../../chunk-E27YZK7O.js";
|
|
13
|
+
import {
|
|
14
|
+
IPApiCoProvider
|
|
15
|
+
} from "../../chunk-MRNRC45L.js";
|
|
16
16
|
import {
|
|
17
17
|
BaseGeoIPProvider,
|
|
18
18
|
truncateString
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GeoIPProviderFactory
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import {
|
|
5
|
-
IPApiProvider
|
|
6
|
-
} from "../../../chunk-E27YZK7O.js";
|
|
7
|
-
import {
|
|
8
|
-
IPApiCoProvider
|
|
9
|
-
} from "../../../chunk-MRNRC45L.js";
|
|
3
|
+
} from "../../../chunk-Q5RPNLET.js";
|
|
10
4
|
import {
|
|
11
5
|
IPGeolocationProvider
|
|
12
6
|
} from "../../../chunk-GJYHMHTU.js";
|
|
13
7
|
import {
|
|
14
8
|
MaxMindProvider
|
|
15
9
|
} from "../../../chunk-R463CTX4.js";
|
|
10
|
+
import {
|
|
11
|
+
IPApiProvider
|
|
12
|
+
} from "../../../chunk-E27YZK7O.js";
|
|
13
|
+
import {
|
|
14
|
+
IPApiCoProvider
|
|
15
|
+
} from "../../../chunk-MRNRC45L.js";
|
|
16
16
|
import {
|
|
17
17
|
BaseGeoIPProvider,
|
|
18
18
|
truncateString
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getMemoryInfo
|
|
3
|
+
} from "../../chunk-U52U5SK7.js";
|
|
4
|
+
import {
|
|
5
|
+
getNetworkInfo
|
|
6
|
+
} from "../../chunk-WBHX4MJV.js";
|
|
1
7
|
import {
|
|
2
8
|
getCpuInfo
|
|
3
9
|
} from "../../chunk-DRTJSTEV.js";
|
|
@@ -6,17 +12,11 @@ import {
|
|
|
6
12
|
} from "../../chunk-E5TDIRBJ.js";
|
|
7
13
|
import {
|
|
8
14
|
checkEnvironmentVariables
|
|
9
|
-
} from "../../chunk-
|
|
15
|
+
} from "../../chunk-UTZ2XXGE.js";
|
|
10
16
|
import {
|
|
11
17
|
checkServiceHealth
|
|
12
|
-
} from "../../chunk-
|
|
18
|
+
} from "../../chunk-IE52LXR7.js";
|
|
13
19
|
import "../../chunk-PBVP7CFZ.js";
|
|
14
|
-
import {
|
|
15
|
-
getMemoryInfo
|
|
16
|
-
} from "../../chunk-U52U5SK7.js";
|
|
17
|
-
import {
|
|
18
|
-
getNetworkInfo
|
|
19
|
-
} from "../../chunk-WBHX4MJV.js";
|
|
20
20
|
import {
|
|
21
21
|
getPlatform,
|
|
22
22
|
getRecommendedCommands
|
package/dist/core/utils/index.js
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
removeEventHandlers,
|
|
3
|
-
sanitizeArray,
|
|
4
|
-
sanitizeHtml,
|
|
5
|
-
sanitizeInput,
|
|
6
|
-
sanitizeObjectFields,
|
|
7
|
-
sanitizeUrl
|
|
8
|
-
} from "../../chunk-3RK3MKAR.js";
|
|
9
1
|
import {
|
|
10
2
|
isApiErrorResponse,
|
|
11
3
|
isApiSuccessResponse,
|
|
@@ -34,6 +26,14 @@ import {
|
|
|
34
26
|
isValidJSON,
|
|
35
27
|
isValidUrl
|
|
36
28
|
} from "../../chunk-4ETAGZIT.js";
|
|
29
|
+
import {
|
|
30
|
+
removeEventHandlers,
|
|
31
|
+
sanitizeArray,
|
|
32
|
+
sanitizeHtml,
|
|
33
|
+
sanitizeInput,
|
|
34
|
+
sanitizeObjectFields,
|
|
35
|
+
sanitizeUrl
|
|
36
|
+
} from "../../chunk-3RK3MKAR.js";
|
|
37
37
|
import "../../chunk-N3ETBM74.js";
|
|
38
38
|
export {
|
|
39
39
|
isApiErrorResponse,
|
|
@@ -25,29 +25,50 @@ var ALLOWED_URL_SCHEMES = [
|
|
|
25
25
|
"tel:",
|
|
26
26
|
"sms:"
|
|
27
27
|
];
|
|
28
|
-
function isPrivateV4(a, b) {
|
|
28
|
+
function isPrivateV4(a, b, c = 0) {
|
|
29
29
|
if (a === 0) return true;
|
|
30
30
|
if (a === 127) return true;
|
|
31
31
|
if (a === 10) return true;
|
|
32
|
+
if (a === 100 && b >= 64 && b <= 127) return true;
|
|
32
33
|
if (a === 169 && b === 254) return true;
|
|
34
|
+
if (a === 192 && b === 0 && c === 0) return true;
|
|
33
35
|
if (a === 192 && b === 168) return true;
|
|
34
36
|
if (a === 172 && b >= 16 && b <= 31) return true;
|
|
37
|
+
if (a >= 224) return true;
|
|
35
38
|
return false;
|
|
36
39
|
}
|
|
40
|
+
function mappedV4Octets(h) {
|
|
41
|
+
const prefix = "::ffff:";
|
|
42
|
+
if (!h.startsWith(prefix)) return null;
|
|
43
|
+
const rest = h.slice(prefix.length);
|
|
44
|
+
const dotted = rest.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
|
|
45
|
+
if (dotted) {
|
|
46
|
+
const o = dotted.slice(1, 5).map(Number);
|
|
47
|
+
return o.some((n) => n > 255) ? null : o;
|
|
48
|
+
}
|
|
49
|
+
const hex = rest.match(/^([0-9a-f]{1,4}):([0-9a-f]{1,4})$/);
|
|
50
|
+
if (!hex) return null;
|
|
51
|
+
const hi = parseInt(hex[1], 16);
|
|
52
|
+
const lo = parseInt(hex[2], 16);
|
|
53
|
+
return [hi >> 8, hi & 255, lo >> 8, lo & 255];
|
|
54
|
+
}
|
|
37
55
|
function isInternalHost(hostname) {
|
|
38
56
|
let h = hostname.toLowerCase();
|
|
39
57
|
if (h.startsWith("[") && h.endsWith("]")) h = h.slice(1, -1);
|
|
58
|
+
if (h.endsWith(".")) h = h.slice(0, -1);
|
|
40
59
|
if (h === "localhost" || h.endsWith(".localhost")) return true;
|
|
41
60
|
if (h.includes(":")) {
|
|
42
61
|
if (h === "::1" || h === "::") return true;
|
|
43
62
|
if (/^f[cd]/.test(h) || /^fe[89ab]/.test(h)) return true;
|
|
63
|
+
const mapped = mappedV4Octets(h);
|
|
64
|
+
if (mapped) return isPrivateV4(mapped[0], mapped[1], mapped[2]);
|
|
44
65
|
return false;
|
|
45
66
|
}
|
|
46
67
|
const v4 = h.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
|
|
47
68
|
if (v4) {
|
|
48
69
|
const o = v4.slice(1, 5).map(Number);
|
|
49
70
|
if (o.some((n) => n > 255)) return false;
|
|
50
|
-
return isPrivateV4(o[0], o[1]);
|
|
71
|
+
return isPrivateV4(o[0], o[1], o[2]);
|
|
51
72
|
}
|
|
52
73
|
return false;
|
|
53
74
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* startup-banner — 공용 서버 구동 배너
|
|
3
|
+
*
|
|
4
|
+
* 모든 withwiz 서버 프로젝트에서 서버 구동 시 환경설정을 동일한 형식으로 출력한다.
|
|
5
|
+
* 외부 의존성 없음(순수 console) — Core tier.
|
|
6
|
+
*
|
|
7
|
+
* 사용 예:
|
|
8
|
+
* import { printStartupBanner, mask, status } from '@withwiz/toolkit/core/utils/startup-banner';
|
|
9
|
+
* printStartupBanner({
|
|
10
|
+
* title: '🚀 My Service',
|
|
11
|
+
* version: process.env.npm_package_version,
|
|
12
|
+
* sections: [
|
|
13
|
+
* { emoji: '⚙️', title: 'Environment', lines: [
|
|
14
|
+
* ['Mode', process.env.NODE_ENV ?? 'development'],
|
|
15
|
+
* ['Base URL', mask(process.env.BASE_URL, 'url')],
|
|
16
|
+
* ]},
|
|
17
|
+
* ],
|
|
18
|
+
* });
|
|
19
|
+
*/
|
|
20
|
+
declare const colors: {
|
|
21
|
+
readonly reset: "\u001B[0m";
|
|
22
|
+
readonly bright: "\u001B[1m";
|
|
23
|
+
readonly dim: "\u001B[2m";
|
|
24
|
+
readonly cyan: "\u001B[36m";
|
|
25
|
+
readonly green: "\u001B[32m";
|
|
26
|
+
readonly yellow: "\u001B[33m";
|
|
27
|
+
readonly red: "\u001B[31m";
|
|
28
|
+
};
|
|
29
|
+
type Color = keyof typeof colors;
|
|
30
|
+
export declare const c: (color: Color, text: string) => string;
|
|
31
|
+
/** 민감/긴 값을 마스킹해 표시. url=host만, secret=앞 4글자, default=앞 20글자. */
|
|
32
|
+
export declare function mask(value: string | undefined, type?: 'url' | 'secret' | 'default'): string;
|
|
33
|
+
/** 불리언 상태를 ✓/✗ 로 표시. */
|
|
34
|
+
export declare function status(condition: boolean): string;
|
|
35
|
+
/** 기능 플래그 표시: 켜짐 ✓, 꺼짐 ⚠ OFF. */
|
|
36
|
+
export declare function feature(condition: boolean): string;
|
|
37
|
+
/** NODE_ENV 를 색상 라벨로. production=노랑, test=시안, 그 외=초록(DEVELOPMENT). */
|
|
38
|
+
export declare function modeLabel(nodeEnv: string | undefined): string;
|
|
39
|
+
export type BannerLine = [label: string, value: string];
|
|
40
|
+
export interface BannerSection {
|
|
41
|
+
emoji: string;
|
|
42
|
+
title: string;
|
|
43
|
+
lines: BannerLine[];
|
|
44
|
+
}
|
|
45
|
+
export interface StartupBannerOptions {
|
|
46
|
+
title: string;
|
|
47
|
+
version?: string;
|
|
48
|
+
sections: BannerSection[];
|
|
49
|
+
width?: number;
|
|
50
|
+
labelWidth?: number;
|
|
51
|
+
locale?: string;
|
|
52
|
+
timeZone?: string;
|
|
53
|
+
}
|
|
54
|
+
/** 서버 구동 배너 출력 (런타임에 실제 로드된 값 사용). */
|
|
55
|
+
export declare function printStartupBanner(opts: StartupBannerOptions): void;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import "../../chunk-N3ETBM74.js";
|
|
2
|
+
|
|
3
|
+
// src/core/utils/startup-banner.ts
|
|
4
|
+
var colors = {
|
|
5
|
+
reset: "\x1B[0m",
|
|
6
|
+
bright: "\x1B[1m",
|
|
7
|
+
dim: "\x1B[2m",
|
|
8
|
+
cyan: "\x1B[36m",
|
|
9
|
+
green: "\x1B[32m",
|
|
10
|
+
yellow: "\x1B[33m",
|
|
11
|
+
red: "\x1B[31m"
|
|
12
|
+
};
|
|
13
|
+
var c = (color, text) => `${colors[color]}${text}${colors.reset}`;
|
|
14
|
+
function mask(value, type = "default") {
|
|
15
|
+
if (!value) return c("red", "\u2717 NOT_SET");
|
|
16
|
+
switch (type) {
|
|
17
|
+
case "url":
|
|
18
|
+
try {
|
|
19
|
+
const url = new URL(value);
|
|
20
|
+
return c("green", `\u2713 ${url.host}`);
|
|
21
|
+
} catch (e) {
|
|
22
|
+
return value.length > 15 ? value.substring(0, 15) + "..." : value;
|
|
23
|
+
}
|
|
24
|
+
case "secret":
|
|
25
|
+
return c("green", `\u2713 ${value.substring(0, 4)}***`);
|
|
26
|
+
default:
|
|
27
|
+
return c("green", `\u2713 ${value.length > 20 ? value.substring(0, 20) + "..." : value}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function status(condition) {
|
|
31
|
+
return condition ? c("green", "\u2713") : c("red", "\u2717");
|
|
32
|
+
}
|
|
33
|
+
function feature(condition) {
|
|
34
|
+
return condition ? status(true) : c("yellow", "\u26A0 OFF");
|
|
35
|
+
}
|
|
36
|
+
function modeLabel(nodeEnv) {
|
|
37
|
+
const mode = nodeEnv || "development";
|
|
38
|
+
if (mode === "production") return c("yellow", "PRODUCTION");
|
|
39
|
+
if (mode === "test") return c("cyan", "TEST");
|
|
40
|
+
return c("green", "DEVELOPMENT");
|
|
41
|
+
}
|
|
42
|
+
function printStartupBanner(opts) {
|
|
43
|
+
const {
|
|
44
|
+
title,
|
|
45
|
+
version,
|
|
46
|
+
sections,
|
|
47
|
+
width = 50,
|
|
48
|
+
labelWidth = 28,
|
|
49
|
+
locale = "ko-KR",
|
|
50
|
+
timeZone = "Asia/Seoul"
|
|
51
|
+
} = opts;
|
|
52
|
+
const bar = c("cyan", "\u2501".repeat(width));
|
|
53
|
+
console.log(`
|
|
54
|
+
${bar}`);
|
|
55
|
+
console.log(`${c("bright", title)}${version ? " " + c("dim", `v${version}`) : ""}`);
|
|
56
|
+
console.log(bar);
|
|
57
|
+
for (const s of sections) {
|
|
58
|
+
console.log(`
|
|
59
|
+
${s.emoji} ${c("bright", s.title)}`);
|
|
60
|
+
for (const [label, value] of s.lines) {
|
|
61
|
+
console.log(` ${c("dim", label.padEnd(labelWidth))} ${value}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
console.log(`
|
|
65
|
+
${bar}`);
|
|
66
|
+
const time = (/* @__PURE__ */ new Date()).toLocaleTimeString(locale, { timeZone });
|
|
67
|
+
console.log(`${c("green", "\u2713")} Ready at ${time}`);
|
|
68
|
+
console.log(`${bar}
|
|
69
|
+
`);
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
c,
|
|
73
|
+
feature,
|
|
74
|
+
mask,
|
|
75
|
+
modeLabel,
|
|
76
|
+
printStartupBanner,
|
|
77
|
+
status
|
|
78
|
+
};
|
package/dist/initialize.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
initializeStorage
|
|
3
3
|
} from "./chunk-C5CBJC6V.js";
|
|
4
|
+
import {
|
|
5
|
+
initializeGeolocation
|
|
6
|
+
} from "./chunk-CRJUFA73.js";
|
|
4
7
|
import {
|
|
5
8
|
config,
|
|
6
9
|
resetConfig
|
|
@@ -8,9 +11,6 @@ import {
|
|
|
8
11
|
import {
|
|
9
12
|
initializeCors
|
|
10
13
|
} from "./chunk-7ZO5UNTJ.js";
|
|
11
|
-
import {
|
|
12
|
-
initializeGeolocation
|
|
13
|
-
} from "./chunk-CRJUFA73.js";
|
|
14
14
|
import {
|
|
15
15
|
initializeLogger
|
|
16
16
|
} from "./chunk-IKZB26SK.js";
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLogoutHandler
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-WNOTRPZP.js";
|
|
4
4
|
import {
|
|
5
5
|
createMeHandler
|
|
6
6
|
} from "../../chunk-AWFP2KAU.js";
|
|
7
7
|
import {
|
|
8
8
|
createOAuthAuthorizeHandler
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-ZVGEGDYF.js";
|
|
10
10
|
import {
|
|
11
11
|
createOAuthCallbackHandler
|
|
12
|
-
} from "../../chunk-
|
|
12
|
+
} from "../../chunk-AQQ7JSS5.js";
|
|
13
13
|
import "../../chunk-MTZXWVW3.js";
|
|
14
14
|
import {
|
|
15
15
|
createRefreshHandler
|
|
16
|
-
} from "../../chunk-
|
|
16
|
+
} from "../../chunk-XIAZAHIL.js";
|
|
17
17
|
import "../../chunk-XAGPZLRK.js";
|
|
18
18
|
import {
|
|
19
19
|
createRegisterHandler
|
|
@@ -33,13 +33,13 @@ import "../../chunk-75UDFONR.js";
|
|
|
33
33
|
import {
|
|
34
34
|
createLoginHandler
|
|
35
35
|
} from "../../chunk-5MPMPXIR.js";
|
|
36
|
-
import "../../chunk-
|
|
36
|
+
import "../../chunk-V3GEYUBG.js";
|
|
37
37
|
import "../../chunk-CDALZTPN.js";
|
|
38
|
+
import "../../chunk-HIZ7USIF.js";
|
|
38
39
|
import "../../chunk-GF3DKZIW.js";
|
|
39
40
|
import "../../chunk-65HVR74O.js";
|
|
40
41
|
import "../../chunk-33RIHX7O.js";
|
|
41
42
|
import "../../chunk-GSSHHVHF.js";
|
|
42
|
-
import "../../chunk-HIZ7USIF.js";
|
|
43
43
|
import "../../chunk-JLRMET4V.js";
|
|
44
44
|
import "../../chunk-ZZABL54F.js";
|
|
45
45
|
import "../../chunk-GH3U4WRE.js";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { NextRequest } from 'next/server';
|
|
2
2
|
import type { AuthHandlerOptions } from '@withwiz/toolkit/next/auth-types/handler-types';
|
|
3
|
-
export declare function createLogoutHandler(
|
|
3
|
+
export declare function createLogoutHandler(options: AuthHandlerOptions): (request: NextRequest) => Promise<Response>;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLogoutHandler
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-WNOTRPZP.js";
|
|
4
|
+
import "../../chunk-XAGPZLRK.js";
|
|
5
|
+
import "../../chunk-LWHLB2Y6.js";
|
|
6
|
+
import "../../chunk-5GWGARXI.js";
|
|
7
|
+
import "../../chunk-HNFYO5XV.js";
|
|
4
8
|
import "../../chunk-DTRXWS7G.js";
|
|
5
9
|
import "../../chunk-TQMQ5XXG.js";
|
|
6
10
|
import "../../chunk-7YWUKMZD.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createOAuthAuthorizeHandler
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-ZVGEGDYF.js";
|
|
4
|
+
import "../../chunk-V3GEYUBG.js";
|
|
5
5
|
import "../../chunk-CDALZTPN.js";
|
|
6
|
+
import "../../chunk-HIZ7USIF.js";
|
|
6
7
|
import "../../chunk-GF3DKZIW.js";
|
|
7
8
|
import "../../chunk-65HVR74O.js";
|
|
8
9
|
import "../../chunk-33RIHX7O.js";
|
|
9
10
|
import "../../chunk-GSSHHVHF.js";
|
|
10
|
-
import "../../chunk-HIZ7USIF.js";
|
|
11
11
|
import "../../chunk-JLRMET4V.js";
|
|
12
12
|
import "../../chunk-GH3U4WRE.js";
|
|
13
13
|
import "../../chunk-5GWGARXI.js";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createOAuthCallbackHandler
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-AQQ7JSS5.js";
|
|
4
4
|
import "../../chunk-MTZXWVW3.js";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-V3GEYUBG.js";
|
|
6
6
|
import "../../chunk-CDALZTPN.js";
|
|
7
|
+
import "../../chunk-HIZ7USIF.js";
|
|
7
8
|
import "../../chunk-GF3DKZIW.js";
|
|
8
9
|
import "../../chunk-65HVR74O.js";
|
|
9
10
|
import "../../chunk-33RIHX7O.js";
|
|
10
11
|
import "../../chunk-GSSHHVHF.js";
|
|
11
|
-
import "../../chunk-HIZ7USIF.js";
|
|
12
12
|
import "../../chunk-JLRMET4V.js";
|
|
13
13
|
import "../../chunk-GH3U4WRE.js";
|
|
14
14
|
import "../../chunk-LWHLB2Y6.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { NextRequest } from 'next/server';
|
|
2
2
|
import type { BaseUser, OAuthProviderName, UserRepository, OAuthAccountRepository, EmailTokenRepository, EmailSender, Logger } from '@withwiz/toolkit/core/auth/types';
|
|
3
3
|
import type { TokenDelivery } from '@withwiz/toolkit/core/auth/config';
|
|
4
|
+
import type { IRefreshTokenStore } from '@withwiz/toolkit/core/auth/services/refresh-token-store';
|
|
4
5
|
export interface AuthHandlerDependencies {
|
|
5
6
|
userRepository: UserRepository;
|
|
6
7
|
oauthAccountRepository: OAuthAccountRepository;
|
|
@@ -64,6 +65,14 @@ export interface AuthHandlerOptions {
|
|
|
64
65
|
};
|
|
65
66
|
/** 토큰 전달 모드. 미지정 시 전역 AuthConfig → 'hybrid' 순으로 해석 */
|
|
66
67
|
tokenDelivery?: TokenDelivery;
|
|
68
|
+
/**
|
|
69
|
+
* refresh 토큰 store. 주입 시:
|
|
70
|
+
* - refresh 핸들러가 회전(rotation) + 재사용 탐지(reuse detection)를 수행하고
|
|
71
|
+
* 새 refresh 토큰을 쿠키/응답에 반영한다.
|
|
72
|
+
* - logout 핸들러가 제출된 refresh 토큰의 family 를 즉시 무효화한다.
|
|
73
|
+
* 미주입 시 0.13 이전과 동일하게 동작한다(access 재발급만, 로그아웃은 쿠키 삭제만).
|
|
74
|
+
*/
|
|
75
|
+
refreshTokenStore?: IRefreshTokenStore;
|
|
67
76
|
}
|
|
68
77
|
export interface AuthHandlerResult {
|
|
69
78
|
GET: (req: NextRequest) => Promise<Response>;
|
|
@@ -4,7 +4,10 @@ import {
|
|
|
4
4
|
withCustomApi,
|
|
5
5
|
withOptionalAuthApi,
|
|
6
6
|
withPublicApi
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-2HFLXCXJ.js";
|
|
8
|
+
import {
|
|
9
|
+
MiddlewareChain
|
|
10
|
+
} from "../../chunk-WXOWI7BJ.js";
|
|
8
11
|
import {
|
|
9
12
|
createRateLimitMiddleware,
|
|
10
13
|
rateLimitMiddleware,
|
|
@@ -33,13 +36,10 @@ import {
|
|
|
33
36
|
import {
|
|
34
37
|
errorHandlerMiddleware
|
|
35
38
|
} from "../../chunk-LFJ24NDO.js";
|
|
39
|
+
import "../../chunk-NHFIOK2D.js";
|
|
36
40
|
import {
|
|
37
41
|
initRequestMiddleware
|
|
38
42
|
} from "../../chunk-VC2E6KYQ.js";
|
|
39
|
-
import {
|
|
40
|
-
MiddlewareChain
|
|
41
|
-
} from "../../chunk-WXOWI7BJ.js";
|
|
42
|
-
import "../../chunk-NHFIOK2D.js";
|
|
43
43
|
import "../../chunk-K2PNAQI4.js";
|
|
44
44
|
import "../../chunk-7WG7XPXC.js";
|
|
45
45
|
import "../../chunk-AMZWDLJ4.js";
|
|
@@ -4,16 +4,16 @@ import {
|
|
|
4
4
|
withCustomApi,
|
|
5
5
|
withOptionalAuthApi,
|
|
6
6
|
withPublicApi
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-2HFLXCXJ.js";
|
|
8
|
+
import "../../chunk-WXOWI7BJ.js";
|
|
8
9
|
import "../../chunk-M4ZVQFOH.js";
|
|
9
10
|
import "../../chunk-LCYDMYZS.js";
|
|
10
11
|
import "../../chunk-Y4WPEIKW.js";
|
|
11
12
|
import "../../chunk-7Q6SMNMN.js";
|
|
12
13
|
import "../../chunk-37VGD4VX.js";
|
|
13
14
|
import "../../chunk-LFJ24NDO.js";
|
|
14
|
-
import "../../chunk-VC2E6KYQ.js";
|
|
15
|
-
import "../../chunk-WXOWI7BJ.js";
|
|
16
15
|
import "../../chunk-NHFIOK2D.js";
|
|
16
|
+
import "../../chunk-VC2E6KYQ.js";
|
|
17
17
|
import "../../chunk-K2PNAQI4.js";
|
|
18
18
|
import "../../chunk-7WG7XPXC.js";
|
|
19
19
|
import "../../chunk-AMZWDLJ4.js";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "../../chunk-XWHT53CZ.js";
|
|
4
4
|
import "../../chunk-KYUJ6D65.js";
|
|
5
5
|
import "../../chunk-TN5ZNYR2.js";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-GPBNH2EZ.js";
|
|
7
7
|
import "../../chunk-BTNM5YSU.js";
|
|
8
8
|
import "../../chunk-4JZIIMAF.js";
|
|
9
9
|
import "../../chunk-NUHSUAXG.js";
|
package/dist/next/oapi/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildOpenApiSpec
|
|
3
|
+
} from "../../chunk-L2A6NGW7.js";
|
|
1
4
|
import {
|
|
2
5
|
createApiKeyAuth
|
|
3
6
|
} from "../../chunk-XWHT53CZ.js";
|
|
@@ -7,12 +10,9 @@ import {
|
|
|
7
10
|
parseSearchParams,
|
|
8
11
|
requireParam
|
|
9
12
|
} from "../../chunk-Z4J452HD.js";
|
|
10
|
-
import {
|
|
11
|
-
buildOpenApiSpec
|
|
12
|
-
} from "../../chunk-L2A6NGW7.js";
|
|
13
13
|
import "../../chunk-KYUJ6D65.js";
|
|
14
14
|
import "../../chunk-TN5ZNYR2.js";
|
|
15
|
-
import "../../chunk-
|
|
15
|
+
import "../../chunk-GPBNH2EZ.js";
|
|
16
16
|
import "../../chunk-BTNM5YSU.js";
|
|
17
17
|
import "../../chunk-4JZIIMAF.js";
|
|
18
18
|
import "../../chunk-NUHSUAXG.js";
|
package/dist/next/utils/index.js
CHANGED
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
boolFormatter,
|
|
3
|
-
createCsvHeader,
|
|
4
|
-
createSimpleCsvResponse,
|
|
5
|
-
createStreamingCsvResponse,
|
|
6
|
-
dateFormatter,
|
|
7
|
-
escapeCsvField,
|
|
8
|
-
rowToCsv
|
|
9
|
-
} from "../../chunk-DVCGAI5N.js";
|
|
10
|
-
import {
|
|
11
|
-
ErrorProcessor,
|
|
12
|
-
errorToResponse,
|
|
13
|
-
handlePrismaError,
|
|
14
|
-
processError,
|
|
15
|
-
throwBadRequestError,
|
|
16
|
-
throwBusinessRuleError,
|
|
17
|
-
throwConflictError,
|
|
18
|
-
throwForbiddenError,
|
|
19
|
-
throwNotFoundError,
|
|
20
|
-
throwUnauthorizedError,
|
|
21
|
-
throwValidationError,
|
|
22
|
-
withErrorHandling
|
|
23
|
-
} from "../../chunk-D4QADM6T.js";
|
|
24
1
|
import {
|
|
25
2
|
createPaginatedResponse,
|
|
26
3
|
getReferer,
|
|
@@ -45,6 +22,29 @@ import {
|
|
|
45
22
|
withPublicCORS,
|
|
46
23
|
withRestrictedCORS
|
|
47
24
|
} from "../../chunk-34L7HTM7.js";
|
|
25
|
+
import {
|
|
26
|
+
boolFormatter,
|
|
27
|
+
createCsvHeader,
|
|
28
|
+
createSimpleCsvResponse,
|
|
29
|
+
createStreamingCsvResponse,
|
|
30
|
+
dateFormatter,
|
|
31
|
+
escapeCsvField,
|
|
32
|
+
rowToCsv
|
|
33
|
+
} from "../../chunk-DVCGAI5N.js";
|
|
34
|
+
import {
|
|
35
|
+
ErrorProcessor,
|
|
36
|
+
errorToResponse,
|
|
37
|
+
handlePrismaError,
|
|
38
|
+
processError,
|
|
39
|
+
throwBadRequestError,
|
|
40
|
+
throwBusinessRuleError,
|
|
41
|
+
throwConflictError,
|
|
42
|
+
throwForbiddenError,
|
|
43
|
+
throwNotFoundError,
|
|
44
|
+
throwUnauthorizedError,
|
|
45
|
+
throwValidationError,
|
|
46
|
+
withErrorHandling
|
|
47
|
+
} from "../../chunk-D4QADM6T.js";
|
|
48
48
|
import "../../chunk-MCPPJI3T.js";
|
|
49
49
|
import "../../chunk-5VZIAXO2.js";
|
|
50
50
|
import "../../chunk-QAIN3WNN.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@withwiz/toolkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Shared utility library for withwiz projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -151,6 +151,7 @@
|
|
|
151
151
|
"./core/utils/optimistic-lock": "./dist/core/utils/optimistic-lock.js",
|
|
152
152
|
"./core/utils/sanitizer": "./dist/core/utils/sanitizer.js",
|
|
153
153
|
"./core/utils/short-code-generator": "./dist/core/utils/short-code-generator.js",
|
|
154
|
+
"./core/utils/startup-banner": "./dist/core/utils/startup-banner.js",
|
|
154
155
|
"./core/utils/timezone": "./dist/core/utils/timezone.js",
|
|
155
156
|
"./core/utils/type-guards": "./dist/core/utils/type-guards.js",
|
|
156
157
|
"./core/utils/url-normalizer": "./dist/core/utils/url-normalizer.js",
|
package/dist/chunk-6E2Q27EN.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
clearTokenCookies
|
|
3
|
-
} from "./chunk-DTRXWS7G.js";
|
|
4
|
-
|
|
5
|
-
// src/next/auth-handlers/logout.handler.ts
|
|
6
|
-
import { NextResponse } from "next/server";
|
|
7
|
-
function createLogoutHandler(_options) {
|
|
8
|
-
return async (_request) => {
|
|
9
|
-
const response = NextResponse.json({ success: true });
|
|
10
|
-
clearTokenCookies(response);
|
|
11
|
-
return response;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
createLogoutHandler
|
|
17
|
-
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MiddlewareChain
|
|
3
|
+
} from "./chunk-WXOWI7BJ.js";
|
|
1
4
|
import {
|
|
2
5
|
rateLimitMiddleware
|
|
3
6
|
} from "./chunk-M4ZVQFOH.js";
|
|
@@ -21,9 +24,6 @@ import {
|
|
|
21
24
|
import {
|
|
22
25
|
initRequestMiddleware
|
|
23
26
|
} from "./chunk-VC2E6KYQ.js";
|
|
24
|
-
import {
|
|
25
|
-
MiddlewareChain
|
|
26
|
-
} from "./chunk-WXOWI7BJ.js";
|
|
27
27
|
|
|
28
28
|
// src/next/middleware/wrappers.ts
|
|
29
29
|
function withPublicApi(handler) {
|
|
File without changes
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IPApiProvider
|
|
3
|
-
} from "./chunk-E27YZK7O.js";
|
|
4
|
-
import {
|
|
5
|
-
IPApiCoProvider
|
|
6
|
-
} from "./chunk-MRNRC45L.js";
|
|
7
1
|
import {
|
|
8
2
|
IPGeolocationProvider
|
|
9
3
|
} from "./chunk-GJYHMHTU.js";
|
|
10
4
|
import {
|
|
11
5
|
MaxMindProvider
|
|
12
6
|
} from "./chunk-R463CTX4.js";
|
|
7
|
+
import {
|
|
8
|
+
IPApiProvider
|
|
9
|
+
} from "./chunk-E27YZK7O.js";
|
|
10
|
+
import {
|
|
11
|
+
IPApiCoProvider
|
|
12
|
+
} from "./chunk-MRNRC45L.js";
|
|
13
13
|
|
|
14
14
|
// src/core/geolocation/providers/index.ts
|
|
15
15
|
var GeoIPProviderFactory = class {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GitHubOAuthProvider
|
|
3
|
+
} from "./chunk-HIZ7USIF.js";
|
|
1
4
|
import {
|
|
2
5
|
GoogleOAuthProvider
|
|
3
6
|
} from "./chunk-GF3DKZIW.js";
|
|
@@ -10,9 +13,6 @@ import {
|
|
|
10
13
|
import {
|
|
11
14
|
MicrosoftOAuthProvider
|
|
12
15
|
} from "./chunk-GSSHHVHF.js";
|
|
13
|
-
import {
|
|
14
|
-
GitHubOAuthProvider
|
|
15
|
-
} from "./chunk-HIZ7USIF.js";
|
|
16
16
|
import {
|
|
17
17
|
OAuthError
|
|
18
18
|
} from "./chunk-5GWGARXI.js";
|