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.
- package/LICENSE +21 -21
- package/README.md +44 -44
- package/cache/redis.cjs +4 -8
- package/cache/redis.d.ts +28 -89
- package/cache/redis.js +1 -1
- package/cache.cjs +4 -8
- package/cache.d.ts +189 -265
- package/cache.js +1 -1
- package/core.cjs +4 -8
- package/core.d.ts +950 -929
- package/core.js +1 -1
- package/datetime.cjs +4 -8
- package/datetime.d.ts +151 -146
- package/datetime.js +1 -1
- package/lock/redis.cjs +7 -49
- package/lock/redis.d.ts +15 -12
- package/lock/redis.js +1 -47
- package/lock.cjs +4 -8
- package/lock.d.ts +117 -170
- package/lock.js +1 -1
- package/package.json +70 -39
- package/postgres.cjs +4 -8
- package/postgres.d.ts +1314 -4398
- package/postgres.js +1 -1
- package/queue/redis.cjs +8 -0
- package/queue/redis.d.ts +31 -0
- package/queue/redis.js +1 -0
- package/queue.cjs +4 -8
- package/queue.d.ts +162 -205
- package/queue.js +1 -1
- package/react/auth.cjs +4 -8
- package/react/auth.d.ts +166 -282
- package/react/auth.js +1 -1
- package/react.cjs +4 -8
- package/react.d.ts +509 -551
- package/react.js +1 -1
- package/redis.cjs +4 -8
- package/redis.d.ts +59 -132
- package/redis.js +1 -1
- package/retry.cjs +4 -8
- package/retry.d.ts +34 -31
- package/retry.js +1 -1
- package/scheduler.cjs +4 -8
- package/scheduler.d.ts +125 -182
- package/scheduler.js +1 -1
- package/security.cjs +4 -8
- package/security.d.ts +472 -595
- package/security.js +1 -1
- package/server/cache.cjs +4 -8
- package/server/cache.d.ts +41 -38
- package/server/cache.js +1 -1
- package/server/cookies.cjs +4 -8
- package/server/cookies.d.ts +46 -41
- package/server/cookies.js +1 -1
- package/server/static.cjs +4 -8
- package/server/static.d.ts +98 -95
- package/server/static.js +1 -1
- package/server/swagger.cjs +4 -8
- package/server/swagger.d.ts +96 -92
- package/server/swagger.js +1 -1
- package/server.cjs +4 -8
- package/server.d.ts +754 -1025
- package/server.js +1 -1
- package/testing.cjs +8 -0
- package/testing.d.ts +1 -0
- package/testing.js +1 -0
- package/topic/redis.cjs +8 -0
- package/topic/redis.d.ts +45 -0
- package/topic/redis.js +1 -0
- package/topic.cjs +4 -8
- package/topic.d.ts +171 -163
- package/topic.js +1 -1
- package/vite.cjs +4 -8
- package/vite.d.ts +89 -82
- package/vite.js +1 -1
- package/src/cache/redis.ts +0 -1
- package/src/cache.ts +0 -1
- package/src/core.ts +0 -1
- package/src/datetime.ts +0 -1
- package/src/lock/redis.ts +0 -1
- package/src/lock.ts +0 -1
- package/src/postgres.ts +0 -1
- package/src/queue/redis.ts +0 -1
- package/src/queue.ts +0 -1
- package/src/react/auth.ts +0 -1
- package/src/react.ts +0 -1
- package/src/redis.ts +0 -1
- package/src/retry.ts +0 -1
- package/src/scheduler.ts +0 -1
- package/src/security.ts +0 -1
- package/src/server/cache.ts +0 -1
- package/src/server/cookies.ts +0 -1
- package/src/server/static.ts +0 -1
- package/src/server/swagger.ts +0 -1
- package/src/server.ts +0 -1
- package/src/topic/redis.ts +0 -1
- package/src/topic.ts +0 -1
- package/src/vite.ts +0 -1
package/core.d.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
|
|
152
|
-
|
|
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
|
-
|
|
157
|
-
|
|
159
|
+
name?: string;
|
|
160
|
+
$services: (alepha: Alepha) => void | Alepha;
|
|
158
161
|
}
|
|
159
162
|
interface ModuleDefinition extends Module {
|
|
160
|
-
|
|
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
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
-
|
|
186
|
-
|
|
187
|
-
|
|
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
|
-
|
|
222
|
+
[key: string]: any;
|
|
218
223
|
}> {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
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
|
-
|
|
231
|
-
|
|
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
|
-
|
|
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
|
-
|
|
266
|
-
|
|
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
|
-
|
|
273
|
-
|
|
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
|
-
|
|
280
|
-
|
|
281
|
-
|
|
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
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
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
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
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
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
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
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
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
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
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
|
-
|
|
423
|
-
|
|
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
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
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
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
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
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
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
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
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
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
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
|
-
|
|
796
|
+
parent?: Service | null;
|
|
815
797
|
/**
|
|
816
|
-
*
|
|
798
|
+
* If the service is provided by a module, the module definition.
|
|
799
|
+
* @internal
|
|
817
800
|
*/
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
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
|
-
*
|
|
833
|
+
* @default false
|
|
843
834
|
*/
|
|
844
|
-
|
|
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
|
-
*
|
|
837
|
+
* If true, the hooks will be logged with their execution time.
|
|
873
838
|
*
|
|
874
|
-
*
|
|
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
|
-
|
|
841
|
+
log?: boolean;
|
|
880
842
|
/**
|
|
881
|
-
*
|
|
843
|
+
* If true, errors will be caught and logged instead of throwing.
|
|
882
844
|
*
|
|
883
|
-
*
|
|
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
|
-
|
|
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
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
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
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
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
|
-
|
|
1020
|
+
constructor();
|
|
1007
1021
|
}
|
|
1008
|
-
|
|
1022
|
+
//#endregion
|
|
1023
|
+
//#region src/errors/CircularDependencyError.d.ts
|
|
1009
1024
|
declare class CircularDependencyError extends Error {
|
|
1010
|
-
|
|
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
|
-
|
|
1030
|
+
constructor(message?: string);
|
|
1015
1031
|
}
|
|
1016
|
-
|
|
1032
|
+
//#endregion
|
|
1033
|
+
//#region src/errors/NotImplementedError.d.ts
|
|
1017
1034
|
declare class NotImplementedError extends Error {
|
|
1018
|
-
|
|
1035
|
+
constructor(provider: string);
|
|
1019
1036
|
}
|
|
1020
|
-
|
|
1037
|
+
//#endregion
|
|
1038
|
+
//#region src/errors/TypeBoxError.d.ts
|
|
1021
1039
|
declare class TypeBoxError extends Error {
|
|
1022
|
-
|
|
1023
|
-
|
|
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
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
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
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
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
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
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
|
-
|
|
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,
|
|
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
|