@withwiz/toolkit 0.6.1 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/auth/adapters/prisma/index.js +2 -2
- package/dist/auth/config.d.ts +0 -3
- package/dist/auth/config.js +1 -1
- package/dist/auth/core/jwt/cookie.js +2 -2
- package/dist/auth/core/jwt/index.js +2 -2
- package/dist/auth/core/jwt/types.js +1 -1
- package/dist/auth/core/oauth/index.d.ts +1 -1
- package/dist/auth/core/oauth/index.js +12 -4
- package/dist/auth/core/oauth/providers/index.d.ts +2 -0
- package/dist/auth/core/oauth/providers/index.js +11 -3
- package/dist/auth/core/oauth/providers/kakao.js +1 -1
- package/dist/auth/core/oauth/providers/meta.d.ts +14 -0
- package/dist/auth/core/oauth/providers/meta.js +8 -0
- package/dist/auth/core/oauth/providers/microsoft.d.ts +21 -0
- package/dist/auth/core/oauth/providers/microsoft.js +8 -0
- package/dist/auth/core/password/client-helper.js +1 -1
- package/dist/auth/core/password/index.js +1 -1
- package/dist/auth/handlers/forgot-password.handler.js +1 -1
- package/dist/auth/handlers/index.js +27 -25
- package/dist/auth/handlers/login.handler.js +3 -3
- package/dist/auth/handlers/logout.handler.js +3 -3
- package/dist/auth/handlers/me.handler.js +2 -2
- package/dist/auth/handlers/oauth-authorize.handler.js +7 -5
- package/dist/auth/handlers/oauth-callback.handler.js +10 -8
- package/dist/auth/handlers/refresh.handler.js +3 -3
- package/dist/auth/handlers/register.handler.js +3 -3
- package/dist/auth/handlers/reset-password.handler.js +1 -1
- package/dist/auth/handlers/verify-email.handler.js +1 -1
- package/dist/auth/index.js +8 -6
- package/dist/auth/services/email-verification.service.js +1 -1
- package/dist/auth/services/index.js +12 -12
- package/dist/auth/services/login.service.js +2 -2
- package/dist/auth/services/oauth-callback.service.js +3 -3
- package/dist/auth/services/password-reset.service.js +1 -1
- package/dist/auth/services/register.service.js +2 -2
- package/dist/auth/services/token-refresh.service.js +2 -2
- package/dist/auth/types/index.d.ts +2 -0
- package/dist/auth/types/index.js +1 -1
- package/dist/cache/cache-config.js +4 -4
- package/dist/cache/cache-env.js +3 -3
- package/dist/cache/cache-factory.js +12 -12
- package/dist/cache/cache-invalidation.js +13 -13
- package/dist/cache/cache-redis.js +6 -6
- package/dist/cache/cache-wrapper.js +13 -13
- package/dist/cache/cache.js +14 -14
- package/dist/cache/config.d.ts +0 -14
- package/dist/cache/config.js +1 -1
- package/dist/cache/hybrid-cache-manager.js +8 -8
- package/dist/cache/index.js +14 -14
- package/dist/cache/inmemory-cache-manager.js +3 -3
- package/dist/cache/noop-cache-manager.js +5 -5
- package/dist/cache/redis-cache-manager.js +7 -7
- package/dist/{chunk-3ECJUXLM.js → chunk-2KG2G35D.js} +3 -3
- package/dist/{chunk-3AJHXCDG.js → chunk-34IDAA7V.js} +2 -2
- package/dist/{chunk-77BJRPMN.js → chunk-3LVCK2NQ.js} +4 -4
- package/dist/{chunk-W2GBKW2T.js → chunk-545Q34YU.js} +2 -2
- package/dist/{chunk-HZLJYEOO.js → chunk-57HPJEZB.js} +9 -1
- package/dist/{chunk-2VMTIYLX.js → chunk-7DMKTJHU.js} +2 -2
- package/dist/{chunk-O35V6RIF.js → chunk-7UQZH2OH.js} +3 -3
- package/dist/{chunk-7KZRPDQD.js → chunk-A6FKWYO2.js} +2 -2
- package/dist/{chunk-EXJQKCTN.js → chunk-A7TN46LC.js} +4 -4
- package/dist/{chunk-AYZJN32D.js → chunk-CDLCZB6F.js} +10 -15
- package/dist/{chunk-SR3SQL72.js → chunk-CVFVL5FL.js} +2 -2
- package/dist/{chunk-Q7VFOUFI.js → chunk-D6MIC5AU.js} +1 -1
- package/dist/{chunk-Q6KXN7HL.js → chunk-ENETIGKL.js} +2 -2
- package/dist/{chunk-WNEXLSDB.js → chunk-ERO4PGNO.js} +1 -1
- package/dist/{chunk-BEV7PQM3.js → chunk-F3NGZYL2.js} +1 -1
- package/dist/chunk-FDFPNSKY.js +14 -0
- package/dist/{chunk-G5OMETUS.js → chunk-FDRQUDFH.js} +1 -1
- package/dist/{chunk-ITGUSYUH.js → chunk-G2WAL2T7.js} +3 -1
- package/dist/{chunk-6JY6NUR6.js → chunk-GDX3YQGK.js} +1 -1
- package/dist/{chunk-6B7VU6RZ.js → chunk-JDXC3QIA.js} +0 -1
- package/dist/chunk-K3OYTLXU.js +63 -0
- package/dist/{chunk-MGQV723O.js → chunk-L74XPPH4.js} +1 -1
- package/dist/{chunk-SSS6XSEG.js → chunk-LG6GH4V7.js} +1 -1
- package/dist/{chunk-HHCDMWEF.js → chunk-LGAV5UU2.js} +1 -1
- package/dist/{chunk-3CBGGMIY.js → chunk-LHIVUV7Q.js} +10 -15
- package/dist/{chunk-OHBAELPZ.js → chunk-LMQSV5UK.js} +15 -21
- package/dist/{chunk-A2XAOU55.js → chunk-LNPZZ23G.js} +13 -19
- package/dist/{chunk-X6MGVFT3.js → chunk-LRRQ54YJ.js} +1 -1
- package/dist/chunk-MGBNIDTP.js +100 -0
- package/dist/{chunk-PYVYYO4X.js → chunk-MULM3Q5S.js} +5 -5
- package/dist/{chunk-TEXVRHPF.js → chunk-NOAU2JG7.js} +1 -1
- package/dist/{chunk-WJSMXUZB.js → chunk-NQUYNPSD.js} +1 -1
- package/dist/{chunk-CKK55QFQ.js → chunk-NW3JIRFK.js} +1 -1
- package/dist/{chunk-FI46LV42.js → chunk-O5E36ZIJ.js} +1 -1
- package/dist/{chunk-DBHISLC6.js → chunk-OFSPZUQD.js} +2 -2
- package/dist/{chunk-WRWWB2NU.js → chunk-PT4FA7U4.js} +2 -2
- package/dist/{chunk-VCOA6LMN.js → chunk-QOKDGW3F.js} +1 -1
- package/dist/{chunk-OCI7QCLM.js → chunk-QXIQB6OF.js} +2 -2
- package/dist/{chunk-L5WLPC2T.js → chunk-QXPMO2CO.js} +1 -1
- package/dist/{chunk-LFKPXF5E.js → chunk-RXVX2DCW.js} +2 -2
- package/dist/{chunk-PAF5OGDU.js → chunk-SI2Z26KP.js} +7 -7
- package/dist/{chunk-ETMTDHK2.js → chunk-SOQOAFB2.js} +0 -1
- package/dist/{chunk-4BGAE7NU.js → chunk-TLBY3DUK.js} +1 -1
- package/dist/{chunk-2QQNL4ND.js → chunk-TLZJQR26.js} +17 -6
- package/dist/{chunk-IHUQRVPV.js → chunk-UQM35MAO.js} +2 -2
- package/dist/{chunk-G2Q4TI3Q.js → chunk-V3ZIR4UL.js} +1 -1
- package/dist/chunk-VB64KFBD.js +99 -0
- package/dist/{chunk-GFWGLWTS.js → chunk-WJWCTCWZ.js} +10 -15
- package/dist/{chunk-CMU52MEQ.js → chunk-WLXAEHKK.js} +2 -2
- package/dist/{chunk-SFPMFVSD.js → chunk-WPW4HXW4.js} +9 -15
- package/dist/{chunk-ON7HZ3PW.js → chunk-WSXOKK6N.js} +1 -1
- package/dist/{chunk-S7OQWKUJ.js → chunk-XIJMATSG.js} +3 -3
- package/dist/{chunk-MDTID4D2.js → chunk-XY3ZVORI.js} +1 -1
- package/dist/{chunk-KF3O2DAV.js → chunk-YTXCKIWE.js} +1 -1
- package/dist/{chunk-7JKZBEVB.js → chunk-YX3XMDDI.js} +8 -8
- package/dist/{chunk-CW3INZMV.js → chunk-ZG2XGO44.js} +1 -1
- package/dist/config/common.d.ts +0 -3
- package/dist/config/common.js +1 -1
- package/dist/config/registry.d.ts +5 -13
- package/dist/config/registry.js +1 -1
- package/dist/error/error-handler.js +3 -3
- package/dist/error/index.js +3 -3
- package/dist/geolocation/batch-processor.js +3 -3
- package/dist/geolocation/config.d.ts +0 -3
- package/dist/geolocation/config.js +1 -1
- package/dist/geolocation/index.js +7 -7
- package/dist/geolocation/providers/index.js +4 -4
- package/dist/geolocation/providers/ipgeolocation-provider.js +2 -2
- package/dist/geolocation/providers/maxmind-provider.js +2 -2
- package/dist/initialize.d.ts +2 -1
- package/dist/initialize.js +18 -17
- package/dist/logger/config.d.ts +0 -3
- package/dist/logger/config.js +1 -1
- package/dist/logger/logger.js +2 -2
- package/dist/middleware/auth.js +5 -5
- package/dist/middleware/cors-config.d.ts +0 -3
- package/dist/middleware/cors-config.js +1 -1
- package/dist/middleware/cors.js +4 -4
- package/dist/middleware/error-handler.js +4 -4
- package/dist/middleware/index.js +14 -14
- package/dist/middleware/middleware-chain.js +3 -3
- package/dist/middleware/rate-limit.js +3 -3
- package/dist/middleware/response-logger.js +3 -3
- package/dist/middleware/security.js +3 -3
- package/dist/middleware/wrappers.js +14 -14
- package/dist/storage/config.d.ts +0 -3
- package/dist/storage/config.js +1 -1
- package/dist/storage/r2-storage.js +1 -1
- package/dist/system/cpu.js +4 -4
- package/dist/system/disk.js +4 -4
- package/dist/system/environment.js +8 -8
- package/dist/system/health-check.js +5 -5
- package/dist/system/index.js +13 -13
- package/dist/system/memory.js +4 -4
- package/dist/system/network.js +4 -4
- package/dist/system/utils.js +3 -3
- package/dist/utils/cors.js +3 -3
- package/dist/utils/csv-export.js +3 -3
- package/dist/utils/error-processor.js +3 -3
- package/dist/utils/index.js +7 -7
- package/package.json +1 -1
- package/dist/chunk-GTPUVHSV.js +0 -30
- package/dist/chunk-UCIUAZQT.js +0 -106
- /package/dist/{chunk-T4MDCVUQ.js → chunk-6CLQRZC2.js} +0 -0
|
@@ -35,9 +35,17 @@ var KakaoOAuthProvider = class {
|
|
|
35
35
|
const errorData = await response.text();
|
|
36
36
|
throw new OAuthError(`Kakao token exchange failed: ${errorData}`, "TOKEN_EXCHANGE_FAILED");
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
const data = await response.json();
|
|
39
|
+
if (data.error) {
|
|
40
|
+
throw new OAuthError(
|
|
41
|
+
`Kakao token exchange failed: ${data.error}${data.error_description ? ` - ${data.error_description}` : ""}`,
|
|
42
|
+
"TOKEN_EXCHANGE_FAILED"
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
return data;
|
|
39
46
|
}
|
|
40
47
|
async getUserInfo(accessToken) {
|
|
48
|
+
var _a, _b, _c, _d;
|
|
41
49
|
const response = await fetch("https://kapi.kakao.com/v2/user/me", {
|
|
42
50
|
headers: { Authorization: `Bearer ${accessToken}` }
|
|
43
51
|
});
|
|
@@ -45,14 +53,17 @@ var KakaoOAuthProvider = class {
|
|
|
45
53
|
throw new OAuthError("Failed to get Kakao user info", "USER_INFO_FAILED");
|
|
46
54
|
}
|
|
47
55
|
const data = await response.json();
|
|
48
|
-
|
|
49
|
-
|
|
56
|
+
if (!data.id) {
|
|
57
|
+
throw new OAuthError("Invalid Kakao response: missing id", "INVALID_RESPONSE");
|
|
58
|
+
}
|
|
59
|
+
const account = (_a = data.kakao_account) != null ? _a : {};
|
|
60
|
+
const profile = (_b = account.profile) != null ? _b : {};
|
|
50
61
|
return {
|
|
51
62
|
id: data.id.toString(),
|
|
52
63
|
email: account.email,
|
|
53
|
-
name: profile.nickname
|
|
54
|
-
image: profile.profile_image_url
|
|
55
|
-
emailVerified: account.is_email_verified
|
|
64
|
+
name: (_c = profile.nickname) != null ? _c : null,
|
|
65
|
+
image: (_d = profile.profile_image_url) != null ? _d : null,
|
|
66
|
+
emailVerified: account.is_email_valid === true && account.is_email_verified === true
|
|
56
67
|
};
|
|
57
68
|
}
|
|
58
69
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
logger
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NOAU2JG7.js";
|
|
4
4
|
import {
|
|
5
5
|
getCacheFallbackConfig,
|
|
6
6
|
getConfig,
|
|
7
7
|
getEnv,
|
|
8
8
|
isCacheEnabled,
|
|
9
9
|
validateRedisEnvironment
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-OFSPZUQD.js";
|
|
11
11
|
|
|
12
12
|
// src/cache/cache-redis.ts
|
|
13
13
|
import { Redis } from "@upstash/redis";
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OAuthError
|
|
3
|
+
} from "./chunk-AIH3F7JV.js";
|
|
4
|
+
|
|
5
|
+
// src/auth/core/oauth/providers/microsoft.ts
|
|
6
|
+
import { decodeJwt } from "jose";
|
|
7
|
+
var MicrosoftOAuthProvider = class {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.name = "microsoft";
|
|
10
|
+
}
|
|
11
|
+
getLoginUrl(config, state) {
|
|
12
|
+
const params = new URLSearchParams({
|
|
13
|
+
client_id: config.clientId,
|
|
14
|
+
redirect_uri: config.redirectUri,
|
|
15
|
+
response_type: "code",
|
|
16
|
+
response_mode: "query",
|
|
17
|
+
scope: "openid profile email"
|
|
18
|
+
});
|
|
19
|
+
if (state) {
|
|
20
|
+
params.set("state", state);
|
|
21
|
+
}
|
|
22
|
+
return `https://login.microsoftonline.com/common/oauth2/v2.0/authorize?${params.toString()}`;
|
|
23
|
+
}
|
|
24
|
+
async exchangeCodeForToken(config, code) {
|
|
25
|
+
var _a;
|
|
26
|
+
const response = await fetch("https://login.microsoftonline.com/common/oauth2/v2.0/token", {
|
|
27
|
+
method: "POST",
|
|
28
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
29
|
+
body: new URLSearchParams({
|
|
30
|
+
client_id: config.clientId,
|
|
31
|
+
client_secret: config.clientSecret,
|
|
32
|
+
code,
|
|
33
|
+
grant_type: "authorization_code",
|
|
34
|
+
redirect_uri: config.redirectUri,
|
|
35
|
+
scope: "openid profile email"
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
if (!response.ok) {
|
|
39
|
+
const errorData = await response.text();
|
|
40
|
+
throw new OAuthError(`Microsoft token exchange failed: ${errorData}`, "TOKEN_EXCHANGE_FAILED");
|
|
41
|
+
}
|
|
42
|
+
const data = await response.json();
|
|
43
|
+
if (data.error) {
|
|
44
|
+
throw new OAuthError(
|
|
45
|
+
`Microsoft token exchange failed: ${data.error}${data.error_description ? ` - ${data.error_description}` : ""}`,
|
|
46
|
+
"TOKEN_EXCHANGE_FAILED"
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
if (!data.id_token) {
|
|
50
|
+
throw new OAuthError("Missing id_token in Microsoft token response", "INVALID_RESPONSE");
|
|
51
|
+
}
|
|
52
|
+
const claims = decodeMicrosoftClaims(data.id_token);
|
|
53
|
+
assertMicrosoftClaims(claims, config.clientId);
|
|
54
|
+
return {
|
|
55
|
+
access_token: data.id_token,
|
|
56
|
+
token_type: (_a = data.token_type) != null ? _a : "Bearer",
|
|
57
|
+
expires_in: data.expires_in,
|
|
58
|
+
refresh_token: data.refresh_token,
|
|
59
|
+
scope: data.scope
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
async getUserInfo(idToken) {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
const claims = decodeMicrosoftClaims(idToken);
|
|
65
|
+
assertMicrosoftClaims(claims);
|
|
66
|
+
return {
|
|
67
|
+
id: claims.oid,
|
|
68
|
+
email: (_a = claims.email) != null ? _a : claims.preferred_username,
|
|
69
|
+
name: (_b = claims.name) != null ? _b : null,
|
|
70
|
+
image: null,
|
|
71
|
+
emailVerified: claims.email_verified === true
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
function decodeMicrosoftClaims(token) {
|
|
76
|
+
try {
|
|
77
|
+
return decodeJwt(token);
|
|
78
|
+
} catch (e) {
|
|
79
|
+
throw new OAuthError("Invalid Microsoft id_token: malformed JWT", "INVALID_RESPONSE");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function assertMicrosoftClaims(claims, expectedAud) {
|
|
83
|
+
if (!claims.iss || !/^https:\/\/login\.microsoftonline\.com\/(?!common\/|consumers\/|organizations\/)[\w-]+\/v2\.0$/.test(claims.iss)) {
|
|
84
|
+
throw new OAuthError("Invalid Microsoft id_token: bad iss", "INVALID_RESPONSE");
|
|
85
|
+
}
|
|
86
|
+
if (expectedAud !== void 0 && claims.aud !== expectedAud) {
|
|
87
|
+
throw new OAuthError("Invalid Microsoft id_token: aud mismatch", "INVALID_RESPONSE");
|
|
88
|
+
}
|
|
89
|
+
if (!claims.exp || claims.exp < Math.floor(Date.now() / 1e3)) {
|
|
90
|
+
throw new OAuthError("Invalid Microsoft id_token: expired", "INVALID_RESPONSE");
|
|
91
|
+
}
|
|
92
|
+
if (!claims.oid) {
|
|
93
|
+
throw new OAuthError("Invalid Microsoft id_token: missing oid", "INVALID_RESPONSE");
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export {
|
|
98
|
+
MicrosoftOAuthProvider
|
|
99
|
+
};
|
|
@@ -6,16 +6,10 @@ import {
|
|
|
6
6
|
} from "./chunk-2QH66EVQ.js";
|
|
7
7
|
|
|
8
8
|
// src/middleware/cors-config.ts
|
|
9
|
-
var GLOBAL_KEY = "__withwiz_cors_config";
|
|
10
|
-
function getConfig() {
|
|
11
|
-
var _a;
|
|
12
|
-
return (_a = globalThis[GLOBAL_KEY]) != null ? _a : null;
|
|
13
|
-
}
|
|
14
|
-
function setConfig(config) {
|
|
15
|
-
globalThis[GLOBAL_KEY] = config;
|
|
16
|
-
}
|
|
17
9
|
function initializeCors(config) {
|
|
18
|
-
|
|
10
|
+
var _a;
|
|
11
|
+
(_a = globalThis.__withwiz_config) != null ? _a : globalThis.__withwiz_config = {};
|
|
12
|
+
if (globalThis.__withwiz_config.cors) return;
|
|
19
13
|
if (!config.allowedOrigins) {
|
|
20
14
|
throw new ConfigurationError("CORS", "allowedOrigins is required");
|
|
21
15
|
}
|
|
@@ -25,20 +19,21 @@ function initializeCors(config) {
|
|
|
25
19
|
if (config.baseUrl === void 0) {
|
|
26
20
|
configWarn("CORS", "baseUrl not provided");
|
|
27
21
|
}
|
|
28
|
-
|
|
22
|
+
globalThis.__withwiz_config.cors = {
|
|
29
23
|
allowedOrigins: [...config.allowedOrigins],
|
|
30
24
|
baseUrl: config.baseUrl
|
|
31
|
-
}
|
|
25
|
+
};
|
|
32
26
|
}
|
|
33
27
|
function getCorsConfig() {
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
var _a;
|
|
29
|
+
const cors = (_a = globalThis.__withwiz_config) == null ? void 0 : _a.cors;
|
|
30
|
+
if (!cors) {
|
|
36
31
|
throw new ConfigurationError("CORS", "Not initialized. Call initializeCors() first.");
|
|
37
32
|
}
|
|
38
|
-
return
|
|
33
|
+
return cors;
|
|
39
34
|
}
|
|
40
35
|
function resetCors() {
|
|
41
|
-
globalThis
|
|
36
|
+
if (globalThis.__withwiz_config) delete globalThis.__withwiz_config.cors;
|
|
42
37
|
}
|
|
43
38
|
|
|
44
39
|
export {
|
|
@@ -6,31 +6,25 @@ import {
|
|
|
6
6
|
} from "./chunk-2QH66EVQ.js";
|
|
7
7
|
|
|
8
8
|
// src/config/common.ts
|
|
9
|
-
var GLOBAL_KEY = "__withwiz_common_config";
|
|
10
|
-
function getConfig() {
|
|
11
|
-
var _a;
|
|
12
|
-
return (_a = globalThis[GLOBAL_KEY]) != null ? _a : null;
|
|
13
|
-
}
|
|
14
|
-
function setConfig(config) {
|
|
15
|
-
globalThis[GLOBAL_KEY] = config;
|
|
16
|
-
}
|
|
17
9
|
function initializeCommon(config) {
|
|
18
|
-
var _a;
|
|
19
|
-
|
|
10
|
+
var _a, _b;
|
|
11
|
+
(_a = globalThis.__withwiz_config) != null ? _a : globalThis.__withwiz_config = {};
|
|
12
|
+
if (globalThis.__withwiz_config.common) return;
|
|
20
13
|
if (!config.nodeEnv) {
|
|
21
14
|
configWarn("Common", "nodeEnv not provided, using default: development");
|
|
22
15
|
}
|
|
23
|
-
|
|
16
|
+
globalThis.__withwiz_config.common = { nodeEnv: (_b = config.nodeEnv) != null ? _b : "development" };
|
|
24
17
|
}
|
|
25
18
|
function getCommonConfig() {
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
var _a;
|
|
20
|
+
const common = (_a = globalThis.__withwiz_config) == null ? void 0 : _a.common;
|
|
21
|
+
if (!common) {
|
|
28
22
|
throw new ConfigurationError("Common", "Not initialized. Call initializeCommon() first.");
|
|
29
23
|
}
|
|
30
|
-
return
|
|
24
|
+
return common;
|
|
31
25
|
}
|
|
32
26
|
function resetCommon() {
|
|
33
|
-
globalThis
|
|
27
|
+
if (globalThis.__withwiz_config) delete globalThis.__withwiz_config.common;
|
|
34
28
|
}
|
|
35
29
|
|
|
36
30
|
export {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OAuthCallbackService
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JDXC3QIA.js";
|
|
4
4
|
import {
|
|
5
5
|
OAuthManager
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-57HPJEZB.js";
|
|
7
7
|
import {
|
|
8
8
|
setTokenCookies
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-V3ZIR4UL.js";
|
|
10
10
|
import {
|
|
11
11
|
AuthError
|
|
12
12
|
} from "./chunk-AIH3F7JV.js";
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NoopCacheManager
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ENETIGKL.js";
|
|
4
4
|
import {
|
|
5
5
|
RedisCacheManager
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7UQZH2OH.js";
|
|
7
7
|
import {
|
|
8
8
|
HybridCacheManager
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-A7TN46LC.js";
|
|
10
10
|
import {
|
|
11
11
|
isRedisAvailableNow,
|
|
12
12
|
isRedisGloballyDisabled
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-UQM35MAO.js";
|
|
14
14
|
import {
|
|
15
15
|
InMemoryCacheManager
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-ZG2XGO44.js";
|
|
17
17
|
import {
|
|
18
18
|
logger
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-NOAU2JG7.js";
|
|
20
20
|
import {
|
|
21
21
|
getCacheConfig
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-F3NGZYL2.js";
|
|
23
23
|
import {
|
|
24
24
|
getENV,
|
|
25
25
|
isCacheEnabled
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-OFSPZUQD.js";
|
|
27
27
|
|
|
28
28
|
// src/cache/cache-factory.ts
|
|
29
29
|
function getInMemoryConfig() {
|
package/dist/config/common.d.ts
CHANGED
|
@@ -4,9 +4,6 @@ export interface CommonConfig {
|
|
|
4
4
|
export interface ResolvedCommonConfig {
|
|
5
5
|
nodeEnv: 'development' | 'production' | 'test';
|
|
6
6
|
}
|
|
7
|
-
declare global {
|
|
8
|
-
var __withwiz_common_config: ResolvedCommonConfig | undefined;
|
|
9
|
-
}
|
|
10
7
|
export declare function initializeCommon(config: CommonConfig): void;
|
|
11
8
|
export declare function getCommonConfig(): ResolvedCommonConfig;
|
|
12
9
|
export declare function resetCommon(): void;
|
package/dist/config/common.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Unified Config Registry
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `config.auth` and `getAuthConfig()` return the same object —
|
|
8
|
-
* there is only one source of truth per module.
|
|
4
|
+
* 모든 모듈 설정을 단일 객체 `globalThis.__withwiz_config`에 저장.
|
|
5
|
+
* `config.auth`와 `getAuthConfig()` 모두 같은 객체를 반환한다.
|
|
9
6
|
*/
|
|
10
7
|
import type { ResolvedCommonConfig } from './common';
|
|
11
8
|
import type { ResolvedAuthConfig } from '../auth/config';
|
|
@@ -23,13 +20,8 @@ export interface ConfigRegistry {
|
|
|
23
20
|
geolocation?: ResolvedGeolocationConfig;
|
|
24
21
|
cors?: ResolvedCorsConfig;
|
|
25
22
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
* Throws `TypeError` on any setter attempt.
|
|
30
|
-
*/
|
|
23
|
+
declare global {
|
|
24
|
+
var __withwiz_config: Partial<ConfigRegistry> | undefined;
|
|
25
|
+
}
|
|
31
26
|
export declare const config: ConfigRegistry;
|
|
32
|
-
/**
|
|
33
|
-
* Reset all module stores. For test cleanup only.
|
|
34
|
-
*/
|
|
35
27
|
export declare function resetConfig(): void;
|
package/dist/config/registry.js
CHANGED
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
error_handler_default,
|
|
6
6
|
processError,
|
|
7
7
|
withErrorHandler
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-XY3ZVORI.js";
|
|
9
9
|
import "../chunk-EOEMOXNT.js";
|
|
10
10
|
import "../chunk-SNTLJ646.js";
|
|
11
11
|
import "../chunk-AIH3F7JV.js";
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-NOAU2JG7.js";
|
|
13
|
+
import "../chunk-LMQSV5UK.js";
|
|
14
14
|
import "../chunk-K25ICPU4.js";
|
|
15
15
|
import "../chunk-2QH66EVQ.js";
|
|
16
16
|
import "../chunk-ORMEWXMH.js";
|
package/dist/error/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
errorToResponse,
|
|
16
16
|
processError,
|
|
17
17
|
withErrorHandler
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-XY3ZVORI.js";
|
|
19
19
|
import {
|
|
20
20
|
AppError
|
|
21
21
|
} from "../chunk-EOEMOXNT.js";
|
|
@@ -48,8 +48,8 @@ import {
|
|
|
48
48
|
getLogLevel
|
|
49
49
|
} from "../chunk-SNTLJ646.js";
|
|
50
50
|
import "../chunk-AIH3F7JV.js";
|
|
51
|
-
import "../chunk-
|
|
52
|
-
import "../chunk-
|
|
51
|
+
import "../chunk-NOAU2JG7.js";
|
|
52
|
+
import "../chunk-LMQSV5UK.js";
|
|
53
53
|
import "../chunk-K25ICPU4.js";
|
|
54
54
|
import "../chunk-2QH66EVQ.js";
|
|
55
55
|
import "../chunk-ORMEWXMH.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BatchProcessor,
|
|
3
3
|
createBatchProcessor
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-LG6GH4V7.js";
|
|
5
|
+
import "../chunk-NOAU2JG7.js";
|
|
6
|
+
import "../chunk-LMQSV5UK.js";
|
|
7
7
|
import "../chunk-K25ICPU4.js";
|
|
8
8
|
import "../chunk-2QH66EVQ.js";
|
|
9
9
|
import "../chunk-ORMEWXMH.js";
|
|
@@ -6,9 +6,6 @@ export interface ResolvedGeolocationConfig {
|
|
|
6
6
|
ipgeolocationApiKey?: string;
|
|
7
7
|
maxmindLicenseKey?: string;
|
|
8
8
|
}
|
|
9
|
-
declare global {
|
|
10
|
-
var __withwiz_geolocation_config: ResolvedGeolocationConfig | undefined;
|
|
11
|
-
}
|
|
12
9
|
export declare function initializeGeolocation(config: GeolocationConfig): void;
|
|
13
10
|
export declare function getGeolocationConfig(): ResolvedGeolocationConfig;
|
|
14
11
|
export declare function resetGeolocation(): void;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GeoIPProviderFactory
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-WLXAEHKK.js";
|
|
4
4
|
import {
|
|
5
5
|
IPGeolocationProvider
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-LGAV5UU2.js";
|
|
7
7
|
import {
|
|
8
8
|
MaxMindProvider
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-FDRQUDFH.js";
|
|
10
10
|
import {
|
|
11
11
|
IPApiProvider
|
|
12
12
|
} from "../chunk-DEEJBDJE.js";
|
|
@@ -20,10 +20,10 @@ import {
|
|
|
20
20
|
import {
|
|
21
21
|
BatchProcessor,
|
|
22
22
|
createBatchProcessor
|
|
23
|
-
} from "../chunk-
|
|
24
|
-
import "../chunk-
|
|
25
|
-
import "../chunk-
|
|
26
|
-
import "../chunk-
|
|
23
|
+
} from "../chunk-LG6GH4V7.js";
|
|
24
|
+
import "../chunk-LHIVUV7Q.js";
|
|
25
|
+
import "../chunk-NOAU2JG7.js";
|
|
26
|
+
import "../chunk-LMQSV5UK.js";
|
|
27
27
|
import "../chunk-K25ICPU4.js";
|
|
28
28
|
import "../chunk-2QH66EVQ.js";
|
|
29
29
|
import "../chunk-ORMEWXMH.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GeoIPProviderFactory
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-WLXAEHKK.js";
|
|
4
4
|
import {
|
|
5
5
|
IPGeolocationProvider
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-LGAV5UU2.js";
|
|
7
7
|
import {
|
|
8
8
|
MaxMindProvider
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-FDRQUDFH.js";
|
|
10
10
|
import {
|
|
11
11
|
IPApiProvider
|
|
12
12
|
} from "../../chunk-DEEJBDJE.js";
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
BaseGeoIPProvider,
|
|
18
18
|
truncateString
|
|
19
19
|
} from "../../chunk-AHDPGRXS.js";
|
|
20
|
-
import "../../chunk-
|
|
20
|
+
import "../../chunk-LHIVUV7Q.js";
|
|
21
21
|
import "../../chunk-K25ICPU4.js";
|
|
22
22
|
import "../../chunk-2QH66EVQ.js";
|
|
23
23
|
import "../../chunk-ORMEWXMH.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IPGeolocationProvider
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-LGAV5UU2.js";
|
|
4
4
|
import "../../chunk-AHDPGRXS.js";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-LHIVUV7Q.js";
|
|
6
6
|
import "../../chunk-K25ICPU4.js";
|
|
7
7
|
import "../../chunk-2QH66EVQ.js";
|
|
8
8
|
import "../../chunk-ORMEWXMH.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MaxMindProvider
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-FDRQUDFH.js";
|
|
4
4
|
import "../../chunk-AHDPGRXS.js";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-LHIVUV7Q.js";
|
|
6
6
|
import "../../chunk-K25ICPU4.js";
|
|
7
7
|
import "../../chunk-2QH66EVQ.js";
|
|
8
8
|
import "../../chunk-ORMEWXMH.js";
|
package/dist/initialize.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { CacheConfigInput } from './cache/config';
|
|
|
5
5
|
import type { StorageConfig } from './storage/config';
|
|
6
6
|
import type { GeolocationConfig } from './geolocation/config';
|
|
7
7
|
import type { CorsConfig } from './middleware/cors-config';
|
|
8
|
+
import type { ConfigRegistry } from './config/registry';
|
|
8
9
|
export interface ToolkitConfig {
|
|
9
10
|
nodeEnv?: CommonConfig['nodeEnv'];
|
|
10
11
|
auth?: AuthConfig;
|
|
@@ -14,7 +15,7 @@ export interface ToolkitConfig {
|
|
|
14
15
|
geolocation?: GeolocationConfig;
|
|
15
16
|
cors?: CorsConfig;
|
|
16
17
|
}
|
|
17
|
-
export declare function initialize(
|
|
18
|
+
export declare function initialize(toolkitConfig: ToolkitConfig): ConfigRegistry;
|
|
18
19
|
export type { AuthConfig, LoggerConfig, CacheConfigInput as CacheConfig, StorageConfig, GeolocationConfig, CorsConfig, };
|
|
19
20
|
export { config, resetConfig } from './config/registry';
|
|
20
21
|
export type { ConfigRegistry } from './config/registry';
|