alepha 0.9.3 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -0
- package/batch.d.ts +3 -6
- package/bucket.d.ts +7 -14
- package/cache/redis.d.ts +7 -7
- package/cache.d.ts +2 -6
- package/command.d.ts +11 -11
- package/core.d.ts +99 -254
- package/datetime.d.ts +3 -7
- package/file.d.ts +0 -3
- package/lock/redis.d.ts +2 -5
- package/lock.d.ts +8 -15
- package/logger.cjs +8 -0
- package/logger.d.ts +222 -0
- package/logger.js +1 -0
- package/package.json +50 -42
- package/postgres.d.ts +192 -271
- package/queue/redis.d.ts +0 -2
- package/queue.d.ts +11 -19
- package/react/auth.d.ts +217 -134
- package/react/form.d.ts +113 -72
- package/react/head.d.ts +7 -14
- package/react/i18n.d.ts +23 -28
- package/react.d.ts +274 -256
- package/redis.d.ts +12 -12
- package/retry.d.ts +0 -4
- package/router.d.ts +0 -1
- package/scheduler.d.ts +9 -13
- package/security.d.ts +68 -86
- package/server/cache.d.ts +3 -5
- package/server/compress.d.ts +0 -3
- package/server/cookies.d.ts +4 -7
- package/server/cors.d.ts +1 -5
- package/server/health.d.ts +0 -3
- package/server/helmet.d.ts +28 -28
- package/server/links.d.ts +144 -42
- package/server/metrics.d.ts +1 -5
- package/server/multipart.d.ts +0 -2
- package/server/proxy.d.ts +3 -7
- package/server/security.d.ts +6 -7
- package/server/static.d.ts +4 -8
- package/server/swagger.d.ts +2 -6
- package/server.d.ts +72 -96
- package/topic/redis.d.ts +3 -6
- package/topic.d.ts +5 -13
- package/vite.d.ts +5 -7
package/core.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ import { ReadableStream as ReadableStream$1 } from "node:stream/web";
|
|
|
14
14
|
* @internal
|
|
15
15
|
*/
|
|
16
16
|
declare const KIND: unique symbol;
|
|
17
|
-
//# sourceMappingURL=KIND.d.ts.map
|
|
18
17
|
//#endregion
|
|
19
18
|
//#region src/constants/MODULE.d.ts
|
|
20
19
|
/**
|
|
@@ -23,16 +22,6 @@ declare const KIND: unique symbol;
|
|
|
23
22
|
* @internal
|
|
24
23
|
*/
|
|
25
24
|
declare const MODULE: unique symbol;
|
|
26
|
-
//# sourceMappingURL=MODULE.d.ts.map
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region src/constants/OPTIONS.d.ts
|
|
29
|
-
/**
|
|
30
|
-
* Used for descriptors options.
|
|
31
|
-
*
|
|
32
|
-
* @internal
|
|
33
|
-
*/
|
|
34
|
-
declare const OPTIONS: unique symbol;
|
|
35
|
-
//# sourceMappingURL=OPTIONS.d.ts.map
|
|
36
25
|
//#endregion
|
|
37
26
|
//#region src/interfaces/Service.d.ts
|
|
38
27
|
/**
|
|
@@ -79,7 +68,6 @@ interface ServiceSubstitution<T extends object = any> {
|
|
|
79
68
|
* And yes, you declare the *type* of the service, not the *instance*.
|
|
80
69
|
*/
|
|
81
70
|
type ServiceEntry<T extends object = any> = Service<T> | ServiceSubstitution<T>;
|
|
82
|
-
//# sourceMappingURL=Service.d.ts.map
|
|
83
71
|
//#endregion
|
|
84
72
|
//#region src/helpers/descriptor.d.ts
|
|
85
73
|
interface DescriptorArgs<T extends object = {}> {
|
|
@@ -114,7 +102,47 @@ type DescriptorFactoryLike<T extends object = any> = {
|
|
|
114
102
|
declare const createDescriptor: <TDescriptor extends Descriptor>(descriptor: InstantiableClass<TDescriptor> & {
|
|
115
103
|
[MODULE]?: Service;
|
|
116
104
|
}, options: TDescriptor["options"]) => TDescriptor;
|
|
117
|
-
//#
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/descriptors/$inject.d.ts
|
|
107
|
+
/**
|
|
108
|
+
* Get the instance of the specified type from the context.
|
|
109
|
+
*
|
|
110
|
+
* ```ts
|
|
111
|
+
* class A { }
|
|
112
|
+
* class B {
|
|
113
|
+
* a = $inject(A);
|
|
114
|
+
* }
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
declare const $inject: <T extends object>(type: Service<T>, opts?: InjectOptions<T>) => T;
|
|
118
|
+
declare class InjectDescriptor extends Descriptor {}
|
|
119
|
+
interface InjectOptions<T extends object = any> {
|
|
120
|
+
/**
|
|
121
|
+
* Ignore current existing instance.
|
|
122
|
+
*/
|
|
123
|
+
skipCache?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Don't store the instance in the registry.
|
|
126
|
+
*/
|
|
127
|
+
skipRegistration?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Constructor arguments to pass when creating a new instance.
|
|
130
|
+
*/
|
|
131
|
+
args?: ConstructorParameters<InstantiableClass<T>>;
|
|
132
|
+
/**
|
|
133
|
+
* Parent service that requested the instance.
|
|
134
|
+
* @internal
|
|
135
|
+
*/
|
|
136
|
+
parent?: Service | null;
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
139
|
+
//#region src/constants/OPTIONS.d.ts
|
|
140
|
+
/**
|
|
141
|
+
* Used for descriptors options.
|
|
142
|
+
*
|
|
143
|
+
* @internal
|
|
144
|
+
*/
|
|
145
|
+
declare const OPTIONS: unique symbol;
|
|
118
146
|
//#endregion
|
|
119
147
|
//#region src/descriptors/$module.d.ts
|
|
120
148
|
/**
|
|
@@ -177,7 +205,6 @@ type ServiceWithModule<T extends object = any> = T & {
|
|
|
177
205
|
};
|
|
178
206
|
declare const isModule: (value: unknown) => value is Module;
|
|
179
207
|
declare const toModuleName: (name: string) => string;
|
|
180
|
-
//# sourceMappingURL=$module.d.ts.map
|
|
181
208
|
//#endregion
|
|
182
209
|
//#region src/interfaces/Async.d.ts
|
|
183
210
|
/**
|
|
@@ -192,7 +219,16 @@ type AsyncFn = (...args: any[]) => Async<any>;
|
|
|
192
219
|
* Transforms a type T into a promise if it is not already a promise.
|
|
193
220
|
*/
|
|
194
221
|
type MaybePromise<T> = T extends Promise<any> ? T : Promise<T>;
|
|
195
|
-
//#
|
|
222
|
+
//#endregion
|
|
223
|
+
//#region src/interfaces/LoggerInterface.d.ts
|
|
224
|
+
type LogLevel = "error" | "warn" | "info" | "debug" | "trace" | "silent";
|
|
225
|
+
interface LoggerInterface {
|
|
226
|
+
trace(message: string, data?: unknown): void;
|
|
227
|
+
debug(message: string, data?: unknown): void;
|
|
228
|
+
info(message: string, data?: unknown): void;
|
|
229
|
+
warn(message: string, data?: unknown): void;
|
|
230
|
+
error(message: string, data?: unknown): void;
|
|
231
|
+
}
|
|
196
232
|
//#endregion
|
|
197
233
|
//#region src/providers/AlsProvider.d.ts
|
|
198
234
|
type AsyncLocalStorageData = any;
|
|
@@ -206,150 +242,6 @@ declare class AlsProvider {
|
|
|
206
242
|
get<T>(key: string): T | undefined;
|
|
207
243
|
set<T>(key: string, value: T): void;
|
|
208
244
|
}
|
|
209
|
-
//# sourceMappingURL=AlsProvider.d.ts.map
|
|
210
|
-
//#endregion
|
|
211
|
-
//#region src/services/Logger.d.ts
|
|
212
|
-
type LogLevel = "error" | "warn" | "info" | "debug" | "trace" | "silent";
|
|
213
|
-
interface LoggerEnv {
|
|
214
|
-
/**
|
|
215
|
-
* Default log level for the application.
|
|
216
|
-
* Default by environment:
|
|
217
|
-
* - dev = "debug"
|
|
218
|
-
* - test = "error"
|
|
219
|
-
* - prod = "info"
|
|
220
|
-
*
|
|
221
|
-
* "trace" | "debug" | "info" | "warn" | "error" | "silent"
|
|
222
|
-
*/
|
|
223
|
-
LOG_LEVEL?: string;
|
|
224
|
-
/**
|
|
225
|
-
* Disable colors in the console output.
|
|
226
|
-
*/
|
|
227
|
-
NO_COLOR?: string;
|
|
228
|
-
/**
|
|
229
|
-
* Force color output for the application.
|
|
230
|
-
*/
|
|
231
|
-
FORCE_COLOR?: string;
|
|
232
|
-
/**
|
|
233
|
-
* Log format.
|
|
234
|
-
*
|
|
235
|
-
* @default "text"
|
|
236
|
-
*/
|
|
237
|
-
LOG_FORMAT?: "json" | "text" | "cli" | "raw";
|
|
238
|
-
}
|
|
239
|
-
interface LoggerOptions {
|
|
240
|
-
/**
|
|
241
|
-
* The logging level. Can be one of "error", "warn", "info", "debug", or "trace".
|
|
242
|
-
*/
|
|
243
|
-
level?: string;
|
|
244
|
-
/**
|
|
245
|
-
* The name of the application. Used to identify the source of the log messages.
|
|
246
|
-
*/
|
|
247
|
-
app?: string;
|
|
248
|
-
/**
|
|
249
|
-
* The name of the logger. Like a module name or a service name.
|
|
250
|
-
*/
|
|
251
|
-
name?: string;
|
|
252
|
-
/**
|
|
253
|
-
* An optional context to include in the log output. Like a request ID or a correlation ID.
|
|
254
|
-
*/
|
|
255
|
-
context?: string;
|
|
256
|
-
/**
|
|
257
|
-
* An optional tag to include in the log output. Like a class name or a module name.
|
|
258
|
-
*/
|
|
259
|
-
caller?: string;
|
|
260
|
-
/**
|
|
261
|
-
* Whether to use colors in the log output. Defaults to true.
|
|
262
|
-
*/
|
|
263
|
-
color?: boolean;
|
|
264
|
-
/**
|
|
265
|
-
* Log output format. Can be "json", "text", or "cli".
|
|
266
|
-
*/
|
|
267
|
-
format?: string;
|
|
268
|
-
/**
|
|
269
|
-
* An optional async local storage provider to use for storing context information.
|
|
270
|
-
*/
|
|
271
|
-
als?: AlsProvider;
|
|
272
|
-
}
|
|
273
|
-
declare const COLORS: {
|
|
274
|
-
reset: string;
|
|
275
|
-
grey: string;
|
|
276
|
-
red: string;
|
|
277
|
-
orange: string;
|
|
278
|
-
green: string;
|
|
279
|
-
blue: string;
|
|
280
|
-
white: string;
|
|
281
|
-
cyan: string;
|
|
282
|
-
darkGrey: string;
|
|
283
|
-
};
|
|
284
|
-
declare const LEVEL_COLORS: Record<string, string>;
|
|
285
|
-
declare class Logger {
|
|
286
|
-
protected levelOrder: Record<string, number>;
|
|
287
|
-
readonly level: string;
|
|
288
|
-
readonly rawLevel: string;
|
|
289
|
-
readonly name: string;
|
|
290
|
-
protected caller: string;
|
|
291
|
-
protected context: string;
|
|
292
|
-
protected app: string;
|
|
293
|
-
protected color: boolean;
|
|
294
|
-
protected format: string;
|
|
295
|
-
protected als?: AlsProvider;
|
|
296
|
-
constructor(options?: LoggerOptions);
|
|
297
|
-
parseLevel(level: string, app: string): LogLevel;
|
|
298
|
-
asLogLevel(something: string): LogLevel;
|
|
299
|
-
child(options: LoggerOptions): Logger;
|
|
300
|
-
error(message: unknown, data?: object | Error | string | unknown): void;
|
|
301
|
-
warn(message: unknown, data?: object | Error | string | unknown): void;
|
|
302
|
-
info(message: unknown, data?: object | Error | string): void;
|
|
303
|
-
debug(message: unknown, data?: object | Error | string): void;
|
|
304
|
-
trace(message: unknown, data?: object | Error | string): void;
|
|
305
|
-
/**
|
|
306
|
-
* Log a message to the console.
|
|
307
|
-
*/
|
|
308
|
-
protected log(level: LogLevel, message: unknown, data?: object | Error | string): void;
|
|
309
|
-
/**
|
|
310
|
-
* Print a log message to the console.
|
|
311
|
-
*/
|
|
312
|
-
protected print(formatted: string): void;
|
|
313
|
-
/**
|
|
314
|
-
* Format a log message to JSON.
|
|
315
|
-
*/
|
|
316
|
-
protected formatJson(level: LogLevel, message: unknown, data?: object | Error | string): string;
|
|
317
|
-
protected formatJsonError(error: Error): object;
|
|
318
|
-
/**
|
|
319
|
-
* Format a log message to a string.
|
|
320
|
-
*/
|
|
321
|
-
protected formatLog(level: LogLevel, message: string, data?: object | Error): string;
|
|
322
|
-
protected nowTimeFormatted(): string;
|
|
323
|
-
protected pad2: (n: number) => string;
|
|
324
|
-
protected pad3: (n: number) => string;
|
|
325
|
-
protected colorize(color: string, text: string, reset?: string): string;
|
|
326
|
-
/**
|
|
327
|
-
* Format an error to a string.
|
|
328
|
-
*
|
|
329
|
-
* @param error
|
|
330
|
-
* @protected
|
|
331
|
-
*/
|
|
332
|
-
protected formatError(error: Error): string;
|
|
333
|
-
}
|
|
334
|
-
declare class MockLogger extends Logger {
|
|
335
|
-
store: MockLoggerStore;
|
|
336
|
-
constructor(options?: LoggerOptions & {
|
|
337
|
-
store: MockLoggerStore;
|
|
338
|
-
});
|
|
339
|
-
print(msg: string): void;
|
|
340
|
-
child(options: LoggerOptions): MockLogger;
|
|
341
|
-
reset(): void;
|
|
342
|
-
}
|
|
343
|
-
interface MockLoggerStore {
|
|
344
|
-
stack: Array<{
|
|
345
|
-
date: string;
|
|
346
|
-
level: string;
|
|
347
|
-
message: string;
|
|
348
|
-
context?: string;
|
|
349
|
-
app?: string;
|
|
350
|
-
} & Record<string, any>>;
|
|
351
|
-
}
|
|
352
|
-
//# sourceMappingURL=Logger.d.ts.map
|
|
353
245
|
//#endregion
|
|
354
246
|
//#region src/Alepha.d.ts
|
|
355
247
|
/**
|
|
@@ -450,7 +342,7 @@ interface MockLoggerStore {
|
|
|
450
342
|
* onCustomerHook = $hook({
|
|
451
343
|
* on: "my:custom:hook",
|
|
452
344
|
* handler: () => {
|
|
453
|
-
* this.log
|
|
345
|
+
* this.log?.info("App is being configured");
|
|
454
346
|
* },
|
|
455
347
|
* });
|
|
456
348
|
* }
|
|
@@ -577,7 +469,7 @@ declare class Alepha {
|
|
|
577
469
|
/**
|
|
578
470
|
* Get logger instance.
|
|
579
471
|
*/
|
|
580
|
-
get log():
|
|
472
|
+
get log(): LoggerInterface | undefined;
|
|
581
473
|
/**
|
|
582
474
|
* The environment variables for the App.
|
|
583
475
|
*/
|
|
@@ -713,25 +605,7 @@ declare class Alepha {
|
|
|
713
605
|
*
|
|
714
606
|
* @return The instance of the specified class or type.
|
|
715
607
|
*/
|
|
716
|
-
inject<T extends object>(service: Service<T>, opts?:
|
|
717
|
-
/**
|
|
718
|
-
* Ignore current existing instance.
|
|
719
|
-
*/
|
|
720
|
-
skipCache?: boolean;
|
|
721
|
-
/**
|
|
722
|
-
* Don't store the instance in the registry.
|
|
723
|
-
*/
|
|
724
|
-
skipRegistration?: boolean;
|
|
725
|
-
/**
|
|
726
|
-
* Constructor arguments to pass when creating a new instance.
|
|
727
|
-
*/
|
|
728
|
-
args?: ConstructorParameters<InstantiableClass<T>>;
|
|
729
|
-
/**
|
|
730
|
-
* Parent service that requested the instance.
|
|
731
|
-
* @internal
|
|
732
|
-
*/
|
|
733
|
-
parent?: Service | null;
|
|
734
|
-
}): T;
|
|
608
|
+
inject<T extends object>(service: Service<T>, opts?: InjectOptions<T>): T;
|
|
735
609
|
/**
|
|
736
610
|
* Configures the specified service with the provided state.
|
|
737
611
|
* If service is not registered, it will do nothing.
|
|
@@ -832,14 +706,10 @@ declare class Alepha {
|
|
|
832
706
|
module?: string;
|
|
833
707
|
}>;
|
|
834
708
|
descriptors<TDescriptor extends Descriptor>(factory: {
|
|
835
|
-
[KIND]: InstantiableClass<TDescriptor
|
|
836
|
-
}): Array<TDescriptor>;
|
|
709
|
+
[KIND]: InstantiableClass<TDescriptor>;
|
|
710
|
+
} | string): Array<TDescriptor>;
|
|
837
711
|
protected new<T extends object>(service: Service<T>, args?: any[]): T;
|
|
838
712
|
protected processDescriptor(value: Descriptor, propertyKey?: string): void;
|
|
839
|
-
/**
|
|
840
|
-
* @internal
|
|
841
|
-
*/
|
|
842
|
-
protected createLogger(env: Env): Logger;
|
|
843
713
|
}
|
|
844
714
|
interface Hook<T extends keyof Hooks = any> {
|
|
845
715
|
caller?: Service;
|
|
@@ -864,7 +734,7 @@ interface ServiceDefinition<T extends object = any> {
|
|
|
864
734
|
*/
|
|
865
735
|
module?: Service;
|
|
866
736
|
}
|
|
867
|
-
interface Env
|
|
737
|
+
interface Env {
|
|
868
738
|
[key: string]: string | boolean | number | undefined;
|
|
869
739
|
/**
|
|
870
740
|
* Optional environment variable that indicates the current environment.
|
|
@@ -880,7 +750,7 @@ interface Env extends LoggerEnv {
|
|
|
880
750
|
MODULE_NAME?: string;
|
|
881
751
|
}
|
|
882
752
|
interface State {
|
|
883
|
-
log
|
|
753
|
+
log?: LoggerInterface;
|
|
884
754
|
env?: Readonly<Env>;
|
|
885
755
|
/**
|
|
886
756
|
* If defined, the Alepha container will only register this service and its dependencies.
|
|
@@ -957,7 +827,6 @@ interface RunOptions {
|
|
|
957
827
|
*/
|
|
958
828
|
cluster?: boolean;
|
|
959
829
|
}
|
|
960
|
-
//# sourceMappingURL=Run.d.ts.map
|
|
961
830
|
//#endregion
|
|
962
831
|
//#region src/constants/PRIMITIVE.d.ts
|
|
963
832
|
/**
|
|
@@ -968,8 +837,6 @@ interface RunOptions {
|
|
|
968
837
|
* @internal
|
|
969
838
|
*/
|
|
970
839
|
declare const PRIMITIVE: unique symbol;
|
|
971
|
-
//# sourceMappingURL=PRIMITIVE.d.ts.map
|
|
972
|
-
|
|
973
840
|
//#endregion
|
|
974
841
|
//#region src/descriptors/$cursor.d.ts
|
|
975
842
|
/**
|
|
@@ -1016,7 +883,6 @@ interface CursorDescriptor {
|
|
|
1016
883
|
definition?: Service;
|
|
1017
884
|
module?: Service;
|
|
1018
885
|
}
|
|
1019
|
-
//# sourceMappingURL=$cursor.d.ts.map
|
|
1020
886
|
//#endregion
|
|
1021
887
|
//#region src/descriptors/$env.d.ts
|
|
1022
888
|
/**
|
|
@@ -1046,8 +912,6 @@ interface CursorDescriptor {
|
|
|
1046
912
|
* ```
|
|
1047
913
|
*/
|
|
1048
914
|
declare const $env: <T extends TObject$1>(type: T) => Static$1<T>;
|
|
1049
|
-
//# sourceMappingURL=$env.d.ts.map
|
|
1050
|
-
|
|
1051
915
|
//#endregion
|
|
1052
916
|
//#region src/descriptors/$hook.d.ts
|
|
1053
917
|
/**
|
|
@@ -1101,7 +965,7 @@ interface HookOptions<T extends keyof Hooks> {
|
|
|
1101
965
|
/**
|
|
1102
966
|
* The handler to run when the hook is triggered.
|
|
1103
967
|
*/
|
|
1104
|
-
handler: (
|
|
968
|
+
handler: (args: Hooks[T]) => Async<any>;
|
|
1105
969
|
/**
|
|
1106
970
|
* Force the hook to run first or last on the list of hooks.
|
|
1107
971
|
*/
|
|
@@ -1119,52 +983,6 @@ declare class HookDescriptor<T extends keyof Hooks> extends Descriptor<HookOptio
|
|
|
1119
983
|
called: number;
|
|
1120
984
|
protected onInit(): void;
|
|
1121
985
|
}
|
|
1122
|
-
//# sourceMappingURL=$hook.d.ts.map
|
|
1123
|
-
//#endregion
|
|
1124
|
-
//#region src/descriptors/$inject.d.ts
|
|
1125
|
-
/**
|
|
1126
|
-
* Get the instance of the specified type from the context.
|
|
1127
|
-
*
|
|
1128
|
-
* ```ts
|
|
1129
|
-
* class A { }
|
|
1130
|
-
* class B {
|
|
1131
|
-
* a = $inject(A);
|
|
1132
|
-
* }
|
|
1133
|
-
* ```
|
|
1134
|
-
*/
|
|
1135
|
-
declare const $inject: <T extends object>(type: Service<T>) => T;
|
|
1136
|
-
declare class InjectDescriptor extends Descriptor {}
|
|
1137
|
-
//# sourceMappingURL=$inject.d.ts.map
|
|
1138
|
-
|
|
1139
|
-
//#endregion
|
|
1140
|
-
//#region src/descriptors/$logger.d.ts
|
|
1141
|
-
/**
|
|
1142
|
-
* Create a logger.
|
|
1143
|
-
*
|
|
1144
|
-
* `name` is optional, by default it will use the name of the service.
|
|
1145
|
-
*
|
|
1146
|
-
* @example
|
|
1147
|
-
* ```ts
|
|
1148
|
-
* import { $logger } from "alepha";
|
|
1149
|
-
*
|
|
1150
|
-
* class MyService {
|
|
1151
|
-
* log = $logger();
|
|
1152
|
-
*
|
|
1153
|
-
* constructor() {
|
|
1154
|
-
* // print something like 'date - [MyService] Service initialized'
|
|
1155
|
-
* this.log.info("Service initialized");
|
|
1156
|
-
* }
|
|
1157
|
-
* }
|
|
1158
|
-
* ```
|
|
1159
|
-
*/
|
|
1160
|
-
declare const $logger: {
|
|
1161
|
-
(options?: LoggerDescriptorOptions): Logger;
|
|
1162
|
-
[KIND]: typeof Logger;
|
|
1163
|
-
};
|
|
1164
|
-
interface LoggerDescriptorOptions {
|
|
1165
|
-
name?: string;
|
|
1166
|
-
}
|
|
1167
|
-
//# sourceMappingURL=$logger.d.ts.map
|
|
1168
986
|
//#endregion
|
|
1169
987
|
//#region src/errors/AlephaError.d.ts
|
|
1170
988
|
/**
|
|
@@ -1173,28 +991,24 @@ interface LoggerDescriptorOptions {
|
|
|
1173
991
|
declare class AlephaError extends Error {
|
|
1174
992
|
name: string;
|
|
1175
993
|
}
|
|
1176
|
-
//# sourceMappingURL=AlephaError.d.ts.map
|
|
1177
994
|
//#endregion
|
|
1178
995
|
//#region src/errors/AppNotStartedError.d.ts
|
|
1179
996
|
declare class AppNotStartedError extends Error {
|
|
1180
997
|
readonly name = "AppNotStartedError";
|
|
1181
998
|
constructor();
|
|
1182
999
|
}
|
|
1183
|
-
//# sourceMappingURL=AppNotStartedError.d.ts.map
|
|
1184
1000
|
//#endregion
|
|
1185
1001
|
//#region src/errors/CircularDependencyError.d.ts
|
|
1186
1002
|
declare class CircularDependencyError extends Error {
|
|
1187
1003
|
readonly name = "CircularDependencyError";
|
|
1188
1004
|
constructor(provider: string, parents?: string[]);
|
|
1189
1005
|
}
|
|
1190
|
-
//# sourceMappingURL=CircularDependencyError.d.ts.map
|
|
1191
1006
|
//#endregion
|
|
1192
1007
|
//#region src/errors/ContainerLockedError.d.ts
|
|
1193
1008
|
declare class ContainerLockedError extends Error {
|
|
1194
1009
|
readonly name = "ContainerLockedError";
|
|
1195
1010
|
constructor(message?: string);
|
|
1196
1011
|
}
|
|
1197
|
-
//# sourceMappingURL=ContainerLockedError.d.ts.map
|
|
1198
1012
|
//#endregion
|
|
1199
1013
|
//#region src/errors/TypeBoxError.d.ts
|
|
1200
1014
|
declare class TypeBoxError extends Error {
|
|
@@ -1202,14 +1016,48 @@ declare class TypeBoxError extends Error {
|
|
|
1202
1016
|
readonly value: ValueError;
|
|
1203
1017
|
constructor(value: ValueError);
|
|
1204
1018
|
}
|
|
1205
|
-
//# sourceMappingURL=TypeBoxError.d.ts.map
|
|
1206
|
-
|
|
1207
1019
|
//#endregion
|
|
1208
1020
|
//#region src/providers/TypeProvider.d.ts
|
|
1209
1021
|
declare class TypeProvider {
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1022
|
+
/**
|
|
1023
|
+
* Default maximum length for strings.
|
|
1024
|
+
*
|
|
1025
|
+
* It can be set to a larger value:
|
|
1026
|
+
* ```ts
|
|
1027
|
+
* TypeProvider.DEFAULT_STRING_MAX_LENGTH = 1000000;
|
|
1028
|
+
* TypeProvider.DEFAULT_STRING_MAX_LENGTH = undefined; // no limit (not recommended)
|
|
1029
|
+
* ```
|
|
1030
|
+
*/
|
|
1031
|
+
static DEFAULT_STRING_MAX_LENGTH: number | undefined;
|
|
1032
|
+
static DEFAULT_SHORT_STRING_MAX_LENGTH: number | undefined;
|
|
1033
|
+
/**
|
|
1034
|
+
* Maximum length for long strings, such as descriptions or comments.
|
|
1035
|
+
* It can be overridden in the string options.
|
|
1036
|
+
*
|
|
1037
|
+
* It can be set to a larger value:
|
|
1038
|
+
* ```ts
|
|
1039
|
+
* TypeProvider.DEFAULT_LONG_STRING_MAX_LENGTH = 2048;
|
|
1040
|
+
* ```
|
|
1041
|
+
*/
|
|
1042
|
+
static DEFAULT_LONG_STRING_MAX_LENGTH: number | undefined;
|
|
1043
|
+
/**
|
|
1044
|
+
* Maximum length for rich strings, such as HTML or Markdown.
|
|
1045
|
+
* This is a large value to accommodate rich text content.
|
|
1046
|
+
* > It's also the maximum length of PG's TEXT type.
|
|
1047
|
+
*
|
|
1048
|
+
* It can be overridden in the string options.
|
|
1049
|
+
*
|
|
1050
|
+
* It can be set to a larger value:
|
|
1051
|
+
* ```ts
|
|
1052
|
+
* TypeProvider.DEFAULT_RICH_STRING_MAX_LENGTH = 1000000;
|
|
1053
|
+
* ```
|
|
1054
|
+
*/
|
|
1055
|
+
static DEFAULT_RICH_STRING_MAX_LENGTH: number | undefined;
|
|
1056
|
+
/**
|
|
1057
|
+
* Maximum number of items in an array.
|
|
1058
|
+
* This is a default value to prevent excessive memory usage.
|
|
1059
|
+
* It can be overridden in the array options.
|
|
1060
|
+
*/
|
|
1213
1061
|
static DEFAULT_ARRAY_MAX_ITEMS: number;
|
|
1214
1062
|
static FormatRegistry: typeof FormatRegistry;
|
|
1215
1063
|
raw: TypeBox.JavaScriptTypeBuilder;
|
|
@@ -1434,7 +1282,6 @@ declare function isISODate(str: string): boolean;
|
|
|
1434
1282
|
declare function isISODateTime(value: string): boolean;
|
|
1435
1283
|
declare function isUUID(value: string): boolean;
|
|
1436
1284
|
declare function isEmail(value: string): boolean;
|
|
1437
|
-
//# sourceMappingURL=TypeProvider.d.ts.map
|
|
1438
1285
|
//#endregion
|
|
1439
1286
|
//#region src/index.d.ts
|
|
1440
1287
|
declare global {
|
|
@@ -1449,8 +1296,6 @@ declare global {
|
|
|
1449
1296
|
*
|
|
1450
1297
|
*/
|
|
1451
1298
|
declare const run: (entry: Alepha | Service | Array<Service>, opts?: RunOptions) => void;
|
|
1452
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1453
|
-
|
|
1454
1299
|
//#endregion
|
|
1455
|
-
export { $cursor, $env, $hook, $inject, $
|
|
1300
|
+
export { $cursor, $env, $hook, $inject, $module, AbstractClass, Alepha, AlephaError, AlephaStringOptions, AlsProvider, AppNotStartedError, Async, AsyncFn, AsyncLocalStorageData, CircularDependencyError, ContainerLockedError, CursorDescriptor, Descriptor, DescriptorArgs, DescriptorConfig, DescriptorFactory, DescriptorFactoryLike, Env, FileLike, Hook, HookDescriptor, HookOptions, Hooks, InjectDescriptor, InjectOptions, InstantiableClass, KIND, LogLevel, LoggerInterface, MaybePromise, Module, ModuleDescriptorOptions, OPTIONS, PRIMITIVE, Service, ServiceEntry, ServiceSubstitution, ServiceWithModule, State, type Static, type StaticDecode, type StaticEncode, StreamLike, type TAny, type TArray, type TBoolean, TFile, type TNumber, type TObject, type TOptional, type TProperties, type TRecord, type TSchema, TStream, type TString, TextLength, TypeBox, TypeBoxError, TypeBoxValue, TypeGuard, TypeProvider, __alephaRef, createDescriptor, isEmail, isFileLike, isISODate, isISODateTime, isModule, isTypeFile, isTypeStream, isUUID, run, t, toModuleName };
|
|
1456
1301
|
//# sourceMappingURL=index.d.ts.map
|
package/datetime.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _alepha_core1 from "alepha";
|
|
2
|
-
import * as _alepha_core0 from "alepha";
|
|
3
2
|
import { Alepha, Descriptor, KIND } from "alepha";
|
|
3
|
+
import * as _alepha_logger0 from "alepha/logger";
|
|
4
4
|
import dayjs, { Dayjs, ManipulateType } from "dayjs";
|
|
5
5
|
import dayjsDuration from "dayjs/plugin/duration.js";
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ type Duration = dayjsDuration.Duration;
|
|
|
11
11
|
type DurationLike = number | dayjsDuration.Duration | [number, ManipulateType];
|
|
12
12
|
declare class DateTimeProvider {
|
|
13
13
|
protected alepha: Alepha;
|
|
14
|
-
protected log:
|
|
14
|
+
protected log: _alepha_logger0.Logger;
|
|
15
15
|
protected ref: DateTime | null;
|
|
16
16
|
protected readonly timeouts: Timeout[];
|
|
17
17
|
protected readonly intervals: Interval[];
|
|
@@ -103,7 +103,6 @@ interface Timeout {
|
|
|
103
103
|
callback: () => void;
|
|
104
104
|
clear: () => void;
|
|
105
105
|
}
|
|
106
|
-
//# sourceMappingURL=DateTimeProvider.d.ts.map
|
|
107
106
|
//#endregion
|
|
108
107
|
//#region src/descriptors/$interval.d.ts
|
|
109
108
|
/**
|
|
@@ -130,12 +129,9 @@ declare class IntervalDescriptor extends Descriptor<IntervalDescriptorOptions> {
|
|
|
130
129
|
called: number;
|
|
131
130
|
protected onInit(): void;
|
|
132
131
|
}
|
|
133
|
-
//# sourceMappingURL=$interval.d.ts.map
|
|
134
132
|
//#endregion
|
|
135
133
|
//#region src/index.d.ts
|
|
136
|
-
declare const AlephaDateTime:
|
|
137
|
-
//# sourceMappingURL=index.d.ts.map
|
|
138
|
-
|
|
134
|
+
declare const AlephaDateTime: _alepha_core1.Service<_alepha_core1.Module>;
|
|
139
135
|
//#endregion
|
|
140
136
|
export { $interval, AlephaDateTime, DateTime, DateTimeApi, DateTimeProvider, Duration, DurationLike, Interval, IntervalDescriptor, IntervalDescriptorOptions, Timeout };
|
|
141
137
|
//# sourceMappingURL=index.d.ts.map
|
package/file.d.ts
CHANGED
|
@@ -35,7 +35,6 @@ declare const streamToBuffer: (streamLike: StreamLike) => Promise<Buffer>;
|
|
|
35
35
|
*/
|
|
36
36
|
declare const bufferToArrayBuffer: (buffer: Buffer) => ArrayBuffer;
|
|
37
37
|
declare const isReadableStream: (obj: unknown) => obj is NodeJS.ReadableStream;
|
|
38
|
-
//# sourceMappingURL=createFile.d.ts.map
|
|
39
38
|
//#endregion
|
|
40
39
|
//#region src/helpers/getContentType.d.ts
|
|
41
40
|
/**
|
|
@@ -49,8 +48,6 @@ declare const mimeMap: Record<string, string>;
|
|
|
49
48
|
* @see {mimeMap}
|
|
50
49
|
*/
|
|
51
50
|
declare const getContentType: (filename: string) => string;
|
|
52
|
-
//# sourceMappingURL=getContentType.d.ts.map
|
|
53
|
-
|
|
54
51
|
//#endregion
|
|
55
52
|
export { bufferToArrayBuffer, createFile, createFileFromBuffer, createFileFromStream, createFileFromUrl, createFileFromWebFile, getContentType, isReadableStream, mimeMap, streamToBuffer };
|
|
56
53
|
//# sourceMappingURL=index.d.ts.map
|
package/lock/redis.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import * as _alepha_core0 from "alepha";
|
|
2
|
-
import { Logger } from "alepha";
|
|
3
2
|
import { LockProvider } from "alepha/lock";
|
|
3
|
+
import * as _alepha_logger0 from "alepha/logger";
|
|
4
4
|
import { RedisProvider } from "alepha/redis";
|
|
5
5
|
|
|
6
6
|
//#region src/providers/RedisLockProvider.d.ts
|
|
7
7
|
declare class RedisLockProvider implements LockProvider {
|
|
8
|
-
protected readonly log: Logger;
|
|
8
|
+
protected readonly log: _alepha_logger0.Logger;
|
|
9
9
|
protected readonly redisProvider: RedisProvider;
|
|
10
10
|
set(key: string, value: string, nx?: boolean, px?: number): Promise<string>;
|
|
11
11
|
del(...keys: string[]): Promise<void>;
|
|
12
12
|
}
|
|
13
|
-
//# sourceMappingURL=RedisLockProvider.d.ts.map
|
|
14
13
|
//#endregion
|
|
15
14
|
//#region src/index.d.ts
|
|
16
15
|
/**
|
|
@@ -20,8 +19,6 @@ declare class RedisLockProvider implements LockProvider {
|
|
|
20
19
|
* @module alepha.lock.redis
|
|
21
20
|
*/
|
|
22
21
|
declare const AlephaLockRedis: _alepha_core0.Service<_alepha_core0.Module>;
|
|
23
|
-
//# sourceMappingURL=index.d.ts.map
|
|
24
|
-
|
|
25
22
|
//#endregion
|
|
26
23
|
export { AlephaLockRedis, RedisLockProvider };
|
|
27
24
|
//# sourceMappingURL=index.d.ts.map
|
package/lock.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import * as _alepha_core2 from "alepha";
|
|
2
1
|
import * as _alepha_core1 from "alepha";
|
|
3
|
-
import * as _alepha_core0 from "alepha";
|
|
4
2
|
import { AsyncFn, Descriptor, KIND, Static } from "alepha";
|
|
5
3
|
import * as _alepha_topic0 from "alepha/topic";
|
|
6
4
|
import { TopicProvider } from "alepha/topic";
|
|
7
5
|
import { DateTime, DateTimeProvider, DurationLike, Timeout } from "alepha/datetime";
|
|
6
|
+
import * as _alepha_logger0 from "alepha/logger";
|
|
8
7
|
import * as dayjs_plugin_duration0 from "dayjs/plugin/duration";
|
|
9
8
|
|
|
10
9
|
//#region src/providers/LockProvider.d.ts
|
|
@@ -28,7 +27,6 @@ declare abstract class LockProvider {
|
|
|
28
27
|
*/
|
|
29
28
|
abstract del(...keys: string[]): Promise<void>;
|
|
30
29
|
}
|
|
31
|
-
//# sourceMappingURL=LockProvider.d.ts.map
|
|
32
30
|
//#endregion
|
|
33
31
|
//#region src/descriptors/$lock.d.ts
|
|
34
32
|
/**
|
|
@@ -89,14 +87,14 @@ interface LockDescriptorOptions<TFunc extends AsyncFn> {
|
|
|
89
87
|
*/
|
|
90
88
|
gracePeriod?: ((...args: Parameters<TFunc>) => DurationLike | undefined) | DurationLike;
|
|
91
89
|
}
|
|
92
|
-
declare const envSchema:
|
|
93
|
-
LOCK_PREFIX_KEY:
|
|
90
|
+
declare const envSchema: _alepha_core1.TObject<{
|
|
91
|
+
LOCK_PREFIX_KEY: _alepha_core1.TString;
|
|
94
92
|
}>;
|
|
95
93
|
declare module "alepha" {
|
|
96
94
|
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
97
95
|
}
|
|
98
96
|
declare class LockDescriptor<TFunc extends AsyncFn> extends Descriptor<LockDescriptorOptions<TFunc>> {
|
|
99
|
-
protected readonly log:
|
|
97
|
+
protected readonly log: _alepha_logger0.Logger;
|
|
100
98
|
protected readonly provider: LockProvider;
|
|
101
99
|
protected readonly env: {
|
|
102
100
|
LOCK_PREFIX_KEY: string;
|
|
@@ -105,8 +103,8 @@ declare class LockDescriptor<TFunc extends AsyncFn> extends Descriptor<LockDescr
|
|
|
105
103
|
protected readonly id: `${string}-${string}-${string}-${string}-${string}`;
|
|
106
104
|
readonly maxDuration: dayjs_plugin_duration0.Duration;
|
|
107
105
|
protected readonly topicLockEnd: _alepha_topic0.TopicDescriptor<{
|
|
108
|
-
payload:
|
|
109
|
-
name:
|
|
106
|
+
payload: _alepha_core1.TObject<{
|
|
107
|
+
name: _alepha_core1.TString;
|
|
110
108
|
}>;
|
|
111
109
|
}>;
|
|
112
110
|
run(...args: Parameters<TFunc>): Promise<void>;
|
|
@@ -128,8 +126,6 @@ interface LockResult {
|
|
|
128
126
|
//#endregion
|
|
129
127
|
//#region src/providers/LockTopicProvider.d.ts
|
|
130
128
|
declare abstract class LockTopicProvider extends TopicProvider {}
|
|
131
|
-
//# sourceMappingURL=LockTopicProvider.d.ts.map
|
|
132
|
-
|
|
133
129
|
//#endregion
|
|
134
130
|
//#region src/providers/MemoryLockProvider.d.ts
|
|
135
131
|
/**
|
|
@@ -137,7 +133,7 @@ declare abstract class LockTopicProvider extends TopicProvider {}
|
|
|
137
133
|
*/
|
|
138
134
|
declare class MemoryLockProvider implements LockProvider {
|
|
139
135
|
protected readonly dateTimeProvider: DateTimeProvider;
|
|
140
|
-
protected readonly log:
|
|
136
|
+
protected readonly log: _alepha_logger0.Logger;
|
|
141
137
|
/**
|
|
142
138
|
* The in-memory store.
|
|
143
139
|
*/
|
|
@@ -150,7 +146,6 @@ declare class MemoryLockProvider implements LockProvider {
|
|
|
150
146
|
del(...keys: string[]): Promise<void>;
|
|
151
147
|
private ttl;
|
|
152
148
|
}
|
|
153
|
-
//# sourceMappingURL=MemoryLockProvider.d.ts.map
|
|
154
149
|
//#endregion
|
|
155
150
|
//#region src/index.d.ts
|
|
156
151
|
/**
|
|
@@ -162,9 +157,7 @@ declare class MemoryLockProvider implements LockProvider {
|
|
|
162
157
|
* @see {@link $lock}
|
|
163
158
|
* @module alepha.lock
|
|
164
159
|
*/
|
|
165
|
-
declare const AlephaLock:
|
|
166
|
-
//# sourceMappingURL=index.d.ts.map
|
|
167
|
-
|
|
160
|
+
declare const AlephaLock: _alepha_core1.Service<_alepha_core1.Module>;
|
|
168
161
|
//#endregion
|
|
169
162
|
export { $lock, AlephaLock, LockDescriptor, LockDescriptorOptions, LockProvider, LockResult, LockTopicProvider, MemoryLockProvider };
|
|
170
163
|
//# sourceMappingURL=index.d.ts.map
|