alepha 0.7.5 → 0.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +44 -44
  3. package/cache/redis.cjs +4 -8
  4. package/cache/redis.d.ts +28 -89
  5. package/cache/redis.js +1 -1
  6. package/cache.cjs +4 -8
  7. package/cache.d.ts +189 -265
  8. package/cache.js +1 -1
  9. package/core.cjs +4 -8
  10. package/core.d.ts +950 -929
  11. package/core.js +1 -1
  12. package/datetime.cjs +4 -8
  13. package/datetime.d.ts +151 -146
  14. package/datetime.js +1 -1
  15. package/lock/redis.cjs +7 -49
  16. package/lock/redis.d.ts +15 -12
  17. package/lock/redis.js +1 -47
  18. package/lock.cjs +4 -8
  19. package/lock.d.ts +117 -170
  20. package/lock.js +1 -1
  21. package/package.json +70 -39
  22. package/postgres.cjs +4 -8
  23. package/postgres.d.ts +1314 -4398
  24. package/postgres.js +1 -1
  25. package/queue/redis.cjs +8 -0
  26. package/queue/redis.d.ts +31 -0
  27. package/queue/redis.js +1 -0
  28. package/queue.cjs +4 -8
  29. package/queue.d.ts +162 -205
  30. package/queue.js +1 -1
  31. package/react/auth.cjs +4 -8
  32. package/react/auth.d.ts +166 -282
  33. package/react/auth.js +1 -1
  34. package/react.cjs +4 -8
  35. package/react.d.ts +509 -551
  36. package/react.js +1 -1
  37. package/redis.cjs +4 -8
  38. package/redis.d.ts +59 -132
  39. package/redis.js +1 -1
  40. package/retry.cjs +4 -8
  41. package/retry.d.ts +34 -31
  42. package/retry.js +1 -1
  43. package/scheduler.cjs +4 -8
  44. package/scheduler.d.ts +125 -182
  45. package/scheduler.js +1 -1
  46. package/security.cjs +4 -8
  47. package/security.d.ts +472 -595
  48. package/security.js +1 -1
  49. package/server/cache.cjs +4 -8
  50. package/server/cache.d.ts +41 -38
  51. package/server/cache.js +1 -1
  52. package/server/cookies.cjs +4 -8
  53. package/server/cookies.d.ts +46 -41
  54. package/server/cookies.js +1 -1
  55. package/server/static.cjs +4 -8
  56. package/server/static.d.ts +98 -95
  57. package/server/static.js +1 -1
  58. package/server/swagger.cjs +4 -8
  59. package/server/swagger.d.ts +96 -92
  60. package/server/swagger.js +1 -1
  61. package/server.cjs +4 -8
  62. package/server.d.ts +754 -1025
  63. package/server.js +1 -1
  64. package/testing.cjs +8 -0
  65. package/testing.d.ts +1 -0
  66. package/testing.js +1 -0
  67. package/topic/redis.cjs +8 -0
  68. package/topic/redis.d.ts +45 -0
  69. package/topic/redis.js +1 -0
  70. package/topic.cjs +4 -8
  71. package/topic.d.ts +171 -163
  72. package/topic.js +1 -1
  73. package/vite.cjs +4 -8
  74. package/vite.d.ts +89 -82
  75. package/vite.js +1 -1
  76. package/src/cache/redis.ts +0 -1
  77. package/src/cache.ts +0 -1
  78. package/src/core.ts +0 -1
  79. package/src/datetime.ts +0 -1
  80. package/src/lock/redis.ts +0 -1
  81. package/src/lock.ts +0 -1
  82. package/src/postgres.ts +0 -1
  83. package/src/queue/redis.ts +0 -1
  84. package/src/queue.ts +0 -1
  85. package/src/react/auth.ts +0 -1
  86. package/src/react.ts +0 -1
  87. package/src/redis.ts +0 -1
  88. package/src/retry.ts +0 -1
  89. package/src/scheduler.ts +0 -1
  90. package/src/security.ts +0 -1
  91. package/src/server/cache.ts +0 -1
  92. package/src/server/cookies.ts +0 -1
  93. package/src/server/static.ts +0 -1
  94. package/src/server/swagger.ts +0 -1
  95. package/src/server.ts +0 -1
  96. package/src/topic/redis.ts +0 -1
  97. package/src/topic.ts +0 -1
  98. package/src/vite.ts +0 -1
package/core.d.ts CHANGED
@@ -1,29 +1,29 @@
1
- import * as TypeBox from '@sinclair/typebox';
2
- import { TSchema, Static, TObject, SchemaOptions, ObjectOptions, Union, TProperties, ArrayOptions, TArray, StringOptions, TString, TBoolean, NumberOptions, TNumber, IntegerOptions, TInteger, TOptionalWithFlag, TNull, TIntersect, TUnsafe, UnsafeOptions } from '@sinclair/typebox';
3
- export { TypeBox };
4
- export { Static, StaticDecode, StaticEncode, TObject, TSchema, TypeGuard } from '@sinclair/typebox';
5
- import { TypeCheck } from '@sinclair/typebox/compiler';
6
- import { AsyncLocalStorage } from 'node:async_hooks';
7
- import { ValueError } from '@sinclair/typebox/errors';
8
- import { ReadableStream as ReadableStream$1 } from 'node:stream/web';
9
- import * as TypeBoxValue from '@sinclair/typebox/value';
10
- export { TypeBoxValue };
11
- import { Readable } from 'node:stream';
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+ import { TypeCheck } from "@sinclair/typebox/compiler";
3
+ import * as TypeBoxValue from "@sinclair/typebox/value";
4
+ import * as TypeBox from "@sinclair/typebox";
5
+ import { ArrayOptions, IntegerOptions, NumberOptions, ObjectOptions, SchemaOptions, Static, Static as Static$1, StaticDecode, StaticEncode, StringOptions, TArray, TBoolean, TInteger, TIntersect, TNull, TNumber, TObject, TObject as TObject$1, TOptionalWithFlag, TProperties, TSchema, TSchema as TSchema$1, TString, TUnsafe, TypeGuard, Union, UnsafeOptions } from "@sinclair/typebox";
6
+ import { ValueError } from "@sinclair/typebox/errors";
7
+ import { ReadableStream as ReadableStream$1 } from "node:stream/web";
8
+ import { Readable } from "node:stream";
12
9
 
10
+ //#region src/constants/KIND.d.ts
13
11
  /**
14
12
  * Used for identifying descriptors.
15
13
  *
16
14
  * @internal
17
15
  */
18
16
  declare const KIND: unique symbol;
19
-
17
+ //#endregion
18
+ //#region src/constants/OPTIONS.d.ts
20
19
  /**
21
20
  * Used for descriptors options.
22
21
  *
23
22
  * @internal
24
23
  */
25
24
  declare const OPTIONS: unique symbol;
26
-
25
+ //#endregion
26
+ //#region src/interfaces/Async.d.ts
27
27
  /**
28
28
  * Represents a value that can be either a value or a promise.
29
29
  */
@@ -37,7 +37,8 @@ type PromiseFn = (...args: any[]) => Promise<any>;
37
37
  */
38
38
  type AsyncFn = (...args: any[]) => Async<any>;
39
39
  type MaybePromise<T> = T extends Promise<any> ? T : Promise<T>;
40
-
40
+ //#endregion
41
+ //#region src/interfaces/Service.d.ts
41
42
  /**
42
43
  * In Alepha, a service is a class that can be instantiated. Nothing more, nothing less.
43
44
  */
@@ -48,21 +49,21 @@ type AbstractService<T extends object = any> = abstract new (...args: any[]) =>
48
49
  * Service substitution allows you to register a class as a different class.
49
50
  */
50
51
  interface ServiceSubstitution<T extends object = any> {
51
- /**
52
- * Every time someone asks for this service, it will be provided with the 'use' service.
53
- */
54
- provide: Service<T>;
55
- /**
56
- * Service to use instead of the 'provide' service.
57
- *
58
- * Note: Syntax is based on Angular's DI system.
59
- */
60
- use: Service<T>;
61
- /**
62
- * If true and the service already exists, just ignore the substitution and do not throw an error.
63
- * Mostly used for plugins to enforce a substitution without throwing an error.
64
- */
65
- optional?: boolean;
52
+ /**
53
+ * Every time someone asks for this service, it will be provided with the 'use' service.
54
+ */
55
+ provide: Service<T>;
56
+ /**
57
+ * Service to use instead of the 'provide' service.
58
+ *
59
+ * Note: Syntax is based on Angular's DI system.
60
+ */
61
+ use: Service<T>;
62
+ /**
63
+ * If true and the service already exists, just ignore the substitution and do not throw an error.
64
+ * Mostly used for plugins to enforce a substitution without throwing an error.
65
+ */
66
+ optional?: boolean;
66
67
  }
67
68
  /**
68
69
  * Every time you register a service, you can use this type to define it.
@@ -74,39 +75,40 @@ interface ServiceSubstitution<T extends object = any> {
74
75
  * And yes, you declare the *type* of the service, not the *instance*.
75
76
  */
76
77
  type ServiceEntry<T extends object = any> = Service<T> | ServiceSubstitution<T>;
77
-
78
+ //#endregion
79
+ //#region src/descriptors/$hook.d.ts
78
80
  declare const KEY = "HOOK";
79
81
  interface HookOptions<T extends keyof Hooks> {
80
- /**
81
- * The name of the hook. "configure", "start", "ready", "stop", ...
82
- */
83
- name: T;
84
- /**
85
- * The handler to run when the hook is triggered.
86
- */
87
- handler: (app: Hooks[T]) => Async<any>;
88
- /**
89
- * Force the hook to run first or last on the list of hooks.
90
- */
91
- priority?: "first" | "last";
92
- /**
93
- * Empty placeholder, not working yet. :-)
94
- */
95
- before?: object | Array<object>;
96
- /**
97
- * Empty placeholder, not working yet. :-)
98
- */
99
- after?: object | Array<object>;
82
+ /**
83
+ * The name of the hook. "configure", "start", "ready", "stop", ...
84
+ */
85
+ name: T;
86
+ /**
87
+ * The handler to run when the hook is triggered.
88
+ */
89
+ handler: (app: Hooks[T]) => Async<any>;
90
+ /**
91
+ * Force the hook to run first or last on the list of hooks.
92
+ */
93
+ priority?: "first" | "last";
94
+ /**
95
+ * Empty placeholder, not working yet. :-)
96
+ */
97
+ before?: object | Array<object>;
98
+ /**
99
+ * Empty placeholder, not working yet. :-)
100
+ */
101
+ after?: object | Array<object>;
100
102
  }
101
103
  interface Hook<T extends keyof Hooks = any> {
102
- caller?: Service;
103
- priority?: "first" | "last";
104
- callback: (payload: Hooks[T]) => Async<void>;
104
+ caller?: Service;
105
+ priority?: "first" | "last";
106
+ callback: (payload: Hooks[T]) => Async<void>;
105
107
  }
106
108
  interface HookDescriptor<T extends keyof Hooks> {
107
- [KIND]: typeof KEY;
108
- [OPTIONS]: HookOptions<T>;
109
- (app: Hooks[T]): Async<any>;
109
+ [KIND]: typeof KEY;
110
+ [OPTIONS]: HookOptions<T>;
111
+ (app: Hooks[T]): Async<any>;
110
112
  }
111
113
  /**
112
114
  * Registers a new hook.
@@ -148,20 +150,22 @@ interface HookDescriptor<T extends keyof Hooks> {
148
150
  *
149
151
  */
150
152
  declare const $hook: {
151
- <T extends keyof Hooks>(options: HookOptions<T>): HookDescriptor<T>;
152
- [KIND]: string;
153
+ <T extends keyof Hooks>(options: HookOptions<T>): HookDescriptor<T>;
154
+ [KIND]: string;
153
155
  };
154
-
156
+ //#endregion
157
+ //#region src/helpers/Module.d.ts
155
158
  interface Module {
156
- name?: string;
157
- $services: (alepha: Alepha) => void | Alepha;
159
+ name?: string;
160
+ $services: (alepha: Alepha) => void | Alepha;
158
161
  }
159
162
  interface ModuleDefinition extends Module {
160
- services: Array<Service>;
163
+ services: Array<Service>;
161
164
  }
162
165
  declare const isModule: (value: unknown) => value is Module;
163
166
  declare const toModuleName: (name: string) => string;
164
-
167
+ //#endregion
168
+ //#region src/descriptors/$cursor.d.ts
165
169
  /**
166
170
  * /!\ Global variable /!\
167
171
  *
@@ -170,21 +174,21 @@ declare const toModuleName: (name: string) => string;
170
174
  * @internal
171
175
  */
172
176
  declare const __alephaRef: {
173
- context?: Alepha;
174
- definition?: Service;
175
- module?: ModuleDefinition;
176
- $services?: {
177
- module: ModuleDefinition;
178
- parent: Service;
179
- };
177
+ context?: Alepha;
178
+ definition?: Service;
179
+ module?: ModuleDefinition;
180
+ $services?: {
181
+ module: ModuleDefinition;
182
+ parent: Service;
183
+ };
180
184
  };
181
185
  /**
182
186
  * Cursor descriptor.
183
187
  */
184
188
  interface CursorDescriptor {
185
- context: Alepha;
186
- definition?: Service;
187
- module?: ModuleDefinition;
189
+ context: Alepha;
190
+ definition?: Service;
191
+ module?: ModuleDefinition;
188
192
  }
189
193
  /**
190
194
  * Get Alepha instance and Class definition from the current context.
@@ -208,28 +212,30 @@ interface CursorDescriptor {
208
212
  * @internal
209
213
  */
210
214
  declare const $cursor: () => CursorDescriptor;
211
-
215
+ //#endregion
216
+ //#region src/helpers/EventEmitterLike.d.ts
212
217
  /**
213
218
  * Low-cost event emitter like for internal use.
214
219
  * Used only for descriptor implicit registration.
215
220
  */
216
221
  declare class EventEmitterLike<TEvents extends {
217
- [key: string]: any;
222
+ [key: string]: any;
218
223
  }> {
219
- private hooks;
220
- on<T extends keyof TEvents>(event: T, callback: (data: TEvents[T]) => void): void;
221
- emit<T extends keyof TEvents>(event: T, data: TEvents[T]): void;
224
+ private hooks;
225
+ on<T extends keyof TEvents>(event: T, callback: (data: TEvents[T]) => void): void;
226
+ emit<T extends keyof TEvents>(event: T, data: TEvents[T]): void;
222
227
  }
223
-
228
+ //#endregion
229
+ //#region src/helpers/descriptor.d.ts
224
230
  /**
225
231
  * Descriptor events.
226
232
  *
227
233
  * - `create` - Emitted when a descriptor is created.
228
234
  */
229
235
  declare const descriptorEvents: EventEmitterLike<{
230
- create: CursorDescriptor & {
231
- [KIND]: string;
232
- };
236
+ create: CursorDescriptor & {
237
+ [KIND]: string;
238
+ };
233
239
  }>;
234
240
  /**
235
241
  * Register a descriptor.
@@ -249,7 +255,7 @@ declare const __descriptor: (kind: string) => void;
249
255
  * @param to
250
256
  */
251
257
  declare const __bind: (descriptor: {
252
- [KIND]: string;
258
+ [KIND]: string;
253
259
  }, ...to: Service[]) => void;
254
260
  /**
255
261
  * Check if the value is a descriptor value.
@@ -262,242 +268,246 @@ declare const isDescriptorValue: (value: any) => value is DescriptorIdentifier;
262
268
  * The "$descriptor" function.
263
269
  */
264
270
  interface Descriptor<T extends object = any> {
265
- [KIND]: string;
266
- (options: T): DescriptorIdentifier<T>;
271
+ [KIND]: string;
272
+ (options: T): DescriptorIdentifier<T>;
267
273
  }
268
274
  /**
269
275
  * Class member descriptor.
270
276
  */
271
277
  interface DescriptorIdentifier<T = object> {
272
- [KIND]: string;
273
- [OPTIONS]: T;
278
+ [KIND]: string;
279
+ [OPTIONS]: T;
274
280
  }
275
281
  /**
276
282
  * Descriptor identifier + his instance + his key.
277
283
  */
278
284
  interface DescriptorItem<T extends Descriptor> {
279
- value: ReturnType<T>;
280
- key: string;
281
- instance: Record<string, any>;
285
+ value: ReturnType<T>;
286
+ key: string;
287
+ instance: Record<string, any>;
282
288
  }
283
-
289
+ //#endregion
290
+ //#region src/providers/AsyncLocalStorageProvider.d.ts
284
291
  type AsyncLocalStorageData = any;
285
292
  declare class AsyncLocalStorageProvider {
286
- protected als?: AsyncLocalStorage<AsyncLocalStorageData>;
287
- init(): Promise<void>;
288
- run<R>(data: AsyncLocalStorageData, callback: () => R): R;
289
- get<T>(key: string): T | undefined;
290
- set<T>(key: string, value: T): void;
293
+ static create: () => AsyncLocalStorage<AsyncLocalStorageData> | undefined;
294
+ protected als?: AsyncLocalStorage<AsyncLocalStorageData>;
295
+ constructor();
296
+ run<R>(data: AsyncLocalStorageData, callback: () => R): R;
297
+ get<T>(key: string): T | undefined;
298
+ set<T>(key: string, value: T): void;
291
299
  }
292
-
300
+ //#endregion
301
+ //#region src/services/Logger.d.ts
293
302
  type LogLevel = "error" | "warn" | "info" | "debug" | "trace" | "silent";
294
303
  interface LoggerEnv {
295
- /**
296
- * Default log level for the application.
297
- * Default by environment:
298
- * - dev = "debug"
299
- * - test = "error"
300
- * - prod = "info"
301
- */
302
- LOG_LEVEL?: "trace" | "debug" | "info" | "warn" | "error" | "silent";
303
- /**
304
- * Disable colors in the console output.
305
- */
306
- NO_COLOR?: string;
307
- /**
308
- * Force color output for the application.
309
- */
310
- FORCE_COLOR?: string;
311
- /**
312
- * Log format.
313
- *
314
- * @default "text"
315
- */
316
- LOG_FORMAT?: "json" | "text";
304
+ /**
305
+ * Default log level for the application.
306
+ * Default by environment:
307
+ * - dev = "debug"
308
+ * - test = "error"
309
+ * - prod = "info"
310
+ */
311
+ LOG_LEVEL?: "trace" | "debug" | "info" | "warn" | "error" | "silent";
312
+ /**
313
+ * Disable colors in the console output.
314
+ */
315
+ NO_COLOR?: string;
316
+ /**
317
+ * Force color output for the application.
318
+ */
319
+ FORCE_COLOR?: string;
320
+ /**
321
+ * Log format.
322
+ *
323
+ * @default "text"
324
+ */
325
+ LOG_FORMAT?: "json" | "text";
317
326
  }
318
327
  interface LoggerOptions {
319
- /**
320
- * The logging level. Can be one of "error", "warn", "info", "debug", or "trace".
321
- */
322
- level?: LogLevel;
323
- /**
324
- * The name of the logger. Like a module name or a service name.
325
- */
326
- name?: string;
327
- /**
328
- * An optional context to include in the log output. Like a request ID or a correlation ID.
329
- */
330
- context?: string;
331
- /**
332
- * An optional tag to include in the log output. Like a class name or a module name.
333
- */
334
- caller?: string;
335
- /**
336
- * Whether to use colors in the log output. Defaults to true.
337
- */
338
- color?: boolean;
339
- /**
340
- * Whether to log in JSON format. Defaults to false.
341
- */
342
- json?: boolean;
343
- /**
344
- * An optional async local storage provider to use for storing context information.
345
- */
346
- als?: AsyncLocalStorageProvider;
328
+ /**
329
+ * The logging level. Can be one of "error", "warn", "info", "debug", or "trace".
330
+ */
331
+ level?: LogLevel;
332
+ /**
333
+ * The name of the logger. Like a module name or a service name.
334
+ */
335
+ name?: string;
336
+ /**
337
+ * An optional context to include in the log output. Like a request ID or a correlation ID.
338
+ */
339
+ context?: string;
340
+ /**
341
+ * An optional tag to include in the log output. Like a class name or a module name.
342
+ */
343
+ caller?: string;
344
+ /**
345
+ * Whether to use colors in the log output. Defaults to true.
346
+ */
347
+ color?: boolean;
348
+ /**
349
+ * Whether to log in JSON format. Defaults to false.
350
+ */
351
+ json?: boolean;
352
+ /**
353
+ * An optional async local storage provider to use for storing context information.
354
+ */
355
+ als?: AsyncLocalStorageProvider;
347
356
  }
348
357
  declare const COLORS: {
349
- reset: string;
350
- grey: string;
351
- red: string;
352
- orange: string;
353
- green: string;
354
- blue: string;
355
- white: string;
356
- cyan: string;
357
- darkGrey: string;
358
+ reset: string;
359
+ grey: string;
360
+ red: string;
361
+ orange: string;
362
+ green: string;
363
+ blue: string;
364
+ white: string;
365
+ cyan: string;
366
+ darkGrey: string;
358
367
  };
359
368
  declare const LEVEL_COLORS: Record<LogLevel, string>;
360
369
  declare class Logger {
361
- protected levelOrder: Record<LogLevel, number>;
362
- readonly level: LogLevel;
363
- readonly name: string;
364
- protected caller: string;
365
- protected context: string;
366
- protected color: boolean;
367
- protected json: boolean;
368
- protected als?: AsyncLocalStorageProvider;
369
- constructor(options?: LoggerOptions);
370
- child(options: LoggerOptions): Logger;
371
- error(message: unknown, data?: object | Error | string | unknown): void;
372
- warn(message: unknown, data?: object | Error | string): void;
373
- info(message: unknown, data?: object | Error | string): void;
374
- debug(message: unknown, data?: object | Error | string): void;
375
- trace(message: unknown, data?: object | Error | string): void;
376
- /**
377
- * Log a message to the console.
378
- *
379
- * @param level
380
- * @param message
381
- * @param data
382
- * @protected
383
- */
384
- protected log(level: LogLevel, message: unknown, data?: object | Error | string): void;
385
- /**
386
- * Print a log message to the console.
387
- *
388
- * @param formatted
389
- * @protected
390
- */
391
- protected print(formatted: string): void;
392
- /**
393
- * Format a log message to JSON.
394
- *
395
- * @param level
396
- * @param message
397
- * @param data
398
- * @protected
399
- */
400
- protected formatJson(level: LogLevel, message: unknown, data?: object | Error | string): string;
401
- protected formatJsonError(error: Error): object;
402
- /**
403
- * Format a log message to a string.
404
- *
405
- * @param level
406
- * @param message
407
- * @param data
408
- * @protected
409
- */
410
- protected formatLog(level: LogLevel, message: string, data?: object | Error): string;
411
- protected colorize(color: string, text: string, reset?: string): string;
412
- /**
413
- * Format an error to a string.
414
- *
415
- * @param error
416
- * @protected
417
- */
418
- protected formatError(error: Error): string;
370
+ protected levelOrder: Record<LogLevel, number>;
371
+ readonly level: LogLevel;
372
+ readonly name: string;
373
+ protected caller: string;
374
+ protected context: string;
375
+ protected color: boolean;
376
+ protected json: boolean;
377
+ protected als?: AsyncLocalStorageProvider;
378
+ constructor(options?: LoggerOptions);
379
+ child(options: LoggerOptions): Logger;
380
+ error(message: unknown, data?: object | Error | string | unknown): void;
381
+ warn(message: unknown, data?: object | Error | string): void;
382
+ info(message: unknown, data?: object | Error | string): void;
383
+ debug(message: unknown, data?: object | Error | string): void;
384
+ trace(message: unknown, data?: object | Error | string): void;
385
+ /**
386
+ * Log a message to the console.
387
+ *
388
+ * @param level
389
+ * @param message
390
+ * @param data
391
+ * @protected
392
+ */
393
+ protected log(level: LogLevel, message: unknown, data?: object | Error | string): void;
394
+ /**
395
+ * Print a log message to the console.
396
+ *
397
+ * @param formatted
398
+ * @protected
399
+ */
400
+ protected print(formatted: string): void;
401
+ /**
402
+ * Format a log message to JSON.
403
+ *
404
+ * @param level
405
+ * @param message
406
+ * @param data
407
+ * @protected
408
+ */
409
+ protected formatJson(level: LogLevel, message: unknown, data?: object | Error | string): string;
410
+ protected formatJsonError(error: Error): object;
411
+ /**
412
+ * Format a log message to a string.
413
+ *
414
+ * @param level
415
+ * @param message
416
+ * @param data
417
+ * @protected
418
+ */
419
+ protected formatLog(level: LogLevel, message: string, data?: object | Error): string;
420
+ protected colorize(color: string, text: string, reset?: string): string;
421
+ /**
422
+ * Format an error to a string.
423
+ *
424
+ * @param error
425
+ * @protected
426
+ */
427
+ protected formatError(error: Error): string;
419
428
  }
420
429
  declare class MockLogger extends Logger {
430
+ store: MockLoggerStore;
431
+ constructor(options?: LoggerOptions & {
421
432
  store: MockLoggerStore;
422
- constructor(options?: LoggerOptions & {
423
- store: MockLoggerStore;
424
- });
425
- print(msg: string): void;
426
- child(options: LoggerOptions): MockLogger;
433
+ });
434
+ print(msg: string): void;
435
+ child(options: LoggerOptions): MockLogger;
427
436
  }
428
437
  interface MockLoggerStore {
429
- stack: Array<{
430
- date: string;
431
- level: string;
432
- message: string;
433
- } & Record<string, any>>;
438
+ stack: Array<{
439
+ date: string;
440
+ level: string;
441
+ message: string;
442
+ } & Record<string, any>>;
434
443
  }
435
-
444
+ //#endregion
445
+ //#region src/Alepha.d.ts
436
446
  interface Env extends LoggerEnv {
437
- [key: string]: string | boolean | number | undefined;
438
- /**
439
- * Optional environment variable that indicates the current environment.
440
- */
441
- NODE_ENV?: "dev" | "test" | "production";
442
- /**
443
- * Optional name of the application.
444
- */
445
- APP_NAME?: string;
446
- /**
447
- * If true, the container will not automatically register the default providers based on the descriptors.
448
- *
449
- * It means that you have to alepha.with(ServiceModule) manually. No magic.
450
- *
451
- * @default false
452
- */
453
- EXPLICIT_PROVIDERS?: boolean;
447
+ [key: string]: string | boolean | number | undefined;
448
+ /**
449
+ * Optional environment variable that indicates the current environment.
450
+ */
451
+ NODE_ENV?: "dev" | "test" | "production";
452
+ /**
453
+ * Optional name of the application.
454
+ */
455
+ APP_NAME?: string;
456
+ /**
457
+ * If true, the container will not automatically register the default providers based on the descriptors.
458
+ *
459
+ * It means that you have to alepha.with(ServiceModule) manually. No magic.
460
+ *
461
+ * @default false
462
+ */
463
+ EXPLICIT_PROVIDERS?: boolean;
454
464
  }
455
465
  interface State {
456
- log: Logger;
457
- env?: Readonly<Env>;
458
- beforeAll?: (run: any) => any;
459
- afterAll?: (run: any) => any;
460
- afterEach?: (run: any) => any;
461
- onTestFinished?: (run: any) => any;
466
+ log: Logger;
467
+ env?: Readonly<Env>;
468
+ beforeAll?: (run: any) => any;
469
+ afterAll?: (run: any) => any;
470
+ afterEach?: (run: any) => any;
471
+ onTestFinished?: (run: any) => any;
462
472
  }
463
473
  interface Hooks {
464
- echo: any;
465
- /**
466
- * Triggered during the configuration phase. Before the start phase.
467
- */
468
- configure: Alepha;
469
- /**
470
- * Triggered during the start phase. When `Alepha#start()` is called.
471
- */
472
- start: Alepha;
473
- /**
474
- * Triggered during the ready phase. After the start phase.
475
- */
476
- ready: Alepha;
477
- /**
478
- * Triggered during the stop phase.
479
- *
480
- * - Stop should be called after a SIGINT or SIGTERM signal in order to gracefully shutdown the application. (@see `run()` method)
481
- *
482
- */
483
- stop: Alepha;
484
- /**
485
- * Triggered when a state value is mutated.
486
- */
487
- "state:mutate": {
488
- /**
489
- * The key of the state that was mutated.
490
- */
491
- key: keyof State;
492
- /**
493
- * The new value of the state.
494
- */
495
- value: any;
496
- /**
497
- * The previous value of the state.
498
- */
499
- prevValue: any;
500
- };
474
+ echo: any;
475
+ /**
476
+ * Triggered during the configuration phase. Before the start phase.
477
+ */
478
+ configure: Alepha;
479
+ /**
480
+ * Triggered during the start phase. When `Alepha#start()` is called.
481
+ */
482
+ start: Alepha;
483
+ /**
484
+ * Triggered during the ready phase. After the start phase.
485
+ */
486
+ ready: Alepha;
487
+ /**
488
+ * Triggered during the stop phase.
489
+ *
490
+ * - Stop should be called after a SIGINT or SIGTERM signal in order to gracefully shutdown the application. (@see `run()` method)
491
+ *
492
+ */
493
+ stop: Alepha;
494
+ /**
495
+ * Triggered when a state value is mutated.
496
+ */
497
+ "state:mutate": {
498
+ /**
499
+ * The key of the state that was mutated.
500
+ */
501
+ key: keyof State;
502
+ /**
503
+ * The new value of the state.
504
+ */
505
+ value: any;
506
+ /**
507
+ * The previous value of the state.
508
+ */
509
+ prevValue: any;
510
+ };
501
511
  }
502
512
  /**
503
513
  * Core container of the Alepha framework.
@@ -529,429 +539,431 @@ interface Hooks {
529
539
  * - $inject -> alepha.get(), alepha.parseEnv()
530
540
  */
531
541
  declare class Alepha {
532
- /**
533
- * Creates a new instance of the Alepha container with some helpers:
534
- *
535
- * - merges `process.env` with the provided state.env when available.
536
- * - populates the test hooks for Vitest or Jest environments when available.
537
- *
538
- * If you are not interested about these helpers, you can use the constructor directly.
539
- */
540
- static create(state?: Partial<State>): Alepha;
541
- /**
542
- * List of all services + how they are provided.
543
- */
544
- protected registry: Map<Service, ServiceDefinition>;
545
- /**
546
- * Flag indicating whether the App won't accept any further changes.
547
- * Pass to true when #start() is called.
548
- */
549
- protected locked: boolean;
550
- /**
551
- * True if the App has been configured.
552
- */
553
- protected configured: boolean;
554
- /**
555
- * True if the App has started.
556
- */
557
- protected started: boolean;
558
- /**
559
- * True if the App is ready.
560
- */
561
- protected ready: boolean;
562
- /**
563
- * A promise that resolves when the App has started.
564
- */
565
- protected starting?: PromiseWithResolvers<this>;
566
- /**
567
- * The current state of the App.
568
- *
569
- * It contains the environment variables, logger, and other state-related properties.
570
- *
571
- * You can declare your own state properties by extending the `State` interface.
572
- *
573
- * ```ts
574
- * declare module "alepha/core" {
575
- * interface State {
576
- * myCustomValue: string;
577
- * }
578
- * }
579
- * ```
580
- *
581
- * Same story for the `Env` interface.
582
- * ```ts
583
- * declare module "@alepha/core" {
584
- * interface Env {
585
- * readonly myCustomValue: string;
586
- * }
587
- * }
588
- * ```
589
- *
590
- * State values can be function or primitive values.
591
- * However, all .env variables must serializable to JSON.
592
- */
593
- protected store: State;
594
- /**
595
- * During the instantiation process, we keep a list of pending instantiations.
596
- * > It allows us to detect circular dependencies.
597
- */
598
- protected pendingInstantiations: Service[];
599
- /**
600
- * Cache for environment variables.
601
- * > It allows us to avoid parsing the same schema multiple times.
602
- */
603
- protected cacheEnv: Map<TSchema, any>;
604
- /**
605
- * Cache for TypeBox type checks.
606
- * > It allows us to avoid compiling the same schema multiple times.
607
- */
608
- protected cacheTypeCheck: Map<TSchema, TypeCheck<TSchema>>;
609
- /**
610
- * List of events that can be triggered. Powered by $hook().
611
- */
612
- protected events: Record<string, Array<Hook>>;
613
- /**
614
- * List of modules that are registered in the container.
615
- *
616
- * Modules are used to group services and provide a way to register them in the container.
617
- */
618
- protected modules: Array<ModuleDefinition>;
619
- /**
620
- * Node.js feature that allows to store context across asynchronous calls.
621
- *
622
- * This is used for logging, tracing, and other context-related features.
623
- *
624
- * Mocked for browser environments.
625
- */
626
- readonly context: AsyncLocalStorageProvider;
627
- /**
628
- * Get logger instance.
629
- */
630
- get log(): Logger;
631
- /**
632
- * The environment variables for the App.
633
- */
634
- get env(): Readonly<Env>;
635
- constructor(state?: Partial<State>);
636
- /**
637
- * Generic handle function used as generic interface for serverless functions.
638
- * You should not use this property directly.
639
- */
640
- handle?: (req: any, res: any) => Promise<any>;
641
- /**
642
- * State accessor and mutator.
643
- */
644
- state<Key extends keyof State>(key: Key, value?: State[Key]): State[Key];
645
- /**
646
- * True when start() is called.
647
- *
648
- * -> No more services can be added, it's over, bye!
649
- */
650
- isLocked(): boolean;
651
- /**
652
- * Returns whether the App is configured.
653
- *
654
- * It means that Alepha#configure() has been called.
655
- *
656
- * > By default, configure() is called automatically when start() is called, but you can also call it manually.
657
- */
658
- isConfigured(): boolean;
659
- /**
660
- * Returns whether the App has started.
661
- *
662
- * It means that #start() has been called but maybe not all services are ready.
663
- */
664
- isStarted(): boolean;
665
- /**
666
- * True if the App is ready. It means that Alepha is started AND ready() hook has beed called.
667
- */
668
- isReady(): boolean;
669
- /**
670
- * True if the App is running in a browser environment.
671
- */
672
- isBrowser(): boolean;
673
- /**
674
- * Returns whether the App is running in a serverless environment.
675
- *
676
- * > Vite developer mode is also considered serverless.
677
- */
678
- isServerless(): boolean | "vite" | "vercel";
679
- /**
680
- * Returns whether the App is in test mode. (Running in a test environment)
681
- *
682
- * > This is automatically set when running tests with Jest or Vitest.
683
- */
684
- isTest(): boolean;
685
- /**
686
- * Returns whether the App is in production mode. (Running in a production environment)
687
- *
688
- * > This is automatically set by Vite or Vercel. However, you have to set it manually when running Docker apps.
689
- */
690
- isProduction(): boolean;
691
- /**
692
- * Starts the App.
693
- *
694
- * - Lock any further changes to the container.
695
- * - Run "configure" hook for all services. Descriptors will be processed.
696
- * - Run "start" hook for all services. Providers will connect/listen/...
697
- * - Run "ready" hook for all services. This is the point where the App is ready to serve requests.
698
- *
699
- * @return A promise that resolves when the App has started.
700
- */
701
- start(): Promise<this>;
702
- /**
703
- * Stops the App.
704
- *
705
- * - Run "stop" hook for all services.
706
- *
707
- * Stop will NOT reset the container.
708
- * Stop will NOT unlock the container.
709
- *
710
- * > Stop is used to gracefully shut down the application, nothing more. There is no "restart".
711
- *
712
- * @return A promise that resolves when the App has stopped.
713
- */
714
- stop(): Promise<void>;
715
- /**
716
- * Check if entry is registered in the container.
717
- */
718
- has(entry: ServiceEntry, opts?: {
719
- /**
720
- * Check if the entry is registered in the pending instantiation stack.
721
- *
722
- * Default: true
723
- */
724
- inStack?: boolean;
725
- /**
726
- * Check if the entry is registered in the container registry.
727
- *
728
- * Default: true
729
- */
730
- inRegistry?: boolean;
731
- }): boolean;
732
- /**
733
- * Registers the specified service in the container.
734
- *
735
- * - If the service is ALREADY registered, the method does nothing.
736
- * - If the service is NOT registered, a new instance is created and registered.
737
- *
738
- * Method is chainable, so you can register multiple services in a single call.
739
- *
740
- * > ServiceEntry allows to provide a service **substitution** feature.
741
- *
742
- * @example
743
- * ```ts
744
- * class A { value = "a"; }
745
- * class B { value = "b"; }
746
- * class M { a = $inject(A); }
747
- *
748
- * Alepha.create().with({ provide: A, use: B }).get(M).a.value; // "b"
749
- * ```
750
- *
751
- * > **Substitution** is an advanced feature that allows you to replace a service with another service.
752
- * > It's useful for testing or for providing different implementations of a service.
753
- * > If you are interested in configuring a service, use Alepha#configure() instead.
754
- *
755
- * @param entry - The service to register in the container.
756
- * @return Current instance of Alepha.
757
- */
758
- with<T extends object>(entry: ServiceEntry<T>): this;
759
- /**
760
- * Get the instance of the specified service and apply some changes, depending on the options.
761
- * - If the service is already registered, it will return the existing instance. (except if `skipCache` is true)
762
- * - If the service is not registered, it will create a new instance and register it. (except if `skipRegistration` is true)
763
- * - New instance can be created with custom constructor arguments. (`args` option)
764
- *
765
- * > This method is used by $inject() under the hood.
766
- *
767
- * @return The instance of the specified class or type.
768
- */
769
- get<T extends object>(serviceEntry: ServiceEntry<T>, opts?: {
770
- /**
771
- * Ignore current existing instance.
772
- */
773
- skipCache?: boolean;
774
- /**
775
- * Don't store the instance in the registry.
776
- */
777
- skipRegistration?: boolean;
778
- /**
779
- * Constructor arguments to pass when creating a new instance.
780
- */
781
- args?: ConstructorParameters<InstantiableService<T>>;
782
- /**
783
- * Parent service that requested the instance.
784
- * @internal
785
- */
786
- parent?: Service | null;
787
- /**
788
- * If the service is provided by a module, the module definition.
789
- * @internal
790
- */
791
- module?: ModuleDefinition;
792
- }): T;
793
- /**
794
- * Configures the specified service with the provided state.
795
- * If service is not registered, it will do nothing.
796
- *
797
- * It's recommended to use this method on the `configure` hook.
798
- * @example
799
- * ```ts
800
- * class AppConfig {
801
- * configure = $hook({
802
- * name: "configure",
803
- * handler: (a) => {
804
- * a.configure(MyProvider, { some: "data" });
805
- * }
806
- * })
807
- * }
808
- * ```
809
- */
810
- configure<T extends object>(service: Service<T>, state: Partial<T>): void;
811
- /**
812
- * Registers a hook for the specified event.
542
+ /**
543
+ * Creates a new instance of the Alepha container with some helpers:
544
+ *
545
+ * - merges `process.env` with the provided state.env when available.
546
+ * - populates the test hooks for Vitest or Jest environments when available.
547
+ *
548
+ * If you are not interested about these helpers, you can use the constructor directly.
549
+ */
550
+ static create(state?: Partial<State>): Alepha;
551
+ /**
552
+ * List of all services + how they are provided.
553
+ */
554
+ protected registry: Map<Service, ServiceDefinition>;
555
+ /**
556
+ * Flag indicating whether the App won't accept any further changes.
557
+ * Pass to true when #start() is called.
558
+ */
559
+ protected locked: boolean;
560
+ /**
561
+ * True if the App has been configured.
562
+ */
563
+ protected configured: boolean;
564
+ /**
565
+ * True if the App has started.
566
+ */
567
+ protected started: boolean;
568
+ /**
569
+ * True if the App is ready.
570
+ */
571
+ protected ready: boolean;
572
+ /**
573
+ * A promise that resolves when the App has started.
574
+ */
575
+ protected starting?: PromiseWithResolvers<this>;
576
+ /**
577
+ * The current state of the App.
578
+ *
579
+ * It contains the environment variables, logger, and other state-related properties.
580
+ *
581
+ * You can declare your own state properties by extending the `State` interface.
582
+ *
583
+ * ```ts
584
+ * declare module "alepha/core" {
585
+ * interface State {
586
+ * myCustomValue: string;
587
+ * }
588
+ * }
589
+ * ```
590
+ *
591
+ * Same story for the `Env` interface.
592
+ * ```ts
593
+ * declare module "@alepha/core" {
594
+ * interface Env {
595
+ * readonly myCustomValue: string;
596
+ * }
597
+ * }
598
+ * ```
599
+ *
600
+ * State values can be function or primitive values.
601
+ * However, all .env variables must serializable to JSON.
602
+ */
603
+ protected store: State;
604
+ /**
605
+ * During the instantiation process, we keep a list of pending instantiations.
606
+ * > It allows us to detect circular dependencies.
607
+ */
608
+ protected pendingInstantiations: Service[];
609
+ /**
610
+ * Cache for environment variables.
611
+ * > It allows us to avoid parsing the same schema multiple times.
612
+ */
613
+ protected cacheEnv: Map<TSchema$1, any>;
614
+ /**
615
+ * Cache for TypeBox type checks.
616
+ * > It allows us to avoid compiling the same schema multiple times.
617
+ */
618
+ protected cacheTypeCheck: Map<TSchema$1, TypeCheck<TSchema$1>>;
619
+ /**
620
+ * List of events that can be triggered. Powered by $hook().
621
+ */
622
+ protected events: Record<string, Array<Hook>>;
623
+ /**
624
+ * List of modules that are registered in the container.
625
+ *
626
+ * Modules are used to group services and provide a way to register them in the container.
627
+ */
628
+ protected modules: Array<ModuleDefinition>;
629
+ /**
630
+ * Node.js feature that allows to store context across asynchronous calls.
631
+ *
632
+ * This is used for logging, tracing, and other context-related features.
633
+ *
634
+ * Mocked for browser environments.
635
+ */
636
+ readonly context: AsyncLocalStorageProvider;
637
+ /**
638
+ * Get logger instance.
639
+ */
640
+ get log(): Logger;
641
+ /**
642
+ * The environment variables for the App.
643
+ */
644
+ get env(): Readonly<Env>;
645
+ constructor(state?: Partial<State>);
646
+ /**
647
+ * Generic handle function used as generic interface for serverless functions.
648
+ * You should not use this property directly.
649
+ */
650
+ handle?: (req: any, res: any) => Promise<any>;
651
+ /**
652
+ * State accessor and mutator.
653
+ */
654
+ state<Key extends keyof State>(key: Key, value?: State[Key]): State[Key];
655
+ /**
656
+ * True when start() is called.
657
+ *
658
+ * -> No more services can be added, it's over, bye!
659
+ */
660
+ isLocked(): boolean;
661
+ /**
662
+ * Returns whether the App is configured.
663
+ *
664
+ * It means that Alepha#configure() has been called.
665
+ *
666
+ * > By default, configure() is called automatically when start() is called, but you can also call it manually.
667
+ */
668
+ isConfigured(): boolean;
669
+ /**
670
+ * Returns whether the App has started.
671
+ *
672
+ * It means that #start() has been called but maybe not all services are ready.
673
+ */
674
+ isStarted(): boolean;
675
+ /**
676
+ * True if the App is ready. It means that Alepha is started AND ready() hook has beed called.
677
+ */
678
+ isReady(): boolean;
679
+ /**
680
+ * True if the App is running in a browser environment.
681
+ */
682
+ isBrowser(): boolean;
683
+ /**
684
+ * Returns whether the App is running in a serverless environment.
685
+ *
686
+ * > Vite developer mode is also considered serverless.
687
+ */
688
+ isServerless(): boolean | "vite" | "vercel";
689
+ /**
690
+ * Returns whether the App is in test mode. (Running in a test environment)
691
+ *
692
+ * > This is automatically set when running tests with Jest or Vitest.
693
+ */
694
+ isTest(): boolean;
695
+ /**
696
+ * Returns whether the App is in production mode. (Running in a production environment)
697
+ *
698
+ * > This is automatically set by Vite or Vercel. However, you have to set it manually when running Docker apps.
699
+ */
700
+ isProduction(): boolean;
701
+ /**
702
+ * Starts the App.
703
+ *
704
+ * - Lock any further changes to the container.
705
+ * - Run "configure" hook for all services. Descriptors will be processed.
706
+ * - Run "start" hook for all services. Providers will connect/listen/...
707
+ * - Run "ready" hook for all services. This is the point where the App is ready to serve requests.
708
+ *
709
+ * @return A promise that resolves when the App has started.
710
+ */
711
+ start(): Promise<this>;
712
+ /**
713
+ * Stops the App.
714
+ *
715
+ * - Run "stop" hook for all services.
716
+ *
717
+ * Stop will NOT reset the container.
718
+ * Stop will NOT unlock the container.
719
+ *
720
+ * > Stop is used to gracefully shut down the application, nothing more. There is no "restart".
721
+ *
722
+ * @return A promise that resolves when the App has stopped.
723
+ */
724
+ stop(): Promise<void>;
725
+ /**
726
+ * Check if entry is registered in the container.
727
+ */
728
+ has(entry: ServiceEntry, opts?: {
729
+ /**
730
+ * Check if the entry is registered in the pending instantiation stack.
731
+ *
732
+ * Default: true
733
+ */
734
+ inStack?: boolean;
735
+ /**
736
+ * Check if the entry is registered in the container registry.
737
+ *
738
+ * Default: true
739
+ */
740
+ inRegistry?: boolean;
741
+ }): boolean;
742
+ /**
743
+ * Registers the specified service in the container.
744
+ *
745
+ * - If the service is ALREADY registered, the method does nothing.
746
+ * - If the service is NOT registered, a new instance is created and registered.
747
+ *
748
+ * Method is chainable, so you can register multiple services in a single call.
749
+ *
750
+ * > ServiceEntry allows to provide a service **substitution** feature.
751
+ *
752
+ * @example
753
+ * ```ts
754
+ * class A { value = "a"; }
755
+ * class B { value = "b"; }
756
+ * class M { a = $inject(A); }
757
+ *
758
+ * Alepha.create().with({ provide: A, use: B }).get(M).a.value; // "b"
759
+ * ```
760
+ *
761
+ * > **Substitution** is an advanced feature that allows you to replace a service with another service.
762
+ * > It's useful for testing or for providing different implementations of a service.
763
+ * > If you are interested in configuring a service, use Alepha#configure() instead.
764
+ *
765
+ * @param entry - The service to register in the container.
766
+ * @return Current instance of Alepha.
767
+ */
768
+ with<T extends object>(entry: ServiceEntry<T>): this;
769
+ /**
770
+ * Get the instance of the specified service and apply some changes, depending on the options.
771
+ * - If the service is already registered, it will return the existing instance. (except if `skipCache` is true)
772
+ * - If the service is not registered, it will create a new instance and register it. (except if `skipRegistration` is true)
773
+ * - New instance can be created with custom constructor arguments. (`args` option)
774
+ *
775
+ * > This method is used by $inject() under the hood.
776
+ *
777
+ * @return The instance of the specified class or type.
778
+ */
779
+ get<T extends object>(serviceEntry: ServiceEntry<T>, opts?: {
780
+ /**
781
+ * Ignore current existing instance.
782
+ */
783
+ skipCache?: boolean;
784
+ /**
785
+ * Don't store the instance in the registry.
786
+ */
787
+ skipRegistration?: boolean;
788
+ /**
789
+ * Constructor arguments to pass when creating a new instance.
790
+ */
791
+ args?: ConstructorParameters<InstantiableService<T>>;
792
+ /**
793
+ * Parent service that requested the instance.
794
+ * @internal
813
795
  */
814
- on<T extends keyof Hooks>(event: T, hookOrFunc: Hook<T> | ((payload: Hooks[T]) => Async<void>)): () => void;
796
+ parent?: Service | null;
815
797
  /**
816
- * Emits the specified event with the given payload.
798
+ * If the service is provided by a module, the module definition.
799
+ * @internal
817
800
  */
818
- emit<T extends keyof Hooks>(func: keyof Hooks, payload: Hooks[T], options?: {
819
- /**
820
- * If true, the hooks will be executed in reverse order.
821
- * This is useful for "stop" hooks that should be executed in reverse order.
822
- *
823
- * @default false
824
- */
825
- reverse?: boolean;
826
- /**
827
- * If true, the hooks will be logged with their execution time.
828
- *
829
- * @default false
830
- */
831
- log?: boolean;
832
- /**
833
- * If true, errors will be caught and logged instead of throwing.
834
- *
835
- * @default false
836
- */
837
- catch?: boolean;
838
- }): Promise<void>;
839
- /**
840
- * Casts the given value to the specified schema.
801
+ module?: ModuleDefinition;
802
+ }): T;
803
+ /**
804
+ * Configures the specified service with the provided state.
805
+ * If service is not registered, it will do nothing.
806
+ *
807
+ * It's recommended to use this method on the `configure` hook.
808
+ * @example
809
+ * ```ts
810
+ * class AppConfig {
811
+ * configure = $hook({
812
+ * name: "configure",
813
+ * handler: (a) => {
814
+ * a.configure(MyProvider, { some: "data" });
815
+ * }
816
+ * })
817
+ * }
818
+ * ```
819
+ */
820
+ configure<T extends object>(service: Service<T>, state: Partial<T>): void;
821
+ /**
822
+ * Registers a hook for the specified event.
823
+ */
824
+ on<T extends keyof Hooks>(event: T, hookOrFunc: Hook<T> | ((payload: Hooks[T]) => Async<void>)): () => void;
825
+ /**
826
+ * Emits the specified event with the given payload.
827
+ */
828
+ emit<T extends keyof Hooks>(func: keyof Hooks, payload: Hooks[T], options?: {
829
+ /**
830
+ * If true, the hooks will be executed in reverse order.
831
+ * This is useful for "stop" hooks that should be executed in reverse order.
841
832
  *
842
- * It uses the TypeBox library to validate the value against the schema.
833
+ * @default false
843
834
  */
844
- parse<T extends TSchema>(schema: T, value?: any, opts?: {
845
- /**
846
- * Clone the value before parsing.
847
- * @default true
848
- */
849
- clone?: boolean;
850
- /**
851
- * Apply default values defined in the schema.
852
- * @default true
853
- */
854
- default?: boolean;
855
- /**
856
- * Remove all values not defined in the schema.
857
- * @default true
858
- */
859
- clean?: boolean;
860
- /**
861
- * Try to cast/convert some data based on the schema.
862
- * @default true
863
- */
864
- convert?: boolean;
865
- /**
866
- * Prepare value after being deserialized.
867
- * @default true
868
- */
869
- check?: boolean;
870
- }): Static<T>;
835
+ reverse?: boolean;
871
836
  /**
872
- * Applies environment variables to the provided schema and state object.
837
+ * If true, the hooks will be logged with their execution time.
873
838
  *
874
- * It replaces also all templated $ENV inside string values.
875
- *
876
- * @param schema - The schema object to apply environment variables to.
877
- * @return The schema object with environment variables applied.
839
+ * @default false
878
840
  */
879
- parseEnv<T extends TObject>(schema: T): Static<T>;
841
+ log?: boolean;
880
842
  /**
881
- * Dump the current dependency graph of the App.
843
+ * If true, errors will be caught and logged instead of throwing.
882
844
  *
883
- * This method returns a record where the keys are the names of the services.
884
- */
885
- graph(): Record<string, {
886
- from: string[];
887
- as?: string;
888
- module?: string;
889
- }>;
890
- /**
891
- * @internal
892
- */
893
- getDescriptorValues<T extends Descriptor>(descriptor: T): Array<DescriptorItem<T>>;
894
- /**
895
- * @internal
896
- */
897
- protected new<T extends object>(definition: Service<T>, args?: any[], module?: ModuleDefinition): T;
898
- /**
899
- * @internal
900
- */
901
- protected createLogger(env: Env): Logger;
902
- /**
903
- * @internal
845
+ * @default false
904
846
  */
905
- getModuleOf(service: Service): Module | undefined;
847
+ catch?: boolean;
848
+ }): Promise<void>;
849
+ /**
850
+ * Casts the given value to the specified schema.
851
+ *
852
+ * It uses the TypeBox library to validate the value against the schema.
853
+ */
854
+ parse<T extends TSchema$1>(schema: T, value?: any, opts?: {
855
+ /**
856
+ * Clone the value before parsing.
857
+ * @default true
858
+ */
859
+ clone?: boolean;
860
+ /**
861
+ * Apply default values defined in the schema.
862
+ * @default true
863
+ */
864
+ default?: boolean;
865
+ /**
866
+ * Remove all values not defined in the schema.
867
+ * @default true
868
+ */
869
+ clean?: boolean;
870
+ /**
871
+ * Try to cast/convert some data based on the schema.
872
+ * @default true
873
+ */
874
+ convert?: boolean;
875
+ /**
876
+ * Prepare value after being deserialized.
877
+ * @default true
878
+ */
879
+ check?: boolean;
880
+ }): Static$1<T>;
881
+ /**
882
+ * Applies environment variables to the provided schema and state object.
883
+ *
884
+ * It replaces also all templated $ENV inside string values.
885
+ *
886
+ * @param schema - The schema object to apply environment variables to.
887
+ * @return The schema object with environment variables applied.
888
+ */
889
+ parseEnv<T extends TObject$1>(schema: T): Static$1<T>;
890
+ /**
891
+ * Dump the current dependency graph of the App.
892
+ *
893
+ * This method returns a record where the keys are the names of the services.
894
+ */
895
+ graph(): Record<string, {
896
+ from: string[];
897
+ as?: string;
898
+ module?: string;
899
+ }>;
900
+ /**
901
+ * @internal
902
+ */
903
+ getDescriptorValues<T extends Descriptor>(descriptor: T): Array<DescriptorItem<T>>;
904
+ /**
905
+ * @internal
906
+ */
907
+ protected new<T extends object>(definition: Service<T>, args?: any[], module?: ModuleDefinition): T;
908
+ /**
909
+ * @internal
910
+ */
911
+ protected createLogger(env: Env): Logger;
912
+ /**
913
+ * @internal
914
+ */
915
+ getModuleOf(service: Service): Module | undefined;
906
916
  }
907
917
  /**
908
918
  * This is how we store services in the Alepha container.
909
919
  */
910
920
  interface ServiceDefinition<T extends object = any> {
911
- /**
912
- * The class or type definition to provide.
913
- */
914
- provide: Service<T>;
915
- /**
916
- * The class or type definition to use. This will override the 'provide' property.
917
- */
918
- use?: Service<T>;
919
- /**
920
- * The instance of the class or type definition.
921
- * Mostly used for caching / singleton but can be used for other purposes like forcing the instance.
922
- */
923
- instance: T;
924
- /**
925
- * List of classes which use this class.
926
- */
927
- parents: Array<Service | null>;
928
- /**
929
- * If the service is provided by a module, the module definition.
930
- */
931
- module?: ModuleDefinition;
921
+ /**
922
+ * The class or type definition to provide.
923
+ */
924
+ provide: Service<T>;
925
+ /**
926
+ * The class or type definition to use. This will override the 'provide' property.
927
+ */
928
+ use?: Service<T>;
929
+ /**
930
+ * The instance of the class or type definition.
931
+ * Mostly used for caching / singleton but can be used for other purposes like forcing the instance.
932
+ */
933
+ instance: T;
934
+ /**
935
+ * List of classes which use this class.
936
+ */
937
+ parents: Array<Service | null>;
938
+ /**
939
+ * If the service is provided by a module, the module definition.
940
+ */
941
+ module?: ModuleDefinition;
932
942
  }
933
-
943
+ //#endregion
944
+ //#region src/interfaces/Run.d.ts
934
945
  interface RunOptions {
935
- /**
936
- * Environment variables to be used by the application.
937
- * If not provided, it will use the current process environment.
938
- */
939
- env?: Env;
940
- /**
941
- * A callback that will be executed before the application starts.
942
- */
943
- configure?: (alepha: Alepha) => Async<void>;
944
- /**
945
- * A callback that will be executed once the application is ready.
946
- * This is useful for initializing resources or starting background tasks.
947
- */
948
- ready?: (alepha: Alepha) => Async<void>;
949
- /**
950
- * If true, the application will stop after the ready callback is executed.
951
- */
952
- once?: boolean;
946
+ /**
947
+ * Environment variables to be used by the application.
948
+ * If not provided, it will use the current process environment.
949
+ */
950
+ env?: Env;
951
+ /**
952
+ * A callback that will be executed before the application starts.
953
+ */
954
+ configure?: (alepha: Alepha) => Async<void>;
955
+ /**
956
+ * A callback that will be executed once the application is ready.
957
+ * This is useful for initializing resources or starting background tasks.
958
+ */
959
+ ready?: (alepha: Alepha) => Async<void>;
960
+ /**
961
+ * If true, the application will stop after the ready callback is executed.
962
+ */
963
+ once?: boolean;
953
964
  }
954
-
965
+ //#endregion
966
+ //#region src/descriptors/$inject.d.ts
955
967
  /**
956
968
  * Get the instance of the specified type from the context.
957
969
  *
@@ -968,13 +980,14 @@ interface RunOptions {
968
980
  * @param type - Type (or TypeBox schema) to resolve
969
981
  * @returns Instance of the specified type
970
982
  */
971
- declare function $inject<T extends TObject>(type: T): Static<T>;
983
+ declare function $inject<T extends TObject$1>(type: T): Static$1<T>;
972
984
  declare function $inject<T extends object>(type: Service<T>): T;
973
985
  /**
974
986
  * @alias $inject
975
987
  */
976
988
  declare const $env: typeof $inject;
977
-
989
+ //#endregion
990
+ //#region src/descriptors/$logger.d.ts
978
991
  /**
979
992
  * Create a logger.
980
993
  *
@@ -995,271 +1008,279 @@ declare const $env: typeof $inject;
995
1008
  * ```
996
1009
  */
997
1010
  declare const $logger: (name?: string) => Logger;
998
-
1011
+ //#endregion
1012
+ //#region src/errors/AlephaError.d.ts
999
1013
  /**
1000
1014
  * Default error class for Alepha.
1001
1015
  */
1002
- declare class AlephaError extends Error {
1003
- }
1004
-
1016
+ declare class AlephaError extends Error {}
1017
+ //#endregion
1018
+ //#region src/errors/AppNotStartedError.d.ts
1005
1019
  declare class AppNotStartedError extends Error {
1006
- constructor();
1020
+ constructor();
1007
1021
  }
1008
-
1022
+ //#endregion
1023
+ //#region src/errors/CircularDependencyError.d.ts
1009
1024
  declare class CircularDependencyError extends Error {
1010
- constructor(provider: string, parents?: string[]);
1025
+ constructor(provider: string, parents?: string[]);
1011
1026
  }
1012
-
1027
+ //#endregion
1028
+ //#region src/errors/ContainerLockedError.d.ts
1013
1029
  declare class ContainerLockedError extends Error {
1014
- constructor(message?: string);
1030
+ constructor(message?: string);
1015
1031
  }
1016
-
1032
+ //#endregion
1033
+ //#region src/errors/NotImplementedError.d.ts
1017
1034
  declare class NotImplementedError extends Error {
1018
- constructor(provider: string);
1035
+ constructor(provider: string);
1019
1036
  }
1020
-
1037
+ //#endregion
1038
+ //#region src/errors/TypeBoxError.d.ts
1021
1039
  declare class TypeBoxError extends Error {
1022
- readonly value: ValueError;
1023
- constructor(value: ValueError);
1040
+ readonly value: ValueError;
1041
+ constructor(value: ValueError);
1024
1042
  }
1025
-
1043
+ //#endregion
1044
+ //#region src/providers/TypeProvider.d.ts
1026
1045
  declare class TypeProvider {
1027
- static DEFAULT_STRING_MAX_LENGTH: number;
1028
- static DEFAULT_LONG_STRING_MAX_LENGTH: number;
1029
- static DEFAULT_RICH_STRING_MAX_LENGTH: number;
1030
- static DEFAULT_ARRAY_MAX_ITEMS: number;
1031
- static FormatRegistry: typeof TypeBox.FormatRegistry;
1032
- Type: TypeBox.JavaScriptTypeBuilder;
1033
- any: (options?: SchemaOptions) => TypeBox.TAny;
1034
- void: (options?: SchemaOptions) => TypeBox.TVoid;
1035
- undefined: (options?: SchemaOptions) => TypeBox.TUndefined;
1036
- record: <Key extends TSchema, Value extends TSchema>(key: Key, value: Value, options?: ObjectOptions) => TypeBox.TRecordOrObject<Key, Value>;
1037
- omit: {
1038
- <Type extends TSchema, Key extends PropertyKey[]>(type: Type, key: readonly [...Key], options?: SchemaOptions): TypeBox.TOmit<Type, Key>;
1039
- <Type extends TSchema, Key extends TSchema>(type: Type, key: Key, options?: SchemaOptions): TypeBox.TOmit<Type, Key>;
1040
- };
1041
- union: <Types extends TSchema[]>(types: [...Types], options?: SchemaOptions) => Union<Types>;
1042
- partial: {
1043
- <MappedResult extends TypeBox.TMappedResult>(type: MappedResult, options?: SchemaOptions): TypeBox.TPartialFromMappedResult<MappedResult>;
1044
- <Type extends TSchema>(type: Type, options?: SchemaOptions): TypeBox.TPartial<Type>;
1045
- };
1046
- composite: <T extends TSchema[]>(schemas: [...T], options?: ObjectOptions) => TypeBox.TComposite<T>;
1047
- pick: {
1048
- <Type extends TSchema, Key extends PropertyKey[]>(type: Type, key: readonly [...Key], options?: SchemaOptions): TypeBox.TPick<Type, Key>;
1049
- <Type extends TSchema, Key extends TSchema>(type: Type, key: Key, options?: SchemaOptions): TypeBox.TPick<Type, Key>;
1050
- };
1051
- clean: typeof TypeBoxValue.Clean;
1052
- /**
1053
- * Create a schema for an object.
1054
- *
1055
- * @param properties The properties of the object.
1056
- * @param options The options for the object.
1057
- */
1058
- object: <T extends TProperties>(properties: T, options?: ObjectOptions) => TObject<T>;
1059
- /**
1060
- * Create a schema for an array.
1061
- *
1062
- * @param schema
1063
- * @param options
1064
- */
1065
- array: <T extends TSchema>(schema: T, options?: ArrayOptions) => TArray<T>;
1066
- /**
1067
- * Create a schema for a string.
1068
- *
1069
- * @param options
1070
- */
1071
- string: (options?: AlephaStringOptions) => TString;
1072
- /**
1073
- * Create a schema for a JSON object.
1074
- *
1075
- * @param options
1076
- */
1077
- json: (options?: SchemaOptions) => TypeBox.TRecord<TString, TypeBox.TAny>;
1078
- /**
1079
- * Create a schema for a boolean.
1080
- *
1081
- * @param options
1082
- */
1083
- boolean: (options?: SchemaOptions) => TBoolean;
1084
- /**
1085
- * Create a schema for a number.
1086
- *
1087
- * @param options
1088
- */
1089
- number: (options?: NumberOptions) => TNumber;
1090
- /**
1091
- * Create a schema for an unsigned 8-bit integer.
1092
- *
1093
- * @param options
1094
- */
1095
- uchar: (options?: IntegerOptions) => TInteger;
1096
- /**
1097
- * Create a schema for an unsigned 32-bit integer.
1098
- */
1099
- uint: (options?: IntegerOptions) => TNumber;
1100
- /**
1101
- * Create a schema for a signed 32-bit integer.
1102
- */
1103
- int: (options?: IntegerOptions) => TInteger;
1104
- /**
1105
- * Create a schema for a bigint. Bigint is a 64-bit integer.
1106
- * This is a workaround for TypeBox, which does not support bigint natively.
1107
- */
1108
- bigint: (options?: IntegerOptions) => TNumber;
1109
- /**
1110
- * Make a schema optional.
1111
- *
1112
- * @param schema The schema to make optional.
1113
- */
1114
- optional: <T extends TSchema>(schema: T) => TOptionalWithFlag<T, true>;
1115
- /**
1116
- * Nullify all properties of a schema.
1117
- *
1118
- * @param schema The schema to nullify.
1119
- * @param options The options for the schema.
1120
- */
1121
- nullify: <T extends TSchema>(schema: T, options?: ObjectOptions) => TObject<TypeBox.Evaluate<TypeBox.TMappedFunctionReturnType<TypeBox.TIndexPropertyKeys<TypeBox.TKeyOf<T>>, TypeBox.TUnion<[TNull, TypeBox.TMappedResult<TypeBox.Evaluate<TypeBox.TIndexPropertyKeys<TypeBox.TKeyOf<T>> extends infer T_1 ? T_1 extends TypeBox.TIndexPropertyKeys<TypeBox.TKeyOf<T>> ? T_1 extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? Right extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? Right extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? Right extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? Right extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? Right extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? Right extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? Right extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? Right extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? Right extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? Right extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? /*elided*/ any : { [_ in Left]: TypeBox.Assert<TypeBox.TIndexFromPropertyKey<T, Left>, TSchema>; } : { [_ in Left]: TypeBox.Assert<TypeBox.TIndexFromPropertyKey<T, Left>, TSchema>; } : { [_ in Left]: TypeBox.Assert<TypeBox.TIndexFromPropertyKey<T, Left>, TSchema>; } : { [_ in Left]: TypeBox.Assert<TypeBox.TIndexFromPropertyKey<T, Left>, TSchema>; } : { [_ in Left]: TypeBox.Assert<TypeBox.TIndexFromPropertyKey<T, Left>, TSchema>; } : { [_ in Left]: TypeBox.Assert<TypeBox.TIndexFromPropertyKey<T, Left>, TSchema>; } : { [_ in Left]: TypeBox.Assert<TypeBox.TIndexFromPropertyKey<T, Left>, TSchema>; } : { [_ in Left]: TypeBox.Assert<TypeBox.TIndexFromPropertyKey<T, Left>, TSchema>; } : { [_ in Left]: TypeBox.Assert<TypeBox.TIndexFromPropertyKey<T, Left>, TSchema>; } : { [_ in Left]: TypeBox.Assert<TypeBox.TIndexFromPropertyKey<T, Left>, TSchema>; } : {} : never : never>>]>, {}>>>;
1122
- /**
1123
- * Make a schema nullable.
1124
- *
1125
- * @param schema The schema to make nullable.
1126
- * @param options The options for the schema.
1127
- */
1128
- nullable: <T extends TSchema>(schema: T, options?: ObjectOptions) => Union<[TNull, T]>;
1129
- /**
1130
- * Map a schema to another schema.
1131
- *
1132
- * @param schema The schema to map.
1133
- * @param operations The operations to perform on the schema.
1134
- * @param options The options for the schema.
1135
- * @returns The mapped schema.
1136
- */
1137
- map: <T extends TObject | TIntersect, Omit extends (keyof T["properties"])[], Optional extends (keyof T["properties"])[]>(schema: T, operations: {
1138
- omit: readonly [...Omit];
1139
- optional: [...Optional];
1140
- }, options?: ObjectOptions) => TObject<TypeBox.Evaluate<TypeBox.TSetDistinct<[...TypeBox.TKeyOfPropertyKeys<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_1 ? T_1 extends [...Omit, ...Optional] ? T_1 extends TypeBox.TRef<string> ? true : false : never : never>>, ...TypeBox.TKeyOfPropertyKeys<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>>], []> extends infer T_2 ? T_2 extends TypeBox.TSetDistinct<[...TypeBox.TKeyOfPropertyKeys<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_53 ? T_53 extends [...Omit, ...Optional] ? T_53 extends TypeBox.TRef<string> ? true : false : never : never>>, ...TypeBox.TKeyOfPropertyKeys<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>>], []> ? T_2 extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? R extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? R extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? R extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? R extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? R extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? R extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? R extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? R extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? R extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? R extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? /*elided*/ any : { [_ in L]: TypeBox.TIntersectEvaluated<TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_3 ? T_3 extends [...Omit, ...Optional] ? T_3 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema> extends infer T_4 ? T_4 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_7 ? T_7 extends [...Omit, ...Optional] ? T_7 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema> ? T_4 extends TypeBox.TNever ? TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> extends infer T_5 ? T_5 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> ? T_5 extends TypeBox.TNever ? [] : [T_5] : never : never : TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> extends infer T_6 ? T_6 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> ? T_6 extends TypeBox.TNever ? [T_4] : [T_4, T_6] : never : never : never : never>; } : { [_ in L]: TypeBox.TIntersectEvaluated<TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_8 ? T_8 extends [...Omit, ...Optional] ? T_8 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema> extends infer T_9 ? T_9 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_12 ? T_12 extends [...Omit, ...Optional] ? T_12 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema> ? T_9 extends TypeBox.TNever ? TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> extends infer T_10 ? T_10 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> ? T_10 extends TypeBox.TNever ? [] : [T_10] : never : never : TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> extends infer T_11 ? T_11 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> ? T_11 extends TypeBox.TNever ? [T_9] : [T_9, T_11] : never : never : never : never>; } : { [_ in L]: TypeBox.TIntersectEvaluated<TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_13 ? T_13 extends [...Omit, ...Optional] ? T_13 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema> extends infer T_14 ? T_14 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_17 ? T_17 extends [...Omit, ...Optional] ? T_17 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema> ? T_14 extends TypeBox.TNever ? TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> extends infer T_15 ? T_15 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> ? T_15 extends TypeBox.TNever ? [] : [T_15] : never : never : TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> extends infer T_16 ? T_16 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> ? T_16 extends TypeBox.TNever ? [T_14] : [T_14, T_16] : never : never : never : never>; } : { [_ in L]: TypeBox.TIntersectEvaluated<TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_18 ? T_18 extends [...Omit, ...Optional] ? T_18 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema> extends infer T_19 ? T_19 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_22 ? T_22 extends [...Omit, ...Optional] ? T_22 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema> ? T_19 extends TypeBox.TNever ? TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> extends infer T_20 ? T_20 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> ? T_20 extends TypeBox.TNever ? [] : [T_20] : never : never : TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> extends infer T_21 ? T_21 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> ? T_21 extends TypeBox.TNever ? [T_19] : [T_19, T_21] : never : never : never : never>; } : { [_ in L]: TypeBox.TIntersectEvaluated<TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_23 ? T_23 extends [...Omit, ...Optional] ? T_23 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema> extends infer T_24 ? T_24 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_27 ? T_27 extends [...Omit, ...Optional] ? T_27 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema> ? T_24 extends TypeBox.TNever ? TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> extends infer T_25 ? T_25 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> ? T_25 extends TypeBox.TNever ? [] : [T_25] : never : never : TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> extends infer T_26 ? T_26 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> ? T_26 extends TypeBox.TNever ? [T_24] : [T_24, T_26] : never : never : never : never>; } : { [_ in L]: TypeBox.TIntersectEvaluated<TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_28 ? T_28 extends [...Omit, ...Optional] ? T_28 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema> extends infer T_29 ? T_29 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_32 ? T_32 extends [...Omit, ...Optional] ? T_32 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema> ? T_29 extends TypeBox.TNever ? TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> extends infer T_30 ? T_30 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> ? T_30 extends TypeBox.TNever ? [] : [T_30] : never : never : TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> extends infer T_31 ? T_31 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> ? T_31 extends TypeBox.TNever ? [T_29] : [T_29, T_31] : never : never : never : never>; } : { [_ in L]: TypeBox.TIntersectEvaluated<TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_33 ? T_33 extends [...Omit, ...Optional] ? T_33 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema> extends infer T_34 ? T_34 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_37 ? T_37 extends [...Omit, ...Optional] ? T_37 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema> ? T_34 extends TypeBox.TNever ? TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> extends infer T_35 ? T_35 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> ? T_35 extends TypeBox.TNever ? [] : [T_35] : never : never : TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> extends infer T_36 ? T_36 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> ? T_36 extends TypeBox.TNever ? [T_34] : [T_34, T_36] : never : never : never : never>; } : { [_ in L]: TypeBox.TIntersectEvaluated<TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_38 ? T_38 extends [...Omit, ...Optional] ? T_38 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema> extends infer T_39 ? T_39 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_42 ? T_42 extends [...Omit, ...Optional] ? T_42 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema> ? T_39 extends TypeBox.TNever ? TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> extends infer T_40 ? T_40 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> ? T_40 extends TypeBox.TNever ? [] : [T_40] : never : never : TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> extends infer T_41 ? T_41 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> ? T_41 extends TypeBox.TNever ? [T_39] : [T_39, T_41] : never : never : never : never>; } : { [_ in L]: TypeBox.TIntersectEvaluated<TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_43 ? T_43 extends [...Omit, ...Optional] ? T_43 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema> extends infer T_44 ? T_44 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_47 ? T_47 extends [...Omit, ...Optional] ? T_47 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema> ? T_44 extends TypeBox.TNever ? TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> extends infer T_45 ? T_45 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> ? T_45 extends TypeBox.TNever ? [] : [T_45] : never : never : TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> extends infer T_46 ? T_46 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> ? T_46 extends TypeBox.TNever ? [T_44] : [T_44, T_46] : never : never : never : never>; } : { [_ in L]: TypeBox.TIntersectEvaluated<TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_48 ? T_48 extends [...Omit, ...Optional] ? T_48 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema> extends infer T_49 ? T_49 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_52 ? T_52 extends [...Omit, ...Optional] ? T_52 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema> ? T_49 extends TypeBox.TNever ? TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> extends infer T_50 ? T_50 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> ? T_50 extends TypeBox.TNever ? [] : [T_50] : never : never : TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> extends infer T_51 ? T_51 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema> ? T_51 extends TypeBox.TNever ? [T_49] : [T_49, T_51] : never : never : never : never>; } : {} : never : never>>;
1141
- /**
1142
- * Create a schema for a string enum.
1143
- *
1144
- * @param values
1145
- * @param options
1146
- */
1147
- enum: <T extends string[]>(values: [...T], options?: StringOptions) => TUnsafe<T[number]>;
1148
- /**
1149
- * Create a schema for a string enum e.g. LIKE_THIS.
1150
- *
1151
- * @param options
1152
- */
1153
- snakeCase: (options?: StringOptions) => TString;
1154
- /**
1155
- * Create a schema for an object with a value and label.
1156
- *
1157
- * @param options
1158
- */
1159
- valueLabel: (options?: ObjectOptions) => TObject<{
1160
- value: TString;
1161
- label: TString;
1162
- description: TypeBox.TOptional<TString>;
1163
- }>;
1164
- /**
1165
- * Create a schema for a datetime.
1166
- *
1167
- * @param options The options for the date.
1168
- */
1169
- datetime: (options?: StringOptions) => TString;
1170
- /**
1171
- * Create a schema for a date.
1172
- *
1173
- * @param options
1174
- */
1175
- date: (options?: StringOptions) => TString;
1176
- /**
1177
- * Create a schema for uuid.
1178
- *
1179
- * @param options The options for the duration.
1180
- */
1181
- uuid: (options?: StringOptions) => TString;
1182
- /**
1183
- *
1184
- *
1185
- * @param kind
1186
- * @param options
1187
- */
1188
- unsafe: <T>(kind: string, options?: UnsafeOptions) => TUnsafe<T>;
1189
- file: (options?: {
1190
- max?: number;
1191
- }) => TFile;
1192
- stream: () => TStream;
1046
+ static DEFAULT_STRING_MAX_LENGTH: number;
1047
+ static DEFAULT_LONG_STRING_MAX_LENGTH: number;
1048
+ static DEFAULT_RICH_STRING_MAX_LENGTH: number;
1049
+ static DEFAULT_ARRAY_MAX_ITEMS: number;
1050
+ static FormatRegistry: typeof TypeBox.FormatRegistry;
1051
+ Type: TypeBox.JavaScriptTypeBuilder;
1052
+ any: (options?: SchemaOptions) => TypeBox.TAny;
1053
+ void: (options?: SchemaOptions) => TypeBox.TVoid;
1054
+ undefined: (options?: SchemaOptions) => TypeBox.TUndefined;
1055
+ record: <Key extends TSchema$1, Value extends TSchema$1>(key: Key, value: Value, options?: ObjectOptions) => TypeBox.TRecordOrObject<Key, Value>;
1056
+ omit: {
1057
+ <Type extends TSchema$1, Key extends PropertyKey[]>(type: Type, key: readonly [...Key], options?: SchemaOptions): TypeBox.TOmit<Type, Key>;
1058
+ <Type extends TSchema$1, Key extends TSchema$1>(type: Type, key: Key, options?: SchemaOptions): TypeBox.TOmit<Type, Key>;
1059
+ };
1060
+ union: <Types extends TSchema$1[]>(types: [...Types], options?: SchemaOptions) => Union<Types>;
1061
+ partial: {
1062
+ <MappedResult extends TypeBox.TMappedResult>(type: MappedResult, options?: SchemaOptions): TypeBox.TPartialFromMappedResult<MappedResult>;
1063
+ <Type extends TSchema$1>(type: Type, options?: SchemaOptions): TypeBox.TPartial<Type>;
1064
+ };
1065
+ composite: <T extends TSchema$1[]>(schemas: [...T], options?: ObjectOptions) => TypeBox.TComposite<T>;
1066
+ pick: {
1067
+ <Type extends TSchema$1, Key extends PropertyKey[]>(type: Type, key: readonly [...Key], options?: SchemaOptions): TypeBox.TPick<Type, Key>;
1068
+ <Type extends TSchema$1, Key extends TSchema$1>(type: Type, key: Key, options?: SchemaOptions): TypeBox.TPick<Type, Key>;
1069
+ };
1070
+ clean: typeof TypeBoxValue.Clean;
1071
+ /**
1072
+ * Create a schema for an object.
1073
+ *
1074
+ * @param properties The properties of the object.
1075
+ * @param options The options for the object.
1076
+ */
1077
+ object: <T extends TProperties>(properties: T, options?: ObjectOptions) => TObject$1<T>;
1078
+ /**
1079
+ * Create a schema for an array.
1080
+ *
1081
+ * @param schema
1082
+ * @param options
1083
+ */
1084
+ array: <T extends TSchema$1>(schema: T, options?: ArrayOptions) => TArray<T>;
1085
+ /**
1086
+ * Create a schema for a string.
1087
+ *
1088
+ * @param options
1089
+ */
1090
+ string: (options?: AlephaStringOptions) => TString;
1091
+ /**
1092
+ * Create a schema for a JSON object.
1093
+ *
1094
+ * @param options
1095
+ */
1096
+ json: (options?: SchemaOptions) => TypeBox.TRecord<TString, TypeBox.TAny>;
1097
+ /**
1098
+ * Create a schema for a boolean.
1099
+ *
1100
+ * @param options
1101
+ */
1102
+ boolean: (options?: SchemaOptions) => TBoolean;
1103
+ /**
1104
+ * Create a schema for a number.
1105
+ *
1106
+ * @param options
1107
+ */
1108
+ number: (options?: NumberOptions) => TNumber;
1109
+ /**
1110
+ * Create a schema for an unsigned 8-bit integer.
1111
+ *
1112
+ * @param options
1113
+ */
1114
+ uchar: (options?: IntegerOptions) => TInteger;
1115
+ /**
1116
+ * Create a schema for an unsigned 32-bit integer.
1117
+ */
1118
+ uint: (options?: IntegerOptions) => TNumber;
1119
+ /**
1120
+ * Create a schema for a signed 32-bit integer.
1121
+ */
1122
+ int: (options?: IntegerOptions) => TInteger;
1123
+ /**
1124
+ * Create a schema for a bigint. Bigint is a 64-bit integer.
1125
+ * This is a workaround for TypeBox, which does not support bigint natively.
1126
+ */
1127
+ bigint: (options?: IntegerOptions) => TNumber;
1128
+ /**
1129
+ * Make a schema optional.
1130
+ *
1131
+ * @param schema The schema to make optional.
1132
+ */
1133
+ optional: <T extends TSchema$1>(schema: T) => TOptionalWithFlag<T, true>;
1134
+ /**
1135
+ * Nullify all properties of a schema.
1136
+ *
1137
+ * @param schema The schema to nullify.
1138
+ * @param options The options for the schema.
1139
+ */
1140
+ nullify: <T extends TSchema$1>(schema: T, options?: ObjectOptions) => TObject$1<TypeBox.Evaluate<TypeBox.TMappedFunctionReturnType<TypeBox.TIndexPropertyKeys<TypeBox.TKeyOf<T>>, TypeBox.TUnion<[TNull, TypeBox.TMappedResult<TypeBox.Evaluate<TypeBox.TIndexPropertyKeys<TypeBox.TKeyOf<T>> extends infer T_1 ? T_1 extends TypeBox.TIndexPropertyKeys<TypeBox.TKeyOf<T>> ? T_1 extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? Right extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? Right extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? Right extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? Right extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? Right extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? Right extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? Right extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? Right extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? Right extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? Right extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? /*elided*/any : { [_ in Left]: TypeBox.Assert<TypeBox.TIndexFromPropertyKey<T, Left>, TSchema$1> } : { [_ in Left]: TypeBox.Assert<TypeBox.TIndexFromPropertyKey<T, Left>, TSchema$1> } : { [_ in Left]: TypeBox.Assert<TypeBox.TIndexFromPropertyKey<T, Left>, TSchema$1> } : { [_ in Left]: TypeBox.Assert<TypeBox.TIndexFromPropertyKey<T, Left>, TSchema$1> } : { [_ in Left]: TypeBox.Assert<TypeBox.TIndexFromPropertyKey<T, Left>, TSchema$1> } : { [_ in Left]: TypeBox.Assert<TypeBox.TIndexFromPropertyKey<T, Left>, TSchema$1> } : { [_ in Left]: TypeBox.Assert<TypeBox.TIndexFromPropertyKey<T, Left>, TSchema$1> } : { [_ in Left]: TypeBox.Assert<TypeBox.TIndexFromPropertyKey<T, Left>, TSchema$1> } : { [_ in Left]: TypeBox.Assert<TypeBox.TIndexFromPropertyKey<T, Left>, TSchema$1> } : { [_ in Left]: TypeBox.Assert<TypeBox.TIndexFromPropertyKey<T, Left>, TSchema$1> } : {} : never : never>>]>, {}>>>;
1141
+ /**
1142
+ * Make a schema nullable.
1143
+ *
1144
+ * @param schema The schema to make nullable.
1145
+ * @param options The options for the schema.
1146
+ */
1147
+ nullable: <T extends TSchema$1>(schema: T, options?: ObjectOptions) => Union<[TNull, T]>;
1148
+ /**
1149
+ * Map a schema to another schema.
1150
+ *
1151
+ * @param schema The schema to map.
1152
+ * @param operations The operations to perform on the schema.
1153
+ * @param options The options for the schema.
1154
+ * @returns The mapped schema.
1155
+ */
1156
+ map: <T extends TObject$1 | TIntersect, Omit extends (keyof T["properties"])[], Optional extends (keyof T["properties"])[]>(schema: T, operations: {
1157
+ omit: readonly [...Omit];
1158
+ optional: [...Optional];
1159
+ }, options?: ObjectOptions) => TObject$1<TypeBox.Evaluate<TypeBox.TSetDistinct<[...TypeBox.TKeyOfPropertyKeys<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_1 ? T_1 extends [...Omit, ...Optional] ? T_1 extends TypeBox.TRef<string> ? true : false : never : never>>, ...TypeBox.TKeyOfPropertyKeys<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>>], []> extends infer T_2 ? T_2 extends TypeBox.TSetDistinct<[...TypeBox.TKeyOfPropertyKeys<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_53 ? T_53 extends [...Omit, ...Optional] ? T_53 extends TypeBox.TRef<string> ? true : false : never : never>>, ...TypeBox.TKeyOfPropertyKeys<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>>], []> ? T_2 extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? R extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? R extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? R extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? R extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? R extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? R extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? R extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? R extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? R extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? R extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? /*elided*/any : { [_ in L]: TypeBox.TIntersectEvaluated<TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_3 ? T_3 extends [...Omit, ...Optional] ? T_3 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema$1> extends infer T_4 ? T_4 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_7 ? T_7 extends [...Omit, ...Optional] ? T_7 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema$1> ? T_4 extends TypeBox.TNever ? TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> extends infer T_5 ? T_5 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> ? T_5 extends TypeBox.TNever ? [] : [T_5] : never : never : TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> extends infer T_6 ? T_6 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> ? T_6 extends TypeBox.TNever ? [T_4] : [T_4, T_6] : never : never : never : never> } : { [_ in L]: TypeBox.TIntersectEvaluated<TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_8 ? T_8 extends [...Omit, ...Optional] ? T_8 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema$1> extends infer T_9 ? T_9 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_12 ? T_12 extends [...Omit, ...Optional] ? T_12 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema$1> ? T_9 extends TypeBox.TNever ? TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> extends infer T_10 ? T_10 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> ? T_10 extends TypeBox.TNever ? [] : [T_10] : never : never : TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> extends infer T_11 ? T_11 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> ? T_11 extends TypeBox.TNever ? [T_9] : [T_9, T_11] : never : never : never : never> } : { [_ in L]: TypeBox.TIntersectEvaluated<TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_13 ? T_13 extends [...Omit, ...Optional] ? T_13 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema$1> extends infer T_14 ? T_14 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_17 ? T_17 extends [...Omit, ...Optional] ? T_17 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema$1> ? T_14 extends TypeBox.TNever ? TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> extends infer T_15 ? T_15 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> ? T_15 extends TypeBox.TNever ? [] : [T_15] : never : never : TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> extends infer T_16 ? T_16 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> ? T_16 extends TypeBox.TNever ? [T_14] : [T_14, T_16] : never : never : never : never> } : { [_ in L]: TypeBox.TIntersectEvaluated<TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_18 ? T_18 extends [...Omit, ...Optional] ? T_18 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema$1> extends infer T_19 ? T_19 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_22 ? T_22 extends [...Omit, ...Optional] ? T_22 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema$1> ? T_19 extends TypeBox.TNever ? TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> extends infer T_20 ? T_20 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> ? T_20 extends TypeBox.TNever ? [] : [T_20] : never : never : TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> extends infer T_21 ? T_21 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> ? T_21 extends TypeBox.TNever ? [T_19] : [T_19, T_21] : never : never : never : never> } : { [_ in L]: TypeBox.TIntersectEvaluated<TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_23 ? T_23 extends [...Omit, ...Optional] ? T_23 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema$1> extends infer T_24 ? T_24 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_27 ? T_27 extends [...Omit, ...Optional] ? T_27 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema$1> ? T_24 extends TypeBox.TNever ? TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> extends infer T_25 ? T_25 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> ? T_25 extends TypeBox.TNever ? [] : [T_25] : never : never : TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> extends infer T_26 ? T_26 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> ? T_26 extends TypeBox.TNever ? [T_24] : [T_24, T_26] : never : never : never : never> } : { [_ in L]: TypeBox.TIntersectEvaluated<TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_28 ? T_28 extends [...Omit, ...Optional] ? T_28 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema$1> extends infer T_29 ? T_29 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_32 ? T_32 extends [...Omit, ...Optional] ? T_32 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema$1> ? T_29 extends TypeBox.TNever ? TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> extends infer T_30 ? T_30 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> ? T_30 extends TypeBox.TNever ? [] : [T_30] : never : never : TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> extends infer T_31 ? T_31 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> ? T_31 extends TypeBox.TNever ? [T_29] : [T_29, T_31] : never : never : never : never> } : { [_ in L]: TypeBox.TIntersectEvaluated<TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_33 ? T_33 extends [...Omit, ...Optional] ? T_33 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema$1> extends infer T_34 ? T_34 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_37 ? T_37 extends [...Omit, ...Optional] ? T_37 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema$1> ? T_34 extends TypeBox.TNever ? TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> extends infer T_35 ? T_35 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> ? T_35 extends TypeBox.TNever ? [] : [T_35] : never : never : TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> extends infer T_36 ? T_36 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> ? T_36 extends TypeBox.TNever ? [T_34] : [T_34, T_36] : never : never : never : never> } : { [_ in L]: TypeBox.TIntersectEvaluated<TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_38 ? T_38 extends [...Omit, ...Optional] ? T_38 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema$1> extends infer T_39 ? T_39 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_42 ? T_42 extends [...Omit, ...Optional] ? T_42 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema$1> ? T_39 extends TypeBox.TNever ? TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> extends infer T_40 ? T_40 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> ? T_40 extends TypeBox.TNever ? [] : [T_40] : never : never : TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> extends infer T_41 ? T_41 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> ? T_41 extends TypeBox.TNever ? [T_39] : [T_39, T_41] : never : never : never : never> } : { [_ in L]: TypeBox.TIntersectEvaluated<TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_43 ? T_43 extends [...Omit, ...Optional] ? T_43 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema$1> extends infer T_44 ? T_44 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_47 ? T_47 extends [...Omit, ...Optional] ? T_47 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema$1> ? T_44 extends TypeBox.TNever ? TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> extends infer T_45 ? T_45 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> ? T_45 extends TypeBox.TNever ? [] : [T_45] : never : never : TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> extends infer T_46 ? T_46 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> ? T_46 extends TypeBox.TNever ? [T_44] : [T_44, T_46] : never : never : never : never> } : { [_ in L]: TypeBox.TIntersectEvaluated<TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_48 ? T_48 extends [...Omit, ...Optional] ? T_48 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema$1> extends infer T_49 ? T_49 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TOmit<T, [...Omit, ...Optional], T extends TypeBox.TRef<string> ? true : false, [...Omit, ...Optional] extends infer T_52 ? T_52 extends [...Omit, ...Optional] ? T_52 extends TypeBox.TRef<string> ? true : false : never : never>, L>, TSchema$1> ? T_49 extends TypeBox.TNever ? TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> extends infer T_50 ? T_50 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> ? T_50 extends TypeBox.TNever ? [] : [T_50] : never : never : TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> extends infer T_51 ? T_51 extends TypeBox.Assert<TypeBox.TIndexFromPropertyKey<TypeBox.TPartial<TypeBox.TPick<T, Optional, T extends TypeBox.TRef<string> ? true : false, Optional extends TypeBox.TRef<string> ? true : false>>, L>, TSchema$1> ? T_51 extends TypeBox.TNever ? [T_49] : [T_49, T_51] : never : never : never : never> } : {} : never : never>>;
1160
+ /**
1161
+ * Create a schema for a string enum.
1162
+ *
1163
+ * @param values
1164
+ * @param options
1165
+ */
1166
+ enum: <T extends string[]>(values: [...T], options?: StringOptions) => TUnsafe<T[number]>;
1167
+ /**
1168
+ * Create a schema for a string enum e.g. LIKE_THIS.
1169
+ *
1170
+ * @param options
1171
+ */
1172
+ snakeCase: (options?: StringOptions) => TString;
1173
+ /**
1174
+ * Create a schema for an object with a value and label.
1175
+ *
1176
+ * @param options
1177
+ */
1178
+ valueLabel: (options?: ObjectOptions) => TObject$1<{
1179
+ value: TString;
1180
+ label: TString;
1181
+ description: TypeBox.TOptional<TString>;
1182
+ }>;
1183
+ /**
1184
+ * Create a schema for a datetime.
1185
+ *
1186
+ * @param options The options for the date.
1187
+ */
1188
+ datetime: (options?: StringOptions) => TString;
1189
+ /**
1190
+ * Create a schema for a date.
1191
+ *
1192
+ * @param options
1193
+ */
1194
+ date: (options?: StringOptions) => TString;
1195
+ /**
1196
+ * Create a schema for uuid.
1197
+ *
1198
+ * @param options The options for the duration.
1199
+ */
1200
+ uuid: (options?: StringOptions) => TString;
1201
+ /**
1202
+ *
1203
+ *
1204
+ * @param kind
1205
+ * @param options
1206
+ */
1207
+ unsafe: <T>(kind: string, options?: UnsafeOptions) => TUnsafe<T>;
1208
+ file: (options?: {
1209
+ max?: number;
1210
+ }) => TFile;
1211
+ stream: () => TStream;
1193
1212
  }
1194
1213
  interface FileLike {
1195
- /**
1196
- * Filename.
1197
- * @default "file"
1198
- */
1199
- name: string;
1200
- /**
1201
- * Mandatory MIME type of the file.
1202
- * @default "application/octet-stream"
1203
- */
1204
- type: string;
1205
- /**
1206
- * Size of the file in bytes.
1207
- *
1208
- * Always 0 for streams, as the size is not known until the stream is fully read.
1209
- *
1210
- * @default 0
1211
- */
1212
- size: number;
1213
- /**
1214
- * Last modified timestamp in milliseconds since epoch.
1215
- *
1216
- * Always the current timestamp for streams, as the last modified time is not known.
1217
- * We use this field to ensure compatibility with File API.
1218
- *
1219
- * @default Date.now()
1220
- */
1221
- lastModified: number;
1222
- /**
1223
- * Returns a ReadableStream or Node.js Readable stream of the file content.
1224
- *
1225
- * For streams, this is the original stream.
1226
- */
1227
- stream(): StreamLike;
1228
- /**
1229
- * Returns the file content as an ArrayBuffer.
1230
- *
1231
- * For streams, this reads the entire stream into memory.
1232
- */
1233
- arrayBuffer(): Promise<ArrayBuffer>;
1234
- /**
1235
- * Returns the file content as a string.
1236
- *
1237
- * For streams, this reads the entire stream into memory and converts it to a string.
1238
- */
1239
- text(): Promise<string>;
1240
- /**
1241
- * Optional file path, if the file is stored on disk.
1242
- *
1243
- * This is not from the File API, but rather a custom field to indicate where the file is stored.
1244
- */
1245
- filepath?: string;
1214
+ /**
1215
+ * Filename.
1216
+ * @default "file"
1217
+ */
1218
+ name: string;
1219
+ /**
1220
+ * Mandatory MIME type of the file.
1221
+ * @default "application/octet-stream"
1222
+ */
1223
+ type: string;
1224
+ /**
1225
+ * Size of the file in bytes.
1226
+ *
1227
+ * Always 0 for streams, as the size is not known until the stream is fully read.
1228
+ *
1229
+ * @default 0
1230
+ */
1231
+ size: number;
1232
+ /**
1233
+ * Last modified timestamp in milliseconds since epoch.
1234
+ *
1235
+ * Always the current timestamp for streams, as the last modified time is not known.
1236
+ * We use this field to ensure compatibility with File API.
1237
+ *
1238
+ * @default Date.now()
1239
+ */
1240
+ lastModified: number;
1241
+ /**
1242
+ * Returns a ReadableStream or Node.js Readable stream of the file content.
1243
+ *
1244
+ * For streams, this is the original stream.
1245
+ */
1246
+ stream(): StreamLike;
1247
+ /**
1248
+ * Returns the file content as an ArrayBuffer.
1249
+ *
1250
+ * For streams, this reads the entire stream into memory.
1251
+ */
1252
+ arrayBuffer(): Promise<ArrayBuffer>;
1253
+ /**
1254
+ * Returns the file content as a string.
1255
+ *
1256
+ * For streams, this reads the entire stream into memory and converts it to a string.
1257
+ */
1258
+ text(): Promise<string>;
1259
+ /**
1260
+ * Optional file path, if the file is stored on disk.
1261
+ *
1262
+ * This is not from the File API, but rather a custom field to indicate where the file is stored.
1263
+ */
1264
+ filepath?: string;
1246
1265
  }
1247
1266
  /**
1248
1267
  * TypeBox view of FileLike.
1249
1268
  */
1250
1269
  type TFile = TUnsafe<FileLike>;
1251
- declare const isTypeFile: (value: TSchema) => value is TFile;
1270
+ declare const isTypeFile: (value: TSchema$1) => value is TFile;
1252
1271
  declare const isFileLike: (value: any) => value is FileLike;
1253
1272
  type StreamLike = ReadableStream | ReadableStream$1 | Readable | NodeJS.ReadableStream;
1254
1273
  type TStream = TUnsafe<StreamLike>;
1255
- declare const isTypeStream: (value: TSchema) => value is TStream;
1274
+ declare const isTypeStream: (value: TSchema$1) => value is TStream;
1256
1275
  type TextLength = "short" | "long" | "rich";
1257
1276
  interface AlephaStringOptions extends StringOptions {
1258
- size?: TextLength;
1277
+ size?: TextLength;
1259
1278
  }
1260
1279
  declare const t: TypeProvider;
1261
1280
  declare const isUUID: (value: string) => boolean;
1262
-
1281
+ //#endregion
1282
+ //#region src/index.d.ts
1263
1283
  declare const run: (entry: Alepha | Service | Array<Service>, opts?: RunOptions) => Alepha;
1264
-
1265
- export { $cursor, $env, $hook, $inject, $logger, type AbstractService, Alepha, AlephaError, type AlephaStringOptions, AppNotStartedError, type Async, type AsyncFn, type AsyncLocalStorageData, AsyncLocalStorageProvider, COLORS, CircularDependencyError, ContainerLockedError, type CursorDescriptor, type Descriptor, type DescriptorIdentifier, type DescriptorItem, type Env, type FileLike, type Hook, type HookDescriptor, type HookOptions, type Hooks, type InstantiableService, KIND, LEVEL_COLORS, type LogLevel, Logger, type LoggerEnv, type LoggerOptions, type MaybePromise, MockLogger, type MockLoggerStore, type Module, type ModuleDefinition, NotImplementedError, OPTIONS, type PromiseFn, type Service, type ServiceEntry, type ServiceSubstitution, type State, type StreamLike, type TFile, type TStream, type TextLength, TypeBoxError, TypeProvider, __alephaRef, __bind, __descriptor, descriptorEvents, isDescriptorValue, isFileLike, isModule, isTypeFile, isTypeStream, isUUID, run, t, toModuleName };
1284
+ //#endregion
1285
+ export { $cursor, $env, $hook, $inject, $logger, AbstractService, Alepha, AlephaError, AlephaStringOptions, AppNotStartedError, Async, AsyncFn, AsyncLocalStorageData, AsyncLocalStorageProvider, COLORS, CircularDependencyError, ContainerLockedError, CursorDescriptor, Descriptor, DescriptorIdentifier, DescriptorItem, Env, FileLike, Hook, HookDescriptor, HookOptions, Hooks, InstantiableService, KIND, LEVEL_COLORS, LogLevel, Logger, LoggerEnv, LoggerOptions, MaybePromise, MockLogger, MockLoggerStore, Module, ModuleDefinition, NotImplementedError, OPTIONS, PromiseFn, Service, ServiceEntry, ServiceSubstitution, State, Static, StaticDecode, StaticEncode, StreamLike, TFile, TObject, TSchema, TStream, TextLength, TypeBox, TypeBoxError, TypeBoxValue, TypeGuard, TypeProvider, __alephaRef, __bind, __descriptor, descriptorEvents, isDescriptorValue, isFileLike, isModule, isTypeFile, isTypeStream, isUUID, run, t, toModuleName };
1286
+ //# sourceMappingURL=index.d.ts.map