@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.
Files changed (157) hide show
  1. package/README.md +2 -2
  2. package/dist/auth/adapters/prisma/index.js +2 -2
  3. package/dist/auth/config.d.ts +0 -3
  4. package/dist/auth/config.js +1 -1
  5. package/dist/auth/core/jwt/cookie.js +2 -2
  6. package/dist/auth/core/jwt/index.js +2 -2
  7. package/dist/auth/core/jwt/types.js +1 -1
  8. package/dist/auth/core/oauth/index.d.ts +1 -1
  9. package/dist/auth/core/oauth/index.js +12 -4
  10. package/dist/auth/core/oauth/providers/index.d.ts +2 -0
  11. package/dist/auth/core/oauth/providers/index.js +11 -3
  12. package/dist/auth/core/oauth/providers/kakao.js +1 -1
  13. package/dist/auth/core/oauth/providers/meta.d.ts +14 -0
  14. package/dist/auth/core/oauth/providers/meta.js +8 -0
  15. package/dist/auth/core/oauth/providers/microsoft.d.ts +21 -0
  16. package/dist/auth/core/oauth/providers/microsoft.js +8 -0
  17. package/dist/auth/core/password/client-helper.js +1 -1
  18. package/dist/auth/core/password/index.js +1 -1
  19. package/dist/auth/handlers/forgot-password.handler.js +1 -1
  20. package/dist/auth/handlers/index.js +27 -25
  21. package/dist/auth/handlers/login.handler.js +3 -3
  22. package/dist/auth/handlers/logout.handler.js +3 -3
  23. package/dist/auth/handlers/me.handler.js +2 -2
  24. package/dist/auth/handlers/oauth-authorize.handler.js +7 -5
  25. package/dist/auth/handlers/oauth-callback.handler.js +10 -8
  26. package/dist/auth/handlers/refresh.handler.js +3 -3
  27. package/dist/auth/handlers/register.handler.js +3 -3
  28. package/dist/auth/handlers/reset-password.handler.js +1 -1
  29. package/dist/auth/handlers/verify-email.handler.js +1 -1
  30. package/dist/auth/index.js +8 -6
  31. package/dist/auth/services/email-verification.service.js +1 -1
  32. package/dist/auth/services/index.js +12 -12
  33. package/dist/auth/services/login.service.js +2 -2
  34. package/dist/auth/services/oauth-callback.service.js +3 -3
  35. package/dist/auth/services/password-reset.service.js +1 -1
  36. package/dist/auth/services/register.service.js +2 -2
  37. package/dist/auth/services/token-refresh.service.js +2 -2
  38. package/dist/auth/types/index.d.ts +2 -0
  39. package/dist/auth/types/index.js +1 -1
  40. package/dist/cache/cache-config.js +4 -4
  41. package/dist/cache/cache-env.js +3 -3
  42. package/dist/cache/cache-factory.js +12 -12
  43. package/dist/cache/cache-invalidation.js +13 -13
  44. package/dist/cache/cache-redis.js +6 -6
  45. package/dist/cache/cache-wrapper.js +13 -13
  46. package/dist/cache/cache.js +14 -14
  47. package/dist/cache/config.d.ts +0 -14
  48. package/dist/cache/config.js +1 -1
  49. package/dist/cache/hybrid-cache-manager.js +8 -8
  50. package/dist/cache/index.js +14 -14
  51. package/dist/cache/inmemory-cache-manager.js +3 -3
  52. package/dist/cache/noop-cache-manager.js +5 -5
  53. package/dist/cache/redis-cache-manager.js +7 -7
  54. package/dist/{chunk-3ECJUXLM.js → chunk-2KG2G35D.js} +3 -3
  55. package/dist/{chunk-3AJHXCDG.js → chunk-34IDAA7V.js} +2 -2
  56. package/dist/{chunk-77BJRPMN.js → chunk-3LVCK2NQ.js} +4 -4
  57. package/dist/{chunk-W2GBKW2T.js → chunk-545Q34YU.js} +2 -2
  58. package/dist/{chunk-HZLJYEOO.js → chunk-57HPJEZB.js} +9 -1
  59. package/dist/{chunk-2VMTIYLX.js → chunk-7DMKTJHU.js} +2 -2
  60. package/dist/{chunk-O35V6RIF.js → chunk-7UQZH2OH.js} +3 -3
  61. package/dist/{chunk-7KZRPDQD.js → chunk-A6FKWYO2.js} +2 -2
  62. package/dist/{chunk-EXJQKCTN.js → chunk-A7TN46LC.js} +4 -4
  63. package/dist/{chunk-AYZJN32D.js → chunk-CDLCZB6F.js} +10 -15
  64. package/dist/{chunk-SR3SQL72.js → chunk-CVFVL5FL.js} +2 -2
  65. package/dist/{chunk-Q7VFOUFI.js → chunk-D6MIC5AU.js} +1 -1
  66. package/dist/{chunk-Q6KXN7HL.js → chunk-ENETIGKL.js} +2 -2
  67. package/dist/{chunk-WNEXLSDB.js → chunk-ERO4PGNO.js} +1 -1
  68. package/dist/{chunk-BEV7PQM3.js → chunk-F3NGZYL2.js} +1 -1
  69. package/dist/chunk-FDFPNSKY.js +14 -0
  70. package/dist/{chunk-G5OMETUS.js → chunk-FDRQUDFH.js} +1 -1
  71. package/dist/{chunk-ITGUSYUH.js → chunk-G2WAL2T7.js} +3 -1
  72. package/dist/{chunk-6JY6NUR6.js → chunk-GDX3YQGK.js} +1 -1
  73. package/dist/{chunk-6B7VU6RZ.js → chunk-JDXC3QIA.js} +0 -1
  74. package/dist/chunk-K3OYTLXU.js +63 -0
  75. package/dist/{chunk-MGQV723O.js → chunk-L74XPPH4.js} +1 -1
  76. package/dist/{chunk-SSS6XSEG.js → chunk-LG6GH4V7.js} +1 -1
  77. package/dist/{chunk-HHCDMWEF.js → chunk-LGAV5UU2.js} +1 -1
  78. package/dist/{chunk-3CBGGMIY.js → chunk-LHIVUV7Q.js} +10 -15
  79. package/dist/{chunk-OHBAELPZ.js → chunk-LMQSV5UK.js} +15 -21
  80. package/dist/{chunk-A2XAOU55.js → chunk-LNPZZ23G.js} +13 -19
  81. package/dist/{chunk-X6MGVFT3.js → chunk-LRRQ54YJ.js} +1 -1
  82. package/dist/chunk-MGBNIDTP.js +100 -0
  83. package/dist/{chunk-PYVYYO4X.js → chunk-MULM3Q5S.js} +5 -5
  84. package/dist/{chunk-TEXVRHPF.js → chunk-NOAU2JG7.js} +1 -1
  85. package/dist/{chunk-WJSMXUZB.js → chunk-NQUYNPSD.js} +1 -1
  86. package/dist/{chunk-CKK55QFQ.js → chunk-NW3JIRFK.js} +1 -1
  87. package/dist/{chunk-FI46LV42.js → chunk-O5E36ZIJ.js} +1 -1
  88. package/dist/{chunk-DBHISLC6.js → chunk-OFSPZUQD.js} +2 -2
  89. package/dist/{chunk-WRWWB2NU.js → chunk-PT4FA7U4.js} +2 -2
  90. package/dist/{chunk-VCOA6LMN.js → chunk-QOKDGW3F.js} +1 -1
  91. package/dist/{chunk-OCI7QCLM.js → chunk-QXIQB6OF.js} +2 -2
  92. package/dist/{chunk-L5WLPC2T.js → chunk-QXPMO2CO.js} +1 -1
  93. package/dist/{chunk-LFKPXF5E.js → chunk-RXVX2DCW.js} +2 -2
  94. package/dist/{chunk-PAF5OGDU.js → chunk-SI2Z26KP.js} +7 -7
  95. package/dist/{chunk-ETMTDHK2.js → chunk-SOQOAFB2.js} +0 -1
  96. package/dist/{chunk-4BGAE7NU.js → chunk-TLBY3DUK.js} +1 -1
  97. package/dist/{chunk-2QQNL4ND.js → chunk-TLZJQR26.js} +17 -6
  98. package/dist/{chunk-IHUQRVPV.js → chunk-UQM35MAO.js} +2 -2
  99. package/dist/{chunk-G2Q4TI3Q.js → chunk-V3ZIR4UL.js} +1 -1
  100. package/dist/chunk-VB64KFBD.js +99 -0
  101. package/dist/{chunk-GFWGLWTS.js → chunk-WJWCTCWZ.js} +10 -15
  102. package/dist/{chunk-CMU52MEQ.js → chunk-WLXAEHKK.js} +2 -2
  103. package/dist/{chunk-SFPMFVSD.js → chunk-WPW4HXW4.js} +9 -15
  104. package/dist/{chunk-ON7HZ3PW.js → chunk-WSXOKK6N.js} +1 -1
  105. package/dist/{chunk-S7OQWKUJ.js → chunk-XIJMATSG.js} +3 -3
  106. package/dist/{chunk-MDTID4D2.js → chunk-XY3ZVORI.js} +1 -1
  107. package/dist/{chunk-KF3O2DAV.js → chunk-YTXCKIWE.js} +1 -1
  108. package/dist/{chunk-7JKZBEVB.js → chunk-YX3XMDDI.js} +8 -8
  109. package/dist/{chunk-CW3INZMV.js → chunk-ZG2XGO44.js} +1 -1
  110. package/dist/config/common.d.ts +0 -3
  111. package/dist/config/common.js +1 -1
  112. package/dist/config/registry.d.ts +5 -13
  113. package/dist/config/registry.js +1 -1
  114. package/dist/error/error-handler.js +3 -3
  115. package/dist/error/index.js +3 -3
  116. package/dist/geolocation/batch-processor.js +3 -3
  117. package/dist/geolocation/config.d.ts +0 -3
  118. package/dist/geolocation/config.js +1 -1
  119. package/dist/geolocation/index.js +7 -7
  120. package/dist/geolocation/providers/index.js +4 -4
  121. package/dist/geolocation/providers/ipgeolocation-provider.js +2 -2
  122. package/dist/geolocation/providers/maxmind-provider.js +2 -2
  123. package/dist/initialize.d.ts +2 -1
  124. package/dist/initialize.js +18 -17
  125. package/dist/logger/config.d.ts +0 -3
  126. package/dist/logger/config.js +1 -1
  127. package/dist/logger/logger.js +2 -2
  128. package/dist/middleware/auth.js +5 -5
  129. package/dist/middleware/cors-config.d.ts +0 -3
  130. package/dist/middleware/cors-config.js +1 -1
  131. package/dist/middleware/cors.js +4 -4
  132. package/dist/middleware/error-handler.js +4 -4
  133. package/dist/middleware/index.js +14 -14
  134. package/dist/middleware/middleware-chain.js +3 -3
  135. package/dist/middleware/rate-limit.js +3 -3
  136. package/dist/middleware/response-logger.js +3 -3
  137. package/dist/middleware/security.js +3 -3
  138. package/dist/middleware/wrappers.js +14 -14
  139. package/dist/storage/config.d.ts +0 -3
  140. package/dist/storage/config.js +1 -1
  141. package/dist/storage/r2-storage.js +1 -1
  142. package/dist/system/cpu.js +4 -4
  143. package/dist/system/disk.js +4 -4
  144. package/dist/system/environment.js +8 -8
  145. package/dist/system/health-check.js +5 -5
  146. package/dist/system/index.js +13 -13
  147. package/dist/system/memory.js +4 -4
  148. package/dist/system/network.js +4 -4
  149. package/dist/system/utils.js +3 -3
  150. package/dist/utils/cors.js +3 -3
  151. package/dist/utils/csv-export.js +3 -3
  152. package/dist/utils/error-processor.js +3 -3
  153. package/dist/utils/index.js +7 -7
  154. package/package.json +1 -1
  155. package/dist/chunk-GTPUVHSV.js +0 -30
  156. package/dist/chunk-UCIUAZQT.js +0 -106
  157. /package/dist/{chunk-T4MDCVUQ.js → chunk-6CLQRZC2.js} +0 -0
@@ -1,30 +0,0 @@
1
- // src/config/registry.ts
2
- var MODULE_KEYS = {
3
- common: "__withwiz_common_config",
4
- auth: "__withwiz_auth_config",
5
- logger: "__withwiz_logger_config",
6
- cache: "__withwiz_cache_config",
7
- storage: "__withwiz_storage_config",
8
- geolocation: "__withwiz_geolocation_config",
9
- cors: "__withwiz_cors_config"
10
- };
11
- var config = new Proxy({}, {
12
- get(_target, prop) {
13
- const globalKey = MODULE_KEYS[prop];
14
- if (!globalKey) return void 0;
15
- return globalThis[globalKey];
16
- },
17
- set() {
18
- throw new TypeError("config is read-only");
19
- }
20
- });
21
- function resetConfig() {
22
- for (const globalKey of Object.values(MODULE_KEYS)) {
23
- globalThis[globalKey] = void 0;
24
- }
25
- }
26
-
27
- export {
28
- config,
29
- resetConfig
30
- };
@@ -1,106 +0,0 @@
1
- import {
2
- ConfigurationError
3
- } from "./chunk-2QH66EVQ.js";
4
- import {
5
- CACHE_DURATION_DEFAULTS,
6
- CACHE_FALLBACK_DEFAULTS,
7
- CACHE_HEALTH_DEFAULTS,
8
- CACHE_TTL_DEFAULTS,
9
- INMEMORY_CACHE_DEFAULTS
10
- } from "./chunk-57W32BFZ.js";
11
- import {
12
- __spreadValues
13
- } from "./chunk-ORMEWXMH.js";
14
-
15
- // src/cache/config.ts
16
- var GLOBAL_KEY = "__withwiz_cache_config";
17
- function getConfig() {
18
- var _a;
19
- return (_a = globalThis[GLOBAL_KEY]) != null ? _a : null;
20
- }
21
- function setConfig(config) {
22
- globalThis[GLOBAL_KEY] = config;
23
- }
24
- function initializeCache(input) {
25
- 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;
26
- if (getConfig()) return;
27
- if (input.redis !== void 0) {
28
- if (!input.redis.url) {
29
- throw new ConfigurationError("cache", "redis.url is required");
30
- }
31
- if (!input.redis.token) {
32
- throw new ConfigurationError("cache", "redis.token is required");
33
- }
34
- }
35
- const defaultCategories = {};
36
- for (const [key, duration] of Object.entries(CACHE_DURATION_DEFAULTS)) {
37
- defaultCategories[key] = { enabled: true, duration };
38
- }
39
- const mergedCategories = __spreadValues({}, defaultCategories);
40
- if (input.categories) {
41
- for (const [key, value] of Object.entries(input.categories)) {
42
- if (value !== void 0) {
43
- mergedCategories[key] = {
44
- enabled: (_a = value.enabled) != null ? _a : true,
45
- duration: (_d = (_c = value.duration) != null ? _c : (_b = defaultCategories[key]) == null ? void 0 : _b.duration) != null ? _d : CACHE_TTL_DEFAULTS.DEFAULT
46
- };
47
- }
48
- }
49
- }
50
- setConfig({
51
- enabled: (_e = input.enabled) != null ? _e : true,
52
- redis: input.redis ? {
53
- url: input.redis.url,
54
- token: input.redis.token,
55
- enabled: (_f = input.redis.enabled) != null ? _f : true
56
- } : void 0,
57
- inmemory: {
58
- enabled: (_h = (_g = input.inmemory) == null ? void 0 : _g.enabled) != null ? _h : true,
59
- maxSize: (_j = (_i = input.inmemory) == null ? void 0 : _i.maxSize) != null ? _j : INMEMORY_CACHE_DEFAULTS.MAX_SIZE,
60
- maxMb: (_l = (_k = input.inmemory) == null ? void 0 : _k.maxMb) != null ? _l : INMEMORY_CACHE_DEFAULTS.MAX_MB,
61
- eviction: (_n = (_m = input.inmemory) == null ? void 0 : _m.eviction) != null ? _n : INMEMORY_CACHE_DEFAULTS.EVICTION,
62
- cleanupInterval: (_p = (_o = input.inmemory) == null ? void 0 : _o.cleanupInterval) != null ? _p : INMEMORY_CACHE_DEFAULTS.CLEANUP_INTERVAL
63
- },
64
- ttl: {
65
- DEFAULT: (_r = (_q = input.ttl) == null ? void 0 : _q.DEFAULT) != null ? _r : CACHE_TTL_DEFAULTS.DEFAULT,
66
- SHORT: (_t = (_s = input.ttl) == null ? void 0 : _s.SHORT) != null ? _t : CACHE_TTL_DEFAULTS.SHORT,
67
- LONG: (_v = (_u = input.ttl) == null ? void 0 : _u.LONG) != null ? _v : CACHE_TTL_DEFAULTS.LONG,
68
- GEOIP: (_x = (_w = input.ttl) == null ? void 0 : _w.GEOIP) != null ? _x : CACHE_TTL_DEFAULTS.GEOIP,
69
- SETTINGS: (_z = (_y = input.ttl) == null ? void 0 : _y.SETTINGS) != null ? _z : CACHE_TTL_DEFAULTS.SETTINGS,
70
- ANALYTICS: (_B = (_A = input.ttl) == null ? void 0 : _A.ANALYTICS) != null ? _B : CACHE_TTL_DEFAULTS.ANALYTICS,
71
- USER: (_D = (_C = input.ttl) == null ? void 0 : _C.USER) != null ? _D : CACHE_TTL_DEFAULTS.USER
72
- },
73
- categories: mergedCategories,
74
- fallback: {
75
- redisErrorThresholdGlobal: (_F = (_E = input.fallback) == null ? void 0 : _E.redisErrorThresholdGlobal) != null ? _F : CACHE_FALLBACK_DEFAULTS.REDIS_ERROR_THRESHOLD_GLOBAL,
76
- redisErrorThresholdLocal: (_H = (_G = input.fallback) == null ? void 0 : _G.redisErrorThresholdLocal) != null ? _H : CACHE_FALLBACK_DEFAULTS.REDIS_ERROR_THRESHOLD_LOCAL,
77
- redisReconnectInterval: (_J = (_I = input.fallback) == null ? void 0 : _I.redisReconnectInterval) != null ? _J : CACHE_FALLBACK_DEFAULTS.REDIS_RECONNECT_INTERVAL,
78
- fallbackOnRedisError: (_L = (_K = input.fallback) == null ? void 0 : _K.fallbackOnRedisError) != null ? _L : CACHE_FALLBACK_DEFAULTS.FALLBACK_ON_REDIS_ERROR,
79
- writeToMemory: (_N = (_M = input.fallback) == null ? void 0 : _M.writeToMemory) != null ? _N : CACHE_FALLBACK_DEFAULTS.WRITE_TO_MEMORY
80
- },
81
- health: {
82
- errorRateThreshold: (_P = (_O = input.health) == null ? void 0 : _O.errorRateThreshold) != null ? _P : CACHE_HEALTH_DEFAULTS.ERROR_RATE_THRESHOLD,
83
- hitRateThreshold: (_R = (_Q = input.health) == null ? void 0 : _Q.hitRateThreshold) != null ? _R : CACHE_HEALTH_DEFAULTS.HIT_RATE_THRESHOLD,
84
- reportHitRateThreshold: (_T = (_S = input.health) == null ? void 0 : _S.reportHitRateThreshold) != null ? _T : CACHE_HEALTH_DEFAULTS.REPORT_HIT_RATE_THRESHOLD,
85
- reportResponseTimeThreshold: (_V = (_U = input.health) == null ? void 0 : _U.reportResponseTimeThreshold) != null ? _V : CACHE_HEALTH_DEFAULTS.REPORT_RESPONSE_TIME_THRESHOLD,
86
- reportInvalidationThreshold: (_X = (_W = input.health) == null ? void 0 : _W.reportInvalidationThreshold) != null ? _X : CACHE_HEALTH_DEFAULTS.REPORT_INVALIDATION_THRESHOLD,
87
- reportMinRequests: (_Z = (_Y = input.health) == null ? void 0 : _Y.reportMinRequests) != null ? _Z : CACHE_HEALTH_DEFAULTS.REPORT_MIN_REQUESTS
88
- }
89
- });
90
- }
91
- function getResolvedCacheConfig() {
92
- const config = getConfig();
93
- if (!config) {
94
- throw new ConfigurationError("cache", "Cache config not initialized. Call initializeCache() first.");
95
- }
96
- return config;
97
- }
98
- function resetCache() {
99
- globalThis[GLOBAL_KEY] = void 0;
100
- }
101
-
102
- export {
103
- initializeCache,
104
- getResolvedCacheConfig,
105
- resetCache
106
- };
File without changes