@catbee/utils 2.0.0-next.0 → 2.0.0-next.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/README.md +52 -16
- package/array/index.cjs +180 -71
- package/array/index.d.ts +293 -1
- package/array/index.mjs +171 -72
- package/async/index.cjs +92 -36
- package/async/index.d.ts +275 -1
- package/async/index.mjs +92 -36
- package/cache/index.cjs +1 -1
- package/cache/index.d.ts +155 -1
- package/cache/index.mjs +2 -2
- package/config/index.cjs +78 -64
- package/config/index.d.ts +64 -2
- package/config/index.mjs +76 -64
- package/context-store/index.d.ts +192 -1
- package/crypto/index.d.ts +163 -1
- package/date/index.cjs +46 -1
- package/date/index.d.ts +190 -1
- package/date/index.mjs +45 -2
- package/decorators/index.cjs +1156 -18
- package/decorators/index.d.ts +684 -1
- package/decorators/index.mjs +1156 -18
- package/dir/index.cjs +4 -3
- package/dir/index.d.ts +195 -1
- package/dir/index.mjs +4 -3
- package/env/index.cjs +10 -26
- package/env/index.d.ts +379 -1
- package/env/index.mjs +10 -26
- package/exception/index.d.ts +232 -1
- package/fs/index.cjs +70 -36
- package/fs/index.d.ts +205 -1
- package/fs/index.mjs +64 -34
- package/http-status-codes/index.d.ts +267 -1
- package/id/index.d.ts +37 -1
- package/index.cjs +3 -3
- package/index.d.ts +1 -1
- package/index.mjs +1 -1
- package/logger/index.cjs +11 -11
- package/logger/index.d.ts +189 -1
- package/logger/index.mjs +12 -12
- package/middleware/index.d.ts +103 -1
- package/obj/index.cjs +150 -162
- package/obj/index.d.ts +136 -1
- package/obj/index.mjs +150 -162
- package/package.json +11 -11
- package/performance/index.cjs +2 -2
- package/performance/index.d.ts +138 -1
- package/performance/index.mjs +2 -2
- package/request/index.cjs +1 -1
- package/request/index.d.ts +241 -2
- package/request/index.mjs +1 -1
- package/response/index.d.ts +318 -2
- package/server/index.cjs +27 -23
- package/server/index.d.ts +785 -4
- package/server/index.mjs +28 -23
- package/stream/index.d.ts +90 -1
- package/string/index.d.ts +102 -1
- package/type/index.cjs +1 -1
- package/type/index.d.ts +107 -1
- package/type/index.mjs +1 -1
- package/types/index.d.ts +774 -4
- package/url/index.cjs +2 -4
- package/url/index.d.ts +142 -1
- package/url/index.mjs +2 -4
- package/{validate → validation}/index.cjs +89 -42
- package/{validate/validate.utils.d.ts → validation/index.d.ts} +32 -23
- package/{validate → validation}/index.mjs +85 -42
- package/array/array.utils.d.ts +0 -191
- package/async/async.utils.d.ts +0 -296
- package/cache/cache.utils.d.ts +0 -176
- package/config/config.d.ts +0 -57
- package/context-store/context-store.utils.d.ts +0 -212
- package/crypto/crypto.utils.d.ts +0 -183
- package/date/date.utils.d.ts +0 -190
- package/decorators/decorators.utils.d.ts +0 -705
- package/dir/dir.utils.d.ts +0 -216
- package/env/env.utils.d.ts +0 -400
- package/exception/exception.utils.d.ts +0 -253
- package/fs/fs.utils.d.ts +0 -196
- package/http-status-codes/http-status-codes.d.ts +0 -289
- package/id/id.utils.d.ts +0 -59
- package/logger/logger.utils.d.ts +0 -210
- package/middleware/middleware.utils.d.ts +0 -123
- package/obj/obj.utils.d.ts +0 -156
- package/performance/performance.utils.d.ts +0 -159
- package/request/request.utils.d.ts +0 -109
- package/response/response.utils.d.ts +0 -186
- package/server/server.builder.d.ts +0 -531
- package/server/server.d.ts +0 -303
- package/stream/stream.utils.d.ts +0 -111
- package/string/string.utils.d.ts +0 -124
- package/type/type.utils.d.ts +0 -129
- package/types/api-response.d.ts +0 -175
- package/types/common.d.ts +0 -148
- package/types/config.d.ts +0 -88
- package/types/server.d.ts +0 -291
- package/url/url.utils.d.ts +0 -164
- package/validate/index.d.ts +0 -25
package/types/api-response.d.ts
DELETED
|
@@ -1,175 +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
|
-
* Generic API response format.
|
|
27
|
-
* Used to wrap any successful or failed response from the server.
|
|
28
|
-
*/
|
|
29
|
-
export interface ApiResponse<T = any> {
|
|
30
|
-
/** Payload returned from the API. Can be any shape depending on the endpoint. */
|
|
31
|
-
data: T | null;
|
|
32
|
-
/** Indicates whether an error occurred (true = error, false = success). */
|
|
33
|
-
error: boolean;
|
|
34
|
-
/** Success message describing the result of the operation. */
|
|
35
|
-
message: string;
|
|
36
|
-
/** Unique request ID for traceability in logs (e.g., from a middleware). */
|
|
37
|
-
requestId: string;
|
|
38
|
-
/** ISO timestamp when the response was generated. */
|
|
39
|
-
timestamp: string;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Generic pagination structure used for paged lists (e.g., /users?page=1).
|
|
43
|
-
*/
|
|
44
|
-
export interface Pagination<T = any> {
|
|
45
|
-
/** List of records for the current page. */
|
|
46
|
-
content: T[];
|
|
47
|
-
/** Metadata about the pagination state. */
|
|
48
|
-
pagination: {
|
|
49
|
-
/** Total number of records across all pages. */
|
|
50
|
-
totalRecords: number;
|
|
51
|
-
/** Total number of pages available. */
|
|
52
|
-
totalPages: number;
|
|
53
|
-
/** Current page number (1-based index). */
|
|
54
|
-
page: number;
|
|
55
|
-
/** Number of records per page. */
|
|
56
|
-
limit: number;
|
|
57
|
-
/** Field by which the data is sorted. */
|
|
58
|
-
sortBy: string;
|
|
59
|
-
/** Sort order: ascending or descending. */
|
|
60
|
-
sortOrder: 'asc' | 'desc';
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Alias for paginated API response.
|
|
65
|
-
* Allows semantic naming like `PaginationResponse<User>` or `PaginationResponse<Post>`.
|
|
66
|
-
*/
|
|
67
|
-
export type PaginationResponse<T = any> = Pagination<T>;
|
|
68
|
-
/**
|
|
69
|
-
* Error response structure with additional metadata.
|
|
70
|
-
* Used for providing richer error information to clients.
|
|
71
|
-
*/
|
|
72
|
-
export interface ApiErrorResponse extends Omit<ApiResponse<never>, 'data'> {
|
|
73
|
-
/** Error always true for error responses */
|
|
74
|
-
error: true;
|
|
75
|
-
/** HTTP status code */
|
|
76
|
-
status: number;
|
|
77
|
-
/** Path to the resource that caused the error */
|
|
78
|
-
path: string;
|
|
79
|
-
/** Stack trace of the error (if available) */
|
|
80
|
-
stack?: string[];
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Success response structure with strongly typed data.
|
|
84
|
-
* Used for providing successful responses to clients.
|
|
85
|
-
*/
|
|
86
|
-
export interface ApiSuccessResponse<T = any> extends ApiResponse<T> {
|
|
87
|
-
/** Error always false for success responses */
|
|
88
|
-
error: false;
|
|
89
|
-
/** HTTP status code (usually 200) */
|
|
90
|
-
status?: number;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Response structure for batch operations.
|
|
94
|
-
* Used when multiple operations are performed in a single request.
|
|
95
|
-
*/
|
|
96
|
-
export interface BatchResponse<T = any> {
|
|
97
|
-
/** Overall success/failure indicator */
|
|
98
|
-
success: boolean;
|
|
99
|
-
/** Total number of operations */
|
|
100
|
-
total: number;
|
|
101
|
-
/** Number of successful operations */
|
|
102
|
-
successful: number;
|
|
103
|
-
/** Number of failed operations */
|
|
104
|
-
failed: number;
|
|
105
|
-
/** Results of individual operations */
|
|
106
|
-
results: Array<{
|
|
107
|
-
/** Identifier for this operation */
|
|
108
|
-
id: string | number;
|
|
109
|
-
/** Success/failure indicator for this operation */
|
|
110
|
-
success: boolean;
|
|
111
|
-
/** Response data for this operation */
|
|
112
|
-
data?: T;
|
|
113
|
-
/** Error information if this operation failed */
|
|
114
|
-
error?: {
|
|
115
|
-
message: string;
|
|
116
|
-
code?: string;
|
|
117
|
-
};
|
|
118
|
-
}>;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Response structure for asynchronous operations.
|
|
122
|
-
* Used when the operation will complete in the future.
|
|
123
|
-
*/
|
|
124
|
-
export interface AsyncOperationResponse {
|
|
125
|
-
/** Always true for async operations */
|
|
126
|
-
async: true;
|
|
127
|
-
/** Job or task ID to check status later */
|
|
128
|
-
jobId: string;
|
|
129
|
-
/** Estimated completion time in seconds (if known) */
|
|
130
|
-
estimatedTime?: number;
|
|
131
|
-
/** URL to check status */
|
|
132
|
-
statusUrl: string;
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Response structure for streaming operations.
|
|
136
|
-
* Used when data is returned as a stream rather than all at once.
|
|
137
|
-
*/
|
|
138
|
-
export interface StreamResponse {
|
|
139
|
-
/** Stream identifier */
|
|
140
|
-
streamId: string;
|
|
141
|
-
/** Stream type (e.g., 'json', 'binary') */
|
|
142
|
-
streamType: string;
|
|
143
|
-
/** Total size in bytes (if known) */
|
|
144
|
-
totalSize?: number;
|
|
145
|
-
/** Chunk size in bytes */
|
|
146
|
-
chunkSize: number;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Sort direction enumeration.
|
|
150
|
-
*/
|
|
151
|
-
export declare enum SortDirection {
|
|
152
|
-
/** Ascending sort order */
|
|
153
|
-
ASC = "asc",
|
|
154
|
-
/** Descending sort order */
|
|
155
|
-
DESC = "desc"
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Pagination parameters for API requests.
|
|
159
|
-
*/
|
|
160
|
-
export interface PaginationParams {
|
|
161
|
-
/** Current page number (1-based index) */
|
|
162
|
-
page: number;
|
|
163
|
-
/** Number of records per page */
|
|
164
|
-
limit: number;
|
|
165
|
-
/** Field by which the data is sorted */
|
|
166
|
-
sortBy: string;
|
|
167
|
-
/** Sort order: ascending or descending */
|
|
168
|
-
sortOrder: SortDirection;
|
|
169
|
-
/** Optional search query */
|
|
170
|
-
search?: string;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Type that combines pagination parameters with additional data.
|
|
174
|
-
*/
|
|
175
|
-
export type WithPagination<T = {}> = PaginationParams & T;
|
package/types/common.d.ts
DELETED
|
@@ -1,148 +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
|
-
* A type that represents a configurable toggle.
|
|
27
|
-
* Can be `true`, `false`, or a custom configuration object `T`.
|
|
28
|
-
*/
|
|
29
|
-
export type ToggleConfig<T> = boolean | T;
|
|
30
|
-
/**
|
|
31
|
-
* A type representing a value that can be `null` or `undefined`.
|
|
32
|
-
*/
|
|
33
|
-
export type Nullable<T> = T | null | undefined;
|
|
34
|
-
/**
|
|
35
|
-
* A type representing a value that may or may not be present.
|
|
36
|
-
*/
|
|
37
|
-
export type Optional<T> = T | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* A type that makes all properties of `T` deeply optional.
|
|
40
|
-
*/
|
|
41
|
-
export type DeepPartial<T> = {
|
|
42
|
-
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* A type that makes all properties of `T` readonly, recursively.
|
|
46
|
-
*/
|
|
47
|
-
export type DeepReadonly<T> = {
|
|
48
|
-
readonly [P in keyof T]: T[P] extends object ? DeepReadonly<T[P]> : T[P];
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* A type that converts a union of types into an intersection.
|
|
52
|
-
*/
|
|
53
|
-
export type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
|
|
54
|
-
/**
|
|
55
|
-
* A type representing a promise or a plain value.
|
|
56
|
-
*/
|
|
57
|
-
export type MaybePromise<T> = T | Promise<T>;
|
|
58
|
-
/**
|
|
59
|
-
* A type representing a record with string keys and values of type `T`.
|
|
60
|
-
*/
|
|
61
|
-
export type StringKeyedRecord<T> = Record<string, T>;
|
|
62
|
-
/**
|
|
63
|
-
* A type representing a function that returns `R` and optionally receives arguments `A`.
|
|
64
|
-
*/
|
|
65
|
-
export type Func<A extends any[] = any[], R = any> = (...args: A) => R;
|
|
66
|
-
/**
|
|
67
|
-
* A type representing a partial pick from `T` (like Partial + Pick combined)
|
|
68
|
-
*/
|
|
69
|
-
export type PartialPick<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
|
|
70
|
-
/**
|
|
71
|
-
* A type that deeply stringifies all properties of T or makes them null.
|
|
72
|
-
*/
|
|
73
|
-
export type DeepStringifyOrNull<T> = T extends string | number | boolean | bigint | boolean | symbol | null | undefined | null ? string | null : T extends Array<infer U> ? Array<DeepStringifyOrNull<U>> : T extends object ? {
|
|
74
|
-
[K in keyof T]: DeepStringifyOrNull<T[K]>;
|
|
75
|
-
} : string | null;
|
|
76
|
-
/**
|
|
77
|
-
* A type representing a non-empty array of T.
|
|
78
|
-
*/
|
|
79
|
-
export type NonEmptyArray<T> = [T, ...T[]];
|
|
80
|
-
/**
|
|
81
|
-
* A type representing the union of all property values of T.
|
|
82
|
-
*/
|
|
83
|
-
export type ValueOf<T> = T[keyof T];
|
|
84
|
-
/**
|
|
85
|
-
* A type that makes all properties of T mutable (removes readonly).
|
|
86
|
-
*/
|
|
87
|
-
export type Mutable<T> = {
|
|
88
|
-
-readonly [P in keyof T]: T[P];
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* A type that gets the keys of T whose values are assignable to U.
|
|
92
|
-
*/
|
|
93
|
-
export type KeysOfType<T, U> = {
|
|
94
|
-
[K in keyof T]: T[K] extends U ? K : never;
|
|
95
|
-
}[keyof T];
|
|
96
|
-
/**
|
|
97
|
-
* Require at least one of the keys in K to be present in T.
|
|
98
|
-
*/
|
|
99
|
-
export type RequireAtLeastOne<T, K extends keyof T = keyof T> = K extends keyof T ? {
|
|
100
|
-
[P in K]-?: T[P];
|
|
101
|
-
} & Omit<T, K> : never;
|
|
102
|
-
/**
|
|
103
|
-
* A record type with optional keys.
|
|
104
|
-
*/
|
|
105
|
-
export type RecordOptional<K extends string | number | symbol, T> = {
|
|
106
|
-
[P in K]?: T;
|
|
107
|
-
};
|
|
108
|
-
/**
|
|
109
|
-
* Primitive types in TypeScript.
|
|
110
|
-
*/
|
|
111
|
-
export type Primitive = string | number | boolean | bigint | symbol | undefined | null;
|
|
112
|
-
/**
|
|
113
|
-
* Recursively unwraps Promise types to get their resolved value type.
|
|
114
|
-
*/
|
|
115
|
-
export type Awaited<T> = T extends Promise<infer U> ? Awaited<U> : T;
|
|
116
|
-
/**
|
|
117
|
-
* Picks properties from T that are of type U.
|
|
118
|
-
*/
|
|
119
|
-
export type PickByType<T, U> = {
|
|
120
|
-
[P in keyof T as T[P] extends U ? P : never]: T[P];
|
|
121
|
-
};
|
|
122
|
-
/**
|
|
123
|
-
* Makes all properties of T required recursively.
|
|
124
|
-
*/
|
|
125
|
-
export type DeepRequired<T> = {
|
|
126
|
-
[P in keyof T]-?: T[P] extends object ? DeepRequired<T[P]> : T[P];
|
|
127
|
-
};
|
|
128
|
-
/**
|
|
129
|
-
* Checks if two types are exactly equal.
|
|
130
|
-
* Returns true or false as type.
|
|
131
|
-
*/
|
|
132
|
-
export type IsEqual<T, U> = (<G>() => G extends T ? 1 : 2) extends <G>() => G extends U ? 1 : 2 ? true : false;
|
|
133
|
-
/**
|
|
134
|
-
* Makes all properties of an object writable (removes readonly).
|
|
135
|
-
*/
|
|
136
|
-
export type Writable<T> = {
|
|
137
|
-
-readonly [P in keyof T]: T[P];
|
|
138
|
-
};
|
|
139
|
-
/**
|
|
140
|
-
* Makes specific keys K of type T optional.
|
|
141
|
-
*/
|
|
142
|
-
export type Optional2<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
143
|
-
/**
|
|
144
|
-
* Creates a type with all properties of T except those with types assignable to U.
|
|
145
|
-
*/
|
|
146
|
-
export type Without<T, U> = {
|
|
147
|
-
[P in keyof T as T[P] extends U ? never : P]: T[P];
|
|
148
|
-
};
|
package/types/config.d.ts
DELETED
|
@@ -1,88 +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 { LoggerLevels } from '@catbee/utils/logger';
|
|
26
|
-
export interface CatbeeConfig {
|
|
27
|
-
logger?: {
|
|
28
|
-
/**
|
|
29
|
-
* Logging level (e.g., 'info', 'debug', 'warn', 'error')
|
|
30
|
-
* Environment variable: LOGGER_LEVEL
|
|
31
|
-
* Default: 'info' in production, 'debug' in development
|
|
32
|
-
*/
|
|
33
|
-
level?: LoggerLevels;
|
|
34
|
-
/**
|
|
35
|
-
* Name of the logger instance (defaults to npm package name)
|
|
36
|
-
* Environment variable: LOGGER_NAME
|
|
37
|
-
* Default: value of npm_package_name or '@catbee/utils'
|
|
38
|
-
*/
|
|
39
|
-
name?: string;
|
|
40
|
-
/**
|
|
41
|
-
* Enables pretty-print logging in development.
|
|
42
|
-
* Has no effect in production.
|
|
43
|
-
* Environment variable: LOGGER_PRETTY
|
|
44
|
-
* Default: true in development, false in production
|
|
45
|
-
*/
|
|
46
|
-
pretty?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Enables colorized output for pretty-print (default: true)
|
|
49
|
-
* Environment variable: LOGGER_PRETTY_COLORIZE
|
|
50
|
-
*/
|
|
51
|
-
colorize?: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Single line output for pretty-print (default: false)
|
|
54
|
-
* Environment variable: LOGGER_PRETTY_SINGLE_LINE
|
|
55
|
-
*/
|
|
56
|
-
singleLine?: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Directory to write log files to (if empty, file logging is disabled)
|
|
59
|
-
* Environment variable: LOGGER_DIR
|
|
60
|
-
* Eg: process.cwd() + '/logs'
|
|
61
|
-
* Note: Directory must exist, it is not created automatically
|
|
62
|
-
*/
|
|
63
|
-
dir?: string;
|
|
64
|
-
};
|
|
65
|
-
cache: {
|
|
66
|
-
/**
|
|
67
|
-
* Default TTL (time to live) for cache entries in milliseconds
|
|
68
|
-
* Environment variable: CACHE_DEFAULT_TTL_SECONDS
|
|
69
|
-
* Default: 3600000 (1 hour)
|
|
70
|
-
*/
|
|
71
|
-
defaultTtl: number;
|
|
72
|
-
};
|
|
73
|
-
server: {
|
|
74
|
-
/**
|
|
75
|
-
* Skip healthz endpoint even if health checks are configured
|
|
76
|
-
* Default: false
|
|
77
|
-
* Set to true to return 200 OK for /healthz without checks
|
|
78
|
-
* Useful in environments where a simple liveness probe is needed
|
|
79
|
-
* without performing actual health checks
|
|
80
|
-
* Example: Kubernetes liveness probe
|
|
81
|
-
* Note: This does not disable the health check functionality itself
|
|
82
|
-
* Health checks can still be performed programmatically
|
|
83
|
-
* or via other endpoints if needed
|
|
84
|
-
* Environment variable: SERVER_SKIP_HEALTHZ
|
|
85
|
-
*/
|
|
86
|
-
skipHealthz: boolean;
|
|
87
|
-
};
|
|
88
|
-
}
|