@withwiz/toolkit 0.2.7 → 0.3.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/auth/config.d.ts +13 -0
- package/dist/auth/config.js +13 -0
- package/dist/auth/index.js +18 -18
- package/dist/cache/cache-config.js +6 -3
- package/dist/cache/cache-env.d.ts +11 -20
- package/dist/cache/cache-env.js +5 -6
- package/dist/cache/cache-factory.js +14 -9
- package/dist/cache/cache-invalidation.js +15 -10
- package/dist/cache/cache-redis.js +8 -3
- package/dist/cache/cache-wrapper.js +15 -10
- package/dist/cache/cache.js +25 -17
- package/dist/cache/config.d.ts +113 -0
- package/dist/cache/config.js +13 -0
- package/dist/cache/hybrid-cache-manager.js +10 -5
- package/dist/cache/index.d.ts +2 -1
- package/dist/cache/index.js +25 -17
- package/dist/cache/inmemory-cache-manager.js +6 -2
- package/dist/cache/noop-cache-manager.js +7 -4
- package/dist/cache/redis-cache-manager.js +9 -4
- package/dist/chunk-2LCLLZME.js +122 -0
- package/dist/chunk-2QH66EVQ.js +11 -0
- package/dist/{chunk-YVF4RXOK.js → chunk-3GKJ763I.js} +12 -12
- package/dist/{chunk-XN4YP4XO.js → chunk-4CSSGCW5.js} +5 -5
- package/dist/{chunk-WZDS4QEC.js → chunk-576PAKLR.js} +1 -1
- package/dist/chunk-5MBKG2ZD.js +32 -0
- package/dist/{chunk-74MSBKYW.js → chunk-5P4E6SGV.js} +17 -13
- package/dist/{chunk-R5OFGX3C.js → chunk-6VNEAK73.js} +6 -6
- package/dist/{chunk-S73334QY.js → chunk-AWFY2HWG.js} +2 -2
- package/dist/{chunk-YMIDD4YE.js → chunk-BJWG3LH5.js} +6 -6
- package/dist/{chunk-BX5CNRVS.js → chunk-BY653UR3.js} +2 -2
- package/dist/{chunk-HCTNZM7D.js → chunk-C3WPAWID.js} +1 -1
- package/dist/{chunk-JOGXLVUZ.js → chunk-CZHFHEBG.js} +5 -5
- package/dist/{chunk-P6VSEFZE.js → chunk-DC2OFQ43.js} +18 -10
- package/dist/{chunk-HOMWLK62.js → chunk-FGA7VLYK.js} +2 -2
- package/dist/{chunk-T3YUJYBX.js → chunk-FIRLRKET.js} +1 -1
- package/dist/{chunk-LEWQBXN6.js → chunk-FO77EZCU.js} +1 -1
- package/dist/{chunk-WEDR5GJO.js → chunk-GRGOD3W5.js} +2 -2
- package/dist/{chunk-JWZSWMOM.js → chunk-HKJCBV3H.js} +6 -6
- package/dist/chunk-ITSXXSFN.js +42 -0
- package/dist/{chunk-6WVKLXVT.js → chunk-JGGGHEBC.js} +1 -1
- package/dist/chunk-JNB7MWG4.js +40 -0
- package/dist/chunk-JTPLPUI7.js +102 -0
- package/dist/chunk-K25ICPU4.js +8 -0
- package/dist/{chunk-IT43YQND.js → chunk-KAIGEZAL.js} +20 -5
- package/dist/{chunk-AOZVTVJG.js → chunk-L6M4DZV2.js} +1 -1
- package/dist/{chunk-GSUQE3SZ.js → chunk-LX2EYD74.js} +31 -16
- package/dist/{chunk-QMZ75GBU.js → chunk-M776IH4D.js} +3 -3
- package/dist/{chunk-DH2ZHGW2.js → chunk-MVH5ZPFD.js} +14 -2
- package/dist/{chunk-WDJLAZCW.js → chunk-NE33JZW3.js} +18 -3
- package/dist/{chunk-2NNLUXPF.js → chunk-NWAN2VRP.js} +12 -12
- package/dist/{chunk-I5PCM2JQ.js → chunk-PU2LFTI5.js} +4 -4
- package/dist/{chunk-4NWJ3WCZ.js → chunk-Q7NIAITA.js} +8 -1
- package/dist/chunk-RLXRDUBX.js +38 -0
- package/dist/{chunk-AZASEBSP.js → chunk-S54PFAEU.js} +1 -1
- package/dist/{chunk-5A2L6TXD.js → chunk-SNNXLA5F.js} +34 -15
- package/dist/{chunk-M5LIX3TD.js → chunk-STNIT65W.js} +1 -1
- package/dist/{chunk-MZRYR3UQ.js → chunk-TQJDNWBL.js} +4 -4
- package/dist/{chunk-NJXCFTOE.js → chunk-UD7YHLHI.js} +1 -1
- package/dist/{chunk-GCZOXUDV.js → chunk-USL5SQLZ.js} +50 -10
- package/dist/chunk-V33BEN6H.js +31 -0
- package/dist/chunk-X2QSMX3B.js +156 -0
- package/dist/{chunk-Y6IHEA3Q.js → chunk-XZ4HMXSK.js} +1 -1
- package/dist/chunk-YCIYDWJU.js +37 -0
- package/dist/{chunk-7KCWVRPR.js → chunk-ZBU2DYLD.js} +2 -2
- package/dist/{chunk-67KRDPIH.js → chunk-ZFFWKCHN.js} +2 -2
- package/dist/components/ui/DataTable.js +6 -6
- package/dist/components/ui/data-table/DataTable.js +6 -6
- package/dist/components/ui/data-table/DataTableFilters.js +2 -2
- package/dist/components/ui/data-table/DataTableSearch.js +2 -2
- package/dist/config/common.d.ts +9 -0
- package/dist/config/common.js +13 -0
- package/dist/config/errors.d.ts +3 -0
- package/dist/config/errors.js +7 -0
- package/dist/config/warn.d.ts +4 -0
- package/dist/config/warn.js +7 -0
- package/dist/constants/index.js +23 -23
- package/dist/error/error-display.js +5 -5
- package/dist/error/error-handler.js +7 -3
- package/dist/error/friendly-messages-v2.js +3 -3
- package/dist/error/index.js +20 -16
- package/dist/error/messages/index.js +2 -2
- package/dist/geolocation/batch-processor.js +6 -2
- package/dist/geolocation/config.d.ts +11 -0
- package/dist/geolocation/config.js +13 -0
- package/dist/geolocation/index.js +10 -5
- package/dist/geolocation/providers/index.js +6 -3
- package/dist/geolocation/providers/ipgeolocation-provider.js +4 -1
- package/dist/geolocation/providers/maxmind-provider.js +4 -1
- package/dist/initialize.d.ts +18 -0
- package/dist/initialize.js +41 -0
- package/dist/logger/config.d.ts +17 -0
- package/dist/logger/config.js +13 -0
- package/dist/logger/logger.js +5 -1
- package/dist/middleware/auth.js +8 -3
- package/dist/middleware/cors-config.d.ts +11 -0
- package/dist/middleware/cors-config.js +13 -0
- package/dist/middleware/cors.js +7 -2
- package/dist/middleware/error-handler.js +11 -7
- package/dist/middleware/index.js +25 -19
- package/dist/middleware/middleware-chain.js +6 -2
- package/dist/middleware/rate-limit.js +6 -2
- package/dist/middleware/response-logger.js +6 -2
- package/dist/middleware/security.js +6 -2
- package/dist/middleware/wrappers.js +20 -14
- package/dist/storage/config.d.ts +17 -0
- package/dist/storage/config.js +13 -0
- package/dist/storage/r2-storage.d.ts +4 -0
- package/dist/storage/r2-storage.js +19 -10
- package/dist/system/cpu.js +7 -3
- package/dist/system/disk.js +7 -3
- package/dist/system/environment.js +11 -3
- package/dist/system/health-check.js +9 -3
- package/dist/system/index.js +18 -10
- package/dist/system/memory.js +7 -3
- package/dist/system/network.js +7 -3
- package/dist/system/utils.js +6 -2
- package/dist/types/env.d.ts +12 -2
- package/dist/utils/cors.js +5 -1
- package/dist/utils/csv-export.js +6 -2
- package/dist/utils/error-processor.js +6 -2
- package/dist/utils/index.js +31 -26
- package/package.json +10 -1
- package/dist/chunk-N4XYQB2G.js +0 -193
- package/dist/chunk-OFPRBEO6.js +0 -93
- package/dist/{chunk-TH45RVP7.js → chunk-KHYY4KCV.js} +3 -3
- package/dist/{chunk-EBUEBEJX.js → chunk-QMCOX3DP.js} +0 -0
- package/dist/{chunk-LJEGM4OO.js → chunk-SEZJN4TC.js} +3 -3
- package/dist/{chunk-ASXZ2NZJ.js → chunk-Y2JYA2AR.js} +3 -3
|
@@ -1,16 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getCorsConfig
|
|
3
|
+
} from "./chunk-JNB7MWG4.js";
|
|
4
|
+
import {
|
|
5
|
+
getCommonConfig
|
|
6
|
+
} from "./chunk-5MBKG2ZD.js";
|
|
1
7
|
import {
|
|
2
8
|
__spreadValues
|
|
3
9
|
} from "./chunk-ORMEWXMH.js";
|
|
4
10
|
|
|
5
11
|
// src/utils/cors.ts
|
|
6
12
|
import { NextResponse } from "next/server";
|
|
13
|
+
var _isDevelopment = false;
|
|
14
|
+
try {
|
|
15
|
+
_isDevelopment = getCommonConfig().nodeEnv === "development";
|
|
16
|
+
} catch (e) {
|
|
17
|
+
_isDevelopment = false;
|
|
18
|
+
}
|
|
7
19
|
var globalCorsConfig = {
|
|
8
|
-
isDevelopment:
|
|
20
|
+
isDevelopment: _isDevelopment
|
|
9
21
|
};
|
|
10
22
|
function initCorsConfig(config) {
|
|
11
23
|
globalCorsConfig = __spreadValues(__spreadValues({}, globalCorsConfig), config);
|
|
12
24
|
}
|
|
13
|
-
function
|
|
25
|
+
function getCorsConfig2() {
|
|
14
26
|
return globalCorsConfig;
|
|
15
27
|
}
|
|
16
28
|
function extractDomainsFromUrl(url) {
|
|
@@ -29,13 +41,25 @@ function extractDomainsFromUrl(url) {
|
|
|
29
41
|
}
|
|
30
42
|
}
|
|
31
43
|
function getBaseUrl() {
|
|
32
|
-
|
|
44
|
+
if (globalCorsConfig.baseUrl) {
|
|
45
|
+
return globalCorsConfig.baseUrl;
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
const middlewareCorsConfig = getCorsConfig();
|
|
49
|
+
if (middlewareCorsConfig.baseUrl) {
|
|
50
|
+
return middlewareCorsConfig.baseUrl;
|
|
51
|
+
}
|
|
52
|
+
} catch (e) {
|
|
53
|
+
}
|
|
54
|
+
return "http://localhost:3000";
|
|
33
55
|
}
|
|
34
56
|
function getAllowedOrigins() {
|
|
57
|
+
var _a;
|
|
35
58
|
const origins = /* @__PURE__ */ new Set();
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
59
|
+
try {
|
|
60
|
+
const middlewareCorsConfig = getCorsConfig();
|
|
61
|
+
middlewareCorsConfig.allowedOrigins.forEach((origin) => origins.add(origin));
|
|
62
|
+
} catch (e) {
|
|
39
63
|
}
|
|
40
64
|
const baseUrl = getBaseUrl();
|
|
41
65
|
if (baseUrl && baseUrl !== "http://localhost:3000") {
|
|
@@ -45,16 +69,32 @@ function getAllowedOrigins() {
|
|
|
45
69
|
if (globalCorsConfig.additionalOrigins) {
|
|
46
70
|
globalCorsConfig.additionalOrigins.forEach((origin) => origins.add(origin));
|
|
47
71
|
}
|
|
48
|
-
|
|
72
|
+
let isDev = (_a = globalCorsConfig.isDevelopment) != null ? _a : false;
|
|
73
|
+
if (!isDev) {
|
|
74
|
+
try {
|
|
75
|
+
isDev = getCommonConfig().nodeEnv === "development";
|
|
76
|
+
} catch (e) {
|
|
77
|
+
isDev = false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (isDev) {
|
|
49
81
|
origins.add("http://localhost:3000");
|
|
50
82
|
origins.add("http://127.0.0.1:3000");
|
|
51
83
|
}
|
|
52
84
|
return Array.from(origins).filter(Boolean);
|
|
53
85
|
}
|
|
54
86
|
function isOriginAllowed(origin) {
|
|
87
|
+
var _a;
|
|
55
88
|
if (!origin) return true;
|
|
56
|
-
|
|
57
|
-
if (
|
|
89
|
+
let isDevEnv = (_a = globalCorsConfig.isDevelopment) != null ? _a : false;
|
|
90
|
+
if (!isDevEnv) {
|
|
91
|
+
try {
|
|
92
|
+
isDevEnv = getCommonConfig().nodeEnv === "development";
|
|
93
|
+
} catch (e) {
|
|
94
|
+
isDevEnv = false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (isDevEnv && origin.includes("localhost")) {
|
|
58
98
|
return true;
|
|
59
99
|
}
|
|
60
100
|
return getAllowedOrigins().includes(origin);
|
|
@@ -122,7 +162,7 @@ function withPublicCORS(handler) {
|
|
|
122
162
|
|
|
123
163
|
export {
|
|
124
164
|
initCorsConfig,
|
|
125
|
-
getCorsConfig,
|
|
165
|
+
getCorsConfig2 as getCorsConfig,
|
|
126
166
|
getAllowedOrigins,
|
|
127
167
|
isOriginAllowed,
|
|
128
168
|
setCorsHeaders,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
configWarn
|
|
3
|
+
} from "./chunk-K25ICPU4.js";
|
|
4
|
+
import {
|
|
5
|
+
ConfigurationError
|
|
6
|
+
} from "./chunk-2QH66EVQ.js";
|
|
7
|
+
|
|
8
|
+
// src/geolocation/config.ts
|
|
9
|
+
var _config = null;
|
|
10
|
+
function initializeGeolocation(config) {
|
|
11
|
+
if (_config) return;
|
|
12
|
+
if (!config.ipgeolocationApiKey) configWarn("Geolocation", "ipgeolocationApiKey not provided, IPGeolocation provider will be unavailable");
|
|
13
|
+
if (!config.maxmindLicenseKey) configWarn("Geolocation", "maxmindLicenseKey not provided, MaxMind provider will be unavailable");
|
|
14
|
+
_config = {
|
|
15
|
+
ipgeolocationApiKey: config.ipgeolocationApiKey,
|
|
16
|
+
maxmindLicenseKey: config.maxmindLicenseKey
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function getGeolocationConfig() {
|
|
20
|
+
if (!_config) throw new ConfigurationError("Geolocation", "Not initialized. Call initializeGeolocation() first.");
|
|
21
|
+
return _config;
|
|
22
|
+
}
|
|
23
|
+
function resetGeolocation() {
|
|
24
|
+
_config = null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
initializeGeolocation,
|
|
29
|
+
getGeolocationConfig,
|
|
30
|
+
resetGeolocation
|
|
31
|
+
};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getResolvedCacheConfig
|
|
3
|
+
} from "./chunk-JTPLPUI7.js";
|
|
4
|
+
import {
|
|
5
|
+
getCommonConfig
|
|
6
|
+
} from "./chunk-5MBKG2ZD.js";
|
|
7
|
+
|
|
8
|
+
// src/cache/cache-env.ts
|
|
9
|
+
function _getNodeEnv() {
|
|
10
|
+
try {
|
|
11
|
+
return getCommonConfig().nodeEnv;
|
|
12
|
+
} catch (e) {
|
|
13
|
+
return "development";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function getConfig() {
|
|
17
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba;
|
|
18
|
+
const cc = getResolvedCacheConfig();
|
|
19
|
+
const nodeEnv = _getNodeEnv();
|
|
20
|
+
return {
|
|
21
|
+
env: {
|
|
22
|
+
NODE_ENV: nodeEnv,
|
|
23
|
+
UPSTASH_REDIS_REST_URL: (_a = cc.redis) == null ? void 0 : _a.url,
|
|
24
|
+
UPSTASH_REDIS_REST_TOKEN: (_b = cc.redis) == null ? void 0 : _b.token,
|
|
25
|
+
CACHE_ENABLED: cc.enabled
|
|
26
|
+
},
|
|
27
|
+
ENV: {
|
|
28
|
+
REDIS: {
|
|
29
|
+
URL: (_c = cc.redis) == null ? void 0 : _c.url,
|
|
30
|
+
TOKEN: (_d = cc.redis) == null ? void 0 : _d.token,
|
|
31
|
+
IS_AVAILABLE: !!((_e = cc.redis) == null ? void 0 : _e.url) && !!((_f = cc.redis) == null ? void 0 : _f.token),
|
|
32
|
+
ENABLED: (_h = (_g = cc.redis) == null ? void 0 : _g.enabled) != null ? _h : false
|
|
33
|
+
},
|
|
34
|
+
CACHE: {
|
|
35
|
+
ENABLED: cc.enabled,
|
|
36
|
+
REDIS: { ENABLED: (_j = (_i = cc.redis) == null ? void 0 : _i.enabled) != null ? _j : false },
|
|
37
|
+
INMEMORY: {
|
|
38
|
+
ENABLED: cc.inmemory.enabled,
|
|
39
|
+
MAX_SIZE: cc.inmemory.maxSize,
|
|
40
|
+
MAX_MB: cc.inmemory.maxMb,
|
|
41
|
+
EVICTION: cc.inmemory.eviction,
|
|
42
|
+
CLEANUP_INTERVAL: cc.inmemory.cleanupInterval
|
|
43
|
+
},
|
|
44
|
+
TTL: cc.ttl,
|
|
45
|
+
ANALYTICS: {
|
|
46
|
+
ENABLED: (_l = (_k = cc.categories.ANALYTICS) == null ? void 0 : _k.enabled) != null ? _l : true,
|
|
47
|
+
DURATION: (_n = (_m = cc.categories.ANALYTICS) == null ? void 0 : _m.duration) != null ? _n : 1800
|
|
48
|
+
},
|
|
49
|
+
USER: {
|
|
50
|
+
ENABLED: (_p = (_o = cc.categories.USER) == null ? void 0 : _o.enabled) != null ? _p : true,
|
|
51
|
+
DURATION: (_r = (_q = cc.categories.USER) == null ? void 0 : _q.duration) != null ? _r : 600
|
|
52
|
+
},
|
|
53
|
+
GEOIP: {
|
|
54
|
+
ENABLED: (_t = (_s = cc.categories.GEOIP) == null ? void 0 : _s.enabled) != null ? _t : true,
|
|
55
|
+
DURATION: (_v = (_u = cc.categories.GEOIP) == null ? void 0 : _u.duration) != null ? _v : 2592e3
|
|
56
|
+
},
|
|
57
|
+
SETTINGS: {
|
|
58
|
+
ENABLED: (_x = (_w = cc.categories.SETTINGS) == null ? void 0 : _w.enabled) != null ? _x : true,
|
|
59
|
+
DURATION: (_z = (_y = cc.categories.SETTINGS) == null ? void 0 : _y.duration) != null ? _z : 1800
|
|
60
|
+
},
|
|
61
|
+
RESERVED_WORDS: {
|
|
62
|
+
ENABLED: (_B = (_A = cc.categories.RESERVED_WORDS) == null ? void 0 : _A.enabled) != null ? _B : true,
|
|
63
|
+
DURATION: (_D = (_C = cc.categories.RESERVED_WORDS) == null ? void 0 : _C.duration) != null ? _D : 1800
|
|
64
|
+
},
|
|
65
|
+
ALIAS: {
|
|
66
|
+
ENABLED: (_F = (_E = cc.categories.ALIAS) == null ? void 0 : _E.enabled) != null ? _F : true,
|
|
67
|
+
DURATION: (_H = (_G = cc.categories.ALIAS) == null ? void 0 : _G.duration) != null ? _H : 300
|
|
68
|
+
},
|
|
69
|
+
COMMUNITY: {
|
|
70
|
+
ENABLED: (_J = (_I = cc.categories.COMMUNITY) == null ? void 0 : _I.enabled) != null ? _J : true,
|
|
71
|
+
DURATION: (_L = (_K = cc.categories.COMMUNITY) == null ? void 0 : _K.duration) != null ? _L : 900
|
|
72
|
+
},
|
|
73
|
+
LINK: {
|
|
74
|
+
ENABLED: (_N = (_M = cc.categories.LINK) == null ? void 0 : _M.enabled) != null ? _N : true,
|
|
75
|
+
DURATION: (_P = (_O = cc.categories.LINK) == null ? void 0 : _O.duration) != null ? _P : 1800
|
|
76
|
+
},
|
|
77
|
+
RATE_LIMIT: {
|
|
78
|
+
ENABLED: true,
|
|
79
|
+
DURATION: (_R = (_Q = cc.categories.RATE_LIMIT) == null ? void 0 : _Q.duration) != null ? _R : 60
|
|
80
|
+
},
|
|
81
|
+
URL_TOKEN: {
|
|
82
|
+
ENABLED: (_T = (_S = cc.categories.URL_TOKEN) == null ? void 0 : _S.enabled) != null ? _T : true,
|
|
83
|
+
DURATION: (_V = (_U = cc.categories.URL_TOKEN) == null ? void 0 : _U.duration) != null ? _V : 300
|
|
84
|
+
},
|
|
85
|
+
API_KEY: {
|
|
86
|
+
ENABLED: (_X = (_W = cc.categories.API_KEY) == null ? void 0 : _W.enabled) != null ? _X : true,
|
|
87
|
+
DURATION: (_Z = (_Y = cc.categories.API_KEY) == null ? void 0 : _Y.duration) != null ? _Z : 300
|
|
88
|
+
},
|
|
89
|
+
API_CONFIG: {
|
|
90
|
+
ENABLED: (_$ = (__ = cc.categories.API_CONFIG) == null ? void 0 : __.enabled) != null ? _$ : true,
|
|
91
|
+
DURATION: (_ba = (_aa = cc.categories.API_CONFIG) == null ? void 0 : _aa.duration) != null ? _ba : 600
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
isCacheEnabled: () => cc.enabled,
|
|
96
|
+
isRedisAvailable: () => {
|
|
97
|
+
var _a2, _b2;
|
|
98
|
+
return !!((_a2 = cc.redis) == null ? void 0 : _a2.url) && !!((_b2 = cc.redis) == null ? void 0 : _b2.token);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
var getEnv = () => getConfig().env;
|
|
103
|
+
var getENV = () => getConfig().ENV;
|
|
104
|
+
var isCacheEnabled = () => getResolvedCacheConfig().enabled;
|
|
105
|
+
function validateRedisEnvironment() {
|
|
106
|
+
var _a, _b;
|
|
107
|
+
const errors = [];
|
|
108
|
+
const cc = getResolvedCacheConfig();
|
|
109
|
+
const redisUrl = (_a = cc.redis) == null ? void 0 : _a.url;
|
|
110
|
+
const redisToken = (_b = cc.redis) == null ? void 0 : _b.token;
|
|
111
|
+
if (!redisUrl) {
|
|
112
|
+
errors.push("UPSTASH_REDIS_REST_URL is not configured.");
|
|
113
|
+
} else if (redisUrl.trim() === "") {
|
|
114
|
+
errors.push("UPSTASH_REDIS_REST_URL is an empty string.");
|
|
115
|
+
}
|
|
116
|
+
if (!redisToken) {
|
|
117
|
+
errors.push("UPSTASH_REDIS_REST_TOKEN is not configured.");
|
|
118
|
+
} else if (redisToken.trim() === "") {
|
|
119
|
+
errors.push("UPSTASH_REDIS_REST_TOKEN is an empty string.");
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
isValid: errors.length === 0,
|
|
123
|
+
errors
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function getCacheFallbackConfig() {
|
|
127
|
+
const fallback = getResolvedCacheConfig().fallback;
|
|
128
|
+
return {
|
|
129
|
+
redisErrorThresholdGlobal: fallback.redisErrorThresholdGlobal,
|
|
130
|
+
redisErrorThresholdLocal: fallback.redisErrorThresholdLocal,
|
|
131
|
+
redisReconnectInterval: fallback.redisReconnectInterval,
|
|
132
|
+
fallbackOnRedisError: fallback.fallbackOnRedisError,
|
|
133
|
+
writeToMemory: fallback.writeToMemory
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function getCacheHealthConfig() {
|
|
137
|
+
const health = getResolvedCacheConfig().health;
|
|
138
|
+
return {
|
|
139
|
+
errorRateThreshold: health.errorRateThreshold,
|
|
140
|
+
hitRateThreshold: health.hitRateThreshold,
|
|
141
|
+
reportHitRateThreshold: health.reportHitRateThreshold,
|
|
142
|
+
reportResponseTimeThreshold: health.reportResponseTimeThreshold,
|
|
143
|
+
reportInvalidationThreshold: health.reportInvalidationThreshold,
|
|
144
|
+
reportMinRequests: health.reportMinRequests
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export {
|
|
149
|
+
getConfig,
|
|
150
|
+
getEnv,
|
|
151
|
+
getENV,
|
|
152
|
+
isCacheEnabled,
|
|
153
|
+
validateRedisEnvironment,
|
|
154
|
+
getCacheFallbackConfig,
|
|
155
|
+
getCacheHealthConfig
|
|
156
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
configWarn
|
|
3
|
+
} from "./chunk-K25ICPU4.js";
|
|
4
|
+
import {
|
|
5
|
+
ConfigurationError
|
|
6
|
+
} from "./chunk-2QH66EVQ.js";
|
|
7
|
+
|
|
8
|
+
// src/storage/config.ts
|
|
9
|
+
var _config = null;
|
|
10
|
+
function initializeStorage(config) {
|
|
11
|
+
if (_config) return;
|
|
12
|
+
if (!config.accountId) throw new ConfigurationError("Storage", "accountId is required");
|
|
13
|
+
if (!config.accessKeyId) throw new ConfigurationError("Storage", "accessKeyId is required");
|
|
14
|
+
if (!config.secretAccessKey) throw new ConfigurationError("Storage", "secretAccessKey is required");
|
|
15
|
+
if (!config.bucketName) throw new ConfigurationError("Storage", "bucketName is required");
|
|
16
|
+
if (config.publicUrl === void 0) configWarn("Storage", "publicUrl not provided");
|
|
17
|
+
_config = {
|
|
18
|
+
accountId: config.accountId,
|
|
19
|
+
accessKeyId: config.accessKeyId,
|
|
20
|
+
secretAccessKey: config.secretAccessKey,
|
|
21
|
+
bucketName: config.bucketName,
|
|
22
|
+
publicUrl: config.publicUrl
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function getStorageConfig() {
|
|
26
|
+
if (!_config) throw new ConfigurationError("Storage", "Not initialized. Call initializeStorage() first.");
|
|
27
|
+
return _config;
|
|
28
|
+
}
|
|
29
|
+
function resetStorage() {
|
|
30
|
+
_config = null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
initializeStorage,
|
|
35
|
+
getStorageConfig,
|
|
36
|
+
resetStorage
|
|
37
|
+
};
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
formatBytesPerSec,
|
|
4
4
|
runCommand,
|
|
5
5
|
runMacCommand
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-JGGGHEBC.js";
|
|
7
7
|
import {
|
|
8
8
|
logger
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-SNNXLA5F.js";
|
|
10
10
|
|
|
11
11
|
// src/system/network.ts
|
|
12
12
|
async function getNetworkInfo() {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DataTable
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-LJEGM4OO.js";
|
|
5
|
-
import "../../chunk-IPXPCBDO.js";
|
|
6
|
-
import "../../chunk-TH45RVP7.js";
|
|
3
|
+
} from "../../chunk-LX2EYD74.js";
|
|
7
4
|
import "../../chunk-7IY3RQQL.js";
|
|
8
5
|
import "../../chunk-MAATEX2R.js";
|
|
6
|
+
import "../../chunk-SEZJN4TC.js";
|
|
7
|
+
import "../../chunk-IPXPCBDO.js";
|
|
8
|
+
import "../../chunk-KHYY4KCV.js";
|
|
9
9
|
import "../../chunk-NY5QXT33.js";
|
|
10
|
+
import "../../chunk-34WAGUT5.js";
|
|
11
|
+
import "../../chunk-RJUVBBZG.js";
|
|
10
12
|
import "../../chunk-IJEZ7G7S.js";
|
|
11
13
|
import "../../chunk-YJWLWUFK.js";
|
|
12
14
|
import "../../chunk-WDUFQFDP.js";
|
|
13
|
-
import "../../chunk-34WAGUT5.js";
|
|
14
15
|
import "../../chunk-F6LCSFSU.js";
|
|
15
16
|
import "../../chunk-L25BNU3E.js";
|
|
16
|
-
import "../../chunk-RJUVBBZG.js";
|
|
17
17
|
import "../../chunk-62FLBG6B.js";
|
|
18
18
|
import "../../chunk-ORMEWXMH.js";
|
|
19
19
|
export {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
DataTable
|
|
4
|
-
} from "../../../chunk-
|
|
5
|
-
import "../../../chunk-LJEGM4OO.js";
|
|
6
|
-
import "../../../chunk-IPXPCBDO.js";
|
|
7
|
-
import "../../../chunk-TH45RVP7.js";
|
|
4
|
+
} from "../../../chunk-LX2EYD74.js";
|
|
8
5
|
import "../../../chunk-7IY3RQQL.js";
|
|
9
6
|
import "../../../chunk-MAATEX2R.js";
|
|
7
|
+
import "../../../chunk-SEZJN4TC.js";
|
|
8
|
+
import "../../../chunk-IPXPCBDO.js";
|
|
9
|
+
import "../../../chunk-KHYY4KCV.js";
|
|
10
10
|
import "../../../chunk-NY5QXT33.js";
|
|
11
|
+
import "../../../chunk-34WAGUT5.js";
|
|
12
|
+
import "../../../chunk-RJUVBBZG.js";
|
|
11
13
|
import "../../../chunk-IJEZ7G7S.js";
|
|
12
14
|
import "../../../chunk-YJWLWUFK.js";
|
|
13
15
|
import "../../../chunk-WDUFQFDP.js";
|
|
14
|
-
import "../../../chunk-34WAGUT5.js";
|
|
15
16
|
import "../../../chunk-F6LCSFSU.js";
|
|
16
17
|
import "../../../chunk-L25BNU3E.js";
|
|
17
|
-
import "../../../chunk-RJUVBBZG.js";
|
|
18
18
|
import "../../../chunk-62FLBG6B.js";
|
|
19
19
|
import "../../../chunk-ORMEWXMH.js";
|
|
20
20
|
export {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
DataTableFilters
|
|
4
|
-
} from "../../../chunk-
|
|
4
|
+
} from "../../../chunk-SEZJN4TC.js";
|
|
5
|
+
import "../../../chunk-RJUVBBZG.js";
|
|
5
6
|
import "../../../chunk-IJEZ7G7S.js";
|
|
6
7
|
import "../../../chunk-WDUFQFDP.js";
|
|
7
8
|
import "../../../chunk-L25BNU3E.js";
|
|
8
|
-
import "../../../chunk-RJUVBBZG.js";
|
|
9
9
|
import "../../../chunk-62FLBG6B.js";
|
|
10
10
|
import "../../../chunk-ORMEWXMH.js";
|
|
11
11
|
export {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
DataTableSearch
|
|
4
|
-
} from "../../../chunk-
|
|
4
|
+
} from "../../../chunk-KHYY4KCV.js";
|
|
5
5
|
import "../../../chunk-NY5QXT33.js";
|
|
6
|
-
import "../../../chunk-L25BNU3E.js";
|
|
7
6
|
import "../../../chunk-RJUVBBZG.js";
|
|
7
|
+
import "../../../chunk-L25BNU3E.js";
|
|
8
8
|
import "../../../chunk-62FLBG6B.js";
|
|
9
9
|
import "../../../chunk-ORMEWXMH.js";
|
|
10
10
|
export {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface CommonConfig {
|
|
2
|
+
nodeEnv?: 'development' | 'production' | 'test';
|
|
3
|
+
}
|
|
4
|
+
export interface ResolvedCommonConfig {
|
|
5
|
+
nodeEnv: 'development' | 'production' | 'test';
|
|
6
|
+
}
|
|
7
|
+
export declare function initializeCommon(config: CommonConfig): void;
|
|
8
|
+
export declare function getCommonConfig(): ResolvedCommonConfig;
|
|
9
|
+
export declare function resetCommon(): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getCommonConfig,
|
|
3
|
+
initializeCommon,
|
|
4
|
+
resetCommon
|
|
5
|
+
} from "../chunk-5MBKG2ZD.js";
|
|
6
|
+
import "../chunk-K25ICPU4.js";
|
|
7
|
+
import "../chunk-2QH66EVQ.js";
|
|
8
|
+
import "../chunk-ORMEWXMH.js";
|
|
9
|
+
export {
|
|
10
|
+
getCommonConfig,
|
|
11
|
+
initializeCommon,
|
|
12
|
+
resetCommon
|
|
13
|
+
};
|
package/dist/constants/index.js
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DATE,
|
|
3
|
+
FILE_UPLOAD,
|
|
4
|
+
NUMERIC,
|
|
5
|
+
PASSWORD,
|
|
6
|
+
TEXT,
|
|
7
|
+
URL,
|
|
8
|
+
USER_INPUT
|
|
9
|
+
} from "../chunk-LNV2E4I6.js";
|
|
10
|
+
import {
|
|
11
|
+
ERROR_CODES,
|
|
12
|
+
HTTP_STATUS,
|
|
13
|
+
classifyError,
|
|
14
|
+
formatErrorMessage,
|
|
15
|
+
getAllErrorCodes,
|
|
16
|
+
getDefaultErrorMessage,
|
|
17
|
+
getErrorByCode,
|
|
18
|
+
getErrorCategory,
|
|
19
|
+
getErrorCodesByCategory,
|
|
20
|
+
getErrorInfo,
|
|
21
|
+
getHttpStatus,
|
|
22
|
+
getLogLevel
|
|
23
|
+
} from "../chunk-SNVGJPPX.js";
|
|
1
24
|
import {
|
|
2
25
|
GENERIC_CONFIRM_MESSAGES,
|
|
3
26
|
GENERIC_ERROR_MESSAGES,
|
|
@@ -22,29 +45,6 @@ import {
|
|
|
22
45
|
SECURITY_HEADERS,
|
|
23
46
|
SESSION
|
|
24
47
|
} from "../chunk-JLLMTTQ4.js";
|
|
25
|
-
import {
|
|
26
|
-
DATE,
|
|
27
|
-
FILE_UPLOAD,
|
|
28
|
-
NUMERIC,
|
|
29
|
-
PASSWORD,
|
|
30
|
-
TEXT,
|
|
31
|
-
URL,
|
|
32
|
-
USER_INPUT
|
|
33
|
-
} from "../chunk-LNV2E4I6.js";
|
|
34
|
-
import {
|
|
35
|
-
ERROR_CODES,
|
|
36
|
-
HTTP_STATUS,
|
|
37
|
-
classifyError,
|
|
38
|
-
formatErrorMessage,
|
|
39
|
-
getAllErrorCodes,
|
|
40
|
-
getDefaultErrorMessage,
|
|
41
|
-
getErrorByCode,
|
|
42
|
-
getErrorCategory,
|
|
43
|
-
getErrorCodesByCategory,
|
|
44
|
-
getErrorInfo,
|
|
45
|
-
getHttpStatus,
|
|
46
|
-
getLogLevel
|
|
47
|
-
} from "../chunk-SNVGJPPX.js";
|
|
48
48
|
import "../chunk-ORMEWXMH.js";
|
|
49
49
|
export {
|
|
50
50
|
API_KEY,
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
getErrorIcon,
|
|
6
6
|
handleApiResponse,
|
|
7
7
|
showFriendlyError
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-TQJDNWBL.js";
|
|
9
|
+
import "../chunk-KXXROUA5.js";
|
|
9
10
|
import {
|
|
10
11
|
getErrorDisplayInfo,
|
|
11
12
|
getFriendlyMessage
|
|
12
|
-
} from "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-IYXMGIEP.js";
|
|
13
|
+
} from "../chunk-S54PFAEU.js";
|
|
14
|
+
import "../chunk-Y2JYA2AR.js";
|
|
15
15
|
import "../chunk-HCF3C3AQ.js";
|
|
16
|
-
import "../chunk-
|
|
16
|
+
import "../chunk-IYXMGIEP.js";
|
|
17
17
|
import "../chunk-SNVGJPPX.js";
|
|
18
18
|
import "../chunk-ORMEWXMH.js";
|
|
19
19
|
export {
|
|
@@ -5,11 +5,15 @@ import {
|
|
|
5
5
|
error_handler_default,
|
|
6
6
|
processError,
|
|
7
7
|
withErrorHandler
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-HKJCBV3H.js";
|
|
9
9
|
import "../chunk-KXXROUA5.js";
|
|
10
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-SNNXLA5F.js";
|
|
11
|
+
import "../chunk-RLXRDUBX.js";
|
|
12
|
+
import "../chunk-5MBKG2ZD.js";
|
|
13
|
+
import "../chunk-K25ICPU4.js";
|
|
14
|
+
import "../chunk-2QH66EVQ.js";
|
|
11
15
|
import "../chunk-AIH3F7JV.js";
|
|
12
|
-
import "../chunk-
|
|
16
|
+
import "../chunk-SNVGJPPX.js";
|
|
13
17
|
import "../chunk-ORMEWXMH.js";
|
|
14
18
|
export {
|
|
15
19
|
AUTH_ERROR_CODE_MAP,
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
formatFriendlyError,
|
|
3
3
|
getErrorDisplayInfo,
|
|
4
4
|
getFriendlyMessage
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-IYXMGIEP.js";
|
|
5
|
+
} from "../chunk-S54PFAEU.js";
|
|
6
|
+
import "../chunk-Y2JYA2AR.js";
|
|
8
7
|
import "../chunk-HCF3C3AQ.js";
|
|
8
|
+
import "../chunk-IYXMGIEP.js";
|
|
9
9
|
import "../chunk-SNVGJPPX.js";
|
|
10
10
|
import "../chunk-ORMEWXMH.js";
|
|
11
11
|
export {
|