@catbee/utils 2.0.0-next.0 → 2.0.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.
Files changed (122) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +102 -52
  3. package/array/index.cjs +215 -74
  4. package/array/index.d.ts +345 -2
  5. package/array/index.mjs +201 -74
  6. package/async/index.cjs +116 -39
  7. package/async/index.d.ts +292 -2
  8. package/async/index.mjs +116 -40
  9. package/cache/index.cjs +2 -2
  10. package/cache/index.d.ts +156 -2
  11. package/cache/index.mjs +3 -3
  12. package/config/index.cjs +80 -66
  13. package/config/index.d.ts +65 -3
  14. package/config/index.mjs +77 -65
  15. package/context-store/index.cjs +2 -3
  16. package/context-store/index.d.ts +193 -2
  17. package/context-store/index.mjs +2 -3
  18. package/crypto/index.cjs +55 -5
  19. package/crypto/index.d.ts +225 -2
  20. package/crypto/index.mjs +52 -7
  21. package/date/index.cjs +676 -2
  22. package/date/index.d.ts +676 -2
  23. package/date/index.mjs +665 -3
  24. package/decorator/index.cjs +2172 -0
  25. package/{decorators/decorators.utils.d.ts → decorator/index.d.ts} +58 -54
  26. package/decorator/index.mjs +2131 -0
  27. package/{dir → directory}/index.cjs +5 -4
  28. package/{dir/dir.utils.d.ts → directory/index.d.ts} +24 -21
  29. package/{dir → directory}/index.mjs +5 -4
  30. package/env/index.cjs +100 -68
  31. package/env/index.d.ts +391 -2
  32. package/env/index.mjs +100 -68
  33. package/exception/index.cjs +1 -1
  34. package/exception/index.d.ts +233 -2
  35. package/exception/index.mjs +1 -1
  36. package/fs/index.cjs +71 -37
  37. package/fs/index.d.ts +206 -2
  38. package/fs/index.mjs +65 -35
  39. package/http-status-codes/index.cjs +1 -1
  40. package/http-status-codes/index.d.ts +268 -2
  41. package/http-status-codes/index.mjs +1 -1
  42. package/id/index.cjs +1 -1
  43. package/id/index.d.ts +38 -2
  44. package/id/index.mjs +1 -1
  45. package/index.cjs +13 -13
  46. package/index.d.ts +5 -5
  47. package/index.mjs +5 -5
  48. package/logger/index.cjs +13 -15
  49. package/logger/index.d.ts +190 -2
  50. package/logger/index.mjs +14 -16
  51. package/middleware/index.cjs +1 -1
  52. package/middleware/index.d.ts +104 -2
  53. package/middleware/index.mjs +1 -1
  54. package/object/index.cjs +379 -0
  55. package/{obj/obj.utils.d.ts → object/index.d.ts} +73 -33
  56. package/object/index.mjs +360 -0
  57. package/package.json +41 -23
  58. package/performance/index.cjs +4 -4
  59. package/performance/index.d.ts +139 -2
  60. package/performance/index.mjs +4 -4
  61. package/request/index.cjs +37 -25
  62. package/request/index.d.ts +242 -3
  63. package/request/index.mjs +37 -25
  64. package/response/index.cjs +1 -1
  65. package/response/index.d.ts +319 -3
  66. package/response/index.mjs +1 -1
  67. package/server/index.cjs +249 -146
  68. package/server/index.d.ts +866 -5
  69. package/server/index.mjs +248 -144
  70. package/stream/index.cjs +1 -1
  71. package/stream/index.d.ts +91 -2
  72. package/stream/index.mjs +1 -1
  73. package/string/index.cjs +34 -1
  74. package/string/index.d.ts +146 -2
  75. package/string/index.mjs +31 -2
  76. package/type/index.cjs +19 -2
  77. package/type/index.d.ts +144 -2
  78. package/type/index.mjs +17 -3
  79. package/types/index.cjs +1 -1
  80. package/types/index.d.ts +775 -5
  81. package/types/index.mjs +1 -1
  82. package/url/index.cjs +63 -5
  83. package/url/index.d.ts +200 -2
  84. package/url/index.mjs +59 -6
  85. package/{validate → validation}/index.cjs +91 -44
  86. package/{validate/validate.utils.d.ts → validation/index.d.ts} +33 -24
  87. package/{validate → validation}/index.mjs +87 -44
  88. package/array/array.utils.d.ts +0 -191
  89. package/async/async.utils.d.ts +0 -296
  90. package/cache/cache.utils.d.ts +0 -176
  91. package/config/config.d.ts +0 -57
  92. package/context-store/context-store.utils.d.ts +0 -212
  93. package/crypto/crypto.utils.d.ts +0 -183
  94. package/date/date.utils.d.ts +0 -190
  95. package/decorators/index.cjs +0 -913
  96. package/decorators/index.d.ts +0 -25
  97. package/decorators/index.mjs +0 -872
  98. package/dir/index.d.ts +0 -25
  99. package/env/env.utils.d.ts +0 -400
  100. package/exception/exception.utils.d.ts +0 -253
  101. package/fs/fs.utils.d.ts +0 -196
  102. package/http-status-codes/http-status-codes.d.ts +0 -289
  103. package/id/id.utils.d.ts +0 -59
  104. package/logger/logger.utils.d.ts +0 -210
  105. package/middleware/middleware.utils.d.ts +0 -123
  106. package/obj/index.cjs +0 -317
  107. package/obj/index.d.ts +0 -25
  108. package/obj/index.mjs +0 -301
  109. package/performance/performance.utils.d.ts +0 -159
  110. package/request/request.utils.d.ts +0 -109
  111. package/response/response.utils.d.ts +0 -186
  112. package/server/server.builder.d.ts +0 -531
  113. package/server/server.d.ts +0 -303
  114. package/stream/stream.utils.d.ts +0 -111
  115. package/string/string.utils.d.ts +0 -124
  116. package/type/type.utils.d.ts +0 -129
  117. package/types/api-response.d.ts +0 -175
  118. package/types/common.d.ts +0 -148
  119. package/types/config.d.ts +0 -88
  120. package/types/server.d.ts +0 -291
  121. package/url/url.utils.d.ts +0 -164
  122. package/validate/index.d.ts +0 -25
package/types/server.d.ts DELETED
@@ -1,291 +0,0 @@
1
- /*
2
- * The MIT License
3
- *
4
- * Copyright (c) 2025 Catbee Technologies. https://catbee.in/license
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in all
14
- * copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
23
- */
24
-
25
- import type { Express, json, NextFunction, urlencoded, Request, Response } from 'express';
26
- import type { ExpressServer } from '@catbee/utils/server';
27
- import type { HelmetOptions } from 'helmet';
28
- import type { CompressionOptions } from 'compression';
29
- import type { CookieParseOptions } from 'cookie-parser';
30
- import type { CorsOptions } from 'cors';
31
- import type http from 'http';
32
- import type { ToggleConfig } from './common';
33
- /**
34
- * Server configuration interface with smart defaults and full customization.
35
- * All options are designed with security and performance best practices.
36
- * Most options can be overridden via environment variables.
37
- */
38
- export interface ServerConfig {
39
- /** Port the server should listen on (default: 3000, env: PORT)
40
- * - default: 3000
41
- */
42
- port: number;
43
- /** Optional host address for binding (default: '0.0.0.0', env: HOST)
44
- * - default: '0.0.0.0'
45
- */
46
- host?: string;
47
- /** CORS configuration (default: false disables CORS, or provide options object)
48
- * - default: false
49
- */
50
- cors?: ToggleConfig<CorsOptions>;
51
- /** Enable Helmet security headers (default: false disables Helmet, or provide options object)
52
- * - default: false
53
- */
54
- helmet?: ToggleConfig<HelmetOptions>;
55
- /** Enable gzip/deflate compression (default: false disables compression, or provide options object)
56
- * - default: false
57
- */
58
- compression?: ToggleConfig<CompressionOptions>;
59
- /** Request body parsing with size limits
60
- * - json: { limit: '1mb' }
61
- * - urlencoded: { extended: true, limit: '1mb' }
62
- */
63
- bodyParser?: {
64
- /** JSON parser (default: { limit: '1mb' }) */
65
- json?: Parameters<typeof json>[0];
66
- /** URL-encoded parser (default: { extended: true, limit: '1mb' }) */
67
- urlencoded?: Parameters<typeof urlencoded>[0];
68
- };
69
- /** Enable cookie parsing with options (default: false)
70
- * - default: false
71
- */
72
- cookieParser?: ToggleConfig<CookieParseOptions>;
73
- /** Trust proxy headers (default: false)
74
- * - default: false
75
- */
76
- trustProxy?: boolean;
77
- /** Static file serving configuration for assets, uploads, etc.
78
- * - path: file system path to serve
79
- * - route: URL route prefix (default: "/")
80
- * - maxAge: cache max age (default: 0)
81
- * - etag: enable ETag headers (default: true)
82
- * - immutable: enable immutable caching (default: false)
83
- * - lastModified: enable last-modified caching (default: true)
84
- * - cacheControl: enable Cache-Control headers (default: true)
85
- */
86
- staticFolders?: Array<{
87
- /** URL route prefix (default: "/") */
88
- path?: string;
89
- /** File system path to serve */
90
- directory: string;
91
- /** Cache-Control: max-age=<duration> (default: 0) */
92
- maxAge?: string;
93
- /** Enable ETag headers (default: true) */
94
- etag?: boolean;
95
- /** Enable immutable caching (default: false) */
96
- immutable?: boolean;
97
- /** Enable last-modified caching (default: true) */
98
- lastModified?: boolean;
99
- /** Enable Cache-Control headers (default: true) */
100
- cacheControl?: boolean;
101
- }>;
102
- /** Enable microservice mode (default: false)
103
- * - default: false
104
- */
105
- isMicroservice?: boolean;
106
- /** Service name for headers/metrics (default: 'express_app', env: APP_NAME)
107
- * - default: 'express_app'
108
- */
109
- appName?: string;
110
- /** Global response headers (default: {})
111
- * - default: {}
112
- */
113
- globalHeaders?: Record<string, string | (() => string)>;
114
- /** Rate limiting settings
115
- * - enable: false
116
- * - windowMs: 15 * 60 * 1000
117
- * - max: 100
118
- * - message: 'Too many requests'
119
- * - standardHeaders: true
120
- * - legacyHeaders: false
121
- */
122
- rateLimit?: {
123
- /** Enable rate limiting (default: false) */
124
- enable: boolean;
125
- /** Time window in ms (default: 900000 - 15 minutes) */
126
- windowMs?: number;
127
- /** Max requests per window (default: 100) */
128
- max?: number;
129
- /** Rate limit message (default: 'Too many requests') */
130
- message?: string;
131
- /** Add standard headers (default: true) */
132
- standardHeaders?: boolean;
133
- /** Add legacy headers (default: false) */
134
- legacyHeaders?: boolean;
135
- };
136
- /** Request logging configuration
137
- * - enable: true in dev, false in prod
138
- * - ignorePaths: skips /healthz, /favicon.ico, /metrics, /docs, /.well-known
139
- * - skipNotFoundRoutes: false
140
- */
141
- requestLogging?: {
142
- /** Enable request logging (default: true in dev, false in prod) */
143
- enable: boolean;
144
- /** Ignore paths function or string[] (default: skips /healthz, /favicon.ico, /metrics, /docs, /.well-known) */
145
- ignorePaths?: string[] | ((req: Request, res: Response) => boolean);
146
- /** Skip logging for not found routes (default: false) */
147
- skipNotFoundRoutes?: boolean;
148
- };
149
- /** Health check settings
150
- * - path: '/healthz'
151
- * - detailed: true
152
- * - withGlobalPrefix: false
153
- */
154
- healthCheck?: {
155
- /** Health check path (default: '/healthz') */
156
- path?: string;
157
- /** Custom checks (default: []) */
158
- checks?: Array<{
159
- name: string;
160
- check: () => Promise<boolean> | boolean;
161
- }>;
162
- /** Show detailed checks status in response (default: true) */
163
- detailed?: boolean;
164
- /** Include in global prefix (default: false) */
165
- withGlobalPrefix?: boolean;
166
- };
167
- /** Request timeout in ms (default: 30000 - 30 seconds)
168
- * - default: 30000
169
- */
170
- requestTimeout?: number;
171
- /** Response timing configuration
172
- * - enable: false
173
- * - addHeader: true
174
- * - logOnComplete: false
175
- */
176
- responseTime?: {
177
- /** Enable timing (default: false) */
178
- enable: boolean;
179
- /** Add X-Response-Time header (default: true) */
180
- addHeader?: boolean;
181
- /** Log completion time (default: false) */
182
- logOnComplete?: boolean;
183
- };
184
- /** Request ID configuration
185
- * - headerName: 'x-request-id'
186
- * - exposeHeader: true
187
- * - generator: uuid()
188
- */
189
- requestId?: {
190
- /** Header name (default: 'x-request-id') */
191
- headerName?: string;
192
- /** Add to response headers (default: true) */
193
- exposeHeader?: boolean;
194
- /** ID generator (default: uuid()) */
195
- generator?: () => string;
196
- };
197
- /** Global route prefix (default: '/')
198
- * - default: '/'
199
- */
200
- globalPrefix?: string;
201
- /** OpenAPI documentation
202
- * - enable: false
203
- * - mountPath: '/docs'
204
- * - verbose: false
205
- * - withGlobalPrefix: false
206
- */
207
- openApi?: {
208
- /** Enable docs (default: false) */
209
- enable: boolean;
210
- /** UI path (default: '/docs') */
211
- mountPath?: string;
212
- /** Spec file path (required if enabled) */
213
- filePath?: string;
214
- /** Enable verbose logs (default: false) */
215
- verbose?: boolean;
216
- /** Include in global prefix (default: false) */
217
- withGlobalPrefix?: boolean;
218
- };
219
- /** Prometheus metrics
220
- * - enable: false
221
- * - path: '/metrics'
222
- * - withGlobalPrefix: false
223
- */
224
- metrics?: {
225
- /** Enable metrics (default: false) */
226
- enable: boolean;
227
- /** Metrics path (default: '/metrics') */
228
- path?: string;
229
- /** Include in global prefix (default: false) */
230
- withGlobalPrefix?: boolean;
231
- };
232
- /** Service version header
233
- * - enable: false
234
- * - headerName: 'x-service-version'
235
- * - version: '0.0.0'
236
- */
237
- serviceVersion?: {
238
- /** Enable version header (default: false) */
239
- enable: boolean;
240
- /** Header name (default: 'x-service-version') */
241
- headerName?: string;
242
- /** Version value (default: '0.0.0') */
243
- version?: string | (() => string);
244
- };
245
- /**
246
- * HTTPS configuration (if provided, server will use HTTPS)
247
- * Requires 'key' and 'cert' at minimum.
248
- * @command - to generate self-signed certificates
249
- * ```bash
250
- * choco install mkcert
251
- * mkcert -key-file localhost-key.pem -cert-file localhost-cert.pem localhost 127.0.0.1 ::1
252
- * ```
253
- */
254
- https?: {
255
- /** Path to SSL private key file (PEM) */
256
- key: string;
257
- /** Path to SSL certificate file (PEM) */
258
- cert: string;
259
- /** Optional path to CA bundle file (PEM) */
260
- ca?: string;
261
- /** Optional passphrase for the private key */
262
- passphrase?: string;
263
- /** Any other https.ServerOptions */
264
- [key: string]: any;
265
- };
266
- }
267
- /**
268
- * Server lifecycle hooks for custom behavior injection.
269
- * Allows extending server functionality without modifying core code.
270
- * All hooks can be async and support error handling.
271
- */
272
- export interface ServerHooks {
273
- /** Called before any middleware or routes are initialized - good for early setup */
274
- beforeInit?: (server: ExpressServer) => Promise<void> | void;
275
- /** Called after middleware and routes are set up - good for final configuration */
276
- afterInit?: (server: ExpressServer) => Promise<void> | void;
277
- /** Called just before the server starts listening - good for last-minute checks */
278
- beforeStart?: (app: Express) => Promise<void> | void;
279
- /** Called after the server starts successfully - good for announcing readiness */
280
- afterStart?: (server: http.Server) => Promise<void> | void;
281
- /** Called before graceful shutdown begins - good for cleanup preparation */
282
- beforeStop?: (server: http.Server) => Promise<void> | void;
283
- /** Called after server has stopped - good for final cleanup */
284
- afterStop?: () => Promise<void> | void;
285
- /** Custom global error handler - overrides the default error handling */
286
- onError?: (error: Error, req: Request, res: Response, next: NextFunction) => void;
287
- /** Called at the start of each request - good for request preprocessing */
288
- onRequest?: (req: Request, res: Response, next: NextFunction) => void;
289
- /** Called before response is sent - good for response modification */
290
- onResponse?: (req: Request, res: Response, next: NextFunction) => void;
291
- }
@@ -1,164 +0,0 @@
1
- /*
2
- * The MIT License
3
- *
4
- * Copyright (c) 2025 Catbee Technologies. https://catbee.in/license
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in all
14
- * copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
23
- */
24
-
25
- /**
26
- * Appends query parameters to a given URL.
27
- *
28
- * @param {string} url - The base URL to which query parameters will be appended.
29
- * @param {Record<string, string | number>} params - Key-value pairs to add as query parameters.
30
- * @returns {string} The new URL string with query parameters appended.
31
- *
32
- * @example
33
- * appendQueryParams('https://example.com', { page: 1, limit: 10 });
34
- * // → 'https://example.com/?page=1&limit=10'
35
- */
36
- export declare function appendQueryParams(url: string, params: Record<string, string | number>): string;
37
- /**
38
- * Parses a query string into a key-value object.
39
- *
40
- * @param {string} query - The query string (with or without leading '?').
41
- * @returns {Record<string, string>} Object representing parsed query parameters.
42
- *
43
- * @example
44
- * parseQueryString('?page=1&limit=10');
45
- * // → { page: '1', limit: '10' }
46
- */
47
- export declare function parseQueryString(query: string): Record<string, string>;
48
- /**
49
- * Validates if a string is a valid URL.
50
- *
51
- * @param {string} url - The URL string to validate.
52
- * @param {boolean} [requireHttps=false] - If true, requires the URL to use HTTPS.
53
- * @returns {boolean} True if the URL is valid, false otherwise.
54
- */
55
- export declare function isValidUrl(url: string, requireHttps?: boolean): boolean;
56
- /**
57
- * Extracts the domain name from a URL.
58
- *
59
- * @param {string} url - The URL to extract the domain from.
60
- * @param {boolean} [removeSubdomains=false] - If true, removes subdomains (returns root domain only).
61
- * @returns {string} The domain name.
62
- *
63
- * @example
64
- * getDomain('https://api.example.com/path');
65
- * // → 'api.example.com'
66
- *
67
- * getDomain('https://api.example.com/path', true);
68
- * // → 'example.com'
69
- */
70
- export declare function getDomain(url: string, removeSubdomains?: boolean): string;
71
- /**
72
- * Joins URL paths properly handling slashes.
73
- *
74
- * @param {...string[]} segments - URL path segments to join.
75
- * @returns {string} Joined URL path.
76
- *
77
- * @example
78
- * joinPaths('https://example.com/', '/api/', '/users');
79
- * // → 'https://example.com/api/users'
80
- */
81
- export declare function joinPaths(...segments: string[]): string;
82
- /**
83
- * Normalizes a URL by resolving relative paths, handling protocol-relative URLs, etc.
84
- *
85
- * @param {string} url - The URL to normalize.
86
- * @param {string} [base] - Optional base URL for resolving relative URLs.
87
- * @returns {string} Normalized URL.
88
- *
89
- * @example
90
- * normalizeUrl('HTTP://Example.COM/foo/../bar');
91
- * // → 'http://example.com/bar'
92
- */
93
- export declare function normalizeUrl(url: string, base?: string): string;
94
- /**
95
- * Creates a URL builder for constructing URLs with a base URL.
96
- *
97
- * @param {string} baseUrl - The base URL to build upon.
98
- * @returns {Object} URL builder methods.
99
- *
100
- * @example
101
- * const api = createUrlBuilder('https://api.example.com');
102
- * api.path('/users', { active: true });
103
- * // → 'https://api.example.com/users?active=true'
104
- */
105
- export declare function createUrlBuilder(baseUrl: string): {
106
- /**
107
- * Creates a full URL with the given path and query parameters.
108
- *
109
- * @param {string} path - The path to append to the base URL.
110
- * @param {Record<string, any>} [params] - Query parameters to add.
111
- * @returns {string} The complete URL.
112
- */
113
- path(path: string, params?: Record<string, any>): string;
114
- /**
115
- * Creates a full URL with query parameters but no additional path.
116
- *
117
- * @param {Record<string, any>} params - Query parameters to add.
118
- * @returns {string} The complete URL with query parameters.
119
- */
120
- query(params: Record<string, any>): string;
121
- };
122
- /**
123
- * Extracts specific query parameters from a URL.
124
- *
125
- * @param {string} url - The URL to extract parameters from.
126
- * @param {string[]} paramNames - Names of parameters to extract.
127
- * @returns {Record<string, string>} Object containing the extracted parameters.
128
- */
129
- export declare function extractQueryParams(url: string, paramNames: string[]): Record<string, string>;
130
- /**
131
- * Removes specified query parameters from a URL.
132
- *
133
- * @param {string} url - The URL to modify.
134
- * @param {string[]} paramsToRemove - Names of parameters to remove.
135
- * @returns {string} URL with parameters removed.
136
- */
137
- export declare function removeQueryParams(url: string, paramsToRemove: string[]): string;
138
- /**
139
- * Gets the file extension from a URL path.
140
- *
141
- * @param {string} url - The URL to examine.
142
- * @returns {string} The file extension (without dot) or empty string if none found.
143
- *
144
- * @example
145
- * getExtension('https://example.com/document.pdf?v=1');
146
- * // → 'pdf'
147
- */
148
- export declare function getExtension(url: string): string;
149
- /**
150
- * Parses URL query parameters into a strongly-typed object.
151
- *
152
- * @template T Expected type of the query parameters
153
- * @param {string} url - The URL to parse.
154
- * @param {Record<keyof T, (val: string) => any>} [converters] - Type converters for params.
155
- * @returns {Partial<T>} Typed query parameters.
156
- *
157
- * @example
158
- * parseTypedQueryParams<{page: number, q: string}>('https://example.com?page=2&q=test', {
159
- * page: Number,
160
- * q: String
161
- * });
162
- * // → { page: 2, q: 'test' }
163
- */
164
- export declare function parseTypedQueryParams<T extends Record<string, any>>(url: string, converters?: Record<keyof T, (val: string) => any>): Partial<T>;
@@ -1,25 +0,0 @@
1
- /*
2
- * The MIT License
3
- *
4
- * Copyright (c) 2025 Catbee Technologies. https://catbee.in/license
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in all
14
- * copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
23
- */
24
-
25
- export * from './validate.utils';