@catbee/utils 1.0.1 → 1.0.2

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/build/index.d.ts CHANGED
@@ -26,6 +26,7 @@ import { AsyncLocalStorage } from 'async_hooks';
26
26
  import { BinaryToTextEncoding, CipherGCMTypes } from 'crypto';
27
27
  import express, { RequestHandler, Router, Request, Response, NextFunction, Express, json, urlencoded } from 'express';
28
28
  import fs, { Stats } from 'fs';
29
+ import { Readable, Transform } from 'stream';
29
30
  import * as prom_client from 'prom-client';
30
31
  import http from 'http';
31
32
  import https from 'https';
@@ -1184,6 +1185,165 @@ declare function createSignedToken(payload: Record<string, any>, secret: string,
1184
1185
  */
1185
1186
  declare function verifySignedToken(token: string, secret: string): Record<string, any> | null;
1186
1187
 
1188
+ /**
1189
+ * Format options for the formatDate function
1190
+ */
1191
+ interface DateFormatOptions {
1192
+ /** Date format pattern (default: 'yyyy-MM-dd') */
1193
+ format?: string;
1194
+ /** Locale to use for formatting (default: system locale) */
1195
+ locale?: string | string[];
1196
+ /** Time zone to use (default: system time zone) */
1197
+ timeZone?: string;
1198
+ }
1199
+ /**
1200
+ * Format a date according to the specified format pattern.
1201
+ *
1202
+ * @param date - Date to format
1203
+ * @param options - Formatting options
1204
+ * @returns Formatted date string
1205
+ *
1206
+ * @example
1207
+ * ```typescript
1208
+ * // Format as ISO date
1209
+ * formatDate(new Date(), { format: 'yyyy-MM-dd' }); // '2023-05-15'
1210
+ *
1211
+ * // Format with time
1212
+ * formatDate(new Date(), { format: 'yyyy-MM-dd HH:mm:ss' }); // '2023-05-15 14:30:22'
1213
+ *
1214
+ * // Format with locale
1215
+ * formatDate(new Date(), { format: 'PPPP', locale: 'fr-FR' }); // 'lundi 15 mai 2023'
1216
+ * ```
1217
+ */
1218
+ declare function formatDate(date: Date | number, options?: DateFormatOptions): string;
1219
+ /**
1220
+ * Format a date as relative time (e.g., "5 minutes ago", "in 3 days").
1221
+ *
1222
+ * @param date - Date to format
1223
+ * @param now - Reference date (default: current time)
1224
+ * @param locale - Locale to use for formatting
1225
+ * @returns Formatted relative time string
1226
+ */
1227
+ declare function formatRelativeTime(date: Date | number, now?: Date | number, locale?: string | string[]): string;
1228
+ /**
1229
+ * Parse a date string or timestamp into a Date object.
1230
+ *
1231
+ * @param input - Date string or timestamp to parse
1232
+ * @param fallback - Fallback date if parsing fails
1233
+ * @returns Parsed Date object or fallback
1234
+ *
1235
+ * @example
1236
+ * ```typescript
1237
+ * parseDate('2023-05-15'); // Date object for May 15, 2023
1238
+ * parseDate('invalid', new Date()); // Returns current date as fallback
1239
+ * ```
1240
+ */
1241
+ declare function parseDate(input: string | number, fallback?: Date): Date | null;
1242
+ /**
1243
+ * Calculate the difference between two dates in the specified unit.
1244
+ *
1245
+ * @param date1 - First date
1246
+ * @param date2 - Second date (default: current time)
1247
+ * @param unit - Unit of time for the difference
1248
+ * @returns Difference in the specified unit
1249
+ *
1250
+ * @example
1251
+ * ```typescript
1252
+ * // Get difference in days
1253
+ * dateDiff(new Date('2023-05-15'), new Date('2023-05-10'), 'days'); // 5
1254
+ *
1255
+ * // Get difference in hours
1256
+ * dateDiff(new Date('2023-05-15T10:00:00'), new Date('2023-05-15T06:00:00'), 'hours'); // 4
1257
+ * ```
1258
+ */
1259
+ declare function dateDiff(date1: Date | number, date2?: Date | number, unit?: 'milliseconds' | 'seconds' | 'minutes' | 'hours' | 'days' | 'months' | 'years'): number;
1260
+ /**
1261
+ * Add a specified amount of time to a date.
1262
+ *
1263
+ * @param date - Base date
1264
+ * @param amount - Amount to add (can be negative)
1265
+ * @param unit - Unit of time to add
1266
+ * @returns New date with the addition
1267
+ *
1268
+ * @example
1269
+ * ```typescript
1270
+ * // Add 5 days
1271
+ * addToDate(new Date('2023-05-15'), 5, 'days'); // Date for May 20, 2023
1272
+ *
1273
+ * // Subtract 2 hours
1274
+ * addToDate(new Date('2023-05-15T10:00:00'), -2, 'hours'); // Date for May 15, 2023 08:00:00
1275
+ * ```
1276
+ */
1277
+ declare function addToDate(date: Date | number, amount: number, unit: 'milliseconds' | 'seconds' | 'minutes' | 'hours' | 'days' | 'months' | 'years'): Date;
1278
+ /**
1279
+ * Get the start of a time period containing the specified date.
1280
+ *
1281
+ * @param date - Date to get the start from
1282
+ * @param unit - Time unit
1283
+ * @returns Date object representing the start of the time unit
1284
+ *
1285
+ * @example
1286
+ * ```typescript
1287
+ * // Get start of day (midnight)
1288
+ * startOf(new Date('2023-05-15T14:30:00'), 'day'); // Date for May 15, 2023 00:00:00
1289
+ *
1290
+ * // Get start of month
1291
+ * startOf(new Date('2023-05-15'), 'month'); // Date for May 1, 2023
1292
+ * ```
1293
+ */
1294
+ declare function startOf(date: Date | number, unit: 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year'): Date;
1295
+ /**
1296
+ * Get the end of a time period containing the specified date.
1297
+ *
1298
+ * @param date - Date to get the end from
1299
+ * @param unit - Time unit
1300
+ * @returns Date object representing the end of the time unit
1301
+ *
1302
+ * @example
1303
+ * ```typescript
1304
+ * // Get end of day (23:59:59.999)
1305
+ * endOf(new Date('2023-05-15T14:30:00'), 'day'); // Date for May 15, 2023 23:59:59.999
1306
+ *
1307
+ * // Get end of month
1308
+ * endOf(new Date('2023-05-15'), 'month'); // Date for May 31, 2023 23:59:59.999
1309
+ * ```
1310
+ */
1311
+ declare function endOf(date: Date | number, unit: 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year'): Date;
1312
+ /**
1313
+ * Check if a date is between two other dates.
1314
+ *
1315
+ * @param date - Date to check
1316
+ * @param start - Start date of the range
1317
+ * @param end - End date of the range
1318
+ * @param inclusive - Whether the comparison should be inclusive of start/end
1319
+ * @returns True if the date is within the range
1320
+ *
1321
+ * @example
1322
+ * ```typescript
1323
+ * const date = new Date('2023-05-15');
1324
+ * const start = new Date('2023-05-10');
1325
+ * const end = new Date('2023-05-20');
1326
+ *
1327
+ * isBetween(date, start, end); // true
1328
+ * ```
1329
+ */
1330
+ declare function isBetween(date: Date | number, start: Date | number, end: Date | number, inclusive?: boolean): boolean;
1331
+ /**
1332
+ * Check if a year is a leap year.
1333
+ *
1334
+ * @param year - Year to check (or date object)
1335
+ * @returns True if the year is a leap year
1336
+ */
1337
+ declare function isLeapYear(year: number | Date): boolean;
1338
+ /**
1339
+ * Get the number of days in a month.
1340
+ *
1341
+ * @param year - Year
1342
+ * @param month - Month (0-11)
1343
+ * @returns Number of days in the month
1344
+ */
1345
+ declare function daysInMonth(year: number | Date, month?: number): number;
1346
+
1187
1347
  /**
1188
1348
  * Parameter decoration definition for method parameters
1189
1349
  */
@@ -3642,6 +3802,142 @@ declare function isObject(value: unknown): value is Record<string, any>;
3642
3802
  */
3643
3803
  declare function getAllPaths(obj: Record<string, any>, parentPath?: string): string[];
3644
3804
 
3805
+ /**
3806
+ * Options for timing function execution.
3807
+ */
3808
+ interface TimingOptions {
3809
+ /** Optional label for the timing (defaults to function name) */
3810
+ label?: string;
3811
+ /** Whether to log the timing (default: false) */
3812
+ log?: boolean;
3813
+ /** Log level to use if logging is enabled (default: 'debug') */
3814
+ logLevel?: 'trace' | 'debug' | 'info' | 'warn' | 'error';
3815
+ }
3816
+ /**
3817
+ * Result of a timing operation.
3818
+ */
3819
+ interface TimingResult {
3820
+ /** Duration in milliseconds */
3821
+ durationMs: number;
3822
+ /** Duration in seconds */
3823
+ durationSec: number;
3824
+ /** Start timestamp */
3825
+ startTime: number;
3826
+ /** End timestamp */
3827
+ endTime: number;
3828
+ /** Label used for the timing */
3829
+ label: string;
3830
+ }
3831
+ /**
3832
+ * Measure the execution time of a synchronous function.
3833
+ *
3834
+ * @param fn - Function to measure
3835
+ * @param options - Timing options
3836
+ * @returns Result containing the return value and timing information
3837
+ *
3838
+ * @example
3839
+ * ```typescript
3840
+ * const { result, timing } = timeSync(() => {
3841
+ * // Some expensive operation
3842
+ * return computeResult();
3843
+ * }, { label: 'Computation', log: true });
3844
+ *
3845
+ * console.log(`Result: ${result}, took ${timing.durationMs}ms`);
3846
+ * ```
3847
+ */
3848
+ declare function timeSync<T>(fn: () => T, options?: TimingOptions): {
3849
+ result: T;
3850
+ timing: TimingResult;
3851
+ };
3852
+ /**
3853
+ * Measure the execution time of an asynchronous function.
3854
+ *
3855
+ * @param fn - Async function to measure
3856
+ * @param options - Timing options
3857
+ * @returns Promise resolving to result and timing information
3858
+ *
3859
+ * @example
3860
+ * ```typescript
3861
+ * const { result, timing } = await timeAsync(async () => {
3862
+ * // Some expensive async operation
3863
+ * const data = await fetchData();
3864
+ * return processData(data);
3865
+ * }, { label: 'API Request', log: true });
3866
+ *
3867
+ * console.log(`Fetched ${result.length} items in ${timing.durationSec.toFixed(2)}s`);
3868
+ * ```
3869
+ */
3870
+ declare function timeAsync<T>(fn: () => Promise<T>, options?: TimingOptions): Promise<{
3871
+ result: T;
3872
+ timing: TimingResult;
3873
+ }>;
3874
+ /**
3875
+ * Create a timing decorator for class methods.
3876
+ *
3877
+ * @param options - Timing options
3878
+ * @returns Method decorator
3879
+ *
3880
+ * @example
3881
+ * ```typescript
3882
+ * class DataService {
3883
+ * @timed({ log: true, logLevel: 'info' })
3884
+ * async fetchData() {
3885
+ * // ...implementation
3886
+ * }
3887
+ * }
3888
+ * ```
3889
+ */
3890
+ declare function timed(options?: TimingOptions): (target: any, propertyKeyOrContext: string | symbol | any, descriptor?: PropertyDescriptor) => void;
3891
+ /**
3892
+ * Memoize function results with optional TTL and max cache size.
3893
+ *
3894
+ * @param fn - Function to memoize
3895
+ * @param options - Memoization options
3896
+ * @returns Memoized function
3897
+ *
3898
+ * @example
3899
+ * ```typescript
3900
+ * // Cache results for 30 seconds, with a maximum of 100 entries
3901
+ * const cachedFetch = memoize(
3902
+ * async (url) => {
3903
+ * const response = await fetch(url);
3904
+ * return response.json();
3905
+ * },
3906
+ * { ttl: 30000, maxSize: 100, cacheKey: (url) => url }
3907
+ * );
3908
+ * ```
3909
+ */
3910
+ declare function memoize<T, Args extends any[]>(fn: (...args: Args) => T, options?: {
3911
+ /** Time-to-live in milliseconds (default: indefinite) */
3912
+ ttl?: number;
3913
+ /** Maximum cache size (default: unlimited) */
3914
+ maxSize?: number;
3915
+ /** Function to generate a cache key from arguments */
3916
+ cacheKey?: (...args: Args) => string;
3917
+ /** Auto-cleanup interval in milliseconds (default: disabled) */
3918
+ autoCleanupMs?: number;
3919
+ }): (...args: Args) => T;
3920
+ /**
3921
+ * Track memory usage for a function execution.
3922
+ *
3923
+ * @param fn - Function to track
3924
+ * @param options - Memory tracking options
3925
+ * @returns Result and memory usage information
3926
+ */
3927
+ declare function trackMemoryUsage<T>(fn: () => T, options?: {
3928
+ /** Whether to log the memory usage (default: false) */
3929
+ log?: boolean;
3930
+ /** Label for the memory tracking (default: function name) */
3931
+ label?: string;
3932
+ }): {
3933
+ result: T;
3934
+ memoryUsage: {
3935
+ before: NodeJS.MemoryUsage;
3936
+ after: NodeJS.MemoryUsage;
3937
+ diff: Record<string, number>;
3938
+ };
3939
+ };
3940
+
3645
3941
  /**
3646
3942
  * Options for parsing and validating request parameters.
3647
3943
  */
@@ -3726,6 +4022,92 @@ declare function extractSortParams(query: Record<string, string | string[]>, all
3726
4022
  */
3727
4023
  declare function extractFilterParams(query: Record<string, string | string[]>, allowedFilters: string[]): Record<string, string | string[]>;
3728
4024
 
4025
+ /**
4026
+ * Convert a buffer or string to a readable stream.
4027
+ *
4028
+ * @param data - Buffer or string to convert
4029
+ * @returns Readable stream containing the data
4030
+ *
4031
+ * @example
4032
+ * ```typescript
4033
+ * const stream = bufferToStream(Buffer.from('Hello world'));
4034
+ * // or
4035
+ * const stream = bufferToStream('Hello world');
4036
+ * ```
4037
+ */
4038
+ declare function bufferToStream(data: Buffer | string): Readable;
4039
+ /**
4040
+ * Convert a readable stream to a buffer.
4041
+ *
4042
+ * @param stream - Readable stream to convert
4043
+ * @returns Promise resolving to a buffer containing all stream data
4044
+ *
4045
+ * @example
4046
+ * ```typescript
4047
+ * const buffer = await streamToBuffer(fs.createReadStream('file.txt'));
4048
+ * console.log(buffer.toString()); // Contents of file.txt
4049
+ * ```
4050
+ */
4051
+ declare function streamToBuffer(stream: Readable): Promise<Buffer>;
4052
+ /**
4053
+ * Convert a readable stream to a string.
4054
+ *
4055
+ * @param stream - Readable stream to convert
4056
+ * @param encoding - Character encoding (default: 'utf8')
4057
+ * @returns Promise resolving to a string containing all stream data
4058
+ *
4059
+ * @example
4060
+ * ```typescript
4061
+ * const content = await streamToString(fs.createReadStream('file.txt'));
4062
+ * console.log(content); // Contents of file.txt as string
4063
+ * ```
4064
+ */
4065
+ declare function streamToString(stream: Readable, encoding?: BufferEncoding): Promise<string>;
4066
+ /**
4067
+ * Create a transform stream that limits the rate of data flow.
4068
+ *
4069
+ * @param bytesPerSecond - Maximum bytes per second
4070
+ * @returns Transform stream that throttles data flow
4071
+ */
4072
+ declare function createThrottleStream(bytesPerSecond: number): Transform;
4073
+ /**
4074
+ * Create a transform stream that batches data into chunks of specified size.
4075
+ *
4076
+ * @param size - Size of each batch (items for object mode, bytes for binary mode)
4077
+ * @param options - Stream options
4078
+ * @returns Transform stream that batches data
4079
+ *
4080
+ * @example
4081
+ * ```typescript
4082
+ * // Batch lines from a file into arrays of 100 lines each
4083
+ * createReadStream('large-file.txt')
4084
+ * .pipe(createLineStream())
4085
+ * .pipe(createBatchStream(100))
4086
+ * .on('data', batch => console.log(`Processing batch of ${batch.length} lines`));
4087
+ * ```
4088
+ */
4089
+ declare function createBatchStream(size: number, options?: {
4090
+ objectMode?: boolean;
4091
+ }): Transform;
4092
+ /**
4093
+ * Create a transform stream that splits text data by newlines.
4094
+ *
4095
+ * @param options - Options for the line stream
4096
+ * @returns Transform stream that emits lines
4097
+ *
4098
+ * @example
4099
+ * ```typescript
4100
+ * // Process a file line by line
4101
+ * createReadStream('file.txt')
4102
+ * .pipe(createLineStream())
4103
+ * .on('data', line => console.log(`Line: ${line}`));
4104
+ * ```
4105
+ */
4106
+ declare function createLineStream(options?: {
4107
+ encoding?: BufferEncoding;
4108
+ includeNewlines?: boolean;
4109
+ }): Transform;
4110
+
3729
4111
  /**
3730
4112
  * Capitalizes the first character of a string.
3731
4113
  *
@@ -3819,6 +4201,96 @@ declare function reverse(str: string): string;
3819
4201
  */
3820
4202
  declare function countOccurrences(str: string, substring: string, caseSensitive?: boolean): number;
3821
4203
 
4204
+ /**
4205
+ * Check if a value is of a specific primitive type.
4206
+ *
4207
+ * @param value - Value to check
4208
+ * @param type - Type to check against
4209
+ * @returns Whether the value is of the specified type
4210
+ *
4211
+ * @example
4212
+ * ```typescript
4213
+ * isPrimitiveType('hello', 'string'); // true
4214
+ * isPrimitiveType(42, 'number'); // true
4215
+ * isPrimitiveType(true, 'boolean'); // true
4216
+ * isPrimitiveType(null, 'null'); // true
4217
+ * isPrimitiveType(undefined, 'undefined'); // true
4218
+ * isPrimitiveType({}, 'object'); // true
4219
+ * isPrimitiveType([], 'array'); // true
4220
+ * ```
4221
+ */
4222
+ declare function isPrimitiveType(value: unknown, type: 'string' | 'number' | 'boolean' | 'symbol' | 'bigint' | 'function' | 'object' | 'array' | 'null' | 'undefined'): boolean;
4223
+ /**
4224
+ * Get the primitive type of a value as a string.
4225
+ *
4226
+ * @param value - Value to get the type of
4227
+ * @returns String representing the type
4228
+ *
4229
+ * @example
4230
+ * ```typescript
4231
+ * getTypeOf('hello'); // 'string'
4232
+ * getTypeOf(42); // 'number'
4233
+ * getTypeOf([]); // 'array'
4234
+ * getTypeOf(null); // 'null'
4235
+ * ```
4236
+ */
4237
+ declare function getTypeOf(value: unknown): string;
4238
+ /**
4239
+ * Type guard for checking if a value is an array of a specific type.
4240
+ *
4241
+ * @param value - Value to check
4242
+ * @param itemTypeGuard - Function that checks if items are of the expected type
4243
+ * @returns True if the value is an array with items of the expected type
4244
+ *
4245
+ * @example
4246
+ * ```typescript
4247
+ * isArrayOf([1, 2, 3], (item): item is number => typeof item === 'number'); // true
4248
+ * isArrayOf(['a', 'b', 'c'], (item): item is string => typeof item === 'string'); // true
4249
+ * isArrayOf([1, '2', 3], (item): item is number => typeof item === 'number'); // false
4250
+ * ```
4251
+ */
4252
+ declare function isArrayOf<T>(value: unknown, itemTypeGuard: (item: unknown) => item is T): value is T[];
4253
+ /**
4254
+ * Convert a value to a string.
4255
+ *
4256
+ * @param value - Value to convert
4257
+ * @param defaultValue - Default value if conversion fails
4258
+ * @returns String representation of the value
4259
+ */
4260
+ declare function toStr(value: unknown, defaultValue?: string): string;
4261
+ /**
4262
+ * Convert a value to a number.
4263
+ *
4264
+ * @param value - Value to convert
4265
+ * @param defaultValue - Default value if conversion fails
4266
+ * @returns Numeric representation of the value
4267
+ */
4268
+ declare function toNum(value: unknown, defaultValue?: number): number;
4269
+ /**
4270
+ * Convert a value to a boolean.
4271
+ *
4272
+ * @param value - Value to convert
4273
+ * @param defaultValue - Default value if conversion fails
4274
+ * @returns Boolean representation of the value
4275
+ */
4276
+ declare function toBool(value: unknown, defaultValue?: boolean): boolean;
4277
+ /**
4278
+ * Ensure a value matches the expected type, or provide a default.
4279
+ *
4280
+ * @param value - Value to check
4281
+ * @param expectedType - Expected primitive type
4282
+ * @param defaultValue - Default value to use if type doesn't match
4283
+ * @returns The value if it matches the type, otherwise the default
4284
+ *
4285
+ * @example
4286
+ * ```typescript
4287
+ * ensureType(42, 'number', 0); // 42
4288
+ * ensureType('42', 'number', 0); // 0
4289
+ * ensureType(undefined, 'string', 'default'); // 'default'
4290
+ * ```
4291
+ */
4292
+ declare function ensureType<T>(value: unknown, expectedType: string, defaultValue: T): T;
4293
+
3822
4294
  /**
3823
4295
  * Appends query parameters to a given URL.
3824
4296
  *
@@ -5281,4 +5753,4 @@ declare class ServerConfigBuilder {
5281
5753
  private setEnabled;
5282
5754
  }
5283
5755
 
5284
- export { After, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, type AsyncOperationResponse, type Awaited$1 as Awaited, BUILD_MARKER, BadGatewayException, BadRequestException, type BatchResponse, Before, Body, type BufferEncoding, Cache, CircuitBreakerOpenError, type CircuitBreakerOptions, CircuitBreakerState, ConflictException, Connect, ContentType, ContextStore, Controller, DIContainer, type DecryptionOptions, type DeepPartial, type DeepReadonly, type DeepRequired, type DeepStringifyOrNull, Delete, type EncryptionOptions, type EncryptionResult, Env, Environment, type ErrorHandlerOptions, ErrorResponse, ExpressServer, ForbiddenException, type Func, GatewayTimeoutException, Get, Head, Header, Headers, HttpCode, HttpError, HttpStatusCodes, Inject, Injectable, InsufficientStorageException, InternalServerErrorException, type IsEqual, type KeysOfType, Log, type Logger, type LoggerLevels, type MaybePromise, MethodNotAllowedException, type Middleware, type Mutable, NoContentResponse, type NonEmptyArray, NotAcceptableException, NotFoundException, type Nullable, type Optional, type Optional2, Options, PaginatedResponse, type Pagination, type PaginationParams, type PaginationResponse, Param, type ParamOptions, type PartialPick, Patch, type PathOptions, PayloadTooLargeException, type PickByType, Post, type Primitive, Put, Query, RateLimit, type RecordOptional, Redirect, RedirectResponse, Req, ReqCookie, ReqHeader, ReqId, ReqLogger, RequestTimeoutException, type RequireAtLeastOne, Res, Roles, type ServerConfig, ServerConfigBuilder, type ServerHooks, ServiceUnavailableException, SortDirection, type Store, StoreKeys, type StreamResponse, type StringKeyedRecord, SuccessResponse, TTLCache, type TTLCacheOptions, type TaskQueue, Timeout, type ToggleConfig, TooManyRequestsException, Trace, TypedContextKey, UnauthorizedException, type UnionToIntersection, UnprocessableEntityException, UnsupportedMediaTypeException, type UrlOptions, Use, type ValidationOptions, type ValidationResult, type ValueOf, Version, type WithPagination, type Without, type Writable, _globalThis, abortable, addRedactFields, addSensitiveFields, appendQueryParams, appendTextFile, capitalize, chunk, circuitBreaker, compact, copyDir, copyFile, countBy, countOccurrences, createChildLogger, createDeferred, createDirectory, createErrorResponse, createFinalErrorResponse, createHttpError, createPaginatedResponse, createParamDecorator, createParamDecoratorWithoutParam, createRequestLogger, createSignedToken, createSuccessResponse, createTaskQueue, createTempDir, createTempFile, createUrlBuilder, debounce, decrypt, deepFreeze, deepObjMerge, defaultSensitiveFields, deleteDirRecursive, deleteFileIfExists, difference, emptyDir, encrypt, ensureDir, ensureEmptyDir, equalsIgnoreCase, errorHandler, extractFilterParams, extractPaginationParams, extractQueryParams, extractSortParams, fileExists, filterObject, findFilesByPattern, findInDir, findNewestFile, findOldestFile, flattenDeep, flattenObject, generateApiKey, generateRandomBytes, generateRandomBytesAsString, getAllPaths, getConfig, getDirSize, getDirStats, getDomain, getErrorMessage, getExtension, getFileSize, getFileStats, getFromContext, getLogger, getPaginationParams, getRedactCensor, getRequestId, getSubdirectories, getValueByPath, groupBy, hasErrorShape, hasRequiredProps, hash, healthCheck, hmac, inject, intersect, isAlpha, isAlphanumeric, isArray, isBase64, isCreditCard, isDateInRange, isDirectory, isEmail, isEqual, isFile, isHexColor, isHttpError, isIPv4, isIPv6, isISODate, isLengthBetween, isNumberBetween, isNumeric, isObjEmpty, isObject, isPhone, isPlainObject, isPort, isStrongPassword, isURL, isUUID, isValidJSON, isValidUrl, joinPaths, listFiles, logError, logger, mapObject, mask, matchesPattern, md5, memoizeAsync, mergeSort, moveDir, moveFile, nanoId, normalizeUrl, omit, parseBooleanParam, parseNumberParam, parseQueryString, parseTypedQueryParams, partition, pick, pluck, random, randomBase64, randomHex, randomInt, randomString, range, rateLimit, readDirectory, readFileBuffer, readJsonFile, readTextFile, redact, registerControllers, removeQueryParams, requestId, responseTime, retry, reverse, runInBatches, runInSeries, runWithConcurrency, safeCompare, safeReadJsonFile, sendResponse, setConfig, setRedactCensor, setSensitiveFields, setValueByPath, settleAll, setupRequestContext, sha1, sha256, sha256Hmac, shuffle, singletonAsync, sleep, slugify, streamFile, stripHtml, take, takeWhile, throttle, timeout, toCamelCase, toKebabCase, toPascalCase, toSnakeCase, truncate, unique, uuid, validateAll, verifySignedToken, walkDir, watchDir, watchDirRecursive, waterfall, withErrorHandling, withTimeout, writeJsonFile, writeTextFile, zip };
5756
+ export { After, type ApiErrorResponse, type ApiResponse, type ApiSuccessResponse, type AsyncOperationResponse, type Awaited$1 as Awaited, BUILD_MARKER, BadGatewayException, BadRequestException, type BatchResponse, Before, Body, type BufferEncoding, Cache, CircuitBreakerOpenError, type CircuitBreakerOptions, CircuitBreakerState, ConflictException, Connect, ContentType, ContextStore, Controller, DIContainer, type DateFormatOptions, type DecryptionOptions, type DeepPartial, type DeepReadonly, type DeepRequired, type DeepStringifyOrNull, Delete, type EncryptionOptions, type EncryptionResult, Env, Environment, type ErrorHandlerOptions, ErrorResponse, ExpressServer, ForbiddenException, type Func, GatewayTimeoutException, Get, Head, Header, Headers, HttpCode, HttpError, HttpStatusCodes, Inject, Injectable, InsufficientStorageException, InternalServerErrorException, type IsEqual, type KeysOfType, Log, type Logger, type LoggerLevels, type MaybePromise, MethodNotAllowedException, type Middleware, type Mutable, NoContentResponse, type NonEmptyArray, NotAcceptableException, NotFoundException, type Nullable, type Optional, type Optional2, Options, PaginatedResponse, type Pagination, type PaginationParams, type PaginationResponse, Param, type ParamOptions, type PartialPick, Patch, type PathOptions, PayloadTooLargeException, type PickByType, Post, type Primitive, Put, Query, RateLimit, type RecordOptional, Redirect, RedirectResponse, Req, ReqCookie, ReqHeader, ReqId, ReqLogger, RequestTimeoutException, type RequireAtLeastOne, Res, Roles, type ServerConfig, ServerConfigBuilder, type ServerHooks, ServiceUnavailableException, SortDirection, type Store, StoreKeys, type StreamResponse, type StringKeyedRecord, SuccessResponse, TTLCache, type TTLCacheOptions, type TaskQueue, Timeout, type TimingOptions, type TimingResult, type ToggleConfig, TooManyRequestsException, Trace, TypedContextKey, UnauthorizedException, type UnionToIntersection, UnprocessableEntityException, UnsupportedMediaTypeException, type UrlOptions, Use, type ValidationOptions, type ValidationResult, type ValueOf, Version, type WithPagination, type Without, type Writable, _globalThis, abortable, addRedactFields, addSensitiveFields, addToDate, appendQueryParams, appendTextFile, bufferToStream, capitalize, chunk, circuitBreaker, compact, copyDir, copyFile, countBy, countOccurrences, createBatchStream, createChildLogger, createDeferred, createDirectory, createErrorResponse, createFinalErrorResponse, createHttpError, createLineStream, createPaginatedResponse, createParamDecorator, createParamDecoratorWithoutParam, createRequestLogger, createSignedToken, createSuccessResponse, createTaskQueue, createTempDir, createTempFile, createThrottleStream, createUrlBuilder, dateDiff, daysInMonth, debounce, decrypt, deepFreeze, deepObjMerge, defaultSensitiveFields, deleteDirRecursive, deleteFileIfExists, difference, emptyDir, encrypt, endOf, ensureDir, ensureEmptyDir, ensureType, equalsIgnoreCase, errorHandler, extractFilterParams, extractPaginationParams, extractQueryParams, extractSortParams, fileExists, filterObject, findFilesByPattern, findInDir, findNewestFile, findOldestFile, flattenDeep, flattenObject, formatDate, formatRelativeTime, generateApiKey, generateRandomBytes, generateRandomBytesAsString, getAllPaths, getConfig, getDirSize, getDirStats, getDomain, getErrorMessage, getExtension, getFileSize, getFileStats, getFromContext, getLogger, getPaginationParams, getRedactCensor, getRequestId, getSubdirectories, getTypeOf, getValueByPath, groupBy, hasErrorShape, hasRequiredProps, hash, healthCheck, hmac, inject, intersect, isAlpha, isAlphanumeric, isArray, isArrayOf, isBase64, isBetween, isCreditCard, isDateInRange, isDirectory, isEmail, isEqual, isFile, isHexColor, isHttpError, isIPv4, isIPv6, isISODate, isLeapYear, isLengthBetween, isNumberBetween, isNumeric, isObjEmpty, isObject, isPhone, isPlainObject, isPort, isPrimitiveType, isStrongPassword, isURL, isUUID, isValidJSON, isValidUrl, joinPaths, listFiles, logError, logger, mapObject, mask, matchesPattern, md5, memoize, memoizeAsync, mergeSort, moveDir, moveFile, nanoId, normalizeUrl, omit, parseBooleanParam, parseDate, parseNumberParam, parseQueryString, parseTypedQueryParams, partition, pick, pluck, random, randomBase64, randomHex, randomInt, randomString, range, rateLimit, readDirectory, readFileBuffer, readJsonFile, readTextFile, redact, registerControllers, removeQueryParams, requestId, responseTime, retry, reverse, runInBatches, runInSeries, runWithConcurrency, safeCompare, safeReadJsonFile, sendResponse, setConfig, setRedactCensor, setSensitiveFields, setValueByPath, settleAll, setupRequestContext, sha1, sha256, sha256Hmac, shuffle, singletonAsync, sleep, slugify, startOf, streamFile, streamToBuffer, streamToString, stripHtml, take, takeWhile, throttle, timeAsync, timeSync, timed, timeout, toBool, toCamelCase, toKebabCase, toNum, toPascalCase, toSnakeCase, toStr, trackMemoryUsage, truncate, unique, uuid, validateAll, verifySignedToken, walkDir, watchDir, watchDirRecursive, waterfall, withErrorHandling, withTimeout, writeJsonFile, writeTextFile, zip };