@withwiz/toolkit 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/config.d.ts +3 -0
- package/dist/auth/config.js +1 -1
- package/dist/auth/index.js +3 -3
- package/dist/cache/cache-config.js +5 -5
- package/dist/cache/cache-env.js +4 -4
- package/dist/cache/cache-factory.js +14 -14
- package/dist/cache/cache-invalidation.js +14 -14
- package/dist/cache/cache-redis.js +7 -7
- package/dist/cache/cache-wrapper.js +14 -14
- package/dist/cache/cache.js +25 -25
- package/dist/cache/config.d.ts +3 -0
- package/dist/cache/config.js +2 -2
- package/dist/cache/hybrid-cache-manager.js +9 -9
- package/dist/cache/index.js +25 -25
- package/dist/cache/inmemory-cache-manager.js +4 -4
- package/dist/cache/noop-cache-manager.js +6 -6
- package/dist/cache/redis-cache-manager.js +8 -8
- package/dist/{chunk-HKJCBV3H.js → chunk-2KDLKHTO.js} +6 -6
- package/dist/{chunk-V33BEN6H.js → chunk-3CBGGMIY.js} +15 -7
- package/dist/{chunk-ZFFWKCHN.js → chunk-4HBAPPB2.js} +2 -2
- package/dist/{chunk-M776IH4D.js → chunk-6MI4XLWC.js} +3 -3
- package/dist/{chunk-BY653UR3.js → chunk-6SOQUYOU.js} +2 -2
- package/dist/{chunk-3GKJ763I.js → chunk-7IN4WRSO.js} +12 -12
- package/dist/{chunk-PU2LFTI5.js → chunk-AXCB7SKY.js} +2 -2
- package/dist/{chunk-YCIYDWJU.js → chunk-AYZJN32D.js} +15 -7
- package/dist/{chunk-5P4E6SGV.js → chunk-BDY3AOX5.js} +5 -5
- package/dist/{chunk-KAIGEZAL.js → chunk-BYCFXGQL.js} +3 -3
- package/dist/{chunk-AWFY2HWG.js → chunk-CUZPD3BF.js} +2 -2
- package/dist/{chunk-CZHFHEBG.js → chunk-E54MAI4I.js} +5 -5
- package/dist/{chunk-GRGOD3W5.js → chunk-FD2TXDTO.js} +2 -2
- package/dist/{chunk-FGA7VLYK.js → chunk-FDRIFPG6.js} +2 -2
- package/dist/{chunk-L6M4DZV2.js → chunk-FPESPW6P.js} +1 -1
- package/dist/{chunk-Q7NIAITA.js → chunk-G5OMETUS.js} +1 -1
- package/dist/{chunk-JNB7MWG4.js → chunk-GFWGLWTS.js} +15 -7
- package/dist/{chunk-SNNXLA5F.js → chunk-GQVBWZLH.js} +2 -2
- package/dist/{chunk-MVH5ZPFD.js → chunk-HHCDMWEF.js} +1 -1
- package/dist/{chunk-XZ4HMXSK.js → chunk-J4TTSXDN.js} +3 -3
- package/dist/{chunk-576PAKLR.js → chunk-JOM3N4EJ.js} +1 -1
- package/dist/{chunk-DC2OFQ43.js → chunk-JR7GVCQX.js} +11 -11
- package/dist/{chunk-FIRLRKET.js → chunk-K3HAYBWX.js} +1 -1
- package/dist/{chunk-NE33JZW3.js → chunk-KGHWGLED.js} +4 -4
- package/dist/{chunk-4CSSGCW5.js → chunk-KZUBO2IL.js} +3 -3
- package/dist/{chunk-NWAN2VRP.js → chunk-LD7POV6B.js} +9 -9
- package/dist/{chunk-ZBU2DYLD.js → chunk-LFQ3IQQB.js} +2 -2
- package/dist/{chunk-C3WPAWID.js → chunk-O7CK3CKJ.js} +1 -1
- package/dist/{chunk-RLXRDUBX.js → chunk-OHBAELPZ.js} +15 -7
- package/dist/{chunk-STNIT65W.js → chunk-OIRAH57Y.js} +1 -1
- package/dist/{chunk-ITSXXSFN.js → chunk-OZE5KUS3.js} +15 -7
- package/dist/{chunk-UD7YHLHI.js → chunk-QVWDWROP.js} +1 -1
- package/dist/{chunk-BJWG3LH5.js → chunk-RWVGJUON.js} +6 -6
- package/dist/{chunk-JGGGHEBC.js → chunk-S5UCZ2T3.js} +1 -1
- package/dist/{chunk-5MBKG2ZD.js → chunk-SFPMFVSD.js} +14 -6
- package/dist/{chunk-6VNEAK73.js → chunk-SV7X6HEN.js} +4 -4
- package/dist/{chunk-JTPLPUI7.js → chunk-TFD3DSM2.js} +18 -10
- package/dist/{chunk-USL5SQLZ.js → chunk-TO5CMMQC.js} +2 -2
- package/dist/{chunk-FO77EZCU.js → chunk-VF4EVAMV.js} +1 -1
- package/dist/{chunk-2LCLLZME.js → chunk-WNF2RKFA.js} +7 -7
- package/dist/{chunk-X2QSMX3B.js → chunk-XI4MRH5P.js} +4 -4
- package/dist/config/common.d.ts +3 -0
- package/dist/config/common.js +1 -1
- package/dist/constants/index.js +24 -24
- package/dist/error/error-display.js +2 -2
- package/dist/error/error-handler.js +6 -6
- package/dist/error/index.js +17 -17
- package/dist/geolocation/batch-processor.js +4 -4
- package/dist/geolocation/config.d.ts +3 -0
- package/dist/geolocation/config.js +1 -1
- package/dist/geolocation/index.js +8 -8
- 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.js +11 -11
- package/dist/logger/config.d.ts +3 -0
- package/dist/logger/config.js +1 -1
- package/dist/logger/logger.js +3 -3
- package/dist/middleware/auth.js +8 -8
- package/dist/middleware/cors-config.d.ts +3 -0
- package/dist/middleware/cors-config.js +1 -1
- package/dist/middleware/cors.js +5 -5
- package/dist/middleware/error-handler.js +8 -8
- package/dist/middleware/index.js +20 -20
- package/dist/middleware/middleware-chain.js +4 -4
- package/dist/middleware/rate-limit.js +5 -5
- package/dist/middleware/response-logger.js +4 -4
- package/dist/middleware/security.js +4 -4
- package/dist/middleware/wrappers.js +18 -18
- package/dist/storage/config.d.ts +3 -0
- package/dist/storage/config.js +1 -1
- package/dist/storage/r2-storage.js +2 -2
- package/dist/system/cpu.js +5 -5
- package/dist/system/disk.js +5 -5
- package/dist/system/environment.js +9 -9
- package/dist/system/health-check.js +7 -7
- package/dist/system/index.js +14 -14
- package/dist/system/memory.js +5 -5
- package/dist/system/network.js +5 -5
- package/dist/system/utils.js +4 -4
- package/dist/utils/cors.js +3 -3
- package/dist/utils/csv-export.js +4 -4
- package/dist/utils/error-processor.js +5 -5
- package/dist/utils/index.js +16 -16
- package/package.json +1 -1
- package/dist/{chunk-TQJDNWBL.js → chunk-IJCVFLEY.js} +3 -3
|
@@ -1,29 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NoopCacheManager
|
|
3
|
+
} from "./chunk-FDRIFPG6.js";
|
|
1
4
|
import {
|
|
2
5
|
RedisCacheManager
|
|
3
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KZUBO2IL.js";
|
|
4
7
|
import {
|
|
5
8
|
HybridCacheManager
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-SV7X6HEN.js";
|
|
7
10
|
import {
|
|
8
11
|
InMemoryCacheManager
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import {
|
|
11
|
-
NoopCacheManager
|
|
12
|
-
} from "./chunk-FGA7VLYK.js";
|
|
13
|
-
import {
|
|
14
|
-
getCacheConfig
|
|
15
|
-
} from "./chunk-C3WPAWID.js";
|
|
12
|
+
} from "./chunk-J4TTSXDN.js";
|
|
16
13
|
import {
|
|
17
14
|
isRedisAvailableNow,
|
|
18
15
|
isRedisGloballyDisabled
|
|
19
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-AXCB7SKY.js";
|
|
20
17
|
import {
|
|
21
18
|
logger
|
|
22
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-GQVBWZLH.js";
|
|
20
|
+
import {
|
|
21
|
+
getCacheConfig
|
|
22
|
+
} from "./chunk-O7CK3CKJ.js";
|
|
23
23
|
import {
|
|
24
24
|
getENV,
|
|
25
25
|
isCacheEnabled
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-XI4MRH5P.js";
|
|
27
27
|
|
|
28
28
|
// src/cache/cache-factory.ts
|
|
29
29
|
function getInMemoryConfig() {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
logger
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GQVBWZLH.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-XI4MRH5P.js";
|
|
11
11
|
|
|
12
12
|
// src/cache/cache-redis.ts
|
|
13
13
|
import { Redis } from "@upstash/redis";
|
|
@@ -6,28 +6,36 @@ import {
|
|
|
6
6
|
} from "./chunk-2QH66EVQ.js";
|
|
7
7
|
|
|
8
8
|
// src/storage/config.ts
|
|
9
|
-
var
|
|
9
|
+
var GLOBAL_KEY = "__withwiz_storage_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
|
+
}
|
|
10
17
|
function initializeStorage(config) {
|
|
11
|
-
if (
|
|
18
|
+
if (getConfig()) return;
|
|
12
19
|
if (!config.accountId) throw new ConfigurationError("Storage", "accountId is required");
|
|
13
20
|
if (!config.accessKeyId) throw new ConfigurationError("Storage", "accessKeyId is required");
|
|
14
21
|
if (!config.secretAccessKey) throw new ConfigurationError("Storage", "secretAccessKey is required");
|
|
15
22
|
if (!config.bucketName) throw new ConfigurationError("Storage", "bucketName is required");
|
|
16
23
|
if (config.publicUrl === void 0) configWarn("Storage", "publicUrl not provided");
|
|
17
|
-
|
|
24
|
+
setConfig({
|
|
18
25
|
accountId: config.accountId,
|
|
19
26
|
accessKeyId: config.accessKeyId,
|
|
20
27
|
secretAccessKey: config.secretAccessKey,
|
|
21
28
|
bucketName: config.bucketName,
|
|
22
29
|
publicUrl: config.publicUrl
|
|
23
|
-
};
|
|
30
|
+
});
|
|
24
31
|
}
|
|
25
32
|
function getStorageConfig() {
|
|
26
|
-
|
|
27
|
-
|
|
33
|
+
const config = getConfig();
|
|
34
|
+
if (!config) throw new ConfigurationError("Storage", "Not initialized. Call initializeStorage() first.");
|
|
35
|
+
return config;
|
|
28
36
|
}
|
|
29
37
|
function resetStorage() {
|
|
30
|
-
|
|
38
|
+
globalThis[GLOBAL_KEY] = void 0;
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
export {
|
|
@@ -2,17 +2,17 @@ import {
|
|
|
2
2
|
AppError
|
|
3
3
|
} from "./chunk-KXXROUA5.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
5
|
+
ERROR_CODES
|
|
6
|
+
} from "./chunk-SNVGJPPX.js";
|
|
7
7
|
import {
|
|
8
8
|
getAuthConfig
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-OZE5KUS3.js";
|
|
10
10
|
import {
|
|
11
11
|
JWTManager
|
|
12
12
|
} from "./chunk-2ATBAIRL.js";
|
|
13
13
|
import {
|
|
14
|
-
|
|
15
|
-
} from "./chunk-
|
|
14
|
+
logger
|
|
15
|
+
} from "./chunk-GQVBWZLH.js";
|
|
16
16
|
|
|
17
17
|
// src/middleware/auth.ts
|
|
18
18
|
function setAccessTokenBlacklistChecker(checker) {
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
} from "./chunk-OIVXOT2X.js";
|
|
5
5
|
import {
|
|
6
6
|
getPlatform
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-S5UCZ2T3.js";
|
|
8
8
|
import {
|
|
9
9
|
logger
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-GQVBWZLH.js";
|
|
11
11
|
import {
|
|
12
12
|
getResolvedCacheConfig
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-TFD3DSM2.js";
|
|
14
14
|
|
|
15
15
|
// src/system/health-check.ts
|
|
16
16
|
async function checkServiceHealth(prismaClient) {
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from "./chunk-VSGKVZB4.js";
|
|
7
7
|
import {
|
|
8
8
|
IPGeolocationProvider
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-HHCDMWEF.js";
|
|
10
10
|
import {
|
|
11
11
|
MaxMindProvider
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-G5OMETUS.js";
|
|
13
13
|
|
|
14
14
|
// src/geolocation/providers/index.ts
|
|
15
15
|
var GeoIPProviderFactory = class {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AppError
|
|
3
3
|
} from "./chunk-KXXROUA5.js";
|
|
4
|
-
import {
|
|
5
|
-
logApiRequest,
|
|
6
|
-
logApiResponse,
|
|
7
|
-
logger
|
|
8
|
-
} from "./chunk-SNNXLA5F.js";
|
|
9
4
|
import {
|
|
10
5
|
ERROR_CODES,
|
|
11
6
|
formatErrorMessage
|
|
12
7
|
} from "./chunk-SNVGJPPX.js";
|
|
8
|
+
import {
|
|
9
|
+
logApiRequest,
|
|
10
|
+
logApiResponse,
|
|
11
|
+
logger
|
|
12
|
+
} from "./chunk-GQVBWZLH.js";
|
|
13
13
|
|
|
14
14
|
// src/utils/error-processor.ts
|
|
15
15
|
import { NextResponse } from "next/server";
|
|
@@ -6,9 +6,16 @@ import {
|
|
|
6
6
|
} from "./chunk-2QH66EVQ.js";
|
|
7
7
|
|
|
8
8
|
// src/middleware/cors-config.ts
|
|
9
|
-
var
|
|
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
|
+
}
|
|
10
17
|
function initializeCors(config) {
|
|
11
|
-
if (
|
|
18
|
+
if (getConfig()) return;
|
|
12
19
|
if (!config.allowedOrigins) {
|
|
13
20
|
throw new ConfigurationError("CORS", "allowedOrigins is required");
|
|
14
21
|
}
|
|
@@ -18,19 +25,20 @@ function initializeCors(config) {
|
|
|
18
25
|
if (config.baseUrl === void 0) {
|
|
19
26
|
configWarn("CORS", "baseUrl not provided");
|
|
20
27
|
}
|
|
21
|
-
|
|
28
|
+
setConfig({
|
|
22
29
|
allowedOrigins: [...config.allowedOrigins],
|
|
23
30
|
baseUrl: config.baseUrl
|
|
24
|
-
};
|
|
31
|
+
});
|
|
25
32
|
}
|
|
26
33
|
function getCorsConfig() {
|
|
27
|
-
|
|
34
|
+
const config = getConfig();
|
|
35
|
+
if (!config) {
|
|
28
36
|
throw new ConfigurationError("CORS", "Not initialized. Call initializeCors() first.");
|
|
29
37
|
}
|
|
30
|
-
return
|
|
38
|
+
return config;
|
|
31
39
|
}
|
|
32
40
|
function resetCors() {
|
|
33
|
-
|
|
41
|
+
globalThis[GLOBAL_KEY] = void 0;
|
|
34
42
|
}
|
|
35
43
|
|
|
36
44
|
export {
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AUTH_ERROR_CODE_MAP
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
AppError
|
|
6
|
-
} from "./chunk-KXXROUA5.js";
|
|
3
|
+
} from "./chunk-2KDLKHTO.js";
|
|
7
4
|
import {
|
|
8
5
|
getErrorMessage
|
|
9
6
|
} from "./chunk-Y2JYA2AR.js";
|
|
10
7
|
import {
|
|
11
|
-
|
|
12
|
-
} from "./chunk-
|
|
8
|
+
AppError
|
|
9
|
+
} from "./chunk-KXXROUA5.js";
|
|
13
10
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
ERROR_CODES,
|
|
12
|
+
classifyError
|
|
13
|
+
} from "./chunk-SNVGJPPX.js";
|
|
16
14
|
import {
|
|
17
15
|
AuthError
|
|
18
16
|
} from "./chunk-AIH3F7JV.js";
|
|
19
17
|
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
logger
|
|
19
|
+
} from "./chunk-GQVBWZLH.js";
|
|
20
|
+
import {
|
|
21
|
+
getCommonConfig
|
|
22
|
+
} from "./chunk-SFPMFVSD.js";
|
|
23
23
|
import {
|
|
24
24
|
__spreadValues
|
|
25
25
|
} from "./chunk-ORMEWXMH.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
logger
|
|
3
|
-
} from "./chunk-SNNXLA5F.js";
|
|
4
1
|
import {
|
|
5
2
|
getCorsConfig
|
|
6
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GFWGLWTS.js";
|
|
4
|
+
import {
|
|
5
|
+
logger
|
|
6
|
+
} from "./chunk-GQVBWZLH.js";
|
|
7
7
|
|
|
8
8
|
// src/middleware/cors.ts
|
|
9
9
|
import { NextResponse } from "next/server";
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
isRedisGloballyDisabled,
|
|
4
4
|
notifyRedisError,
|
|
5
5
|
resetRedisGlobalState
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AXCB7SKY.js";
|
|
7
7
|
import {
|
|
8
8
|
logger
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-GQVBWZLH.js";
|
|
10
10
|
import {
|
|
11
11
|
getENV,
|
|
12
12
|
isCacheEnabled
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-XI4MRH5P.js";
|
|
14
14
|
import {
|
|
15
15
|
__spreadValues
|
|
16
16
|
} from "./chunk-ORMEWXMH.js";
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
errorHandlerMiddleware
|
|
3
|
-
} from "./chunk-DC2OFQ43.js";
|
|
4
1
|
import {
|
|
5
2
|
initRequestMiddleware
|
|
6
3
|
} from "./chunk-62Q7DN5G.js";
|
|
7
4
|
import {
|
|
8
5
|
MiddlewareChain
|
|
9
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FPESPW6P.js";
|
|
10
7
|
import {
|
|
11
8
|
rateLimitMiddleware
|
|
12
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6MI4XLWC.js";
|
|
13
10
|
import {
|
|
14
11
|
responseLoggerMiddleware
|
|
15
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-OIRAH57Y.js";
|
|
16
13
|
import {
|
|
17
14
|
securityMiddleware
|
|
18
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-QVWDWROP.js";
|
|
19
16
|
import {
|
|
20
17
|
adminMiddleware,
|
|
21
18
|
authMiddleware,
|
|
22
19
|
optionalAuthMiddleware
|
|
23
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-BDY3AOX5.js";
|
|
24
21
|
import {
|
|
25
22
|
corsMiddleware
|
|
26
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-KGHWGLED.js";
|
|
24
|
+
import {
|
|
25
|
+
errorHandlerMiddleware
|
|
26
|
+
} from "./chunk-JR7GVCQX.js";
|
|
27
27
|
|
|
28
28
|
// src/middleware/wrappers.ts
|
|
29
29
|
function withPublicApi(handler) {
|
|
@@ -6,29 +6,37 @@ import {
|
|
|
6
6
|
} from "./chunk-2QH66EVQ.js";
|
|
7
7
|
|
|
8
8
|
// src/logger/config.ts
|
|
9
|
-
var
|
|
9
|
+
var GLOBAL_KEY = "__withwiz_logger_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
|
+
}
|
|
10
17
|
function initializeLogger(config) {
|
|
11
18
|
var _a, _b, _c, _d, _e;
|
|
12
|
-
if (
|
|
19
|
+
if (getConfig()) return;
|
|
13
20
|
if (config.level === void 0) configWarn("Logger", "level not provided, using default: info");
|
|
14
21
|
if (config.dir === void 0) configWarn("Logger", "dir not provided, using default: ./logs");
|
|
15
22
|
if (config.file === void 0) configWarn("Logger", "file not provided, using default: app.log");
|
|
16
23
|
if (config.fileEnabled === void 0) configWarn("Logger", "fileEnabled not provided, using default: true");
|
|
17
24
|
if (config.consoleEnabled === void 0) configWarn("Logger", "consoleEnabled not provided, using default: true");
|
|
18
|
-
|
|
25
|
+
setConfig({
|
|
19
26
|
level: (_a = config.level) != null ? _a : "info",
|
|
20
27
|
dir: (_b = config.dir) != null ? _b : "./logs",
|
|
21
28
|
file: (_c = config.file) != null ? _c : "app.log",
|
|
22
29
|
fileEnabled: (_d = config.fileEnabled) != null ? _d : true,
|
|
23
30
|
consoleEnabled: (_e = config.consoleEnabled) != null ? _e : true
|
|
24
|
-
};
|
|
31
|
+
});
|
|
25
32
|
}
|
|
26
33
|
function getLoggerConfig() {
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
const config = getConfig();
|
|
35
|
+
if (!config) throw new ConfigurationError("Logger", "Not initialized. Call initializeLogger() first.");
|
|
36
|
+
return config;
|
|
29
37
|
}
|
|
30
38
|
function resetLogger() {
|
|
31
|
-
|
|
39
|
+
globalThis[GLOBAL_KEY] = void 0;
|
|
32
40
|
}
|
|
33
41
|
|
|
34
42
|
export {
|
|
@@ -6,10 +6,17 @@ import {
|
|
|
6
6
|
} from "./chunk-2QH66EVQ.js";
|
|
7
7
|
|
|
8
8
|
// src/auth/config.ts
|
|
9
|
-
var
|
|
9
|
+
var GLOBAL_KEY = "__withwiz_auth_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
|
+
}
|
|
10
17
|
function initializeAuth(config) {
|
|
11
18
|
var _a, _b;
|
|
12
|
-
if (
|
|
19
|
+
if (getConfig()) return;
|
|
13
20
|
if (!config.jwtSecret) {
|
|
14
21
|
throw new ConfigurationError("Auth", "jwtSecret is required");
|
|
15
22
|
}
|
|
@@ -19,20 +26,21 @@ function initializeAuth(config) {
|
|
|
19
26
|
if (!config.refreshTokenExpiry) {
|
|
20
27
|
configWarn("Auth", "refreshTokenExpiry not provided, using default: 30d");
|
|
21
28
|
}
|
|
22
|
-
|
|
29
|
+
setConfig({
|
|
23
30
|
jwtSecret: config.jwtSecret,
|
|
24
31
|
accessTokenExpiry: (_a = config.accessTokenExpiry) != null ? _a : "7d",
|
|
25
32
|
refreshTokenExpiry: (_b = config.refreshTokenExpiry) != null ? _b : "30d"
|
|
26
|
-
};
|
|
33
|
+
});
|
|
27
34
|
}
|
|
28
35
|
function getAuthConfig() {
|
|
29
|
-
|
|
36
|
+
const config = getConfig();
|
|
37
|
+
if (!config) {
|
|
30
38
|
throw new ConfigurationError("Auth", "Not initialized. Call initializeAuth() first.");
|
|
31
39
|
}
|
|
32
|
-
return
|
|
40
|
+
return config;
|
|
33
41
|
}
|
|
34
42
|
function resetAuth() {
|
|
35
|
-
|
|
43
|
+
globalThis[GLOBAL_KEY] = void 0;
|
|
36
44
|
}
|
|
37
45
|
|
|
38
46
|
export {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCacheManager,
|
|
3
3
|
getEffectiveCacheBackend
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7IN4WRSO.js";
|
|
5
|
+
import {
|
|
6
|
+
logger
|
|
7
|
+
} from "./chunk-GQVBWZLH.js";
|
|
5
8
|
import {
|
|
6
9
|
getCacheConfig,
|
|
7
10
|
getCacheTTL
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import {
|
|
10
|
-
logger
|
|
11
|
-
} from "./chunk-SNNXLA5F.js";
|
|
11
|
+
} from "./chunk-O7CK3CKJ.js";
|
|
12
12
|
import {
|
|
13
13
|
isCacheEnabled
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-XI4MRH5P.js";
|
|
15
15
|
|
|
16
16
|
// src/cache/cache-wrapper.ts
|
|
17
17
|
function getCacheBackendLabel() {
|
|
@@ -6,23 +6,31 @@ import {
|
|
|
6
6
|
} from "./chunk-2QH66EVQ.js";
|
|
7
7
|
|
|
8
8
|
// src/config/common.ts
|
|
9
|
-
var
|
|
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
|
+
}
|
|
10
17
|
function initializeCommon(config) {
|
|
11
18
|
var _a;
|
|
12
|
-
if (
|
|
19
|
+
if (getConfig()) return;
|
|
13
20
|
if (!config.nodeEnv) {
|
|
14
21
|
configWarn("Common", "nodeEnv not provided, using default: development");
|
|
15
22
|
}
|
|
16
|
-
|
|
23
|
+
setConfig({ nodeEnv: (_a = config.nodeEnv) != null ? _a : "development" });
|
|
17
24
|
}
|
|
18
25
|
function getCommonConfig() {
|
|
19
|
-
|
|
26
|
+
const config = getConfig();
|
|
27
|
+
if (!config) {
|
|
20
28
|
throw new ConfigurationError("Common", "Not initialized. Call initializeCommon() first.");
|
|
21
29
|
}
|
|
22
|
-
return
|
|
30
|
+
return config;
|
|
23
31
|
}
|
|
24
32
|
function resetCommon() {
|
|
25
|
-
|
|
33
|
+
globalThis[GLOBAL_KEY] = void 0;
|
|
26
34
|
}
|
|
27
35
|
|
|
28
36
|
export {
|