@withwiz/toolkit 0.2.4 → 0.2.6

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 (79) hide show
  1. package/dist/auth/core/jwt/index.d.ts +1 -1
  2. package/dist/auth/core/jwt/index.js +1 -1
  3. package/dist/auth/index.js +18 -18
  4. package/dist/cache/cache-config.js +3 -3
  5. package/dist/cache/cache-env.js +2 -2
  6. package/dist/cache/cache-factory.js +9 -9
  7. package/dist/cache/cache-invalidation.js +10 -10
  8. package/dist/cache/cache-redis.js +3 -3
  9. package/dist/cache/cache-wrapper.js +10 -10
  10. package/dist/cache/cache.js +11 -11
  11. package/dist/cache/hybrid-cache-manager.js +5 -5
  12. package/dist/cache/index.js +11 -11
  13. package/dist/cache/inmemory-cache-manager.js +2 -2
  14. package/dist/cache/noop-cache-manager.js +4 -4
  15. package/dist/cache/redis-cache-manager.js +4 -4
  16. package/dist/{chunk-UT4J7NPS.js → chunk-2ATBAIRL.js} +4 -8
  17. package/dist/{chunk-EZR55KV2.js → chunk-5A2L6TXD.js} +2 -2
  18. package/dist/{chunk-65LHDFU3.js → chunk-67KRDPIH.js} +2 -2
  19. package/dist/{chunk-KWTBD4CM.js → chunk-6WVKLXVT.js} +1 -1
  20. package/dist/{chunk-V4KAPU2S.js → chunk-74MSBKYW.js} +2 -2
  21. package/dist/{chunk-G4NI37NN.js → chunk-7KCWVRPR.js} +2 -2
  22. package/dist/{chunk-4ODT3Q4A.js → chunk-AOZVTVJG.js} +1 -1
  23. package/dist/{chunk-4DPSCTX4.js → chunk-BX5CNRVS.js} +2 -2
  24. package/dist/{chunk-TXGNSECL.js → chunk-HCTNZM7D.js} +1 -1
  25. package/dist/{chunk-Q7IP4JMW.js → chunk-HOMWLK62.js} +2 -2
  26. package/dist/{chunk-WTRBW2UY.js → chunk-HWX3INO5.js} +7 -7
  27. package/dist/{chunk-6LTZCXNC.js → chunk-I5PCM2JQ.js} +2 -2
  28. package/dist/{chunk-WHR7HPWF.js → chunk-IT43YQND.js} +2 -2
  29. package/dist/{chunk-M4VXPTKV.js → chunk-JOGXLVUZ.js} +1 -1
  30. package/dist/{chunk-WDRDGFHO.js → chunk-JWZSWMOM.js} +1 -1
  31. package/dist/{chunk-4KJXENRM.js → chunk-LEWQBXN6.js} +1 -1
  32. package/dist/{chunk-KAWVMIRJ.js → chunk-M5LIX3TD.js} +5 -1
  33. package/dist/{chunk-I47QEDTX.js → chunk-N4XYQB2G.js} +1 -1
  34. package/dist/{chunk-WSQMXMTL.js → chunk-NJXCFTOE.js} +6 -2
  35. package/dist/{chunk-26Y7VEYG.js → chunk-OFPRBEO6.js} +1 -1
  36. package/dist/{chunk-HV3DGSSH.js → chunk-R5OFGX3C.js} +4 -4
  37. package/dist/{chunk-6DD3MUDZ.js → chunk-SNSLMP6S.js} +1 -1
  38. package/dist/{chunk-BKGVSC6S.js → chunk-T3YUJYBX.js} +1 -1
  39. package/dist/chunk-WDJLAZCW.js +68 -0
  40. package/dist/{chunk-L76O3X3D.js → chunk-WEDR5GJO.js} +2 -2
  41. package/dist/{chunk-QYIUGQ5Q.js → chunk-WSUFD4SO.js} +2 -2
  42. package/dist/{chunk-TZAP5T4N.js → chunk-WZDS4QEC.js} +1 -1
  43. package/dist/{chunk-GL2NANFH.js → chunk-XN4YP4XO.js} +3 -3
  44. package/dist/{chunk-Z4D4CMDA.js → chunk-Y6IHEA3Q.js} +1 -1
  45. package/dist/{chunk-YBSHN67U.js → chunk-YMIDD4YE.js} +4 -4
  46. package/dist/{chunk-AIHQBQ3E.js → chunk-YVF4RXOK.js} +8 -8
  47. package/dist/components/ui/DataTable.js +3 -3
  48. package/dist/components/ui/data-table/DataTable.js +3 -3
  49. package/dist/error/error-handler.js +2 -2
  50. package/dist/error/index.js +2 -2
  51. package/dist/geolocation/batch-processor.js +2 -2
  52. package/dist/geolocation/index.js +2 -2
  53. package/dist/logger/logger.js +1 -1
  54. package/dist/middleware/auth.js +3 -3
  55. package/dist/middleware/cors.d.ts +39 -6
  56. package/dist/middleware/cors.js +4 -2
  57. package/dist/middleware/error-handler.js +3 -3
  58. package/dist/middleware/index.js +11 -11
  59. package/dist/middleware/middleware-chain.js +2 -2
  60. package/dist/middleware/rate-limit.js +2 -2
  61. package/dist/middleware/response-logger.js +2 -2
  62. package/dist/middleware/security.js +2 -1
  63. package/dist/middleware/wrappers.js +11 -11
  64. package/dist/system/cpu.js +3 -3
  65. package/dist/system/disk.js +3 -3
  66. package/dist/system/environment.js +3 -3
  67. package/dist/system/health-check.js +3 -3
  68. package/dist/system/index.js +8 -8
  69. package/dist/system/memory.js +3 -3
  70. package/dist/system/network.js +3 -3
  71. package/dist/system/utils.js +2 -2
  72. package/dist/utils/csv-export.js +2 -2
  73. package/dist/utils/error-processor.js +2 -2
  74. package/dist/utils/index.js +3 -3
  75. package/dist/utils/input-validation.d.ts +2 -0
  76. package/dist/utils/input-validation.js +4 -5
  77. package/package.json +1 -1
  78. package/dist/chunk-FOKAATUQ.js +0 -62
  79. package/dist/{chunk-GSUQE3SZ.js → chunk-M2S3OMKX.js} +6 -6
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  checkEnvironmentVariables
3
- } from "../chunk-26Y7VEYG.js";
4
- import "../chunk-KWTBD4CM.js";
5
- import "../chunk-EZR55KV2.js";
3
+ } from "../chunk-OFPRBEO6.js";
4
+ import "../chunk-6WVKLXVT.js";
5
+ import "../chunk-5A2L6TXD.js";
6
6
  import "../chunk-ORMEWXMH.js";
7
7
  export {
8
8
  checkEnvironmentVariables
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  checkServiceHealth
3
- } from "../chunk-WHR7HPWF.js";
3
+ } from "../chunk-IT43YQND.js";
4
4
  import "../chunk-OIVXOT2X.js";
5
- import "../chunk-KWTBD4CM.js";
6
- import "../chunk-EZR55KV2.js";
5
+ import "../chunk-6WVKLXVT.js";
6
+ import "../chunk-5A2L6TXD.js";
7
7
  import "../chunk-ORMEWXMH.js";
8
8
  export {
9
9
  checkServiceHealth
@@ -1,29 +1,29 @@
1
1
  import {
2
2
  getDiskInfo
3
- } from "../chunk-4DPSCTX4.js";
3
+ } from "../chunk-BX5CNRVS.js";
4
4
  import {
5
5
  checkEnvironmentVariables
6
- } from "../chunk-26Y7VEYG.js";
6
+ } from "../chunk-OFPRBEO6.js";
7
7
  import {
8
8
  checkServiceHealth
9
- } from "../chunk-WHR7HPWF.js";
9
+ } from "../chunk-IT43YQND.js";
10
10
  import "../chunk-OIVXOT2X.js";
11
11
  import {
12
12
  getMemoryInfo
13
- } from "../chunk-G4NI37NN.js";
13
+ } from "../chunk-7KCWVRPR.js";
14
14
  import {
15
15
  getNetworkInfo
16
- } from "../chunk-65LHDFU3.js";
16
+ } from "../chunk-67KRDPIH.js";
17
17
  import {
18
18
  getCpuInfo
19
- } from "../chunk-L76O3X3D.js";
19
+ } from "../chunk-WEDR5GJO.js";
20
20
  import {
21
21
  getPlatform,
22
22
  getRecommendedCommands
23
- } from "../chunk-KWTBD4CM.js";
23
+ } from "../chunk-6WVKLXVT.js";
24
24
  import {
25
25
  logger
26
- } from "../chunk-EZR55KV2.js";
26
+ } from "../chunk-5A2L6TXD.js";
27
27
  import "../chunk-ORMEWXMH.js";
28
28
 
29
29
  // src/system/index.ts
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  getMemoryInfo
3
- } from "../chunk-G4NI37NN.js";
4
- import "../chunk-KWTBD4CM.js";
5
- import "../chunk-EZR55KV2.js";
3
+ } from "../chunk-7KCWVRPR.js";
4
+ import "../chunk-6WVKLXVT.js";
5
+ import "../chunk-5A2L6TXD.js";
6
6
  import "../chunk-ORMEWXMH.js";
7
7
  export {
8
8
  getMemoryInfo
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  getNetworkInfo
3
- } from "../chunk-65LHDFU3.js";
4
- import "../chunk-KWTBD4CM.js";
5
- import "../chunk-EZR55KV2.js";
3
+ } from "../chunk-67KRDPIH.js";
4
+ import "../chunk-6WVKLXVT.js";
5
+ import "../chunk-5A2L6TXD.js";
6
6
  import "../chunk-ORMEWXMH.js";
7
7
  export {
8
8
  getNetworkInfo
@@ -9,8 +9,8 @@ import {
9
9
  runMacCommand,
10
10
  runPlatformCommand,
11
11
  runSafeCommand
12
- } from "../chunk-KWTBD4CM.js";
13
- import "../chunk-EZR55KV2.js";
12
+ } from "../chunk-6WVKLXVT.js";
13
+ import "../chunk-5A2L6TXD.js";
14
14
  import "../chunk-ORMEWXMH.js";
15
15
  export {
16
16
  commandExists,
@@ -6,8 +6,8 @@ import {
6
6
  dateFormatter,
7
7
  escapeCsvField,
8
8
  rowToCsv
9
- } from "../chunk-BKGVSC6S.js";
10
- import "../chunk-EZR55KV2.js";
9
+ } from "../chunk-T3YUJYBX.js";
10
+ import "../chunk-5A2L6TXD.js";
11
11
  import "../chunk-ORMEWXMH.js";
12
12
  export {
13
13
  boolFormatter,
@@ -12,10 +12,10 @@ import {
12
12
  throwUnauthorizedError,
13
13
  throwValidationError,
14
14
  withErrorHandling
15
- } from "../chunk-M4VXPTKV.js";
15
+ } from "../chunk-JOGXLVUZ.js";
16
16
  import "../chunk-KXXROUA5.js";
17
17
  import "../chunk-SNVGJPPX.js";
18
- import "../chunk-EZR55KV2.js";
18
+ import "../chunk-5A2L6TXD.js";
19
19
  import "../chunk-ORMEWXMH.js";
20
20
  export {
21
21
  ErrorProcessor,
@@ -52,7 +52,7 @@ import {
52
52
  dateFormatter,
53
53
  escapeCsvField,
54
54
  rowToCsv
55
- } from "../chunk-BKGVSC6S.js";
55
+ } from "../chunk-T3YUJYBX.js";
56
56
  import {
57
57
  ErrorProcessor,
58
58
  errorToResponse,
@@ -66,7 +66,7 @@ import {
66
66
  throwUnauthorizedError,
67
67
  throwValidationError,
68
68
  withErrorHandling
69
- } from "../chunk-M4VXPTKV.js";
69
+ } from "../chunk-JOGXLVUZ.js";
70
70
  import {
71
71
  createPaginatedResponse,
72
72
  getReferer,
@@ -83,7 +83,7 @@ import {
83
83
  } from "../chunk-7JWIX5BS.js";
84
84
  import "../chunk-KXXROUA5.js";
85
85
  import "../chunk-SNVGJPPX.js";
86
- import "../chunk-EZR55KV2.js";
86
+ import "../chunk-5A2L6TXD.js";
87
87
  import "../chunk-ORMEWXMH.js";
88
88
  export {
89
89
  ErrorProcessor,
@@ -10,6 +10,8 @@ export interface URLValidationOptions {
10
10
  allowedSchemes?: string[];
11
11
  maxLength?: number;
12
12
  requireProtocol?: boolean;
13
+ /** localhost/127.0.0.1 URL 허용 여부 (기본값: false) */
14
+ allowLocalhost?: boolean;
13
15
  }
14
16
  /**
15
17
  * URL 안전성 검증
@@ -29,7 +29,8 @@ function validateURL(url, options = {}) {
29
29
  const {
30
30
  allowedSchemes = ALLOWED_URL_SCHEMES,
31
31
  maxLength = 2048,
32
- requireProtocol = true
32
+ requireProtocol = true,
33
+ allowLocalhost = false
33
34
  } = options;
34
35
  if (!url || typeof url !== "string") {
35
36
  return { valid: false, error: "URL is required" };
@@ -57,10 +58,8 @@ function validateURL(url, options = {}) {
57
58
  try {
58
59
  const urlToParse = hasProtocol ? trimmedUrl : `https://${trimmedUrl}`;
59
60
  const parsed = new URL(urlToParse);
60
- if (parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1") {
61
- if (process.env.NODE_ENV === "production") {
62
- return { valid: false, error: "Internal URLs are not allowed" };
63
- }
61
+ if (!allowLocalhost && (parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1")) {
62
+ return { valid: false, error: "Internal URLs are not allowed" };
64
63
  }
65
64
  return {
66
65
  valid: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withwiz/toolkit",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "Shared utility library for withwiz projects",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -1,62 +0,0 @@
1
- import {
2
- logger
3
- } from "./chunk-EZR55KV2.js";
4
-
5
- // src/middleware/cors.ts
6
- import { NextResponse } from "next/server";
7
- var getAllowedOrigins = () => {
8
- const nodeEnv = process.env.NODE_ENV;
9
- if (nodeEnv === "production") {
10
- return [
11
- process.env.NEXT_PUBLIC_APP_URL || "https://tlog.net",
12
- "https://www.tlog.net"
13
- ].filter(Boolean);
14
- }
15
- return [
16
- "http://localhost:3000",
17
- "http://localhost:3001",
18
- "http://127.0.0.1:3000",
19
- process.env.NEXT_PUBLIC_APP_URL
20
- ].filter(Boolean);
21
- };
22
- var corsMiddleware = async (context, next) => {
23
- const { request } = context;
24
- const origin = request.headers.get("origin");
25
- const allowedOrigins = getAllowedOrigins();
26
- if (request.method === "OPTIONS") {
27
- const response2 = new NextResponse(null, { status: 204 });
28
- if (origin && allowedOrigins.includes(origin)) {
29
- response2.headers.set("Access-Control-Allow-Origin", origin);
30
- } else if (allowedOrigins.includes("*")) {
31
- response2.headers.set("Access-Control-Allow-Origin", "*");
32
- }
33
- response2.headers.set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, PATCH, OPTIONS");
34
- response2.headers.set("Access-Control-Allow-Headers", "Content-Type, Authorization, X-Requested-With, X-API-Key");
35
- response2.headers.set("Access-Control-Max-Age", "86400");
36
- response2.headers.set("Access-Control-Allow-Credentials", "true");
37
- return response2;
38
- }
39
- const response = await next();
40
- if (origin && allowedOrigins.includes(origin)) {
41
- response.headers.set("Access-Control-Allow-Origin", origin);
42
- response.headers.set("Access-Control-Allow-Credentials", "true");
43
- } else if (allowedOrigins.includes("*") || process.env.NODE_ENV === "test") {
44
- response.headers.set("Access-Control-Allow-Origin", origin || "*");
45
- response.headers.set("Access-Control-Allow-Credentials", "true");
46
- }
47
- response.headers.set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, PATCH, OPTIONS");
48
- response.headers.set("Access-Control-Allow-Headers", "Content-Type, Authorization, X-Requested-With, X-API-Key");
49
- return response;
50
- };
51
- function validateCorsConfiguration() {
52
- const allowedOrigins = getAllowedOrigins();
53
- const nodeEnv = process.env.NODE_ENV;
54
- logger.info(
55
- `[CORS Middleware] \u2705 Initialized - Environment: ${nodeEnv}, Allowed Origins: [${allowedOrigins.join(", ")}]`
56
- );
57
- }
58
-
59
- export {
60
- corsMiddleware,
61
- validateCorsConfiguration
62
- };
@@ -1,3 +1,9 @@
1
+ import {
2
+ DataTableBody
3
+ } from "./chunk-7IY3RQQL.js";
4
+ import {
5
+ DataTableBulkActions
6
+ } from "./chunk-MAATEX2R.js";
1
7
  import {
2
8
  DataTableFilters
3
9
  } from "./chunk-LJEGM4OO.js";
@@ -7,12 +13,6 @@ import {
7
13
  import {
8
14
  DataTableSearch
9
15
  } from "./chunk-TH45RVP7.js";
10
- import {
11
- DataTableBody
12
- } from "./chunk-7IY3RQQL.js";
13
- import {
14
- DataTableBulkActions
15
- } from "./chunk-MAATEX2R.js";
16
16
  import {
17
17
  DEFAULT_LABELS
18
18
  } from "./chunk-NY5QXT33.js";