@alepha/devtools 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-MC1wKe0N.js +27 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1402 -176
- package/dist/index.d.ts +1402 -176
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
- package/src/DevToolsProvider.ts +2 -7
- package/src/entities/logs.ts +1 -1
- package/src/ui/styles.css +1 -1
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.ts.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,227 +1,1453 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import * as typebox0 from "typebox";
|
|
2
|
+
import { Static, StaticDecode as Static$1, StaticEncode, TAny, TArray, TArray as TArray$1, TBoolean, TInteger, TNumber, TObject, TObject as TObject$1, TOptional, TOptionalAdd, TRecord, TSchema, TSchema as TSchema$1, TString, TUnsafe } from "typebox";
|
|
3
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
|
+
import { Validator } from "typebox/compile";
|
|
5
|
+
import dayjsDuration from "dayjs/plugin/duration.js";
|
|
6
|
+
import DayjsApi, { Dayjs, ManipulateType, PluginFunc } from "dayjs";
|
|
5
7
|
|
|
8
|
+
//#region ../alepha/src/core/constants/KIND.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* Used for identifying descriptors.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
declare const KIND: unique symbol;
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region ../alepha/src/core/interfaces/Service.d.ts
|
|
17
|
+
/**
|
|
18
|
+
* In Alepha, a service is a class that can be instantiated or an abstract class. Nothing more, nothing less...
|
|
19
|
+
*/
|
|
20
|
+
type Service<T extends object = any> = InstantiableClass<T> | AbstractClass<T> | RunFunction<T>;
|
|
21
|
+
type RunFunction<T extends object = any> = (...args: any[]) => T | void;
|
|
22
|
+
type InstantiableClass<T extends object = any> = new (...args: any[]) => T;
|
|
23
|
+
/**
|
|
24
|
+
* Abstract class is a class that cannot be instantiated directly!
|
|
25
|
+
* It widely used for defining interfaces.
|
|
26
|
+
*/
|
|
27
|
+
type AbstractClass<T extends object = any> = abstract new (...args: any[]) => T;
|
|
28
|
+
/**
|
|
29
|
+
* Service substitution allows you to register a class as a different class.
|
|
30
|
+
* Providing class A, but using class B instead.
|
|
31
|
+
* This is useful for testing, mocking, or providing a different implementation of a service.
|
|
32
|
+
*
|
|
33
|
+
* class A is mostly an AbstractClass, while class B is an InstantiableClass.
|
|
34
|
+
*/
|
|
35
|
+
interface ServiceSubstitution<T extends object = any> {
|
|
36
|
+
/**
|
|
37
|
+
* Every time someone asks for this class, it will be provided with the 'use' class.
|
|
38
|
+
*/
|
|
39
|
+
provide: Service<T>;
|
|
40
|
+
/**
|
|
41
|
+
* Service to use instead of the 'provide' service.
|
|
42
|
+
*
|
|
43
|
+
* Syntax is inspired by Angular's DI system.
|
|
44
|
+
*/
|
|
45
|
+
use: Service<T>;
|
|
46
|
+
/**
|
|
47
|
+
* If true, if the service already exists -> just ignore the substitution and do not throw an error.
|
|
48
|
+
* Mostly used for plugins to enforce a substitution without throwing an error.
|
|
49
|
+
*/
|
|
50
|
+
optional?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Every time you register a service, you can use this type to define it.
|
|
54
|
+
*
|
|
55
|
+
* alepha.with( ServiceEntry )
|
|
56
|
+
* or
|
|
57
|
+
* alepha.with( provide: ServiceEntry, use: MyOwnServiceEntry )
|
|
58
|
+
*
|
|
59
|
+
* And yes, you declare the *type* of the service, not the *instance*.
|
|
60
|
+
*/
|
|
61
|
+
type ServiceEntry<T extends object = any> = Service<T> | ServiceSubstitution<T>;
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region ../alepha/src/core/helpers/descriptor.d.ts
|
|
64
|
+
interface DescriptorArgs<T extends object = {}> {
|
|
65
|
+
options: T;
|
|
66
|
+
alepha: Alepha;
|
|
67
|
+
service: InstantiableClass<Service>;
|
|
68
|
+
module?: Service;
|
|
69
|
+
}
|
|
70
|
+
interface DescriptorConfig {
|
|
71
|
+
propertyKey: string;
|
|
72
|
+
service: InstantiableClass<Service>;
|
|
73
|
+
module?: Service;
|
|
74
|
+
}
|
|
75
|
+
declare abstract class Descriptor<T extends object = {}> {
|
|
76
|
+
protected readonly alepha: Alepha;
|
|
77
|
+
readonly options: T;
|
|
78
|
+
readonly config: DescriptorConfig;
|
|
79
|
+
constructor(args: DescriptorArgs<T>);
|
|
80
|
+
/**
|
|
81
|
+
* Called automatically by Alepha after the descriptor is created.
|
|
82
|
+
*/
|
|
83
|
+
protected onInit(): void;
|
|
84
|
+
}
|
|
85
|
+
type DescriptorFactoryLike<T extends object = any> = {
|
|
86
|
+
(options: T): any;
|
|
87
|
+
[KIND]: any;
|
|
88
|
+
};
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region ../alepha/src/core/descriptors/$inject.d.ts
|
|
91
|
+
interface InjectOptions<T extends object = any> {
|
|
92
|
+
/**
|
|
93
|
+
* - 'transient' → Always a new instance on every inject. Zero caching.
|
|
94
|
+
* - 'singleton' → One instance per Alepha runtime (per-thread). Never disposed until Alepha shuts down. (default)
|
|
95
|
+
* - 'scoped' → One instance per AsyncLocalStorage context.
|
|
96
|
+
* - A new scope is created when Alepha handles a request, a scheduled job, a queue worker task...
|
|
97
|
+
* - You can also start a manual scope via alepha.context.run(() => { ... }).
|
|
98
|
+
* - When the scope ends, the scoped registry is discarded.
|
|
99
|
+
*
|
|
100
|
+
* @default "singleton"
|
|
101
|
+
*/
|
|
102
|
+
lifetime?: "transient" | "singleton" | "scoped";
|
|
103
|
+
/**
|
|
104
|
+
* Constructor arguments to pass when creating a new instance.
|
|
105
|
+
*/
|
|
106
|
+
args?: ConstructorParameters<InstantiableClass<T>>;
|
|
107
|
+
/**
|
|
108
|
+
* Parent that requested the instance.
|
|
109
|
+
*
|
|
110
|
+
* @internal
|
|
111
|
+
*/
|
|
112
|
+
parent?: Service | null;
|
|
113
|
+
}
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region ../alepha/src/core/descriptors/$module.d.ts
|
|
116
|
+
interface ModuleDescriptorOptions {
|
|
117
|
+
/**
|
|
118
|
+
* Name of the module.
|
|
119
|
+
*
|
|
120
|
+
* It should be in the format of `project.module.submodule`.
|
|
121
|
+
*/
|
|
122
|
+
name: string;
|
|
123
|
+
/**
|
|
124
|
+
* List all services related to this module.
|
|
125
|
+
*
|
|
126
|
+
* If you don't declare 'register' function, all services will be registered automatically.
|
|
127
|
+
* If you declare 'register' function, you must handle the registration of ALL services manually.
|
|
128
|
+
*/
|
|
129
|
+
services?: Array<Service>;
|
|
130
|
+
/**
|
|
131
|
+
* List of $descriptors to register in the module.
|
|
132
|
+
*/
|
|
133
|
+
descriptors?: Array<DescriptorFactoryLike>;
|
|
134
|
+
/**
|
|
135
|
+
* By default, module will register ALL services.
|
|
136
|
+
* You can override this behavior by providing a register function.
|
|
137
|
+
* It's useful when you want to register services conditionally or in a specific order.
|
|
138
|
+
*
|
|
139
|
+
* Again, if you declare 'register', you must handle the registration of ALL services manually.
|
|
140
|
+
*/
|
|
141
|
+
register?: (alepha: Alepha) => void;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Base class for all modules.
|
|
145
|
+
*/
|
|
146
|
+
declare abstract class Module {
|
|
147
|
+
abstract readonly options: ModuleDescriptorOptions;
|
|
148
|
+
abstract register(alepha: Alepha): void;
|
|
149
|
+
static NAME_REGEX: RegExp;
|
|
150
|
+
/**
|
|
151
|
+
* Check if a Service is a Module.
|
|
152
|
+
*/
|
|
153
|
+
static is(ctor: Service): boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Get the Module of a Service.
|
|
156
|
+
*
|
|
157
|
+
* Returns undefined if the Service is not part of a Module.
|
|
158
|
+
*/
|
|
159
|
+
static of(ctor: Service): Service<Module> | undefined;
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region ../alepha/src/core/interfaces/Async.d.ts
|
|
163
|
+
/**
|
|
164
|
+
* Represents a value that can be either a value or a promise of value.
|
|
165
|
+
*/
|
|
166
|
+
type Async<T> = T | Promise<T>;
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region ../alepha/src/core/interfaces/LoggerInterface.d.ts
|
|
169
|
+
type LogLevel = "ERROR" | "WARN" | "INFO" | "DEBUG" | "TRACE" | "SILENT";
|
|
170
|
+
interface LoggerInterface {
|
|
171
|
+
trace(message: string, data?: unknown): void;
|
|
172
|
+
debug(message: string, data?: unknown): void;
|
|
173
|
+
info(message: string, data?: unknown): void;
|
|
174
|
+
warn(message: string, data?: unknown): void;
|
|
175
|
+
error(message: string, data?: unknown): void;
|
|
176
|
+
}
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region ../alepha/src/core/providers/AlsProvider.d.ts
|
|
179
|
+
type AsyncLocalStorageData = any;
|
|
180
|
+
declare class AlsProvider {
|
|
181
|
+
static create: () => AsyncLocalStorage<AsyncLocalStorageData> | undefined;
|
|
182
|
+
als?: AsyncLocalStorage<AsyncLocalStorageData>;
|
|
183
|
+
constructor();
|
|
184
|
+
createContextId(): string;
|
|
185
|
+
run<R>(callback: () => R, data?: Record<string, any>): R;
|
|
186
|
+
exists(): boolean;
|
|
187
|
+
get<T>(key: string): T | undefined;
|
|
188
|
+
set<T>(key: string, value: T): void;
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region ../alepha/src/core/providers/Json.d.ts
|
|
192
|
+
/**
|
|
193
|
+
* Mimics the JSON global object with stringify and parse methods.
|
|
194
|
+
*
|
|
195
|
+
* Used across the codebase via dependency injection.
|
|
196
|
+
*/
|
|
197
|
+
declare class Json {
|
|
198
|
+
stringify(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
|
|
199
|
+
parse(text: string, reviver?: (this: any, key: string, value: any) => any): any;
|
|
200
|
+
}
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region ../alepha/src/core/providers/TypeProvider.d.ts
|
|
203
|
+
declare module "typebox" {
|
|
204
|
+
interface TString {
|
|
205
|
+
format?: string;
|
|
206
|
+
minLength?: number;
|
|
207
|
+
maxLength?: number;
|
|
208
|
+
}
|
|
209
|
+
interface TNumber {
|
|
210
|
+
format?: "int64";
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
//#endregion
|
|
214
|
+
//#region ../alepha/src/core/providers/SchemaCodec.d.ts
|
|
215
|
+
declare abstract class SchemaCodec {
|
|
216
|
+
/**
|
|
217
|
+
* Encode the value to a string format.
|
|
218
|
+
*/
|
|
219
|
+
abstract encodeToString<T extends TSchema$1>(schema: T, value: Static$1<T>): string;
|
|
220
|
+
/**
|
|
221
|
+
* Encode the value to a binary format.
|
|
222
|
+
*/
|
|
223
|
+
abstract encodeToBinary<T extends TSchema$1>(schema: T, value: Static$1<T>): Uint8Array;
|
|
224
|
+
/**
|
|
225
|
+
* Decode string, binary, or other formats to the schema type.
|
|
226
|
+
*/
|
|
227
|
+
abstract decode<T>(schema: TSchema$1, value: unknown): T;
|
|
228
|
+
}
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region ../alepha/src/core/providers/JsonSchemaCodec.d.ts
|
|
231
|
+
declare class JsonSchemaCodec extends SchemaCodec {
|
|
232
|
+
protected readonly json: Json;
|
|
233
|
+
protected readonly encoder: TextEncoder;
|
|
234
|
+
protected readonly decoder: TextDecoder;
|
|
235
|
+
encodeToString<T extends TSchema>(schema: T, value: Static$1<T>): string;
|
|
236
|
+
encodeToBinary<T extends TSchema>(schema: T, value: Static$1<T>): Uint8Array;
|
|
237
|
+
decode<T>(schema: TSchema, value: unknown): T;
|
|
238
|
+
}
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region ../alepha/src/core/providers/SchemaValidator.d.ts
|
|
241
|
+
declare class SchemaValidator {
|
|
242
|
+
protected cache: Map<TSchema, Validator<typebox0.TProperties, TSchema, unknown, unknown>>;
|
|
243
|
+
/**
|
|
244
|
+
* Validate the value against the provided schema.
|
|
245
|
+
*
|
|
246
|
+
* Validation create a new value by applying some preprocessing. (e.g., trimming text)
|
|
247
|
+
*/
|
|
248
|
+
validate<T extends TSchema>(schema: T, value: unknown, options?: ValidateOptions): Static$1<T>;
|
|
249
|
+
protected getValidator<T extends TSchema>(schema: T): Validator<{}, T>;
|
|
250
|
+
/**
|
|
251
|
+
* Preprocess the value based on the schema before validation.
|
|
252
|
+
*
|
|
253
|
+
* - If the value is `null` and the schema does not allow `null`, it converts it to `undefined`.
|
|
254
|
+
* - If the value is a string and the schema has a `~options.trim` flag, it trims whitespace from the string.
|
|
255
|
+
*/
|
|
256
|
+
beforeParse(schema: any, value: any, options: ValidateOptions): any;
|
|
257
|
+
/**
|
|
258
|
+
* Used by `beforeParse` to determine if a schema allows null values.
|
|
259
|
+
*/
|
|
260
|
+
protected isSchemaNullable: (schema: any) => boolean;
|
|
261
|
+
}
|
|
262
|
+
interface ValidateOptions {
|
|
263
|
+
trim?: boolean;
|
|
264
|
+
nullToUndefined?: boolean;
|
|
265
|
+
deleteUndefined?: boolean;
|
|
266
|
+
}
|
|
267
|
+
//#endregion
|
|
268
|
+
//#region ../alepha/src/core/providers/CodecManager.d.ts
|
|
269
|
+
type Encoding = "object" | "string" | "binary";
|
|
270
|
+
interface EncodeOptions<T extends Encoding = Encoding> {
|
|
271
|
+
/**
|
|
272
|
+
* The output encoding format:
|
|
273
|
+
* - 'string': Returns JSON string
|
|
274
|
+
* - 'binary': Returns Uint8Array (for protobuf, msgpack, etc.)
|
|
275
|
+
*
|
|
276
|
+
* @default "string"
|
|
277
|
+
*/
|
|
278
|
+
as?: T;
|
|
279
|
+
/**
|
|
280
|
+
* The encoder to use (e.g., 'json', 'protobuf', 'msgpack')
|
|
281
|
+
*
|
|
282
|
+
* @default "json"
|
|
283
|
+
*/
|
|
284
|
+
encoder?: string;
|
|
285
|
+
/**
|
|
286
|
+
* Validation options to apply before encoding.
|
|
287
|
+
*/
|
|
288
|
+
validation?: ValidateOptions | false;
|
|
289
|
+
}
|
|
290
|
+
type EncodeResult<T extends TSchema, E extends Encoding> = E extends "string" ? string : E extends "binary" ? Uint8Array : StaticEncode<T>;
|
|
291
|
+
interface DecodeOptions {
|
|
292
|
+
/**
|
|
293
|
+
* The encoder to use (e.g., 'json', 'protobuf', 'msgpack')
|
|
294
|
+
*
|
|
295
|
+
* @default "json"
|
|
296
|
+
*/
|
|
297
|
+
encoder?: string;
|
|
298
|
+
/**
|
|
299
|
+
* Validation options to apply before encoding.
|
|
300
|
+
*/
|
|
301
|
+
validation?: ValidateOptions | false;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* CodecManager manages multiple codec formats and provides a unified interface
|
|
305
|
+
* for encoding and decoding data with different formats.
|
|
306
|
+
*/
|
|
307
|
+
declare class CodecManager {
|
|
308
|
+
protected readonly codecs: Map<string, SchemaCodec>;
|
|
309
|
+
protected readonly jsonCodec: JsonSchemaCodec;
|
|
310
|
+
protected readonly schemaValidator: SchemaValidator;
|
|
311
|
+
default: string;
|
|
312
|
+
constructor();
|
|
313
|
+
/**
|
|
314
|
+
* Register a new codec format.
|
|
315
|
+
*
|
|
316
|
+
* @param name - The name of the codec (e.g., 'json', 'protobuf')
|
|
317
|
+
* @param codec - The codec implementation
|
|
318
|
+
*/
|
|
319
|
+
register(name: string, codec: SchemaCodec): void;
|
|
320
|
+
/**
|
|
321
|
+
* Get a specific codec by name.
|
|
322
|
+
*
|
|
323
|
+
* @param name - The name of the codec
|
|
324
|
+
* @returns The codec instance
|
|
325
|
+
* @throws {AlephaError} If the codec is not found
|
|
326
|
+
*/
|
|
327
|
+
getCodec(name: string): SchemaCodec;
|
|
328
|
+
/**
|
|
329
|
+
* Encode data using the specified codec and output format.
|
|
330
|
+
*/
|
|
331
|
+
encode<T extends TSchema, E extends Encoding = "object">(schema: T, value: unknown, options?: EncodeOptions<E>): EncodeResult<T, E>;
|
|
332
|
+
/**
|
|
333
|
+
* Decode data using the specified codec.
|
|
334
|
+
*/
|
|
335
|
+
decode<T extends TSchema>(schema: T, data: any, options?: DecodeOptions): Static$1<T>;
|
|
336
|
+
/**
|
|
337
|
+
* Validate decoded data against the schema.
|
|
338
|
+
*
|
|
339
|
+
* This is automatically called before encoding or after decoding.
|
|
340
|
+
*/
|
|
341
|
+
validate<T extends TSchema>(schema: T, value: unknown, options?: ValidateOptions): Static$1<T>;
|
|
342
|
+
}
|
|
343
|
+
//#endregion
|
|
344
|
+
//#region ../alepha/src/core/providers/EventManager.d.ts
|
|
345
|
+
declare class EventManager {
|
|
346
|
+
protected logFn?: () => LoggerInterface | undefined;
|
|
347
|
+
/**
|
|
348
|
+
* List of events that can be triggered. Powered by $hook().
|
|
349
|
+
*/
|
|
350
|
+
protected events: Record<string, Array<Hook>>;
|
|
351
|
+
constructor(logFn?: () => LoggerInterface | undefined);
|
|
352
|
+
protected get log(): LoggerInterface | undefined;
|
|
353
|
+
/**
|
|
354
|
+
* Registers a hook for the specified event.
|
|
355
|
+
*/
|
|
356
|
+
on<T extends keyof Hooks>(event: T, hookOrFunc: Hook<T> | ((payload: Hooks[T]) => Async<void>)): () => void;
|
|
357
|
+
/**
|
|
358
|
+
* Emits the specified event with the given payload.
|
|
359
|
+
*/
|
|
360
|
+
emit<T extends keyof Hooks>(func: T, payload: Hooks[T], options?: {
|
|
361
|
+
/**
|
|
362
|
+
* If true, the hooks will be executed in reverse order.
|
|
363
|
+
* This is useful for "stop" hooks that should be executed in reverse order.
|
|
364
|
+
*
|
|
365
|
+
* @default false
|
|
366
|
+
*/
|
|
367
|
+
reverse?: boolean;
|
|
368
|
+
/**
|
|
369
|
+
* If true, the hooks will be logged with their execution time.
|
|
370
|
+
*
|
|
371
|
+
* @default false
|
|
372
|
+
*/
|
|
373
|
+
log?: boolean;
|
|
374
|
+
/**
|
|
375
|
+
* If true, errors will be caught and logged instead of throwing.
|
|
376
|
+
*
|
|
377
|
+
* @default false
|
|
378
|
+
*/
|
|
379
|
+
catch?: boolean;
|
|
380
|
+
}): Promise<void>;
|
|
381
|
+
}
|
|
382
|
+
//#endregion
|
|
383
|
+
//#region ../alepha/src/core/descriptors/$atom.d.ts
|
|
384
|
+
type AtomOptions<T extends TAtomObject, N extends string> = {
|
|
385
|
+
name: N;
|
|
386
|
+
schema: T;
|
|
387
|
+
description?: string;
|
|
388
|
+
} & (T extends TOptionalAdd<T> ? {
|
|
389
|
+
default?: Static$1<T>;
|
|
390
|
+
} : {
|
|
391
|
+
default: Static$1<T>;
|
|
392
|
+
});
|
|
393
|
+
declare class Atom<T extends TAtomObject = TObject$1, N extends string = string> {
|
|
394
|
+
readonly options: AtomOptions<T, N>;
|
|
395
|
+
get schema(): T;
|
|
396
|
+
get key(): N;
|
|
397
|
+
constructor(options: AtomOptions<T, N>);
|
|
398
|
+
}
|
|
399
|
+
type TAtomObject = TObject$1<any> | TArray;
|
|
400
|
+
type AtomStatic<T extends TAtomObject> = T extends TOptionalAdd<T> ? Static$1<T> | undefined : Static$1<T>;
|
|
401
|
+
//#endregion
|
|
402
|
+
//#region ../alepha/src/core/providers/StateManager.d.ts
|
|
403
|
+
interface AtomWithValue {
|
|
404
|
+
atom: Atom;
|
|
405
|
+
value: unknown;
|
|
406
|
+
}
|
|
407
|
+
declare class StateManager<State$1 extends object = State> {
|
|
408
|
+
protected readonly als: AlsProvider;
|
|
409
|
+
protected readonly events: EventManager;
|
|
410
|
+
protected readonly codec: JsonSchemaCodec;
|
|
411
|
+
protected readonly atoms: Map<keyof State$1, Atom<TObject<typebox0.TProperties>, string>>;
|
|
412
|
+
protected store: Partial<State$1>;
|
|
413
|
+
constructor(store?: Partial<State$1>);
|
|
414
|
+
getAtoms(context?: boolean): Array<AtomWithValue>;
|
|
415
|
+
register(atom: Atom<any>): this;
|
|
416
|
+
/**
|
|
417
|
+
* Get a value from the state with proper typing
|
|
418
|
+
*/
|
|
419
|
+
get<T extends TAtomObject>(target: Atom<T>): Static$1<T>;
|
|
420
|
+
get<Key extends keyof State$1>(target: Key): State$1[Key] | undefined;
|
|
421
|
+
/**
|
|
422
|
+
* Set a value in the state
|
|
423
|
+
*/
|
|
424
|
+
set<T extends TAtomObject>(target: Atom<T>, value: AtomStatic<T>): this;
|
|
425
|
+
set<Key extends keyof State$1>(target: Key, value: State$1[Key] | undefined): this;
|
|
426
|
+
/**
|
|
427
|
+
* Mutate a value in the state.
|
|
428
|
+
*/
|
|
429
|
+
mut<T extends TObject>(target: Atom<T>, mutator: (current: Static$1<T>) => Static$1<T>): this;
|
|
430
|
+
mut<Key extends keyof State$1>(target: Key, mutator: (current: State$1[Key] | undefined) => State$1[Key] | undefined): this;
|
|
431
|
+
/**
|
|
432
|
+
* Check if a key exists in the state
|
|
433
|
+
*/
|
|
434
|
+
has<Key extends keyof State$1>(key: Key): boolean;
|
|
435
|
+
/**
|
|
436
|
+
* Delete a key from the state (set to undefined)
|
|
437
|
+
*/
|
|
438
|
+
del<Key extends keyof State$1>(key: Key): this;
|
|
439
|
+
/**
|
|
440
|
+
* Push a value to an array in the state
|
|
441
|
+
*/
|
|
442
|
+
push<Key extends keyof OnlyArray<State$1>>(key: Key, value: NonNullable<State$1[Key]> extends Array<infer U> ? U : never): this;
|
|
443
|
+
/**
|
|
444
|
+
* Clear all state
|
|
445
|
+
*/
|
|
446
|
+
clear(): this;
|
|
447
|
+
/**
|
|
448
|
+
* Get all keys that exist in the state
|
|
449
|
+
*/
|
|
450
|
+
keys(): (keyof State$1)[];
|
|
451
|
+
}
|
|
452
|
+
type OnlyArray<T extends object> = { [K in keyof T]: NonNullable<T[K]> extends Array<any> ? K : never };
|
|
453
|
+
//#endregion
|
|
454
|
+
//#region ../alepha/src/core/Alepha.d.ts
|
|
455
|
+
/**
|
|
456
|
+
* Core container of the Alepha framework.
|
|
457
|
+
*
|
|
458
|
+
* It is responsible for managing the lifecycle of services,
|
|
459
|
+
* handling dependency injection,
|
|
460
|
+
* and providing a unified interface for the application.
|
|
461
|
+
*
|
|
462
|
+
* @example
|
|
463
|
+
* ```ts
|
|
464
|
+
* import { Alepha, run } from "alepha";
|
|
465
|
+
*
|
|
466
|
+
* class MyService {
|
|
467
|
+
* // business logic here
|
|
468
|
+
* }
|
|
469
|
+
*
|
|
470
|
+
* const alepha = Alepha.create({
|
|
471
|
+
* // state, env, and other properties
|
|
472
|
+
* })
|
|
473
|
+
*
|
|
474
|
+
* alepha.with(MyService);
|
|
475
|
+
*
|
|
476
|
+
* run(alepha); // trigger .start (and .stop) automatically
|
|
477
|
+
* ```
|
|
478
|
+
*
|
|
479
|
+
* ### Alepha Factory
|
|
480
|
+
*
|
|
481
|
+
* Alepha.create() is an enhanced version of new Alepha().
|
|
482
|
+
* - It merges `process.env` with the provided state.env when available.
|
|
483
|
+
* - It populates the test hooks for Vitest or Jest environments when available.
|
|
484
|
+
*
|
|
485
|
+
* new Alepha() is fine if you don't need these helpers.
|
|
486
|
+
*
|
|
487
|
+
* ### Platforms & Environments
|
|
488
|
+
*
|
|
489
|
+
* Alepha is designed to work in various environments:
|
|
490
|
+
* - **Browser**: Runs in the browser, using the global `window` object.
|
|
491
|
+
* - **Serverless**: Runs in serverless environments like Vercel or Vite.
|
|
492
|
+
* - **Test**: Runs in test environments like Jest or Vitest.
|
|
493
|
+
* - **Production**: Runs in production environments, typically with NODE_ENV set to "production".
|
|
494
|
+
* * You can check the current environment using the following methods:
|
|
495
|
+
*
|
|
496
|
+
* - `isBrowser()`: Returns true if the App is running in a browser environment.
|
|
497
|
+
* - `isServerless()`: Returns true if the App is running in a serverless environment.
|
|
498
|
+
* - `isTest()`: Returns true if the App is running in a test environment.
|
|
499
|
+
* - `isProduction()`: Returns true if the App is running in a production environment.
|
|
500
|
+
*
|
|
501
|
+
* ### State & Environment
|
|
502
|
+
*
|
|
503
|
+
* The state of the Alepha container is stored in the `store` property.
|
|
504
|
+
* Most important property is `store.env`, which contains the environment variables.
|
|
505
|
+
*
|
|
506
|
+
* ```ts
|
|
507
|
+
* const alepha = Alepha.create({ env: { MY_VAR: "value" } });
|
|
508
|
+
*
|
|
509
|
+
* // You can access the environment variables using alepha.env
|
|
510
|
+
* console.log(alepha.env.MY_VAR); // "value"
|
|
511
|
+
*
|
|
512
|
+
* // But you should use $env() descriptor to get typed values from the environment.
|
|
513
|
+
* class App {
|
|
514
|
+
* env = $env(
|
|
515
|
+
* t.object({
|
|
516
|
+
* MY_VAR: t.text(),
|
|
517
|
+
* })
|
|
518
|
+
* );
|
|
519
|
+
* }
|
|
520
|
+
* ```
|
|
521
|
+
*
|
|
522
|
+
* ### Modules
|
|
523
|
+
*
|
|
524
|
+
* Modules are a way to group services together.
|
|
525
|
+
* You can register a module using the `$module` descriptor.
|
|
526
|
+
*
|
|
527
|
+
* ```ts
|
|
528
|
+
* import { $module } from "alepha";
|
|
529
|
+
*
|
|
530
|
+
* class MyLib {}
|
|
531
|
+
*
|
|
532
|
+
* const myModule = $module({
|
|
533
|
+
* name: "my.project.module",
|
|
534
|
+
* services: [MyLib],
|
|
535
|
+
* });
|
|
536
|
+
* ```
|
|
537
|
+
*
|
|
538
|
+
* Do not use modules for small applications.
|
|
539
|
+
*
|
|
540
|
+
* ### Hooks
|
|
541
|
+
*
|
|
542
|
+
* Hooks are a way to run async functions from all registered providers/services.
|
|
543
|
+
* You can register a hook using the `$hook` descriptor.
|
|
544
|
+
*
|
|
545
|
+
* ```ts
|
|
546
|
+
* import { $hook } from "alepha";
|
|
547
|
+
*
|
|
548
|
+
* class App {
|
|
549
|
+
* log = $logger();
|
|
550
|
+
* onCustomerHook = $hook({
|
|
551
|
+
* on: "my:custom:hook",
|
|
552
|
+
* handler: () => {
|
|
553
|
+
* this.log?.info("App is being configured");
|
|
554
|
+
* },
|
|
555
|
+
* });
|
|
556
|
+
* }
|
|
557
|
+
*
|
|
558
|
+
* Alepha.create()
|
|
559
|
+
* .with(App)
|
|
560
|
+
* .start()
|
|
561
|
+
* .then(alepha => alepha.events.emit("my:custom:hook"));
|
|
562
|
+
* ```
|
|
563
|
+
*
|
|
564
|
+
* Hooks are fully typed. You can create your own hooks by using module augmentation:
|
|
565
|
+
*
|
|
566
|
+
* ```ts
|
|
567
|
+
* declare module "alepha" {
|
|
568
|
+
* interface Hooks {
|
|
569
|
+
* "my:custom:hook": {
|
|
570
|
+
* arg1: string;
|
|
571
|
+
* }
|
|
572
|
+
* }
|
|
573
|
+
* }
|
|
574
|
+
* ```
|
|
575
|
+
*
|
|
576
|
+
* @module alepha
|
|
577
|
+
*/
|
|
578
|
+
declare class Alepha {
|
|
579
|
+
/**
|
|
580
|
+
* Creates a new instance of the Alepha container with some helpers:
|
|
581
|
+
*
|
|
582
|
+
* - merges `process.env` with the provided state.env when available.
|
|
583
|
+
* - populates the test hooks for Vitest or Jest environments when available.
|
|
584
|
+
*
|
|
585
|
+
* If you are not interested about these helpers, you can use the constructor directly.
|
|
586
|
+
*/
|
|
587
|
+
static create(state?: Partial<State>): Alepha;
|
|
588
|
+
/**
|
|
589
|
+
* Flag indicating whether the App won't accept any further changes.
|
|
590
|
+
* Pass to true when #start() is called.
|
|
591
|
+
*/
|
|
592
|
+
protected locked: boolean;
|
|
593
|
+
/**
|
|
594
|
+
* True if the App has been configured.
|
|
595
|
+
*/
|
|
596
|
+
protected configured: boolean;
|
|
597
|
+
/**
|
|
598
|
+
* True if the App has started.
|
|
599
|
+
*/
|
|
600
|
+
protected started: boolean;
|
|
601
|
+
/**
|
|
602
|
+
* True if the App is ready.
|
|
603
|
+
*/
|
|
604
|
+
protected ready: boolean;
|
|
605
|
+
/**
|
|
606
|
+
* A promise that resolves when the App has started.
|
|
607
|
+
*/
|
|
608
|
+
protected starting?: PromiseWithResolvers<this>;
|
|
609
|
+
/**
|
|
610
|
+
* Initial state of the container.
|
|
611
|
+
*
|
|
612
|
+
* > Used to initialize the StateManager.
|
|
613
|
+
*/
|
|
614
|
+
protected init: Partial<State>;
|
|
615
|
+
/**
|
|
616
|
+
* During the instantiation process, we keep a list of pending instantiations.
|
|
617
|
+
* > It allows us to detect circular dependencies.
|
|
618
|
+
*/
|
|
619
|
+
protected pendingInstantiations: Service[];
|
|
620
|
+
/**
|
|
621
|
+
* Cache for environment variables.
|
|
622
|
+
* > It allows us to avoid parsing the same schema multiple times.
|
|
623
|
+
*/
|
|
624
|
+
protected cacheEnv: Map<TSchema$1, any>;
|
|
625
|
+
/**
|
|
626
|
+
* List of modules that are registered in the container.
|
|
627
|
+
*
|
|
628
|
+
* Modules are used to group services and provide a way to register them in the container.
|
|
629
|
+
*/
|
|
630
|
+
protected modules: Array<Module>;
|
|
631
|
+
/**
|
|
632
|
+
* List of service substitutions.
|
|
633
|
+
*
|
|
634
|
+
* Services registered here will be replaced by the specified service when injected.
|
|
635
|
+
*/
|
|
636
|
+
protected substitutions: Map<Service, {
|
|
637
|
+
use: Service;
|
|
638
|
+
}>;
|
|
639
|
+
/**
|
|
640
|
+
* Registry of descriptors.
|
|
641
|
+
*/
|
|
642
|
+
protected descriptorRegistry: Map<Service<Descriptor<{}>>, Descriptor<{}>[]>;
|
|
643
|
+
/**
|
|
644
|
+
* List of all services + how they are provided.
|
|
645
|
+
*/
|
|
646
|
+
protected registry: Map<Service, ServiceDefinition>;
|
|
647
|
+
/**
|
|
648
|
+
* Node.js feature that allows to store context across asynchronous calls.
|
|
649
|
+
*
|
|
650
|
+
* This is used for logging, tracing, and other context-related features.
|
|
651
|
+
*
|
|
652
|
+
* Mocked for browser environments.
|
|
653
|
+
*/
|
|
654
|
+
get context(): AlsProvider;
|
|
655
|
+
/**
|
|
656
|
+
* Event manager to handle lifecycle events and custom events.
|
|
657
|
+
*/
|
|
658
|
+
get events(): EventManager;
|
|
659
|
+
/**
|
|
660
|
+
* State manager to store arbitrary values.
|
|
661
|
+
*/
|
|
662
|
+
get state(): StateManager<State>;
|
|
663
|
+
/**
|
|
664
|
+
* Codec manager for encoding and decoding data with different formats.
|
|
665
|
+
*
|
|
666
|
+
* Supports multiple codec formats (JSON, Protobuf, etc.) with a unified interface.
|
|
667
|
+
*/
|
|
668
|
+
get codec(): CodecManager;
|
|
669
|
+
/**
|
|
670
|
+
* Get logger instance.
|
|
671
|
+
*/
|
|
672
|
+
get log(): LoggerInterface | undefined;
|
|
673
|
+
/**
|
|
674
|
+
* The environment variables for the App.
|
|
675
|
+
*/
|
|
676
|
+
get env(): Readonly<Env>;
|
|
677
|
+
constructor(init?: Partial<State>);
|
|
678
|
+
/**
|
|
679
|
+
* True when start() is called.
|
|
680
|
+
*
|
|
681
|
+
* -> No more services can be added, it's over, bye!
|
|
682
|
+
*/
|
|
683
|
+
isLocked(): boolean;
|
|
684
|
+
/**
|
|
685
|
+
* Returns whether the App is configured.
|
|
686
|
+
*
|
|
687
|
+
* It means that Alepha#configure() has been called.
|
|
688
|
+
*
|
|
689
|
+
* > By default, configure() is called automatically when start() is called, but you can also call it manually.
|
|
690
|
+
*/
|
|
691
|
+
isConfigured(): boolean;
|
|
692
|
+
/**
|
|
693
|
+
* Returns whether the App has started.
|
|
694
|
+
*
|
|
695
|
+
* It means that #start() has been called but maybe not all services are ready.
|
|
696
|
+
*/
|
|
697
|
+
isStarted(): boolean;
|
|
698
|
+
/**
|
|
699
|
+
* True if the App is ready. It means that Alepha is started AND ready() hook has beed called.
|
|
700
|
+
*/
|
|
701
|
+
isReady(): boolean;
|
|
702
|
+
/**
|
|
703
|
+
* True if the App is running in a Continuous Integration environment.
|
|
704
|
+
*/
|
|
705
|
+
isCI(): boolean;
|
|
706
|
+
/**
|
|
707
|
+
* True if the App is running in a browser environment.
|
|
708
|
+
*/
|
|
709
|
+
isBrowser(): boolean;
|
|
710
|
+
/**
|
|
711
|
+
* Returns whether the App is running in Vite dev mode.
|
|
712
|
+
*/
|
|
713
|
+
isViteDev(): boolean;
|
|
714
|
+
isBun(): boolean;
|
|
715
|
+
/**
|
|
716
|
+
* Returns whether the App is running in a serverless environment.
|
|
717
|
+
*/
|
|
718
|
+
isServerless(): boolean;
|
|
719
|
+
/**
|
|
720
|
+
* Returns whether the App is in test mode. (Running in a test environment)
|
|
721
|
+
*
|
|
722
|
+
* > This is automatically set when running tests with Jest or Vitest.
|
|
723
|
+
*/
|
|
724
|
+
isTest(): boolean;
|
|
725
|
+
/**
|
|
726
|
+
* Returns whether the App is in production mode. (Running in a production environment)
|
|
727
|
+
*
|
|
728
|
+
* > This is automatically set by Vite or Vercel. However, you have to set it manually when running Docker apps.
|
|
729
|
+
*/
|
|
730
|
+
isProduction(): boolean;
|
|
731
|
+
/**
|
|
732
|
+
* Starts the App.
|
|
733
|
+
*
|
|
734
|
+
* - Lock any further changes to the container.
|
|
735
|
+
* - Run "configure" hook for all services. Descriptors will be processed.
|
|
736
|
+
* - Run "start" hook for all services. Providers will connect/listen/...
|
|
737
|
+
* - Run "ready" hook for all services. This is the point where the App is ready to serve requests.
|
|
738
|
+
*
|
|
739
|
+
* @return A promise that resolves when the App has started.
|
|
740
|
+
*/
|
|
741
|
+
start(): Promise<this>;
|
|
742
|
+
/**
|
|
743
|
+
* Stops the App.
|
|
744
|
+
*
|
|
745
|
+
* - Run "stop" hook for all services.
|
|
746
|
+
*
|
|
747
|
+
* Stop will NOT reset the container.
|
|
748
|
+
* Stop will NOT unlock the container.
|
|
749
|
+
*
|
|
750
|
+
* > Stop is used to gracefully shut down the application, nothing more. There is no "restart".
|
|
751
|
+
*
|
|
752
|
+
* @return A promise that resolves when the App has stopped.
|
|
753
|
+
*/
|
|
754
|
+
stop(): Promise<void>;
|
|
755
|
+
/**
|
|
756
|
+
* Check if entry is registered in the container.
|
|
757
|
+
*/
|
|
758
|
+
has(entry: ServiceEntry, opts?: {
|
|
759
|
+
/**
|
|
760
|
+
* Check if the entry is registered in the pending instantiation stack.
|
|
761
|
+
*
|
|
762
|
+
* @default true
|
|
763
|
+
*/
|
|
764
|
+
inStack?: boolean;
|
|
765
|
+
/**
|
|
766
|
+
* Check if the entry is registered in the container registry.
|
|
767
|
+
*
|
|
768
|
+
* @default true
|
|
769
|
+
*/
|
|
770
|
+
inRegistry?: boolean;
|
|
771
|
+
/**
|
|
772
|
+
* Check if the entry is registered in the substitutions.
|
|
773
|
+
*
|
|
774
|
+
* @default true
|
|
775
|
+
*/
|
|
776
|
+
inSubstitutions?: boolean;
|
|
777
|
+
/**
|
|
778
|
+
* Where to look for registered services.
|
|
779
|
+
*
|
|
780
|
+
* @default this.registry
|
|
781
|
+
*/
|
|
782
|
+
registry?: Map<Service, ServiceDefinition>;
|
|
783
|
+
}): boolean;
|
|
784
|
+
/**
|
|
785
|
+
* Registers the specified service in the container.
|
|
786
|
+
*
|
|
787
|
+
* - If the service is ALREADY registered, the method does nothing.
|
|
788
|
+
* - If the service is NOT registered, a new instance is created and registered.
|
|
789
|
+
*
|
|
790
|
+
* Method is chainable, so you can register multiple services in a single call.
|
|
791
|
+
*
|
|
792
|
+
* > ServiceEntry allows to provide a service **substitution** feature.
|
|
793
|
+
*
|
|
794
|
+
* @example
|
|
795
|
+
* ```ts
|
|
796
|
+
* class A { value = "a"; }
|
|
797
|
+
* class B { value = "b"; }
|
|
798
|
+
* class M { a = $inject(A); }
|
|
799
|
+
*
|
|
800
|
+
* Alepha.create().with({ provide: A, use: B }).get(M).a.value; // "b"
|
|
801
|
+
* ```
|
|
802
|
+
*
|
|
803
|
+
* > **Substitution** is an advanced feature that allows you to replace a service with another service.
|
|
804
|
+
* > It's useful for testing or for providing different implementations of a service.
|
|
805
|
+
* > If you are interested in configuring a service, use Alepha#configure() instead.
|
|
806
|
+
*
|
|
807
|
+
* @param serviceEntry - The service to register in the container.
|
|
808
|
+
* @return Current instance of Alepha.
|
|
809
|
+
*/
|
|
810
|
+
with<T extends object>(serviceEntry: ServiceEntry<T> | {
|
|
811
|
+
default: ServiceEntry<T>;
|
|
812
|
+
}): this;
|
|
813
|
+
/**
|
|
814
|
+
* Get an instance of the specified service from the container.
|
|
815
|
+
*
|
|
816
|
+
* @see {@link InjectOptions} for the available options.
|
|
817
|
+
*/
|
|
818
|
+
inject<T extends object>(service: Service<T> | string, opts?: InjectOptions<T>): T;
|
|
819
|
+
/**
|
|
820
|
+
* Applies environment variables to the provided schema and state object.
|
|
821
|
+
*
|
|
822
|
+
* It replaces also all templated $ENV inside string values.
|
|
823
|
+
*
|
|
824
|
+
* @param schema - The schema object to apply environment variables to.
|
|
825
|
+
* @return The schema object with environment variables applied.
|
|
826
|
+
*/
|
|
827
|
+
parseEnv<T extends TObject>(schema: T): Static<T>;
|
|
828
|
+
/**
|
|
829
|
+
* Dump the current dependency graph of the App.
|
|
830
|
+
*
|
|
831
|
+
* This method returns a record where the keys are the names of the services.
|
|
832
|
+
*/
|
|
833
|
+
graph(): Record<string, {
|
|
834
|
+
from: string[];
|
|
835
|
+
as?: string[];
|
|
836
|
+
module?: string;
|
|
837
|
+
}>;
|
|
838
|
+
services<T extends object>(base: Service<T>): Array<T>;
|
|
839
|
+
/**
|
|
840
|
+
* Get all descriptors of the specified type.
|
|
841
|
+
*/
|
|
842
|
+
descriptors<TDescriptor extends Descriptor>(factory: {
|
|
843
|
+
[KIND]: InstantiableClass<TDescriptor>;
|
|
844
|
+
} | string): Array<TDescriptor>;
|
|
845
|
+
protected new<T extends object>(service: Service<T>, args?: any[]): T;
|
|
846
|
+
protected processDescriptor(value: Descriptor, propertyKey?: string): void;
|
|
847
|
+
}
|
|
848
|
+
interface Hook<T extends keyof Hooks = any> {
|
|
849
|
+
caller?: Service;
|
|
850
|
+
priority?: "first" | "last";
|
|
851
|
+
callback: (payload: Hooks[T]) => Async<void>;
|
|
852
|
+
}
|
|
853
|
+
/**
|
|
854
|
+
* This is how we store services in the Alepha container.
|
|
855
|
+
*/
|
|
856
|
+
interface ServiceDefinition<T extends object = any> {
|
|
857
|
+
/**
|
|
858
|
+
* The instance of the class or type definition.
|
|
859
|
+
* Mostly used for caching / singleton but can be used for other purposes like forcing the instance.
|
|
860
|
+
*/
|
|
861
|
+
instance: T;
|
|
862
|
+
/**
|
|
863
|
+
* List of classes which use this class.
|
|
864
|
+
*/
|
|
865
|
+
parents: Array<Service | null>;
|
|
866
|
+
}
|
|
867
|
+
interface Env {
|
|
868
|
+
[key: string]: string | boolean | number | undefined;
|
|
869
|
+
/**
|
|
870
|
+
* Optional environment variable that indicates the current environment.
|
|
871
|
+
*/
|
|
872
|
+
NODE_ENV?: "dev" | "test" | "production";
|
|
873
|
+
/**
|
|
874
|
+
* Optional name of the application.
|
|
875
|
+
*/
|
|
876
|
+
APP_NAME?: string;
|
|
877
|
+
/**
|
|
878
|
+
* Optional root module name.
|
|
879
|
+
*/
|
|
880
|
+
MODULE_NAME?: string;
|
|
881
|
+
}
|
|
882
|
+
interface State {
|
|
883
|
+
/**
|
|
884
|
+
* Environment variables for the application.
|
|
885
|
+
*/
|
|
886
|
+
env?: Readonly<Env>;
|
|
887
|
+
/**
|
|
888
|
+
* Logger instance to be used by the Alepha container.
|
|
889
|
+
*
|
|
890
|
+
* @internal
|
|
891
|
+
*/
|
|
892
|
+
"alepha.logger"?: LoggerInterface;
|
|
893
|
+
/**
|
|
894
|
+
* If defined, the Alepha container will only register this service and its dependencies.
|
|
895
|
+
*/
|
|
896
|
+
"alepha.target"?: Service;
|
|
897
|
+
/**
|
|
898
|
+
* Bind to Vitest 'beforeAll' hook.
|
|
899
|
+
* Used for testing purposes.
|
|
900
|
+
* This is automatically attached if Alepha#create() detects a test environment and global 'beforeAll' is available.
|
|
901
|
+
*/
|
|
902
|
+
"alepha.test.beforeAll"?: (run: any) => any;
|
|
903
|
+
/**
|
|
904
|
+
* Bind to Vitest 'afterAll' hook.
|
|
905
|
+
* Used for testing purposes.
|
|
906
|
+
* This is automatically attached if Alepha#create() detects a test environment and global 'afterAll' is available.
|
|
907
|
+
*/
|
|
908
|
+
"alepha.test.afterAll"?: (run: any) => any;
|
|
909
|
+
/**
|
|
910
|
+
* Bind to Vitest 'afterEach' hook.
|
|
911
|
+
* Used for testing purposes.
|
|
912
|
+
* This is automatically attached if Alepha#create() detects a test environment and global 'afterEach' is available.
|
|
913
|
+
*/
|
|
914
|
+
"alepha.test.afterEach"?: (run: any) => any;
|
|
915
|
+
/**
|
|
916
|
+
* Bind to Vitest 'onTestFinished' hook.
|
|
917
|
+
* Used for testing purposes.
|
|
918
|
+
* This is automatically attached if Alepha#create() detects a test environment and global 'onTestFinished' is available.
|
|
919
|
+
*/
|
|
920
|
+
"alepha.test.onTestFinished"?: (run: any) => any;
|
|
921
|
+
/**
|
|
922
|
+
* List of static assets to be copied to the output directory during the build process.
|
|
923
|
+
*
|
|
924
|
+
* Used for Alepha-based applications that require static assets.
|
|
925
|
+
*
|
|
926
|
+
* See alepha/vite for more details.
|
|
927
|
+
*/
|
|
928
|
+
"alepha.build.assets"?: Array<string>;
|
|
929
|
+
}
|
|
930
|
+
interface Hooks {
|
|
931
|
+
/**
|
|
932
|
+
* Used for testing purposes.
|
|
933
|
+
*/
|
|
934
|
+
echo: unknown;
|
|
935
|
+
/**
|
|
936
|
+
* Triggered during the configuration phase. Before the start phase.
|
|
937
|
+
*/
|
|
938
|
+
configure: Alepha;
|
|
939
|
+
/**
|
|
940
|
+
* Triggered during the start phase. When `Alepha#start()` is called.
|
|
941
|
+
*/
|
|
942
|
+
start: Alepha;
|
|
943
|
+
/**
|
|
944
|
+
* Triggered during the ready phase. After the start phase.
|
|
945
|
+
*/
|
|
946
|
+
ready: Alepha;
|
|
947
|
+
/**
|
|
948
|
+
* Triggered during the stop phase.
|
|
949
|
+
*
|
|
950
|
+
* - Stop should be called after a SIGINT or SIGTERM signal in order to gracefully shutdown the application. (@see `run()` method)
|
|
951
|
+
*
|
|
952
|
+
*/
|
|
953
|
+
stop: Alepha;
|
|
954
|
+
/**
|
|
955
|
+
* Triggered when a state value is mutated.
|
|
956
|
+
*/
|
|
957
|
+
"state:mutate": {
|
|
958
|
+
/**
|
|
959
|
+
* The key of the state that was mutated.
|
|
960
|
+
*/
|
|
961
|
+
key: keyof State;
|
|
962
|
+
/**
|
|
963
|
+
* The new value of the state.
|
|
964
|
+
*/
|
|
965
|
+
value: any;
|
|
966
|
+
/**
|
|
967
|
+
* The previous value of the state.
|
|
968
|
+
*/
|
|
969
|
+
prevValue: any;
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
//#endregion
|
|
973
|
+
//#region ../alepha/src/core/descriptors/$hook.d.ts
|
|
974
|
+
interface HookOptions<T extends keyof Hooks> {
|
|
975
|
+
/**
|
|
976
|
+
* The name of the hook. "configure", "start", "ready", "stop", ...
|
|
977
|
+
*/
|
|
978
|
+
on: T;
|
|
979
|
+
/**
|
|
980
|
+
* The handler to run when the hook is triggered.
|
|
981
|
+
*/
|
|
982
|
+
handler: (args: Hooks[T]) => Async<any>;
|
|
983
|
+
/**
|
|
984
|
+
* Force the hook to run first or last on the list of hooks.
|
|
985
|
+
*/
|
|
986
|
+
priority?: "first" | "last";
|
|
987
|
+
/**
|
|
988
|
+
* Empty placeholder, not implemented yet. :-)
|
|
989
|
+
*/
|
|
990
|
+
before?: object | Array<object>;
|
|
991
|
+
/**
|
|
992
|
+
* Empty placeholder, not implemented yet. :-)
|
|
993
|
+
*/
|
|
994
|
+
after?: object | Array<object>;
|
|
995
|
+
}
|
|
996
|
+
declare class HookDescriptor<T extends keyof Hooks> extends Descriptor<HookOptions<T>> {
|
|
997
|
+
called: number;
|
|
998
|
+
protected onInit(): void;
|
|
999
|
+
}
|
|
1000
|
+
//#endregion
|
|
1001
|
+
//#region ../alepha/src/core/schemas/pageSchema.d.ts
|
|
1002
|
+
declare const pageMetadataSchema: TObject$1<{
|
|
1003
|
+
number: TInteger;
|
|
1004
|
+
size: TInteger;
|
|
1005
|
+
offset: TInteger;
|
|
1006
|
+
numberOfElements: TInteger;
|
|
1007
|
+
totalElements: TOptional<TInteger>;
|
|
1008
|
+
totalPages: TOptional<TInteger>;
|
|
1009
|
+
isEmpty: TBoolean;
|
|
1010
|
+
isFirst: TBoolean;
|
|
1011
|
+
isLast: TBoolean;
|
|
1012
|
+
sort: TOptional<TObject$1<{
|
|
1013
|
+
sorted: TBoolean;
|
|
1014
|
+
fields: TArray$1<TObject$1<{
|
|
1015
|
+
field: TString;
|
|
1016
|
+
direction: TUnsafe<"asc" | "desc">;
|
|
1017
|
+
}>>;
|
|
1018
|
+
}>>;
|
|
1019
|
+
}>;
|
|
1020
|
+
type TPage<T extends TObject$1 | TRecord> = TObject$1<{
|
|
1021
|
+
content: TArray$1<T>;
|
|
1022
|
+
page: typeof pageMetadataSchema;
|
|
1023
|
+
}>;
|
|
1024
|
+
declare module "alepha" {
|
|
1025
|
+
interface TypeProvider {
|
|
1026
|
+
/**
|
|
1027
|
+
* Create a schema for a paginated response.
|
|
1028
|
+
*/
|
|
1029
|
+
page<T extends TObject$1 | TRecord>(itemSchema: T): TPage<T>;
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
//#endregion
|
|
1033
|
+
//#region ../alepha/src/logger/schemas/logEntrySchema.d.ts
|
|
1034
|
+
declare const logEntrySchema: TObject$1<{
|
|
1035
|
+
level: TUnsafe<"TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR" | "SILENT">;
|
|
1036
|
+
message: TString;
|
|
1037
|
+
service: TString;
|
|
1038
|
+
module: TString;
|
|
1039
|
+
context: TOptional<TString>;
|
|
1040
|
+
app: TOptional<TString>;
|
|
1041
|
+
data: TOptional<TAny>;
|
|
1042
|
+
timestamp: TNumber;
|
|
1043
|
+
}>;
|
|
1044
|
+
type LogEntry = Static$1<typeof logEntrySchema>;
|
|
1045
|
+
//#endregion
|
|
1046
|
+
//#region ../alepha/src/datetime/providers/DateTimeProvider.d.ts
|
|
1047
|
+
type DateTime = DayjsApi.Dayjs;
|
|
1048
|
+
type Duration = dayjsDuration.Duration;
|
|
1049
|
+
type DurationLike = number | dayjsDuration.Duration | [number, ManipulateType];
|
|
1050
|
+
declare class DateTimeProvider {
|
|
1051
|
+
static PLUGINS: Array<PluginFunc<any>>;
|
|
1052
|
+
protected alepha: Alepha;
|
|
1053
|
+
protected ref: DateTime | null;
|
|
1054
|
+
protected readonly timeouts: Timeout[];
|
|
1055
|
+
protected readonly intervals: Interval[];
|
|
1056
|
+
constructor();
|
|
1057
|
+
protected readonly onStart: HookDescriptor<"start">;
|
|
1058
|
+
protected readonly onStop: HookDescriptor<"stop">;
|
|
1059
|
+
setLocale(locale: string): void;
|
|
1060
|
+
isDateTime(value: unknown): value is DateTime;
|
|
1061
|
+
/**
|
|
1062
|
+
* Create a new UTC DateTime instance.
|
|
1063
|
+
*/
|
|
1064
|
+
utc(date: string | number | Date | Dayjs | null | undefined): DateTime;
|
|
1065
|
+
/**
|
|
1066
|
+
* Create a new DateTime instance.
|
|
1067
|
+
*/
|
|
1068
|
+
of(date: string | number | Date | Dayjs | null | undefined): DateTime;
|
|
1069
|
+
/**
|
|
1070
|
+
* Get the current date as a string.
|
|
1071
|
+
*/
|
|
1072
|
+
toISOString(date?: Date | string | DateTime): string;
|
|
1073
|
+
/**
|
|
1074
|
+
* Get the current date.
|
|
1075
|
+
*/
|
|
1076
|
+
now(): DateTime;
|
|
1077
|
+
/**
|
|
1078
|
+
* Get the current date as a string.
|
|
1079
|
+
*
|
|
1080
|
+
* This is much faster than `DateTimeProvider.now().toISOString()` as it avoids creating a DateTime instance.
|
|
1081
|
+
*/
|
|
1082
|
+
nowISOString(): string;
|
|
1083
|
+
/**
|
|
1084
|
+
* Get the current date as milliseconds since epoch.
|
|
1085
|
+
*
|
|
1086
|
+
* This is much faster than `DateTimeProvider.now().valueOf()` as it avoids creating a DateTime instance.
|
|
1087
|
+
*/
|
|
1088
|
+
nowMillis(): number;
|
|
1089
|
+
/**
|
|
1090
|
+
* Get the current date as a string.
|
|
1091
|
+
*
|
|
1092
|
+
* @protected
|
|
1093
|
+
*/
|
|
1094
|
+
protected getCurrentDate(): DateTime;
|
|
1095
|
+
/**
|
|
1096
|
+
* Create a new Duration instance.
|
|
1097
|
+
*/
|
|
1098
|
+
duration: (duration: DurationLike, unit?: ManipulateType) => Duration;
|
|
1099
|
+
isDurationLike(value: unknown): value is DurationLike;
|
|
1100
|
+
/**
|
|
1101
|
+
* Return a promise that resolves after the next tick.
|
|
1102
|
+
* It uses `setTimeout` with 0 ms delay.
|
|
1103
|
+
*/
|
|
1104
|
+
tick(): Promise<void>;
|
|
1105
|
+
/**
|
|
1106
|
+
* Wait for a certain duration.
|
|
1107
|
+
*
|
|
1108
|
+
* You can clear the timeout by using the `AbortSignal` API.
|
|
1109
|
+
* Aborted signal will resolve the promise immediately, it does not reject it.
|
|
1110
|
+
*/
|
|
1111
|
+
wait(duration: DurationLike, options?: {
|
|
1112
|
+
signal?: AbortSignal;
|
|
1113
|
+
now?: number;
|
|
1114
|
+
}): Promise<void>;
|
|
1115
|
+
createInterval(run: () => unknown, duration: DurationLike, start?: boolean): Interval;
|
|
1116
|
+
/**
|
|
1117
|
+
* Run a callback after a certain duration.
|
|
1118
|
+
*/
|
|
1119
|
+
createTimeout(callback: () => void, duration: DurationLike, now?: number): Timeout;
|
|
1120
|
+
clearTimeout(timeout: Timeout): void;
|
|
1121
|
+
clearInterval(interval: Interval): void;
|
|
1122
|
+
/**
|
|
1123
|
+
* Run a function with a deadline.
|
|
1124
|
+
*/
|
|
1125
|
+
deadline<T>(fn: (signal: AbortSignal) => Promise<T>, duration: DurationLike): Promise<T>;
|
|
1126
|
+
/**
|
|
1127
|
+
* Add time to the current date.
|
|
1128
|
+
*/
|
|
1129
|
+
travel(duration: DurationLike, unit?: ManipulateType): Promise<void>;
|
|
1130
|
+
/**
|
|
1131
|
+
* Stop the time.
|
|
1132
|
+
*/
|
|
1133
|
+
pause(): DateTime;
|
|
1134
|
+
/**
|
|
1135
|
+
* Reset the reference date.
|
|
1136
|
+
*/
|
|
1137
|
+
reset(): void;
|
|
1138
|
+
}
|
|
1139
|
+
interface Interval {
|
|
1140
|
+
timer?: any;
|
|
1141
|
+
duration: number;
|
|
1142
|
+
run: () => unknown;
|
|
1143
|
+
}
|
|
1144
|
+
interface Timeout {
|
|
1145
|
+
now: number;
|
|
1146
|
+
timer?: any;
|
|
1147
|
+
duration: number;
|
|
1148
|
+
callback: () => void;
|
|
1149
|
+
clear: () => void;
|
|
1150
|
+
}
|
|
1151
|
+
//#endregion
|
|
1152
|
+
//#region ../alepha/src/logger/providers/LogDestinationProvider.d.ts
|
|
1153
|
+
declare abstract class LogDestinationProvider {
|
|
1154
|
+
abstract write(message: string, entry: LogEntry): void;
|
|
1155
|
+
}
|
|
1156
|
+
//#endregion
|
|
1157
|
+
//#region ../alepha/src/logger/providers/LogFormatterProvider.d.ts
|
|
1158
|
+
declare abstract class LogFormatterProvider {
|
|
1159
|
+
abstract format(entry: LogEntry): string;
|
|
1160
|
+
}
|
|
1161
|
+
//#endregion
|
|
1162
|
+
//#region ../alepha/src/logger/services/Logger.d.ts
|
|
1163
|
+
declare class Logger implements LoggerInterface {
|
|
1164
|
+
protected readonly alepha: Alepha;
|
|
1165
|
+
protected readonly formatter: LogFormatterProvider;
|
|
1166
|
+
protected readonly destination: LogDestinationProvider;
|
|
1167
|
+
protected readonly dateTimeProvider: DateTimeProvider;
|
|
1168
|
+
protected readonly levels: Record<string, number>;
|
|
1169
|
+
protected readonly service: string;
|
|
1170
|
+
protected readonly module: string;
|
|
1171
|
+
protected readonly app?: string;
|
|
1172
|
+
protected appLogLevel: string;
|
|
1173
|
+
protected logLevel: LogLevel;
|
|
1174
|
+
constructor(service: string, module: string);
|
|
1175
|
+
get context(): string | undefined;
|
|
1176
|
+
get level(): string;
|
|
1177
|
+
parseLevel(level: string, app: string): LogLevel;
|
|
1178
|
+
private matchesPattern;
|
|
1179
|
+
asLogLevel(something: string): LogLevel;
|
|
1180
|
+
error(message: string, data?: unknown): void;
|
|
1181
|
+
warn(message: string, data?: unknown): void;
|
|
1182
|
+
info(message: string, data?: unknown): void;
|
|
1183
|
+
debug(message: string, data?: unknown): void;
|
|
1184
|
+
trace(message: string, data?: unknown): void;
|
|
1185
|
+
protected log(level: LogLevel, message: string, data?: unknown): void;
|
|
1186
|
+
protected emit(entry: LogEntry, message?: string): void;
|
|
1187
|
+
}
|
|
1188
|
+
//#endregion
|
|
1189
|
+
//#region ../alepha/src/logger/index.d.ts
|
|
1190
|
+
declare const envSchema: TObject$1<{
|
|
1191
|
+
/**
|
|
1192
|
+
* Default log level for the application.
|
|
1193
|
+
*
|
|
1194
|
+
* Default by environment:
|
|
1195
|
+
* - dev = info
|
|
1196
|
+
* - prod = info
|
|
1197
|
+
* - test = error
|
|
1198
|
+
*
|
|
1199
|
+
* Levels are: "trace" | "debug" | "info" | "warn" | "error" | "silent"
|
|
1200
|
+
*
|
|
1201
|
+
* Level can be set for a specific module:
|
|
1202
|
+
*
|
|
1203
|
+
* @example
|
|
1204
|
+
* LOG_LEVEL=my.module.name:debug,info # Set debug level for my.module.name and info for all other modules
|
|
1205
|
+
* LOG_LEVEL=alepha:trace, info # Set trace level for all alepha modules and info for all other modules
|
|
1206
|
+
*/
|
|
1207
|
+
LOG_LEVEL: TOptional<TString>;
|
|
1208
|
+
/**
|
|
1209
|
+
* Built-in log formats.
|
|
1210
|
+
* - "json" - JSON format, useful for structured logging and log aggregation. {@link JsonFormatterProvider}
|
|
1211
|
+
* - "pretty" - Simple text format, human-readable, with colors. {@link SimpleFormatterProvider}
|
|
1212
|
+
* - "raw" - Raw format, no formatting, just the message. {@link RawFormatterProvider}
|
|
1213
|
+
*/
|
|
1214
|
+
LOG_FORMAT: TOptional<TUnsafe<"json" | "pretty" | "raw">>;
|
|
1215
|
+
}>;
|
|
1216
|
+
declare module "alepha" {
|
|
1217
|
+
interface Env extends Partial<Static$1<typeof envSchema>> {}
|
|
1218
|
+
interface State {
|
|
1219
|
+
/**
|
|
1220
|
+
* Current log level for the application or specific modules.
|
|
1221
|
+
*/
|
|
1222
|
+
"alepha.logger.level"?: string;
|
|
1223
|
+
}
|
|
1224
|
+
interface Hooks {
|
|
1225
|
+
log: {
|
|
1226
|
+
message?: string;
|
|
1227
|
+
entry: LogEntry;
|
|
1228
|
+
};
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
//#endregion
|
|
6
1232
|
//#region src/schemas/DevActionMetadata.d.ts
|
|
7
|
-
declare const devActionMetadataSchema:
|
|
8
|
-
name:
|
|
9
|
-
group:
|
|
10
|
-
method:
|
|
11
|
-
path:
|
|
12
|
-
prefix:
|
|
13
|
-
fullPath:
|
|
14
|
-
description:
|
|
15
|
-
summary:
|
|
16
|
-
disabled:
|
|
17
|
-
secure:
|
|
18
|
-
hide:
|
|
19
|
-
body:
|
|
20
|
-
params:
|
|
21
|
-
query:
|
|
22
|
-
response:
|
|
23
|
-
bodyContentType:
|
|
1233
|
+
declare const devActionMetadataSchema: TObject$1<{
|
|
1234
|
+
name: TString;
|
|
1235
|
+
group: TString;
|
|
1236
|
+
method: TString;
|
|
1237
|
+
path: TString;
|
|
1238
|
+
prefix: TString;
|
|
1239
|
+
fullPath: TString;
|
|
1240
|
+
description: TOptional<TString>;
|
|
1241
|
+
summary: TOptional<TString>;
|
|
1242
|
+
disabled: TOptional<TBoolean>;
|
|
1243
|
+
secure: TOptional<TBoolean>;
|
|
1244
|
+
hide: TOptional<TBoolean>;
|
|
1245
|
+
body: TOptional<TAny>;
|
|
1246
|
+
params: TOptional<TAny>;
|
|
1247
|
+
query: TOptional<TAny>;
|
|
1248
|
+
response: TOptional<TAny>;
|
|
1249
|
+
bodyContentType: TOptional<TString>;
|
|
24
1250
|
}>;
|
|
25
|
-
type DevActionMetadata = Static<typeof devActionMetadataSchema>;
|
|
1251
|
+
type DevActionMetadata = Static$1<typeof devActionMetadataSchema>;
|
|
26
1252
|
//#endregion
|
|
27
1253
|
//#region src/schemas/DevBucketMetadata.d.ts
|
|
28
|
-
declare const devBucketMetadataSchema:
|
|
29
|
-
name:
|
|
30
|
-
description:
|
|
31
|
-
mimeTypes:
|
|
32
|
-
maxSize:
|
|
33
|
-
provider:
|
|
1254
|
+
declare const devBucketMetadataSchema: TObject$1<{
|
|
1255
|
+
name: TString;
|
|
1256
|
+
description: TOptional<TString>;
|
|
1257
|
+
mimeTypes: TOptional<TArray$1<TString>>;
|
|
1258
|
+
maxSize: TOptional<TNumber>;
|
|
1259
|
+
provider: TString;
|
|
34
1260
|
}>;
|
|
35
|
-
type DevBucketMetadata = Static<typeof devBucketMetadataSchema>;
|
|
1261
|
+
type DevBucketMetadata = Static$1<typeof devBucketMetadataSchema>;
|
|
36
1262
|
//#endregion
|
|
37
1263
|
//#region src/schemas/DevCacheMetadata.d.ts
|
|
38
|
-
declare const devCacheMetadataSchema:
|
|
39
|
-
name:
|
|
40
|
-
ttl:
|
|
41
|
-
disabled:
|
|
42
|
-
provider:
|
|
1264
|
+
declare const devCacheMetadataSchema: TObject$1<{
|
|
1265
|
+
name: TString;
|
|
1266
|
+
ttl: TOptional<TAny>;
|
|
1267
|
+
disabled: TOptional<TBoolean>;
|
|
1268
|
+
provider: TString;
|
|
43
1269
|
}>;
|
|
44
|
-
type DevCacheMetadata = Static<typeof devCacheMetadataSchema>;
|
|
1270
|
+
type DevCacheMetadata = Static$1<typeof devCacheMetadataSchema>;
|
|
45
1271
|
//#endregion
|
|
46
1272
|
//#region src/schemas/DevMetadata.d.ts
|
|
47
|
-
declare const devMetadataSchema:
|
|
48
|
-
actions:
|
|
49
|
-
name:
|
|
50
|
-
group:
|
|
51
|
-
method:
|
|
52
|
-
path:
|
|
53
|
-
prefix:
|
|
54
|
-
fullPath:
|
|
55
|
-
description:
|
|
56
|
-
summary:
|
|
57
|
-
disabled:
|
|
58
|
-
secure:
|
|
59
|
-
hide:
|
|
60
|
-
body:
|
|
61
|
-
params:
|
|
62
|
-
query:
|
|
63
|
-
response:
|
|
64
|
-
bodyContentType:
|
|
1273
|
+
declare const devMetadataSchema: TObject$1<{
|
|
1274
|
+
actions: TArray$1<TObject$1<{
|
|
1275
|
+
name: TString;
|
|
1276
|
+
group: TString;
|
|
1277
|
+
method: TString;
|
|
1278
|
+
path: TString;
|
|
1279
|
+
prefix: TString;
|
|
1280
|
+
fullPath: TString;
|
|
1281
|
+
description: TOptional<TString>;
|
|
1282
|
+
summary: TOptional<TString>;
|
|
1283
|
+
disabled: TOptional<TBoolean>;
|
|
1284
|
+
secure: TOptional<TBoolean>;
|
|
1285
|
+
hide: TOptional<TBoolean>;
|
|
1286
|
+
body: TOptional<TAny>;
|
|
1287
|
+
params: TOptional<TAny>;
|
|
1288
|
+
query: TOptional<TAny>;
|
|
1289
|
+
response: TOptional<TAny>;
|
|
1290
|
+
bodyContentType: TOptional<TString>;
|
|
65
1291
|
}>>;
|
|
66
|
-
queues:
|
|
67
|
-
name:
|
|
68
|
-
description:
|
|
69
|
-
schema:
|
|
70
|
-
provider:
|
|
1292
|
+
queues: TArray$1<TObject$1<{
|
|
1293
|
+
name: TString;
|
|
1294
|
+
description: TOptional<TString>;
|
|
1295
|
+
schema: TOptional<TAny>;
|
|
1296
|
+
provider: TString;
|
|
71
1297
|
}>>;
|
|
72
|
-
schedulers:
|
|
73
|
-
name:
|
|
74
|
-
description:
|
|
75
|
-
cron:
|
|
76
|
-
interval:
|
|
77
|
-
lock:
|
|
1298
|
+
schedulers: TArray$1<TObject$1<{
|
|
1299
|
+
name: TString;
|
|
1300
|
+
description: TOptional<TString>;
|
|
1301
|
+
cron: TOptional<TString>;
|
|
1302
|
+
interval: TOptional<TAny>;
|
|
1303
|
+
lock: TOptional<TBoolean>;
|
|
78
1304
|
}>>;
|
|
79
|
-
topics:
|
|
80
|
-
name:
|
|
81
|
-
description:
|
|
82
|
-
schema:
|
|
83
|
-
provider:
|
|
1305
|
+
topics: TArray$1<TObject$1<{
|
|
1306
|
+
name: TString;
|
|
1307
|
+
description: TOptional<TString>;
|
|
1308
|
+
schema: TOptional<TAny>;
|
|
1309
|
+
provider: TString;
|
|
84
1310
|
}>>;
|
|
85
|
-
buckets:
|
|
86
|
-
name:
|
|
87
|
-
description:
|
|
88
|
-
mimeTypes:
|
|
89
|
-
maxSize:
|
|
90
|
-
provider:
|
|
1311
|
+
buckets: TArray$1<TObject$1<{
|
|
1312
|
+
name: TString;
|
|
1313
|
+
description: TOptional<TString>;
|
|
1314
|
+
mimeTypes: TOptional<TArray$1<TString>>;
|
|
1315
|
+
maxSize: TOptional<TNumber>;
|
|
1316
|
+
provider: TString;
|
|
91
1317
|
}>>;
|
|
92
|
-
realms:
|
|
93
|
-
name:
|
|
94
|
-
description:
|
|
95
|
-
roles:
|
|
96
|
-
type:
|
|
97
|
-
settings:
|
|
98
|
-
accessTokenExpiration:
|
|
99
|
-
refreshTokenExpiration:
|
|
100
|
-
hasOnCreateSession:
|
|
101
|
-
hasOnRefreshSession:
|
|
102
|
-
hasOnDeleteSession:
|
|
1318
|
+
realms: TArray$1<TObject$1<{
|
|
1319
|
+
name: TString;
|
|
1320
|
+
description: TOptional<TString>;
|
|
1321
|
+
roles: TOptional<TArray$1<TAny>>;
|
|
1322
|
+
type: TUnsafe<"internal" | "external">;
|
|
1323
|
+
settings: TOptional<TObject$1<{
|
|
1324
|
+
accessTokenExpiration: TOptional<TAny>;
|
|
1325
|
+
refreshTokenExpiration: TOptional<TAny>;
|
|
1326
|
+
hasOnCreateSession: TBoolean;
|
|
1327
|
+
hasOnRefreshSession: TBoolean;
|
|
1328
|
+
hasOnDeleteSession: TBoolean;
|
|
103
1329
|
}>>;
|
|
104
1330
|
}>>;
|
|
105
|
-
caches:
|
|
106
|
-
name:
|
|
107
|
-
ttl:
|
|
108
|
-
disabled:
|
|
109
|
-
provider:
|
|
1331
|
+
caches: TArray$1<TObject$1<{
|
|
1332
|
+
name: TString;
|
|
1333
|
+
ttl: TOptional<TAny>;
|
|
1334
|
+
disabled: TOptional<TBoolean>;
|
|
1335
|
+
provider: TString;
|
|
110
1336
|
}>>;
|
|
111
|
-
pages:
|
|
112
|
-
name:
|
|
113
|
-
description:
|
|
114
|
-
path:
|
|
115
|
-
params:
|
|
116
|
-
query:
|
|
117
|
-
hasComponent:
|
|
118
|
-
hasLazy:
|
|
119
|
-
hasResolve:
|
|
120
|
-
hasChildren:
|
|
121
|
-
hasParent:
|
|
122
|
-
hasErrorHandler:
|
|
123
|
-
static:
|
|
124
|
-
cache:
|
|
125
|
-
client:
|
|
126
|
-
animation:
|
|
1337
|
+
pages: TArray$1<TObject$1<{
|
|
1338
|
+
name: TString;
|
|
1339
|
+
description: TOptional<TString>;
|
|
1340
|
+
path: TOptional<TString>;
|
|
1341
|
+
params: TOptional<TAny>;
|
|
1342
|
+
query: TOptional<TAny>;
|
|
1343
|
+
hasComponent: TBoolean;
|
|
1344
|
+
hasLazy: TBoolean;
|
|
1345
|
+
hasResolve: TBoolean;
|
|
1346
|
+
hasChildren: TBoolean;
|
|
1347
|
+
hasParent: TBoolean;
|
|
1348
|
+
hasErrorHandler: TBoolean;
|
|
1349
|
+
static: TOptional<TBoolean>;
|
|
1350
|
+
cache: TOptional<TAny>;
|
|
1351
|
+
client: TOptional<TAny>;
|
|
1352
|
+
animation: TOptional<TAny>;
|
|
127
1353
|
}>>;
|
|
128
|
-
providers:
|
|
129
|
-
name:
|
|
130
|
-
module:
|
|
131
|
-
dependencies:
|
|
132
|
-
aliases:
|
|
1354
|
+
providers: TArray$1<TObject$1<{
|
|
1355
|
+
name: TString;
|
|
1356
|
+
module: TOptional<TString>;
|
|
1357
|
+
dependencies: TArray$1<TString>;
|
|
1358
|
+
aliases: TOptional<TArray$1<TString>>;
|
|
133
1359
|
}>>;
|
|
134
|
-
modules:
|
|
135
|
-
name:
|
|
136
|
-
providers:
|
|
1360
|
+
modules: TArray$1<TObject$1<{
|
|
1361
|
+
name: TString;
|
|
1362
|
+
providers: TArray$1<TString>;
|
|
137
1363
|
}>>;
|
|
138
1364
|
}>;
|
|
139
|
-
type DevMetadata = Static<typeof devMetadataSchema>;
|
|
1365
|
+
type DevMetadata = Static$1<typeof devMetadataSchema>;
|
|
140
1366
|
//#endregion
|
|
141
1367
|
//#region src/schemas/DevModuleMetadata.d.ts
|
|
142
|
-
declare const devModuleMetadataSchema:
|
|
143
|
-
name:
|
|
144
|
-
providers:
|
|
1368
|
+
declare const devModuleMetadataSchema: TObject$1<{
|
|
1369
|
+
name: TString;
|
|
1370
|
+
providers: TArray$1<TString>;
|
|
145
1371
|
}>;
|
|
146
|
-
type DevModuleMetadata = Static<typeof devModuleMetadataSchema>;
|
|
1372
|
+
type DevModuleMetadata = Static$1<typeof devModuleMetadataSchema>;
|
|
147
1373
|
//#endregion
|
|
148
1374
|
//#region src/schemas/DevPageMetadata.d.ts
|
|
149
|
-
declare const devPageMetadataSchema:
|
|
150
|
-
name:
|
|
151
|
-
description:
|
|
152
|
-
path:
|
|
153
|
-
params:
|
|
154
|
-
query:
|
|
155
|
-
hasComponent:
|
|
156
|
-
hasLazy:
|
|
157
|
-
hasResolve:
|
|
158
|
-
hasChildren:
|
|
159
|
-
hasParent:
|
|
160
|
-
hasErrorHandler:
|
|
161
|
-
static:
|
|
162
|
-
cache:
|
|
163
|
-
client:
|
|
164
|
-
animation:
|
|
1375
|
+
declare const devPageMetadataSchema: TObject$1<{
|
|
1376
|
+
name: TString;
|
|
1377
|
+
description: TOptional<TString>;
|
|
1378
|
+
path: TOptional<TString>;
|
|
1379
|
+
params: TOptional<TAny>;
|
|
1380
|
+
query: TOptional<TAny>;
|
|
1381
|
+
hasComponent: TBoolean;
|
|
1382
|
+
hasLazy: TBoolean;
|
|
1383
|
+
hasResolve: TBoolean;
|
|
1384
|
+
hasChildren: TBoolean;
|
|
1385
|
+
hasParent: TBoolean;
|
|
1386
|
+
hasErrorHandler: TBoolean;
|
|
1387
|
+
static: TOptional<TBoolean>;
|
|
1388
|
+
cache: TOptional<TAny>;
|
|
1389
|
+
client: TOptional<TAny>;
|
|
1390
|
+
animation: TOptional<TAny>;
|
|
165
1391
|
}>;
|
|
166
|
-
type DevPageMetadata = Static<typeof devPageMetadataSchema>;
|
|
1392
|
+
type DevPageMetadata = Static$1<typeof devPageMetadataSchema>;
|
|
167
1393
|
//#endregion
|
|
168
1394
|
//#region src/schemas/DevProviderMetadata.d.ts
|
|
169
|
-
declare const devProviderMetadataSchema:
|
|
170
|
-
name:
|
|
171
|
-
module:
|
|
172
|
-
dependencies:
|
|
173
|
-
aliases:
|
|
1395
|
+
declare const devProviderMetadataSchema: TObject$1<{
|
|
1396
|
+
name: TString;
|
|
1397
|
+
module: TOptional<TString>;
|
|
1398
|
+
dependencies: TArray$1<TString>;
|
|
1399
|
+
aliases: TOptional<TArray$1<TString>>;
|
|
174
1400
|
}>;
|
|
175
|
-
type DevProviderMetadata = Static<typeof devProviderMetadataSchema>;
|
|
1401
|
+
type DevProviderMetadata = Static$1<typeof devProviderMetadataSchema>;
|
|
176
1402
|
//#endregion
|
|
177
1403
|
//#region src/schemas/DevQueueMetadata.d.ts
|
|
178
|
-
declare const devQueueMetadataSchema:
|
|
179
|
-
name:
|
|
180
|
-
description:
|
|
181
|
-
schema:
|
|
182
|
-
provider:
|
|
1404
|
+
declare const devQueueMetadataSchema: TObject$1<{
|
|
1405
|
+
name: TString;
|
|
1406
|
+
description: TOptional<TString>;
|
|
1407
|
+
schema: TOptional<TAny>;
|
|
1408
|
+
provider: TString;
|
|
183
1409
|
}>;
|
|
184
|
-
type DevQueueMetadata = Static<typeof devQueueMetadataSchema>;
|
|
1410
|
+
type DevQueueMetadata = Static$1<typeof devQueueMetadataSchema>;
|
|
185
1411
|
//#endregion
|
|
186
1412
|
//#region src/schemas/DevRealmMetadata.d.ts
|
|
187
|
-
declare const devRealmMetadataSchema:
|
|
188
|
-
name:
|
|
189
|
-
description:
|
|
190
|
-
roles:
|
|
191
|
-
type:
|
|
192
|
-
settings:
|
|
193
|
-
accessTokenExpiration:
|
|
194
|
-
refreshTokenExpiration:
|
|
195
|
-
hasOnCreateSession:
|
|
196
|
-
hasOnRefreshSession:
|
|
197
|
-
hasOnDeleteSession:
|
|
1413
|
+
declare const devRealmMetadataSchema: TObject$1<{
|
|
1414
|
+
name: TString;
|
|
1415
|
+
description: TOptional<TString>;
|
|
1416
|
+
roles: TOptional<TArray$1<TAny>>;
|
|
1417
|
+
type: TUnsafe<"internal" | "external">;
|
|
1418
|
+
settings: TOptional<TObject$1<{
|
|
1419
|
+
accessTokenExpiration: TOptional<TAny>;
|
|
1420
|
+
refreshTokenExpiration: TOptional<TAny>;
|
|
1421
|
+
hasOnCreateSession: TBoolean;
|
|
1422
|
+
hasOnRefreshSession: TBoolean;
|
|
1423
|
+
hasOnDeleteSession: TBoolean;
|
|
198
1424
|
}>>;
|
|
199
1425
|
}>;
|
|
200
|
-
type DevRealmMetadata = Static<typeof devRealmMetadataSchema>;
|
|
1426
|
+
type DevRealmMetadata = Static$1<typeof devRealmMetadataSchema>;
|
|
201
1427
|
//#endregion
|
|
202
1428
|
//#region src/schemas/DevSchedulerMetadata.d.ts
|
|
203
|
-
declare const devSchedulerMetadataSchema:
|
|
204
|
-
name:
|
|
205
|
-
description:
|
|
206
|
-
cron:
|
|
207
|
-
interval:
|
|
208
|
-
lock:
|
|
1429
|
+
declare const devSchedulerMetadataSchema: TObject$1<{
|
|
1430
|
+
name: TString;
|
|
1431
|
+
description: TOptional<TString>;
|
|
1432
|
+
cron: TOptional<TString>;
|
|
1433
|
+
interval: TOptional<TAny>;
|
|
1434
|
+
lock: TOptional<TBoolean>;
|
|
209
1435
|
}>;
|
|
210
|
-
type DevSchedulerMetadata = Static<typeof devSchedulerMetadataSchema>;
|
|
1436
|
+
type DevSchedulerMetadata = Static$1<typeof devSchedulerMetadataSchema>;
|
|
211
1437
|
//#endregion
|
|
212
1438
|
//#region src/schemas/DevTopicMetadata.d.ts
|
|
213
|
-
declare const devTopicMetadataSchema:
|
|
214
|
-
name:
|
|
215
|
-
description:
|
|
216
|
-
schema:
|
|
217
|
-
provider:
|
|
1439
|
+
declare const devTopicMetadataSchema: TObject$1<{
|
|
1440
|
+
name: TString;
|
|
1441
|
+
description: TOptional<TString>;
|
|
1442
|
+
schema: TOptional<TAny>;
|
|
1443
|
+
provider: TString;
|
|
218
1444
|
}>;
|
|
219
|
-
type DevTopicMetadata = Static<typeof devTopicMetadataSchema>;
|
|
1445
|
+
type DevTopicMetadata = Static$1<typeof devTopicMetadataSchema>;
|
|
220
1446
|
//#endregion
|
|
221
1447
|
//#region src/providers/DevToolsMetadataProvider.d.ts
|
|
222
1448
|
declare class DevToolsMetadataProvider {
|
|
223
1449
|
protected readonly alepha: Alepha;
|
|
224
|
-
protected readonly log:
|
|
1450
|
+
protected readonly log: Logger;
|
|
225
1451
|
getActions(): DevActionMetadata[];
|
|
226
1452
|
getQueues(): DevQueueMetadata[];
|
|
227
1453
|
getSchedulers(): DevSchedulerMetadata[];
|
|
@@ -246,7 +1472,7 @@ declare class DevToolsMetadataProvider {
|
|
|
246
1472
|
* @see {@link DevToolsMetadataProvider}
|
|
247
1473
|
* @module alepha.devtools
|
|
248
1474
|
*/
|
|
249
|
-
declare const AlephaDevtools:
|
|
1475
|
+
declare const AlephaDevtools: Service<Module>;
|
|
250
1476
|
//#endregion
|
|
251
1477
|
export { AlephaDevtools, DevActionMetadata, DevBucketMetadata, DevCacheMetadata, DevMetadata, DevModuleMetadata, DevPageMetadata, DevProviderMetadata, DevQueueMetadata, DevRealmMetadata, DevSchedulerMetadata, DevToolsMetadataProvider, DevTopicMetadata, devActionMetadataSchema, devBucketMetadataSchema, devCacheMetadataSchema, devMetadataSchema, devModuleMetadataSchema, devPageMetadataSchema, devProviderMetadataSchema, devQueueMetadataSchema, devRealmMetadataSchema, devSchedulerMetadataSchema, devTopicMetadataSchema };
|
|
252
1478
|
//# sourceMappingURL=index.d.cts.map
|