@catbee/utils 0.0.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/LICENSE +201 -0
- package/README.md +295 -0
- package/build/esm/config.d.ts +22 -0
- package/build/esm/config.js +21 -0
- package/build/esm/config.js.map +1 -0
- package/build/esm/index.d.ts +19 -0
- package/build/esm/index.js +19 -0
- package/build/esm/index.js.map +1 -0
- package/build/esm/types/api-response.d.ts +44 -0
- package/build/esm/types/api-response.js +2 -0
- package/build/esm/types/api-response.js.map +1 -0
- package/build/esm/utils/array.utils.d.ts +105 -0
- package/build/esm/utils/array.utils.js +232 -0
- package/build/esm/utils/array.utils.js.map +1 -0
- package/build/esm/utils/async.utils.d.ts +119 -0
- package/build/esm/utils/async.utils.js +474 -0
- package/build/esm/utils/async.utils.js.map +1 -0
- package/build/esm/utils/cache.utils.d.ts +90 -0
- package/build/esm/utils/cache.utils.js +294 -0
- package/build/esm/utils/cache.utils.js.map +1 -0
- package/build/esm/utils/context-store.utils.d.ts +85 -0
- package/build/esm/utils/context-store.utils.js +99 -0
- package/build/esm/utils/context-store.utils.js.map +1 -0
- package/build/esm/utils/crypto.utils.d.ts +58 -0
- package/build/esm/utils/crypto.utils.js +76 -0
- package/build/esm/utils/crypto.utils.js.map +1 -0
- package/build/esm/utils/dir.utils.d.ts +75 -0
- package/build/esm/utils/dir.utils.js +400 -0
- package/build/esm/utils/dir.utils.js.map +1 -0
- package/build/esm/utils/env.utils.d.ts +131 -0
- package/build/esm/utils/env.utils.js +218 -0
- package/build/esm/utils/env.utils.js.map +1 -0
- package/build/esm/utils/exception.utils.d.ts +114 -0
- package/build/esm/utils/exception.utils.js +217 -0
- package/build/esm/utils/exception.utils.js.map +1 -0
- package/build/esm/utils/fs.utils.d.ts +32 -0
- package/build/esm/utils/fs.utils.js +140 -0
- package/build/esm/utils/fs.utils.js.map +1 -0
- package/build/esm/utils/http-status-codes.d.ts +357 -0
- package/build/esm/utils/http-status-codes.js +358 -0
- package/build/esm/utils/http-status-codes.js.map +1 -0
- package/build/esm/utils/id.utils.d.ts +35 -0
- package/build/esm/utils/id.utils.js +55 -0
- package/build/esm/utils/id.utils.js.map +1 -0
- package/build/esm/utils/logger.utils.d.ts +15 -0
- package/build/esm/utils/logger.utils.js +59 -0
- package/build/esm/utils/logger.utils.js.map +1 -0
- package/build/esm/utils/obj.utils.d.ts +55 -0
- package/build/esm/utils/obj.utils.js +121 -0
- package/build/esm/utils/obj.utils.js.map +1 -0
- package/build/esm/utils/response.utils.d.ts +48 -0
- package/build/esm/utils/response.utils.js +80 -0
- package/build/esm/utils/response.utils.js.map +1 -0
- package/build/esm/utils/string.utils.d.ts +37 -0
- package/build/esm/utils/string.utils.js +56 -0
- package/build/esm/utils/string.utils.js.map +1 -0
- package/build/esm/utils/url.utils.d.ts +24 -0
- package/build/esm/utils/url.utils.js +73 -0
- package/build/esm/utils/url.utils.js.map +1 -0
- package/build/esm/utils/validate.utils.d.ts +60 -0
- package/build/esm/utils/validate.utils.js +121 -0
- package/build/esm/utils/validate.utils.js.map +1 -0
- package/build/esnext/config.d.ts +22 -0
- package/build/esnext/config.js +21 -0
- package/build/esnext/config.js.map +1 -0
- package/build/esnext/index.d.ts +19 -0
- package/build/esnext/index.js +19 -0
- package/build/esnext/index.js.map +1 -0
- package/build/esnext/types/api-response.d.ts +44 -0
- package/build/esnext/types/api-response.js +2 -0
- package/build/esnext/types/api-response.js.map +1 -0
- package/build/esnext/utils/array.utils.d.ts +105 -0
- package/build/esnext/utils/array.utils.js +203 -0
- package/build/esnext/utils/array.utils.js.map +1 -0
- package/build/esnext/utils/async.utils.d.ts +119 -0
- package/build/esnext/utils/async.utils.js +291 -0
- package/build/esnext/utils/async.utils.js.map +1 -0
- package/build/esnext/utils/cache.utils.d.ts +90 -0
- package/build/esnext/utils/cache.utils.js +142 -0
- package/build/esnext/utils/cache.utils.js.map +1 -0
- package/build/esnext/utils/context-store.utils.d.ts +85 -0
- package/build/esnext/utils/context-store.utils.js +95 -0
- package/build/esnext/utils/context-store.utils.js.map +1 -0
- package/build/esnext/utils/crypto.utils.d.ts +58 -0
- package/build/esnext/utils/crypto.utils.js +72 -0
- package/build/esnext/utils/crypto.utils.js.map +1 -0
- package/build/esnext/utils/dir.utils.d.ts +75 -0
- package/build/esnext/utils/dir.utils.js +150 -0
- package/build/esnext/utils/dir.utils.js.map +1 -0
- package/build/esnext/utils/env.utils.d.ts +131 -0
- package/build/esnext/utils/env.utils.js +211 -0
- package/build/esnext/utils/env.utils.js.map +1 -0
- package/build/esnext/utils/exception.utils.d.ts +114 -0
- package/build/esnext/utils/exception.utils.js +148 -0
- package/build/esnext/utils/exception.utils.js.map +1 -0
- package/build/esnext/utils/fs.utils.d.ts +32 -0
- package/build/esnext/utils/fs.utils.js +62 -0
- package/build/esnext/utils/fs.utils.js.map +1 -0
- package/build/esnext/utils/http-status-codes.d.ts +357 -0
- package/build/esnext/utils/http-status-codes.js +358 -0
- package/build/esnext/utils/http-status-codes.js.map +1 -0
- package/build/esnext/utils/id.utils.d.ts +35 -0
- package/build/esnext/utils/id.utils.js +53 -0
- package/build/esnext/utils/id.utils.js.map +1 -0
- package/build/esnext/utils/logger.utils.d.ts +15 -0
- package/build/esnext/utils/logger.utils.js +59 -0
- package/build/esnext/utils/logger.utils.js.map +1 -0
- package/build/esnext/utils/obj.utils.d.ts +55 -0
- package/build/esnext/utils/obj.utils.js +94 -0
- package/build/esnext/utils/obj.utils.js.map +1 -0
- package/build/esnext/utils/response.utils.d.ts +48 -0
- package/build/esnext/utils/response.utils.js +58 -0
- package/build/esnext/utils/response.utils.js.map +1 -0
- package/build/esnext/utils/string.utils.d.ts +37 -0
- package/build/esnext/utils/string.utils.js +46 -0
- package/build/esnext/utils/string.utils.js.map +1 -0
- package/build/esnext/utils/url.utils.d.ts +24 -0
- package/build/esnext/utils/url.utils.js +35 -0
- package/build/esnext/utils/url.utils.js.map +1 -0
- package/build/esnext/utils/validate.utils.d.ts +60 -0
- package/build/esnext/utils/validate.utils.js +105 -0
- package/build/esnext/utils/validate.utils.js.map +1 -0
- package/build/src/config.d.ts +22 -0
- package/build/src/config.js +24 -0
- package/build/src/config.js.map +1 -0
- package/build/src/index.d.ts +19 -0
- package/build/src/index.js +35 -0
- package/build/src/index.js.map +1 -0
- package/build/src/types/api-response.d.ts +44 -0
- package/build/src/types/api-response.js +3 -0
- package/build/src/types/api-response.js.map +1 -0
- package/build/src/utils/array.utils.d.ts +105 -0
- package/build/src/utils/array.utils.js +216 -0
- package/build/src/utils/array.utils.js.map +1 -0
- package/build/src/utils/async.utils.d.ts +119 -0
- package/build/src/utils/async.utils.js +304 -0
- package/build/src/utils/async.utils.js.map +1 -0
- package/build/src/utils/cache.utils.d.ts +90 -0
- package/build/src/utils/cache.utils.js +146 -0
- package/build/src/utils/cache.utils.js.map +1 -0
- package/build/src/utils/context-store.utils.d.ts +85 -0
- package/build/src/utils/context-store.utils.js +100 -0
- package/build/src/utils/context-store.utils.js.map +1 -0
- package/build/src/utils/crypto.utils.d.ts +58 -0
- package/build/src/utils/crypto.utils.js +82 -0
- package/build/src/utils/crypto.utils.js.map +1 -0
- package/build/src/utils/dir.utils.d.ts +75 -0
- package/build/src/utils/dir.utils.js +164 -0
- package/build/src/utils/dir.utils.js.map +1 -0
- package/build/src/utils/env.utils.d.ts +131 -0
- package/build/src/utils/env.utils.js +215 -0
- package/build/src/utils/env.utils.js.map +1 -0
- package/build/src/utils/exception.utils.d.ts +114 -0
- package/build/src/utils/exception.utils.js +162 -0
- package/build/src/utils/exception.utils.js.map +1 -0
- package/build/src/utils/fs.utils.d.ts +32 -0
- package/build/src/utils/fs.utils.js +71 -0
- package/build/src/utils/fs.utils.js.map +1 -0
- package/build/src/utils/http-status-codes.d.ts +357 -0
- package/build/src/utils/http-status-codes.js +361 -0
- package/build/src/utils/http-status-codes.js.map +1 -0
- package/build/src/utils/id.utils.d.ts +35 -0
- package/build/src/utils/id.utils.js +60 -0
- package/build/src/utils/id.utils.js.map +1 -0
- package/build/src/utils/logger.utils.d.ts +15 -0
- package/build/src/utils/logger.utils.js +96 -0
- package/build/src/utils/logger.utils.js.map +1 -0
- package/build/src/utils/obj.utils.d.ts +55 -0
- package/build/src/utils/obj.utils.js +103 -0
- package/build/src/utils/obj.utils.js.map +1 -0
- package/build/src/utils/response.utils.d.ts +48 -0
- package/build/src/utils/response.utils.js +63 -0
- package/build/src/utils/response.utils.js.map +1 -0
- package/build/src/utils/string.utils.d.ts +37 -0
- package/build/src/utils/string.utils.js +54 -0
- package/build/src/utils/string.utils.js.map +1 -0
- package/build/src/utils/url.utils.d.ts +24 -0
- package/build/src/utils/url.utils.js +39 -0
- package/build/src/utils/url.utils.js.map +1 -0
- package/build/src/utils/validate.utils.d.ts +60 -0
- package/build/src/utils/validate.utils.js +115 -0
- package/build/src/utils/validate.utils.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether the object has no own enumerable properties.
|
|
3
|
+
*
|
|
4
|
+
* @param {Record<any, any>} obj - The object to check.
|
|
5
|
+
* @returns {boolean} True if the object is empty, false otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export const isObjEmpty = (obj) => !!obj && typeof obj === "object" && Object.keys(obj).length === 0;
|
|
8
|
+
/**
|
|
9
|
+
* Returns a new object with only the specified keys picked.
|
|
10
|
+
*
|
|
11
|
+
* @template T
|
|
12
|
+
* @template K
|
|
13
|
+
* @param {T} obj - The source object.
|
|
14
|
+
* @param {K[]} keys - Keys to pick from the object.
|
|
15
|
+
* @returns {Pick<T, K>} New object with picked keys.
|
|
16
|
+
*/
|
|
17
|
+
export const pick = (obj, keys) => Object.fromEntries(keys.map((key) => [key, obj[key]]));
|
|
18
|
+
/**
|
|
19
|
+
* Returns a new object with the specified keys omitted.
|
|
20
|
+
*
|
|
21
|
+
* @template T
|
|
22
|
+
* @template K
|
|
23
|
+
* @param {T} obj - The source object.
|
|
24
|
+
* @param {K[]} keys - Keys to omit from the object.
|
|
25
|
+
* @returns {Omit<T, K>} New object without omitted keys.
|
|
26
|
+
*/
|
|
27
|
+
export const omit = (obj, keys) => Object.fromEntries(Object.entries(obj).filter(([key]) => !keys.includes(key)));
|
|
28
|
+
/**
|
|
29
|
+
* Deeply merges two objects (mutates and returns the target object, not pure).
|
|
30
|
+
*
|
|
31
|
+
* @template T
|
|
32
|
+
* @param {T} target - The object to merge into (will be mutated).
|
|
33
|
+
* @param {Partial<T>} source - The object to merge from.
|
|
34
|
+
* @returns {T} The merged object (same as target).
|
|
35
|
+
*/
|
|
36
|
+
export function deepObjMerge(target, source) {
|
|
37
|
+
for (const key in source) {
|
|
38
|
+
const sourceVal = source[key];
|
|
39
|
+
const targetVal = target[key];
|
|
40
|
+
if (sourceVal &&
|
|
41
|
+
typeof sourceVal === "object" &&
|
|
42
|
+
!Array.isArray(sourceVal)) {
|
|
43
|
+
if (!targetVal ||
|
|
44
|
+
typeof targetVal !== "object" ||
|
|
45
|
+
Array.isArray(targetVal)) {
|
|
46
|
+
target[key] = {};
|
|
47
|
+
}
|
|
48
|
+
deepObjMerge(target[key], sourceVal);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
target[key] = sourceVal;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return target;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Flattens a nested object using dot notation for keys (e.g., `{a: {b: 1}}` → `{ "a.b": 1 }`).
|
|
58
|
+
*
|
|
59
|
+
* @template T
|
|
60
|
+
* @param {T} obj - The object to flatten.
|
|
61
|
+
* @param {string} [prefix=""] - Optional prefix for nested keys (used internally).
|
|
62
|
+
* @returns {Record<string, any>} A new object with flattened keys.
|
|
63
|
+
*/
|
|
64
|
+
export function flattenObject(obj, prefix = "") {
|
|
65
|
+
return Object.entries(obj).reduce((acc, [key, value]) => {
|
|
66
|
+
const newKey = prefix ? `${prefix}.${key}` : key;
|
|
67
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
68
|
+
Object.assign(acc, flattenObject(value, newKey));
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
acc[newKey] = value;
|
|
72
|
+
}
|
|
73
|
+
return acc;
|
|
74
|
+
}, {});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Safely gets the value of a deeply nested key in an object using dot/bracket notation path.
|
|
78
|
+
*
|
|
79
|
+
* @template T
|
|
80
|
+
* @param {T} obj - The object to extract from.
|
|
81
|
+
* @param {string} path - String path using dot and/or bracket notation (e.g., 'user.friends[0].name').
|
|
82
|
+
* @returns {any} The value at the given path, or undefined if not found.
|
|
83
|
+
*/
|
|
84
|
+
export function getValueByPath(obj, path) {
|
|
85
|
+
if (!obj || typeof obj !== "object")
|
|
86
|
+
return undefined;
|
|
87
|
+
// Convert path like "a.b[0].c" into ["a", "b", "0", "c"]
|
|
88
|
+
const parts = path
|
|
89
|
+
.replace(/\[(\d+)\]/g, ".$1") // convert [0] to .0
|
|
90
|
+
.split(".")
|
|
91
|
+
.filter(Boolean); // remove empty strings
|
|
92
|
+
return parts.reduce((acc, key) => acc === null || acc === void 0 ? void 0 : acc[key], obj);
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=obj.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"obj.utils.js","sourceRoot":"","sources":["../../../src/utils/obj.utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAqB,EAAW,EAAE,CAC3D,CAAC,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;AAEpE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,GAAM,EACN,IAAS,EACG,EAAE,CACd,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAe,CAAC;AAEvE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,GAAM,EACN,IAAS,EACG,EAAE,CACd,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAQ,CAAC,CAAC,CAClD,CAAC;AAElB;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAC1B,MAAS,EACT,MAAkB;IAElB,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC9B,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAE9B,IACE,SAAS;YACT,OAAO,SAAS,KAAK,QAAQ;YAC7B,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EACzB,CAAC;YACD,IACE,CAAC,SAAS;gBACV,OAAO,SAAS,KAAK,QAAQ;gBAC7B,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EACxB,CAAC;gBACD,MAAM,CAAC,GAAG,CAAC,GAAG,EAAS,CAAC;YAC1B,CAAC;YACD,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,SAAgB,CAAC,CAAC;QAC9C,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,GAAG,CAAC,GAAG,SAAwC,CAAC;QACzD,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAC3B,GAAM,EACN,MAAM,GAAG,EAAE;IAEX,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAC/B,CAAC,GAAwB,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACzC,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QAEjD,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAChE,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;QACtB,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAAE,CACH,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAmB,GAAM,EAAE,IAAY;IACnE,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAEtD,yDAAyD;IACzD,MAAM,KAAK,GAAG,IAAI;SACf,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,oBAAoB;SACjD,KAAK,CAAC,GAAG,CAAC;SACV,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,uBAAuB;IAE3C,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,GAAQ,EAAE,GAAW,EAAE,EAAE,CAAC,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAG,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;AAClE,CAAC","sourcesContent":["/**\n * Checks whether the object has no own enumerable properties.\n *\n * @param {Record<any, any>} obj - The object to check.\n * @returns {boolean} True if the object is empty, false otherwise.\n */\nexport const isObjEmpty = (obj: Record<any, any>): boolean =>\n !!obj && typeof obj === \"object\" && Object.keys(obj).length === 0;\n\n/**\n * Returns a new object with only the specified keys picked.\n *\n * @template T\n * @template K\n * @param {T} obj - The source object.\n * @param {K[]} keys - Keys to pick from the object.\n * @returns {Pick<T, K>} New object with picked keys.\n */\nexport const pick = <T extends object, K extends keyof T>(\n obj: T,\n keys: K[],\n): Pick<T, K> =>\n Object.fromEntries(keys.map((key) => [key, obj[key]])) as Pick<T, K>;\n\n/**\n * Returns a new object with the specified keys omitted.\n *\n * @template T\n * @template K\n * @param {T} obj - The source object.\n * @param {K[]} keys - Keys to omit from the object.\n * @returns {Omit<T, K>} New object without omitted keys.\n */\nexport const omit = <T extends object, K extends keyof T>(\n obj: T,\n keys: K[],\n): Omit<T, K> =>\n Object.fromEntries(\n Object.entries(obj).filter(([key]) => !keys.includes(key as K)),\n ) as Omit<T, K>;\n\n/**\n * Deeply merges two objects (mutates and returns the target object, not pure).\n *\n * @template T\n * @param {T} target - The object to merge into (will be mutated).\n * @param {Partial<T>} source - The object to merge from.\n * @returns {T} The merged object (same as target).\n */\nexport function deepObjMerge<T extends Record<string, any>>(\n target: T,\n source: Partial<T>,\n): T {\n for (const key in source) {\n const sourceVal = source[key];\n const targetVal = target[key];\n\n if (\n sourceVal &&\n typeof sourceVal === \"object\" &&\n !Array.isArray(sourceVal)\n ) {\n if (\n !targetVal ||\n typeof targetVal !== \"object\" ||\n Array.isArray(targetVal)\n ) {\n target[key] = {} as any;\n }\n deepObjMerge(target[key], sourceVal as any);\n } else {\n target[key] = sourceVal as T[Extract<keyof T, string>];\n }\n }\n return target;\n}\n\n/**\n * Flattens a nested object using dot notation for keys (e.g., `{a: {b: 1}}` → `{ \"a.b\": 1 }`).\n *\n * @template T\n * @param {T} obj - The object to flatten.\n * @param {string} [prefix=\"\"] - Optional prefix for nested keys (used internally).\n * @returns {Record<string, any>} A new object with flattened keys.\n */\nexport function flattenObject<T extends Record<string, any>>(\n obj: T,\n prefix = \"\",\n): Record<string, any> {\n return Object.entries(obj).reduce(\n (acc: Record<string, any>, [key, value]) => {\n const newKey = prefix ? `${prefix}.${key}` : key;\n\n if (value && typeof value === \"object\" && !Array.isArray(value)) {\n Object.assign(acc, flattenObject(value, newKey));\n } else {\n acc[newKey] = value;\n }\n\n return acc;\n },\n {},\n );\n}\n\n/**\n * Safely gets the value of a deeply nested key in an object using dot/bracket notation path.\n *\n * @template T\n * @param {T} obj - The object to extract from.\n * @param {string} path - String path using dot and/or bracket notation (e.g., 'user.friends[0].name').\n * @returns {any} The value at the given path, or undefined if not found.\n */\nexport function getValueByPath<T extends object>(obj: T, path: string) {\n if (!obj || typeof obj !== \"object\") return undefined;\n\n // Convert path like \"a.b[0].c\" into [\"a\", \"b\", \"0\", \"c\"]\n const parts = path\n .replace(/\\[(\\d+)\\]/g, \".$1\") // convert [0] to .0\n .split(\".\")\n .filter(Boolean); // remove empty strings\n\n return parts.reduce((acc: any, key: string) => acc?.[key], obj);\n}\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ApiResponse } from "../types/api-response";
|
|
2
|
+
/**
|
|
3
|
+
* Standard HTTP response wrapper for successful responses.
|
|
4
|
+
* Implements the `ApiResponse<T>` interface and sets default values.
|
|
5
|
+
*
|
|
6
|
+
* @typeParam T - The shape of the data returned in the response.
|
|
7
|
+
*/
|
|
8
|
+
export declare class SuccessResponse<T> implements ApiResponse<T> {
|
|
9
|
+
/** Message describing the result of the operation. */
|
|
10
|
+
message: string;
|
|
11
|
+
/** Whether the response is an error. Always false in success responses. */
|
|
12
|
+
error: boolean;
|
|
13
|
+
/** The payload returned from the API. */
|
|
14
|
+
data: T | null;
|
|
15
|
+
/** Timestamp when the response was generated, in ISO format. */
|
|
16
|
+
timestamp: string;
|
|
17
|
+
/** Unique identifier for this response, useful for request tracing. */
|
|
18
|
+
requestId: string;
|
|
19
|
+
/**
|
|
20
|
+
* Constructs a new success response.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} message - Optional message to override the default.
|
|
23
|
+
* @param {T} [data] - Optional data payload.
|
|
24
|
+
*/
|
|
25
|
+
constructor(message: string, data?: T);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Wrapper for error responses that extends the native `Error` object.
|
|
29
|
+
* Implements `ApiResponse` but omits the `data` field (which should not be present in errors).
|
|
30
|
+
*/
|
|
31
|
+
export declare class ErrorResponse extends Error implements Omit<ApiResponse<never>, "data"> {
|
|
32
|
+
/** HTTP status code associated with the error (e.g., 404, 500). */
|
|
33
|
+
status: number;
|
|
34
|
+
/** Indicates that this is an error. Always true. */
|
|
35
|
+
error: boolean;
|
|
36
|
+
/** Timestamp when the error occurred, in ISO format. */
|
|
37
|
+
timestamp: string;
|
|
38
|
+
/** Unique identifier for this error instance. */
|
|
39
|
+
requestId: string;
|
|
40
|
+
/**
|
|
41
|
+
* Constructs a new error response.
|
|
42
|
+
*
|
|
43
|
+
* @param {string} message - The error message to display or log.
|
|
44
|
+
* @param {number} [status=500] - Optional HTTP status code (defaults to 500).
|
|
45
|
+
*/
|
|
46
|
+
constructor(message: string, status?: number);
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=response.utils.d.ts.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { randomUUID } from "crypto";
|
|
2
|
+
import { getRequestId } from "./context-store.utils";
|
|
3
|
+
/**
|
|
4
|
+
* Standard HTTP response wrapper for successful responses.
|
|
5
|
+
* Implements the `ApiResponse<T>` interface and sets default values.
|
|
6
|
+
*
|
|
7
|
+
* @typeParam T - The shape of the data returned in the response.
|
|
8
|
+
*/
|
|
9
|
+
export class SuccessResponse {
|
|
10
|
+
/**
|
|
11
|
+
* Constructs a new success response.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} message - Optional message to override the default.
|
|
14
|
+
* @param {T} [data] - Optional data payload.
|
|
15
|
+
*/
|
|
16
|
+
constructor(message, data) {
|
|
17
|
+
var _a;
|
|
18
|
+
/** Message describing the result of the operation. */
|
|
19
|
+
this.message = "Success";
|
|
20
|
+
/** Whether the response is an error. Always false in success responses. */
|
|
21
|
+
this.error = false;
|
|
22
|
+
/** The payload returned from the API. */
|
|
23
|
+
this.data = null;
|
|
24
|
+
/** Timestamp when the response was generated, in ISO format. */
|
|
25
|
+
this.timestamp = new Date().toISOString();
|
|
26
|
+
/** Unique identifier for this response, useful for request tracing. */
|
|
27
|
+
this.requestId = (_a = getRequestId()) !== null && _a !== void 0 ? _a : randomUUID();
|
|
28
|
+
if (message)
|
|
29
|
+
this.message = message;
|
|
30
|
+
this.data = data !== null && data !== void 0 ? data : null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Wrapper for error responses that extends the native `Error` object.
|
|
35
|
+
* Implements `ApiResponse` but omits the `data` field (which should not be present in errors).
|
|
36
|
+
*/
|
|
37
|
+
export class ErrorResponse extends Error {
|
|
38
|
+
/**
|
|
39
|
+
* Constructs a new error response.
|
|
40
|
+
*
|
|
41
|
+
* @param {string} message - The error message to display or log.
|
|
42
|
+
* @param {number} [status=500] - Optional HTTP status code (defaults to 500).
|
|
43
|
+
*/
|
|
44
|
+
constructor(message, status = 500) {
|
|
45
|
+
var _a;
|
|
46
|
+
super(message);
|
|
47
|
+
/** Indicates that this is an error. Always true. */
|
|
48
|
+
this.error = true;
|
|
49
|
+
/** Timestamp when the error occurred, in ISO format. */
|
|
50
|
+
this.timestamp = new Date().toISOString();
|
|
51
|
+
/** Unique identifier for this error instance. */
|
|
52
|
+
this.requestId = (_a = getRequestId()) !== null && _a !== void 0 ? _a : randomUUID();
|
|
53
|
+
this.status = status;
|
|
54
|
+
this.name = this.constructor.name;
|
|
55
|
+
Error.captureStackTrace(this, this.constructor);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=response.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response.utils.js","sourceRoot":"","sources":["../../../src/utils/response.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IAgB1B;;;;;OAKG;IACH,YAAY,OAAe,EAAE,IAAQ;;QArBrC,sDAAsD;QACtD,YAAO,GAAW,SAAS,CAAC;QAE5B,2EAA2E;QAC3E,UAAK,GAAY,KAAK,CAAC;QAEvB,yCAAyC;QACzC,SAAI,GAAa,IAAI,CAAC;QAEtB,gEAAgE;QAChE,cAAS,GAAW,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAE7C,uEAAuE;QACvE,cAAS,GAAW,MAAA,YAAY,EAAE,mCAAI,UAAU,EAAE,CAAC;QASjD,IAAI,OAAO;YAAE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACpC,IAAI,CAAC,IAAI,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,IAAI,CAAC;IAC3B,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,aACX,SAAQ,KAAK;IAeb;;;;;OAKG;IACH,YAAY,OAAe,EAAE,SAAiB,GAAG;;QAC/C,KAAK,CAAC,OAAO,CAAC,CAAC;QAhBjB,oDAAoD;QACpD,UAAK,GAAY,IAAI,CAAC;QAEtB,wDAAwD;QACxD,cAAS,GAAW,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAE7C,iDAAiD;QACjD,cAAS,GAAW,MAAA,YAAY,EAAE,mCAAI,UAAU,EAAE,CAAC;QAUjD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAClD,CAAC;CACF","sourcesContent":["import { randomUUID } from \"crypto\";\nimport { ApiResponse } from \"../types/api-response\";\nimport { getRequestId } from \"./context-store.utils\";\n\n/**\n * Standard HTTP response wrapper for successful responses.\n * Implements the `ApiResponse<T>` interface and sets default values.\n *\n * @typeParam T - The shape of the data returned in the response.\n */\nexport class SuccessResponse<T> implements ApiResponse<T> {\n /** Message describing the result of the operation. */\n message: string = \"Success\";\n\n /** Whether the response is an error. Always false in success responses. */\n error: boolean = false;\n\n /** The payload returned from the API. */\n data: T | null = null;\n\n /** Timestamp when the response was generated, in ISO format. */\n timestamp: string = new Date().toISOString();\n\n /** Unique identifier for this response, useful for request tracing. */\n requestId: string = getRequestId() ?? randomUUID();\n\n /**\n * Constructs a new success response.\n *\n * @param {string} message - Optional message to override the default.\n * @param {T} [data] - Optional data payload.\n */\n constructor(message: string, data?: T) {\n if (message) this.message = message;\n this.data = data ?? null;\n }\n}\n\n/**\n * Wrapper for error responses that extends the native `Error` object.\n * Implements `ApiResponse` but omits the `data` field (which should not be present in errors).\n */\nexport class ErrorResponse\n extends Error\n implements Omit<ApiResponse<never>, \"data\">\n{\n /** HTTP status code associated with the error (e.g., 404, 500). */\n status: number;\n\n /** Indicates that this is an error. Always true. */\n error: boolean = true;\n\n /** Timestamp when the error occurred, in ISO format. */\n timestamp: string = new Date().toISOString();\n\n /** Unique identifier for this error instance. */\n requestId: string = getRequestId() ?? randomUUID();\n\n /**\n * Constructs a new error response.\n *\n * @param {string} message - The error message to display or log.\n * @param {number} [status=500] - Optional HTTP status code (defaults to 500).\n */\n constructor(message: string, status: number = 500) {\n super(message);\n this.status = status;\n this.name = this.constructor.name;\n Error.captureStackTrace(this, this.constructor);\n }\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capitalizes the first character of a string.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} str - The input string.
|
|
5
|
+
* @returns {string} The string with the first character in uppercase.
|
|
6
|
+
*/
|
|
7
|
+
export declare const capitalize: (str: string) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Converts a string to kebab-case (e.g., "FooBar test" → "foo-bar-test").
|
|
10
|
+
*
|
|
11
|
+
* @param {string} str - The input string.
|
|
12
|
+
* @returns {string} The kebab-cased string.
|
|
13
|
+
*/
|
|
14
|
+
export declare const toKebabCase: (str: string) => string;
|
|
15
|
+
/**
|
|
16
|
+
* Converts a kebab-case or snake_case string to camelCase.
|
|
17
|
+
*
|
|
18
|
+
* @param {string} str - The input string.
|
|
19
|
+
* @returns {string} The camelCased string.
|
|
20
|
+
*/
|
|
21
|
+
export declare const toCamelCase: (str: string) => string;
|
|
22
|
+
/**
|
|
23
|
+
* Converts a string to a URL-friendly slug (lowercase, dashes, alphanumeric).
|
|
24
|
+
*
|
|
25
|
+
* @param {string} str - The input string.
|
|
26
|
+
* @returns {string} The slugified string.
|
|
27
|
+
*/
|
|
28
|
+
export declare const slugify: (str: string) => string;
|
|
29
|
+
/**
|
|
30
|
+
* Truncates a string to a specific length, appending '...' if truncated.
|
|
31
|
+
*
|
|
32
|
+
* @param {string} str - The input string.
|
|
33
|
+
* @param {number} len - The maximum length.
|
|
34
|
+
* @returns {string} The truncated string.
|
|
35
|
+
*/
|
|
36
|
+
export declare const truncate: (str: string, len: number) => string;
|
|
37
|
+
//# sourceMappingURL=string.utils.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capitalizes the first character of a string.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} str - The input string.
|
|
5
|
+
* @returns {string} The string with the first character in uppercase.
|
|
6
|
+
*/
|
|
7
|
+
export const capitalize = (str) => str.length === 0 ? "" : str.charAt(0).toUpperCase() + str.slice(1);
|
|
8
|
+
/**
|
|
9
|
+
* Converts a string to kebab-case (e.g., "FooBar test" → "foo-bar-test").
|
|
10
|
+
*
|
|
11
|
+
* @param {string} str - The input string.
|
|
12
|
+
* @returns {string} The kebab-cased string.
|
|
13
|
+
*/
|
|
14
|
+
export const toKebabCase = (str) => str
|
|
15
|
+
.replace(/([a-z])([A-Z])/g, "$1-$2") // camelCase -> camel-Case
|
|
16
|
+
.replace(/\s+/g, "-") // spaces to dash
|
|
17
|
+
.replace(/_+/g, "-") // underscores to dash
|
|
18
|
+
.toLowerCase();
|
|
19
|
+
/**
|
|
20
|
+
* Converts a kebab-case or snake_case string to camelCase.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} str - The input string.
|
|
23
|
+
* @returns {string} The camelCased string.
|
|
24
|
+
*/
|
|
25
|
+
export const toCamelCase = (str) => str.replace(/[-_](.)/g, (_, c) => c.toUpperCase());
|
|
26
|
+
/**
|
|
27
|
+
* Converts a string to a URL-friendly slug (lowercase, dashes, alphanumeric).
|
|
28
|
+
*
|
|
29
|
+
* @param {string} str - The input string.
|
|
30
|
+
* @returns {string} The slugified string.
|
|
31
|
+
*/
|
|
32
|
+
export const slugify = (str) => str
|
|
33
|
+
.toLowerCase()
|
|
34
|
+
.replace(/[^\w\s-]/g, "") // remove non-word
|
|
35
|
+
.replace(/\s+/g, "-") // spaces to dash
|
|
36
|
+
.replace(/-+/g, "-") // multiple dashes to one
|
|
37
|
+
.replace(/^-+|-+$/g, ""); // trim leading/trailing dashes
|
|
38
|
+
/**
|
|
39
|
+
* Truncates a string to a specific length, appending '...' if truncated.
|
|
40
|
+
*
|
|
41
|
+
* @param {string} str - The input string.
|
|
42
|
+
* @param {number} len - The maximum length.
|
|
43
|
+
* @returns {string} The truncated string.
|
|
44
|
+
*/
|
|
45
|
+
export const truncate = (str, len) => str.length > len ? str.slice(0, len) + "..." : str;
|
|
46
|
+
//# sourceMappingURL=string.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.utils.js","sourceRoot":"","sources":["../../../src/utils/string.utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAW,EAAU,EAAE,CAChD,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAErE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAU,EAAE,CACjD,GAAG;KACA,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,0BAA0B;KAC9D,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,iBAAiB;KACtC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,sBAAsB;KAC1C,WAAW,EAAE,CAAC;AAEnB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAU,EAAE,CACjD,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAW,EAAU,EAAE,CAC7C,GAAG;KACA,WAAW,EAAE;KACb,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,kBAAkB;KAC3C,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,iBAAiB;KACtC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,yBAAyB;KAC7C,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC,+BAA+B;AAE7D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,GAAW,EAAU,EAAE,CAC3D,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC","sourcesContent":["/**\n * Capitalizes the first character of a string.\n *\n * @param {string} str - The input string.\n * @returns {string} The string with the first character in uppercase.\n */\nexport const capitalize = (str: string): string =>\n str.length === 0 ? \"\" : str.charAt(0).toUpperCase() + str.slice(1);\n\n/**\n * Converts a string to kebab-case (e.g., \"FooBar test\" → \"foo-bar-test\").\n *\n * @param {string} str - The input string.\n * @returns {string} The kebab-cased string.\n */\nexport const toKebabCase = (str: string): string =>\n str\n .replace(/([a-z])([A-Z])/g, \"$1-$2\") // camelCase -> camel-Case\n .replace(/\\s+/g, \"-\") // spaces to dash\n .replace(/_+/g, \"-\") // underscores to dash\n .toLowerCase();\n\n/**\n * Converts a kebab-case or snake_case string to camelCase.\n *\n * @param {string} str - The input string.\n * @returns {string} The camelCased string.\n */\nexport const toCamelCase = (str: string): string =>\n str.replace(/[-_](.)/g, (_, c: string) => c.toUpperCase());\n\n/**\n * Converts a string to a URL-friendly slug (lowercase, dashes, alphanumeric).\n *\n * @param {string} str - The input string.\n * @returns {string} The slugified string.\n */\nexport const slugify = (str: string): string =>\n str\n .toLowerCase()\n .replace(/[^\\w\\s-]/g, \"\") // remove non-word\n .replace(/\\s+/g, \"-\") // spaces to dash\n .replace(/-+/g, \"-\") // multiple dashes to one\n .replace(/^-+|-+$/g, \"\"); // trim leading/trailing dashes\n\n/**\n * Truncates a string to a specific length, appending '...' if truncated.\n *\n * @param {string} str - The input string.\n * @param {number} len - The maximum length.\n * @returns {string} The truncated string.\n */\nexport const truncate = (str: string, len: number): string =>\n str.length > len ? str.slice(0, len) + \"...\" : str;\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Appends query parameters to a given URL.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} url - The base URL to which query parameters will be appended.
|
|
5
|
+
* @param {Record<string, string | number>} params - Key-value pairs to add as query parameters.
|
|
6
|
+
* @returns {string} The new URL string with query parameters appended.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* appendQueryParams('https://example.com', { page: 1, limit: 10 });
|
|
10
|
+
* // → 'https://example.com/?page=1&limit=10'
|
|
11
|
+
*/
|
|
12
|
+
export declare function appendQueryParams(url: string, params: Record<string, string | number>): string;
|
|
13
|
+
/**
|
|
14
|
+
* Parses a query string into a key-value object.
|
|
15
|
+
*
|
|
16
|
+
* @param {string} query - The query string (with or without leading '?').
|
|
17
|
+
* @returns {Record<string, string>} Object representing parsed query parameters.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* parseQueryString('?page=1&limit=10');
|
|
21
|
+
* // → { page: '1', limit: '10' }
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseQueryString(query: string): Record<string, string>;
|
|
24
|
+
//# sourceMappingURL=url.utils.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { URL, URLSearchParams } from "url";
|
|
2
|
+
/**
|
|
3
|
+
* Appends query parameters to a given URL.
|
|
4
|
+
*
|
|
5
|
+
* @param {string} url - The base URL to which query parameters will be appended.
|
|
6
|
+
* @param {Record<string, string | number>} params - Key-value pairs to add as query parameters.
|
|
7
|
+
* @returns {string} The new URL string with query parameters appended.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* appendQueryParams('https://example.com', { page: 1, limit: 10 });
|
|
11
|
+
* // → 'https://example.com/?page=1&limit=10'
|
|
12
|
+
*/
|
|
13
|
+
export function appendQueryParams(url, params) {
|
|
14
|
+
const urlObj = new URL(url);
|
|
15
|
+
for (const [key, value] of Object.entries(params)) {
|
|
16
|
+
urlObj.searchParams.set(key, value.toString());
|
|
17
|
+
}
|
|
18
|
+
return urlObj.toString();
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Parses a query string into a key-value object.
|
|
22
|
+
*
|
|
23
|
+
* @param {string} query - The query string (with or without leading '?').
|
|
24
|
+
* @returns {Record<string, string>} Object representing parsed query parameters.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* parseQueryString('?page=1&limit=10');
|
|
28
|
+
* // → { page: '1', limit: '10' }
|
|
29
|
+
*/
|
|
30
|
+
export function parseQueryString(query) {
|
|
31
|
+
const cleanQuery = query.startsWith("?") ? query.slice(1) : query;
|
|
32
|
+
// Object.fromEntries guarantees string values in result
|
|
33
|
+
return Object.fromEntries(new URLSearchParams(cleanQuery));
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=url.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.utils.js","sourceRoot":"","sources":["../../../src/utils/url.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC;AAE3C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAC/B,GAAW,EACX,MAAuC;IAEvC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;AAC3B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAClE,wDAAwD;IACxD,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,eAAe,CAAC,UAAU,CAAC,CAGxD,CAAC;AACJ,CAAC","sourcesContent":["import { URL, URLSearchParams } from \"url\";\n\n/**\n * Appends query parameters to a given URL.\n *\n * @param {string} url - The base URL to which query parameters will be appended.\n * @param {Record<string, string | number>} params - Key-value pairs to add as query parameters.\n * @returns {string} The new URL string with query parameters appended.\n *\n * @example\n * appendQueryParams('https://example.com', { page: 1, limit: 10 });\n * // → 'https://example.com/?page=1&limit=10'\n */\nexport function appendQueryParams(\n url: string,\n params: Record<string, string | number>,\n): string {\n const urlObj = new URL(url);\n for (const [key, value] of Object.entries(params)) {\n urlObj.searchParams.set(key, value.toString());\n }\n return urlObj.toString();\n}\n\n/**\n * Parses a query string into a key-value object.\n *\n * @param {string} query - The query string (with or without leading '?').\n * @returns {Record<string, string>} Object representing parsed query parameters.\n *\n * @example\n * parseQueryString('?page=1&limit=10');\n * // → { page: '1', limit: '10' }\n */\nexport function parseQueryString(query: string): Record<string, string> {\n const cleanQuery = query.startsWith(\"?\") ? query.slice(1) : query;\n // Object.fromEntries guarantees string values in result\n return Object.fromEntries(new URLSearchParams(cleanQuery)) as Record<\n string,\n string\n >;\n}\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collection of common validation helpers for strings, numbers, email, UUID, etc.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Checks if a string is a valid email address.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} str - The input string.
|
|
8
|
+
* @returns {boolean} True if valid email, else false.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isEmail(str: string): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Checks if a string is a valid UUID (versions 1-5).
|
|
13
|
+
*
|
|
14
|
+
* @param {string} str - The input string.
|
|
15
|
+
* @returns {boolean} True if valid UUID, else false.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isUUID(str: string): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Checks if a string is a valid URL.
|
|
20
|
+
*
|
|
21
|
+
* @param {string} str - The input string.
|
|
22
|
+
* @returns {boolean} True if valid URL, else false.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isURL(str: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Checks if a string is a valid international phone number (E.164 or common patterns).
|
|
27
|
+
*
|
|
28
|
+
* @param {string} str - The input string.
|
|
29
|
+
* @returns {boolean} True if looks like a phone number.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isPhone(str: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Checks if a string is strictly alphanumeric (letters/numbers only).
|
|
34
|
+
*
|
|
35
|
+
* @param {string} str - The input string.
|
|
36
|
+
* @returns {boolean} True if alphanumeric.
|
|
37
|
+
*/
|
|
38
|
+
export declare function isAlphanumeric(str: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Checks if a string or number can be safely parsed to a number.
|
|
41
|
+
*
|
|
42
|
+
* @param {string | number} value - The value to check.
|
|
43
|
+
* @returns {boolean} True if the value is numeric.
|
|
44
|
+
*/
|
|
45
|
+
export declare function isNumeric(value: string | number): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Checks if a string is a valid hex color code (e.g. #FFF or #FFFFFF).
|
|
48
|
+
*
|
|
49
|
+
* @param {string} str - Input string.
|
|
50
|
+
* @returns {boolean}
|
|
51
|
+
*/
|
|
52
|
+
export declare function isHexColor(str: string): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Checks if a string is a valid date string.
|
|
55
|
+
*
|
|
56
|
+
* @param {string} str - Input string.
|
|
57
|
+
* @returns {boolean}
|
|
58
|
+
*/
|
|
59
|
+
export declare function isISODate(str: string): boolean;
|
|
60
|
+
//# sourceMappingURL=validate.utils.d.ts.map
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collection of common validation helpers for strings, numbers, email, UUID, etc.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Checks if a string is a valid email address.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} str - The input string.
|
|
8
|
+
* @returns {boolean} True if valid email, else false.
|
|
9
|
+
*/
|
|
10
|
+
export function isEmail(str) {
|
|
11
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(str))
|
|
12
|
+
return false;
|
|
13
|
+
// Additional checks
|
|
14
|
+
const [local, domain] = str.split("@");
|
|
15
|
+
if (!local || !domain)
|
|
16
|
+
return false;
|
|
17
|
+
// Disallow consecutive dots in local or domain part
|
|
18
|
+
if (local.includes("..") || domain.includes(".."))
|
|
19
|
+
return false;
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Checks if a string is a valid UUID (versions 1-5).
|
|
24
|
+
*
|
|
25
|
+
* @param {string} str - The input string.
|
|
26
|
+
* @returns {boolean} True if valid UUID, else false.
|
|
27
|
+
*/
|
|
28
|
+
export function isUUID(str) {
|
|
29
|
+
return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(str);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Checks if a string is a valid URL.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} str - The input string.
|
|
35
|
+
* @returns {boolean} True if valid URL, else false.
|
|
36
|
+
*/
|
|
37
|
+
export function isURL(str) {
|
|
38
|
+
try {
|
|
39
|
+
new URL(str);
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
catch (_a) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Checks if a string is a valid international phone number (E.164 or common patterns).
|
|
48
|
+
*
|
|
49
|
+
* @param {string} str - The input string.
|
|
50
|
+
* @returns {boolean} True if looks like a phone number.
|
|
51
|
+
*/
|
|
52
|
+
export function isPhone(str) {
|
|
53
|
+
if (typeof str !== "string")
|
|
54
|
+
return false;
|
|
55
|
+
// Strip non-digit characters to count total digits
|
|
56
|
+
const digitsOnly = str.replace(/\D/g, "");
|
|
57
|
+
if (digitsOnly.length < 6 || digitsOnly.length > 15)
|
|
58
|
+
return false;
|
|
59
|
+
// Accept typical phone characters: +, digits, space, -, (, )
|
|
60
|
+
return /^[+]?[\d\s().-]+$/.test(str);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Checks if a string is strictly alphanumeric (letters/numbers only).
|
|
64
|
+
*
|
|
65
|
+
* @param {string} str - The input string.
|
|
66
|
+
* @returns {boolean} True if alphanumeric.
|
|
67
|
+
*/
|
|
68
|
+
export function isAlphanumeric(str) {
|
|
69
|
+
return /^[a-z0-9]+$/i.test(str);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Checks if a string or number can be safely parsed to a number.
|
|
73
|
+
*
|
|
74
|
+
* @param {string | number} value - The value to check.
|
|
75
|
+
* @returns {boolean} True if the value is numeric.
|
|
76
|
+
*/
|
|
77
|
+
export function isNumeric(value) {
|
|
78
|
+
if (typeof value === "string" && value.trim() === "")
|
|
79
|
+
return false;
|
|
80
|
+
const num = typeof value === "number" ? value : Number(value);
|
|
81
|
+
return typeof num === "number" && isFinite(num);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Checks if a string is a valid hex color code (e.g. #FFF or #FFFFFF).
|
|
85
|
+
*
|
|
86
|
+
* @param {string} str - Input string.
|
|
87
|
+
* @returns {boolean}
|
|
88
|
+
*/
|
|
89
|
+
export function isHexColor(str) {
|
|
90
|
+
return /^#([a-f0-9]{6}|[a-f0-9]{3})$/i.test(str);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Checks if a string is a valid date string.
|
|
94
|
+
*
|
|
95
|
+
* @param {string} str - Input string.
|
|
96
|
+
* @returns {boolean}
|
|
97
|
+
*/
|
|
98
|
+
export function isISODate(str) {
|
|
99
|
+
const isoRegex = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?)?$/;
|
|
100
|
+
if (!isoRegex.test(str))
|
|
101
|
+
return false;
|
|
102
|
+
const date = new Date(str);
|
|
103
|
+
return (!isNaN(date.getTime()) && date.toISOString().startsWith(str.slice(0, 10)));
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=validate.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.utils.js","sourceRoot":"","sources":["../../../src/utils/validate.utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,GAAW;IACjC,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAE1D,oBAAoB;IACpB,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACvC,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAEpC,oDAAoD;IACpD,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAEhE,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAC,GAAW;IAChC,OAAO,4EAA4E,CAAC,IAAI,CACtF,GAAG,CACJ,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,GAAW;IAC/B,IAAI,CAAC;QACH,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,GAAW;IACjC,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE1C,mDAAmD;IACnD,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC1C,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,UAAU,CAAC,MAAM,GAAG,EAAE;QAAE,OAAO,KAAK,CAAC;IAElE,6DAA6D;IAC7D,OAAO,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,OAAO,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,KAAsB;IAC9C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,KAAK,CAAC;IACnE,MAAM,GAAG,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9D,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC;AAClD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,OAAO,+BAA+B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,MAAM,QAAQ,GACZ,sEAAsE,CAAC;IAEzE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAEtC,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3B,OAAO,CACL,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAC1E,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Collection of common validation helpers for strings, numbers, email, UUID, etc.\n */\n\n/**\n * Checks if a string is a valid email address.\n *\n * @param {string} str - The input string.\n * @returns {boolean} True if valid email, else false.\n */\nexport function isEmail(str: string): boolean {\n if (!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(str)) return false;\n\n // Additional checks\n const [local, domain] = str.split(\"@\");\n if (!local || !domain) return false;\n\n // Disallow consecutive dots in local or domain part\n if (local.includes(\"..\") || domain.includes(\"..\")) return false;\n\n return true;\n}\n\n/**\n * Checks if a string is a valid UUID (versions 1-5).\n *\n * @param {string} str - The input string.\n * @returns {boolean} True if valid UUID, else false.\n */\nexport function isUUID(str: string): boolean {\n return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(\n str,\n );\n}\n\n/**\n * Checks if a string is a valid URL.\n *\n * @param {string} str - The input string.\n * @returns {boolean} True if valid URL, else false.\n */\nexport function isURL(str: string): boolean {\n try {\n new URL(str);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Checks if a string is a valid international phone number (E.164 or common patterns).\n *\n * @param {string} str - The input string.\n * @returns {boolean} True if looks like a phone number.\n */\nexport function isPhone(str: string): boolean {\n if (typeof str !== \"string\") return false;\n\n // Strip non-digit characters to count total digits\n const digitsOnly = str.replace(/\\D/g, \"\");\n if (digitsOnly.length < 6 || digitsOnly.length > 15) return false;\n\n // Accept typical phone characters: +, digits, space, -, (, )\n return /^[+]?[\\d\\s().-]+$/.test(str);\n}\n\n/**\n * Checks if a string is strictly alphanumeric (letters/numbers only).\n *\n * @param {string} str - The input string.\n * @returns {boolean} True if alphanumeric.\n */\nexport function isAlphanumeric(str: string): boolean {\n return /^[a-z0-9]+$/i.test(str);\n}\n\n/**\n * Checks if a string or number can be safely parsed to a number.\n *\n * @param {string | number} value - The value to check.\n * @returns {boolean} True if the value is numeric.\n */\nexport function isNumeric(value: string | number): boolean {\n if (typeof value === \"string\" && value.trim() === \"\") return false;\n const num = typeof value === \"number\" ? value : Number(value);\n return typeof num === \"number\" && isFinite(num);\n}\n\n/**\n * Checks if a string is a valid hex color code (e.g. #FFF or #FFFFFF).\n *\n * @param {string} str - Input string.\n * @returns {boolean}\n */\nexport function isHexColor(str: string): boolean {\n return /^#([a-f0-9]{6}|[a-f0-9]{3})$/i.test(str);\n}\n\n/**\n * Checks if a string is a valid date string.\n *\n * @param {string} str - Input string.\n * @returns {boolean}\n */\nexport function isISODate(str: string): boolean {\n const isoRegex =\n /^\\d{4}-\\d{2}-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})?)?$/;\n\n if (!isoRegex.test(str)) return false;\n\n const date = new Date(str);\n return (\n !isNaN(date.getTime()) && date.toISOString().startsWith(str.slice(0, 10))\n );\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type LogLevel = "fatal" | "error" | "warn" | "info" | "debug" | "trace" | "silent";
|
|
2
|
+
/**
|
|
3
|
+
* Application runtime configuration loaded from environment variables.
|
|
4
|
+
*/
|
|
5
|
+
export declare const Config: {
|
|
6
|
+
Logger: {
|
|
7
|
+
/**
|
|
8
|
+
* Logging level (e.g., 'info', 'debug', 'warn', 'error').
|
|
9
|
+
*/
|
|
10
|
+
level: LogLevel;
|
|
11
|
+
/**
|
|
12
|
+
* Name of the logger instance (defaults to npm package name).
|
|
13
|
+
*/
|
|
14
|
+
name: string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Whether to use ISO 8601 timestamps in logs.
|
|
17
|
+
*/
|
|
18
|
+
isoTimestamp: boolean;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Config = void 0;
|
|
4
|
+
const env_utils_1 = require("./utils/env.utils");
|
|
5
|
+
/**
|
|
6
|
+
* Application runtime configuration loaded from environment variables.
|
|
7
|
+
*/
|
|
8
|
+
exports.Config = {
|
|
9
|
+
Logger: {
|
|
10
|
+
/**
|
|
11
|
+
* Logging level (e.g., 'info', 'debug', 'warn', 'error').
|
|
12
|
+
*/
|
|
13
|
+
level: env_utils_1.Env.get("LOGGER_LEVEL", "info"),
|
|
14
|
+
/**
|
|
15
|
+
* Name of the logger instance (defaults to npm package name).
|
|
16
|
+
*/
|
|
17
|
+
name: env_utils_1.Env.get("LOGGER_NAME", env_utils_1.Env.get("npm_package_name", "@catbee/utils")),
|
|
18
|
+
/**
|
|
19
|
+
* Whether to use ISO 8601 timestamps in logs.
|
|
20
|
+
*/
|
|
21
|
+
isoTimestamp: env_utils_1.Env.getBoolean("LOGGER_ISO_TIMESTAMP", false),
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";;;AAAA,iDAAwC;AAWxC;;GAEG;AACU,QAAA,MAAM,GAAG;IACpB,MAAM,EAAE;QACN;;WAEG;QACH,KAAK,EAAE,eAAG,CAAC,GAAG,CAAC,cAAc,EAAE,MAAM,CAAa;QAElD;;WAEG;QACH,IAAI,EAAE,eAAG,CAAC,GAAG,CAAC,aAAa,EAAE,eAAG,CAAC,GAAG,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;QAE1E;;WAEG;QACH,YAAY,EAAE,eAAG,CAAC,UAAU,CAAC,sBAAsB,EAAE,KAAK,CAAC;KAC5D;CACF,CAAC","sourcesContent":["import { Env } from \"./utils/env.utils\";\n\ntype LogLevel =\n | \"fatal\"\n | \"error\"\n | \"warn\"\n | \"info\"\n | \"debug\"\n | \"trace\"\n | \"silent\";\n\n/**\n * Application runtime configuration loaded from environment variables.\n */\nexport const Config = {\n Logger: {\n /**\n * Logging level (e.g., 'info', 'debug', 'warn', 'error').\n */\n level: Env.get(\"LOGGER_LEVEL\", \"info\") as LogLevel,\n\n /**\n * Name of the logger instance (defaults to npm package name).\n */\n name: Env.get(\"LOGGER_NAME\", Env.get(\"npm_package_name\", \"@catbee/utils\")),\n\n /**\n * Whether to use ISO 8601 timestamps in logs.\n */\n isoTimestamp: Env.getBoolean(\"LOGGER_ISO_TIMESTAMP\", false),\n },\n};\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export * from "./utils/array.utils";
|
|
2
|
+
export * from "./utils/async.utils";
|
|
3
|
+
export * from "./utils/cache.utils";
|
|
4
|
+
export * from "./utils/context-store.utils";
|
|
5
|
+
export * from "./utils/crypto.utils";
|
|
6
|
+
export * from "./utils/dir.utils";
|
|
7
|
+
export * from "./utils/env.utils";
|
|
8
|
+
export * from "./utils/exception.utils";
|
|
9
|
+
export * from "./utils/fs.utils";
|
|
10
|
+
export * from "./utils/http-status-codes";
|
|
11
|
+
export * from "./utils/id.utils";
|
|
12
|
+
export * from "./utils/logger.utils";
|
|
13
|
+
export * from "./utils/obj.utils";
|
|
14
|
+
export * from "./utils/response.utils";
|
|
15
|
+
export * from "./utils/string.utils";
|
|
16
|
+
export * from "./utils/url.utils";
|
|
17
|
+
export * from "./utils/validate.utils";
|
|
18
|
+
export * from "./types/api-response";
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|