alepha 0.9.1 → 0.9.3
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/batch.d.ts +4 -4
- package/bucket.d.ts +3 -3
- package/cache/redis.d.ts +4 -4
- package/cache.d.ts +3 -3
- package/command.d.ts +27 -13
- package/core.d.ts +104 -100
- package/datetime.d.ts +5 -5
- package/lock/redis.d.ts +1 -1
- package/lock.d.ts +8 -8
- package/package.json +54 -47
- package/postgres.d.ts +135 -98
- package/queue/redis.d.ts +1 -1
- package/queue.d.ts +12 -12
- package/react/auth.d.ts +342 -118
- package/{testing.cjs → react/form.cjs} +1 -1
- package/react/form.d.ts +126 -0
- package/react/form.js +1 -0
- package/react/head.d.ts +46 -8
- package/react/i18n.cjs +8 -0
- package/react/i18n.d.ts +112 -0
- package/react/i18n.js +1 -0
- package/react.d.ts +261 -164
- package/redis.d.ts +7 -7
- package/scheduler.d.ts +9 -9
- package/security.d.ts +131 -111
- package/server/cache.d.ts +10 -8
- package/server/compress.d.ts +1 -1
- package/server/cookies.d.ts +44 -15
- package/server/cors.d.ts +4 -4
- package/server/health.d.ts +1 -1
- package/server/helmet.d.ts +1 -1
- package/server/links.d.ts +11 -10
- package/server/metrics.d.ts +5 -5
- package/server/multipart.d.ts +1 -1
- package/server/proxy.d.ts +4 -4
- package/server/security.d.ts +8 -10
- package/server/static.d.ts +3 -3
- package/server/swagger.d.ts +3 -3
- package/server.d.ts +47 -39
- package/topic/redis.d.ts +4 -4
- package/topic.d.ts +5 -5
- package/vite.d.ts +55 -24
- package/testing.d.ts +0 -1
- package/testing.js +0 -1
package/batch.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alepha_core1 from "alepha";
|
|
2
2
|
import * as _alepha_core0 from "alepha";
|
|
3
3
|
import { Descriptor, KIND, Static, TSchema } from "alepha";
|
|
4
4
|
import { DateTimeProvider, DurationLike } from "alepha/datetime";
|
|
@@ -52,7 +52,7 @@ interface BatchDescriptorOptions<TItem extends TSchema, TResponse = any> {
|
|
|
52
52
|
retry?: Omit<RetryDescriptorOptions<() => Array<Static<TItem>>>, "handler">;
|
|
53
53
|
}
|
|
54
54
|
declare class BatchDescriptor<TItem extends TSchema, TResponse = any> extends Descriptor<BatchDescriptorOptions<TItem, TResponse>> {
|
|
55
|
-
protected readonly log:
|
|
55
|
+
protected readonly log: _alepha_core1.Logger;
|
|
56
56
|
protected readonly dateTime: DateTimeProvider;
|
|
57
57
|
protected readonly partitions: Map<any, any>;
|
|
58
58
|
protected activeHandlers: PromiseWithResolvers<void>[];
|
|
@@ -66,7 +66,7 @@ declare class BatchDescriptor<TItem extends TSchema, TResponse = any> extends De
|
|
|
66
66
|
push(item: Static<TItem>): Promise<TResponse>;
|
|
67
67
|
flush(partitionKey?: string): Promise<void>;
|
|
68
68
|
protected flushPartition(partitionKey: string): Promise<void>;
|
|
69
|
-
protected readonly dispose:
|
|
69
|
+
protected readonly dispose: _alepha_core1.HookDescriptor<"stop">;
|
|
70
70
|
}
|
|
71
71
|
//# sourceMappingURL=$batch.d.ts.map
|
|
72
72
|
//#endregion
|
|
@@ -105,7 +105,7 @@ declare class BatchDescriptor<TItem extends TSchema, TResponse = any> extends De
|
|
|
105
105
|
* @see {@link $batch}
|
|
106
106
|
* @module alepha.batch
|
|
107
107
|
*/
|
|
108
|
-
declare const AlephaBatch: _alepha_core0.
|
|
108
|
+
declare const AlephaBatch: _alepha_core0.Service<_alepha_core0.Module>;
|
|
109
109
|
//# sourceMappingURL=index.d.ts.map
|
|
110
110
|
|
|
111
111
|
//#endregion
|
package/bucket.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alepha_core1 from "alepha";
|
|
2
2
|
import * as _alepha_core0 from "alepha";
|
|
3
3
|
import { Alepha, Descriptor, FileLike, KIND, Service } from "alepha";
|
|
4
4
|
import * as fs from "node:fs";
|
|
@@ -136,7 +136,7 @@ declare class LocalFileStorageProvider implements FileStorageProvider {
|
|
|
136
136
|
options: {
|
|
137
137
|
storagePath: string;
|
|
138
138
|
};
|
|
139
|
-
protected readonly configure:
|
|
139
|
+
protected readonly configure: _alepha_core1.HookDescriptor<"start">;
|
|
140
140
|
upload(bucketName: string, file: FileLike, fileId?: string): Promise<string>;
|
|
141
141
|
download(bucketName: string, fileId: string): Promise<FileLike>;
|
|
142
142
|
exists(bucketName: string, fileId: string): Promise<boolean>;
|
|
@@ -186,7 +186,7 @@ declare module "alepha" {
|
|
|
186
186
|
* @see {@link FileStorageProvider}
|
|
187
187
|
* @module alepha.bucket
|
|
188
188
|
*/
|
|
189
|
-
declare const AlephaBucket: _alepha_core0.
|
|
189
|
+
declare const AlephaBucket: _alepha_core0.Service<_alepha_core0.Module>;
|
|
190
190
|
//# sourceMappingURL=index.d.ts.map
|
|
191
191
|
|
|
192
192
|
//#endregion
|
package/cache/redis.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { CacheProvider } from "alepha/cache";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _alepha_core1 from "alepha";
|
|
3
3
|
import * as _alepha_core0 from "alepha";
|
|
4
4
|
import { Alepha, Logger, Static } from "alepha";
|
|
5
5
|
import { RedisProvider } from "alepha/redis";
|
|
6
6
|
|
|
7
7
|
//#region src/providers/RedisCacheProvider.d.ts
|
|
8
|
-
declare const envSchema:
|
|
9
|
-
REDIS_CACHE_PREFIX:
|
|
8
|
+
declare const envSchema: _alepha_core1.TObject<{
|
|
9
|
+
REDIS_CACHE_PREFIX: _alepha_core1.TOptional<_alepha_core1.TString>;
|
|
10
10
|
}>;
|
|
11
11
|
declare module "alepha" {
|
|
12
12
|
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
@@ -31,7 +31,7 @@ declare class RedisCacheProvider implements CacheProvider {
|
|
|
31
31
|
* @see {@link RedisCacheProvider}
|
|
32
32
|
* @module alepha.cache.redis
|
|
33
33
|
*/
|
|
34
|
-
declare const AlephaCacheRedis: _alepha_core0.
|
|
34
|
+
declare const AlephaCacheRedis: _alepha_core0.Service<_alepha_core0.Module>;
|
|
35
35
|
//# sourceMappingURL=index.d.ts.map
|
|
36
36
|
|
|
37
37
|
//#endregion
|
package/cache.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alepha_core1 from "alepha";
|
|
2
2
|
import * as _alepha_core0 from "alepha";
|
|
3
3
|
import { Descriptor, InstantiableClass, KIND } from "alepha";
|
|
4
4
|
import { DateTimeProvider, DurationLike, Timeout } from "alepha/datetime";
|
|
@@ -127,7 +127,7 @@ type CacheValue = {
|
|
|
127
127
|
};
|
|
128
128
|
declare class MemoryCacheProvider implements CacheProvider {
|
|
129
129
|
protected readonly dateTimeProvider: DateTimeProvider;
|
|
130
|
-
protected readonly log:
|
|
130
|
+
protected readonly log: _alepha_core1.Logger;
|
|
131
131
|
protected store: Record<CacheName, Record<CacheKey, CacheValue>>;
|
|
132
132
|
get(name: string, key: string): Promise<Uint8Array | undefined>;
|
|
133
133
|
set(name: string, key: string, value: Uint8Array, ttl?: number): Promise<Uint8Array>;
|
|
@@ -148,7 +148,7 @@ declare class MemoryCacheProvider implements CacheProvider {
|
|
|
148
148
|
* @see {@link CacheProvider}
|
|
149
149
|
* @module alepha.cache
|
|
150
150
|
*/
|
|
151
|
-
declare const AlephaCache: _alepha_core0.
|
|
151
|
+
declare const AlephaCache: _alepha_core0.Service<_alepha_core0.Module>;
|
|
152
152
|
//# sourceMappingURL=index.d.ts.map
|
|
153
153
|
|
|
154
154
|
//#endregion
|
package/command.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alepha_core1 from "alepha";
|
|
2
2
|
import * as _alepha_core0 from "alepha";
|
|
3
3
|
import { Alepha, AlephaError, Async, Descriptor, KIND, Logger, Static, TObject, TSchema } from "alepha";
|
|
4
4
|
import * as fs from "node:fs/promises";
|
|
@@ -14,12 +14,20 @@ interface Timer {
|
|
|
14
14
|
name: string;
|
|
15
15
|
duration: string;
|
|
16
16
|
}
|
|
17
|
+
interface RunOptions {
|
|
18
|
+
/**
|
|
19
|
+
* Rename the command for logging purposes.
|
|
20
|
+
*/
|
|
21
|
+
alias?: string;
|
|
22
|
+
/**
|
|
23
|
+
* If true, the command will not be logged.
|
|
24
|
+
*/
|
|
25
|
+
silent?: boolean;
|
|
26
|
+
}
|
|
17
27
|
interface RunnerMethod {
|
|
18
|
-
(cmd: string | Array<string | Task>, fn?: () => any): Promise<string>;
|
|
19
|
-
rm: (glob: string | string[]) => Promise<string>;
|
|
20
|
-
cp: (source: string, dest: string, options?:
|
|
21
|
-
alias?: string;
|
|
22
|
-
}) => Promise<string>;
|
|
28
|
+
(cmd: string | Array<string | Task>, fn?: () => any, options?: RunOptions): Promise<string>;
|
|
29
|
+
rm: (glob: string | string[], options?: RunOptions) => Promise<string>;
|
|
30
|
+
cp: (source: string, dest: string, options?: RunOptions) => Promise<string>;
|
|
23
31
|
}
|
|
24
32
|
declare class Runner {
|
|
25
33
|
protected readonly log: Logger;
|
|
@@ -77,6 +85,10 @@ interface CommandDescriptorOptions<T extends TObject> {
|
|
|
77
85
|
* A TypeBox object schema defining the flags for the command.
|
|
78
86
|
*/
|
|
79
87
|
flags?: T;
|
|
88
|
+
/**
|
|
89
|
+
* If false, skip summary message at the end of the command execution.
|
|
90
|
+
*/
|
|
91
|
+
summary?: boolean;
|
|
80
92
|
}
|
|
81
93
|
declare class CommandDescriptor<T extends TObject = TObject> extends Descriptor<CommandDescriptorOptions<T>> {
|
|
82
94
|
readonly flags: TObject<{}>;
|
|
@@ -92,13 +104,15 @@ interface CommandHandlerArgs<T extends TObject> {
|
|
|
92
104
|
//# sourceMappingURL=$command.d.ts.map
|
|
93
105
|
//#endregion
|
|
94
106
|
//#region src/errors/CommandError.d.ts
|
|
95
|
-
declare class CommandError extends AlephaError {
|
|
107
|
+
declare class CommandError extends AlephaError {
|
|
108
|
+
readonly name = "CommandError";
|
|
109
|
+
}
|
|
96
110
|
//# sourceMappingURL=CommandError.d.ts.map
|
|
97
111
|
//#endregion
|
|
98
112
|
//#region src/providers/CliProvider.d.ts
|
|
99
113
|
declare const envSchema: TObject<{
|
|
100
|
-
CLI_NAME:
|
|
101
|
-
CLI_DESCRIPTION:
|
|
114
|
+
CLI_NAME: _alepha_core1.TString;
|
|
115
|
+
CLI_DESCRIPTION: _alepha_core1.TString;
|
|
102
116
|
}>;
|
|
103
117
|
declare module "alepha" {
|
|
104
118
|
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
@@ -119,7 +133,7 @@ declare class CliProvider {
|
|
|
119
133
|
schema: _sinclair_typebox0.TBoolean;
|
|
120
134
|
};
|
|
121
135
|
};
|
|
122
|
-
protected readonly onReady:
|
|
136
|
+
protected readonly onReady: _alepha_core1.HookDescriptor<"ready">;
|
|
123
137
|
get commands(): CommandDescriptor<any>[];
|
|
124
138
|
private findCommand;
|
|
125
139
|
protected parseCommandFlags(argv: string[], schema: TObject): Record<string, any>;
|
|
@@ -128,7 +142,7 @@ declare class CliProvider {
|
|
|
128
142
|
aliases: string[];
|
|
129
143
|
schema: TSchema;
|
|
130
144
|
}[]): Record<string, any>;
|
|
131
|
-
|
|
145
|
+
printHelp(command?: CommandDescriptor<any>): void;
|
|
132
146
|
private getMaxCmdLength;
|
|
133
147
|
private getMaxFlagLength;
|
|
134
148
|
}
|
|
@@ -143,7 +157,7 @@ declare class CliProvider {
|
|
|
143
157
|
* @see {@link $command}
|
|
144
158
|
* @module alepha.command
|
|
145
159
|
*/
|
|
146
|
-
declare const AlephaCommand: _alepha_core0.
|
|
160
|
+
declare const AlephaCommand: _alepha_core0.Service<_alepha_core0.Module>;
|
|
147
161
|
declare module "@sinclair/typebox" {
|
|
148
162
|
interface StringOptions {
|
|
149
163
|
/**
|
|
@@ -157,5 +171,5 @@ declare module "@sinclair/typebox" {
|
|
|
157
171
|
//# sourceMappingURL=index.d.ts.map
|
|
158
172
|
|
|
159
173
|
//#endregion
|
|
160
|
-
export { $command, AlephaCommand, CliProvider, CommandDescriptor, CommandDescriptorOptions, CommandError, CommandHandlerArgs, Runner, RunnerMethod, Task };
|
|
174
|
+
export { $command, AlephaCommand, CliProvider, CommandDescriptor, CommandDescriptorOptions, CommandError, CommandHandlerArgs, RunOptions, Runner, RunnerMethod, Task };
|
|
161
175
|
//# sourceMappingURL=index.d.ts.map
|
package/core.d.ts
CHANGED
|
@@ -16,6 +16,24 @@ import { ReadableStream as ReadableStream$1 } from "node:stream/web";
|
|
|
16
16
|
declare const KIND: unique symbol;
|
|
17
17
|
//# sourceMappingURL=KIND.d.ts.map
|
|
18
18
|
//#endregion
|
|
19
|
+
//#region src/constants/MODULE.d.ts
|
|
20
|
+
/**
|
|
21
|
+
* Used for identifying modules.
|
|
22
|
+
*
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
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
|
+
//#endregion
|
|
19
37
|
//#region src/interfaces/Service.d.ts
|
|
20
38
|
/**
|
|
21
39
|
* In Alepha, a service is a class that can be instantiated or an abstract class. Nothing more, nothing less...
|
|
@@ -64,12 +82,6 @@ type ServiceEntry<T extends object = any> = Service<T> | ServiceSubstitution<T>;
|
|
|
64
82
|
//# sourceMappingURL=Service.d.ts.map
|
|
65
83
|
//#endregion
|
|
66
84
|
//#region src/helpers/descriptor.d.ts
|
|
67
|
-
declare const descriptorEvents: {
|
|
68
|
-
events: Map<Service, ((alepha: Alepha) => void)[]>;
|
|
69
|
-
on(descriptor: Service, callback: (alepha: Alepha) => void): void;
|
|
70
|
-
emit(descriptor: Service, alepha: Alepha): void;
|
|
71
|
-
bind(when: Service, register: Service): void;
|
|
72
|
-
};
|
|
73
85
|
interface DescriptorArgs<T extends object = {}> {
|
|
74
86
|
options: T;
|
|
75
87
|
alepha: Alepha;
|
|
@@ -99,20 +111,73 @@ type DescriptorFactoryLike<T extends object = any> = {
|
|
|
99
111
|
(options: T): any;
|
|
100
112
|
[KIND]: any;
|
|
101
113
|
};
|
|
102
|
-
declare const createDescriptor: <TDescriptor extends Descriptor>(descriptor: InstantiableClass<TDescriptor
|
|
114
|
+
declare const createDescriptor: <TDescriptor extends Descriptor>(descriptor: InstantiableClass<TDescriptor> & {
|
|
115
|
+
[MODULE]?: Service;
|
|
116
|
+
}, options: TDescriptor["options"]) => TDescriptor;
|
|
103
117
|
//# sourceMappingURL=descriptor.d.ts.map
|
|
104
118
|
//#endregion
|
|
105
|
-
//#region src/
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
119
|
+
//#region src/descriptors/$module.d.ts
|
|
120
|
+
/**
|
|
121
|
+
* Wrap services and descriptors into a module.
|
|
122
|
+
*
|
|
123
|
+
* Module is just a class.
|
|
124
|
+
* You must attach a `name` to it.
|
|
125
|
+
*
|
|
126
|
+
* It's recommended to use `project.module.submodule` format.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```ts
|
|
130
|
+
* import { $module } from "alepha";
|
|
131
|
+
* import { MyService } from "./MyService.ts";
|
|
132
|
+
*
|
|
133
|
+
* // export MyService so it can be used everywhere
|
|
134
|
+
* export * from "./MyService.ts";
|
|
135
|
+
*
|
|
136
|
+
* export default $module({
|
|
137
|
+
* name: "my.project.module",
|
|
138
|
+
* // MyService will have a module context "my.project.module"
|
|
139
|
+
* services: [MyService],
|
|
140
|
+
* });
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* - Module is used for logging and other purposes.
|
|
144
|
+
* - It's useful for large applications or libraries to group services and descriptors together.
|
|
145
|
+
* - It's probably overkill for small applications.
|
|
146
|
+
*/
|
|
147
|
+
declare const $module: (options: ModuleDescriptorOptions) => Service<Module>;
|
|
148
|
+
interface ModuleDescriptorOptions {
|
|
149
|
+
/**
|
|
150
|
+
* Name of the module.
|
|
151
|
+
*
|
|
152
|
+
* It should be in the format of `project.module.submodule`.
|
|
153
|
+
*/
|
|
154
|
+
name: string;
|
|
155
|
+
/**
|
|
156
|
+
* List of services to register in the module.
|
|
157
|
+
*/
|
|
158
|
+
services?: Array<Service>;
|
|
159
|
+
/**
|
|
160
|
+
* List of $descriptors to register in the module.
|
|
161
|
+
*/
|
|
162
|
+
descriptors?: Array<DescriptorFactoryLike>;
|
|
163
|
+
/**
|
|
164
|
+
* By default, module will register all services.
|
|
165
|
+
* You can override this behavior by providing a register function.
|
|
166
|
+
* It's useful when you want to register services conditionally or in a specific order.
|
|
167
|
+
*/
|
|
168
|
+
register?: (alepha: Alepha) => void;
|
|
109
169
|
}
|
|
110
|
-
interface
|
|
111
|
-
|
|
170
|
+
interface Module {
|
|
171
|
+
[KIND]: "MODULE";
|
|
172
|
+
[OPTIONS]: ModuleDescriptorOptions;
|
|
173
|
+
register: (alepha: Alepha) => void;
|
|
112
174
|
}
|
|
175
|
+
type ServiceWithModule<T extends object = any> = T & {
|
|
176
|
+
[MODULE]?: Service;
|
|
177
|
+
};
|
|
113
178
|
declare const isModule: (value: unknown) => value is Module;
|
|
114
179
|
declare const toModuleName: (name: string) => string;
|
|
115
|
-
//# sourceMappingURL
|
|
180
|
+
//# sourceMappingURL=$module.d.ts.map
|
|
116
181
|
//#endregion
|
|
117
182
|
//#region src/interfaces/Async.d.ts
|
|
118
183
|
/**
|
|
@@ -133,10 +198,11 @@ type MaybePromise<T> = T extends Promise<any> ? T : Promise<T>;
|
|
|
133
198
|
type AsyncLocalStorageData = any;
|
|
134
199
|
declare class AlsProvider {
|
|
135
200
|
static create: () => AsyncLocalStorage<AsyncLocalStorageData> | undefined;
|
|
136
|
-
|
|
201
|
+
als?: AsyncLocalStorage<AsyncLocalStorageData>;
|
|
137
202
|
constructor();
|
|
138
203
|
createContextId(): string;
|
|
139
204
|
run<R>(callback: () => R, data?: Record<string, any>): R;
|
|
205
|
+
exists(): boolean;
|
|
140
206
|
get<T>(key: string): T | undefined;
|
|
141
207
|
set<T>(key: string, value: T): void;
|
|
142
208
|
}
|
|
@@ -232,7 +298,7 @@ declare class Logger {
|
|
|
232
298
|
asLogLevel(something: string): LogLevel;
|
|
233
299
|
child(options: LoggerOptions): Logger;
|
|
234
300
|
error(message: unknown, data?: object | Error | string | unknown): void;
|
|
235
|
-
warn(message: unknown, data?: object | Error | string): void;
|
|
301
|
+
warn(message: unknown, data?: object | Error | string | unknown): void;
|
|
236
302
|
info(message: unknown, data?: object | Error | string): void;
|
|
237
303
|
debug(message: unknown, data?: object | Error | string): void;
|
|
238
304
|
trace(message: unknown, data?: object | Error | string): void;
|
|
@@ -494,10 +560,9 @@ declare class Alepha {
|
|
|
494
560
|
*
|
|
495
561
|
* Modules are used to group services and provide a way to register them in the container.
|
|
496
562
|
*/
|
|
497
|
-
protected modules: Array<
|
|
563
|
+
protected modules: Array<Module>;
|
|
498
564
|
protected substitutions: Map<Service, {
|
|
499
565
|
use: Service;
|
|
500
|
-
module?: ModuleDefinition;
|
|
501
566
|
}>;
|
|
502
567
|
protected configurations: Map<Service, object>;
|
|
503
568
|
protected descriptorRegistry: Map<Service<Descriptor<{}>>, Descriptor<{}>[]>;
|
|
@@ -666,13 +731,7 @@ declare class Alepha {
|
|
|
666
731
|
* @internal
|
|
667
732
|
*/
|
|
668
733
|
parent?: Service | null;
|
|
669
|
-
/**
|
|
670
|
-
* If the service is provided by a module, the module definition.
|
|
671
|
-
* @internal
|
|
672
|
-
*/
|
|
673
|
-
module?: ModuleDefinition;
|
|
674
734
|
}): T;
|
|
675
|
-
protected pushModule(instance: Module): void;
|
|
676
735
|
/**
|
|
677
736
|
* Configures the specified service with the provided state.
|
|
678
737
|
* If service is not registered, it will do nothing.
|
|
@@ -775,7 +834,7 @@ declare class Alepha {
|
|
|
775
834
|
descriptors<TDescriptor extends Descriptor>(factory: {
|
|
776
835
|
[KIND]: InstantiableClass<TDescriptor> | string;
|
|
777
836
|
}): Array<TDescriptor>;
|
|
778
|
-
protected new<T extends object>(service: Service<T>, args?: any[]
|
|
837
|
+
protected new<T extends object>(service: Service<T>, args?: any[]): T;
|
|
779
838
|
protected processDescriptor(value: Descriptor, propertyKey?: string): void;
|
|
780
839
|
/**
|
|
781
840
|
* @internal
|
|
@@ -803,7 +862,7 @@ interface ServiceDefinition<T extends object = any> {
|
|
|
803
862
|
/**
|
|
804
863
|
* If the service is provided by a module, the module definition.
|
|
805
864
|
*/
|
|
806
|
-
module?:
|
|
865
|
+
module?: Service;
|
|
807
866
|
}
|
|
808
867
|
interface Env extends LoggerEnv {
|
|
809
868
|
[key: string]: string | boolean | number | undefined;
|
|
@@ -900,14 +959,16 @@ interface RunOptions {
|
|
|
900
959
|
}
|
|
901
960
|
//# sourceMappingURL=Run.d.ts.map
|
|
902
961
|
//#endregion
|
|
903
|
-
//#region src/constants/
|
|
962
|
+
//#region src/constants/PRIMITIVE.d.ts
|
|
904
963
|
/**
|
|
905
|
-
*
|
|
964
|
+
* Symbol to mark a value as a primitive.
|
|
965
|
+
*
|
|
966
|
+
* Used to enhance TypeBox types with metadata. See @alepha/protobuf.
|
|
906
967
|
*
|
|
907
968
|
* @internal
|
|
908
969
|
*/
|
|
909
|
-
declare const
|
|
910
|
-
//# sourceMappingURL=
|
|
970
|
+
declare const PRIMITIVE: unique symbol;
|
|
971
|
+
//# sourceMappingURL=PRIMITIVE.d.ts.map
|
|
911
972
|
|
|
912
973
|
//#endregion
|
|
913
974
|
//#region src/descriptors/$cursor.d.ts
|
|
@@ -942,12 +1003,10 @@ declare const $cursor: () => CursorDescriptor;
|
|
|
942
1003
|
*/
|
|
943
1004
|
declare const __alephaRef: {
|
|
944
1005
|
context?: Alepha;
|
|
945
|
-
definition?: Service
|
|
946
|
-
|
|
947
|
-
$services?: {
|
|
948
|
-
module: ModuleDefinition;
|
|
949
|
-
parent: Service;
|
|
1006
|
+
definition?: Service & {
|
|
1007
|
+
[MODULE]?: Service;
|
|
950
1008
|
};
|
|
1009
|
+
parent?: Service;
|
|
951
1010
|
};
|
|
952
1011
|
/**
|
|
953
1012
|
* Cursor descriptor.
|
|
@@ -955,7 +1014,7 @@ declare const __alephaRef: {
|
|
|
955
1014
|
interface CursorDescriptor {
|
|
956
1015
|
context: Alepha;
|
|
957
1016
|
definition?: Service;
|
|
958
|
-
module?:
|
|
1017
|
+
module?: Service;
|
|
959
1018
|
}
|
|
960
1019
|
//# sourceMappingURL=$cursor.d.ts.map
|
|
961
1020
|
//#endregion
|
|
@@ -1106,95 +1165,40 @@ interface LoggerDescriptorOptions {
|
|
|
1106
1165
|
name?: string;
|
|
1107
1166
|
}
|
|
1108
1167
|
//# sourceMappingURL=$logger.d.ts.map
|
|
1109
|
-
|
|
1110
|
-
//#endregion
|
|
1111
|
-
//#region src/descriptors/$module.d.ts
|
|
1112
|
-
/**
|
|
1113
|
-
* Wrap services and descriptors into a module.
|
|
1114
|
-
*
|
|
1115
|
-
* Module is just a class.
|
|
1116
|
-
* You must attach a `name` to it.
|
|
1117
|
-
*
|
|
1118
|
-
* It's recommended to use `project.module.submodule` format.
|
|
1119
|
-
*
|
|
1120
|
-
* @example
|
|
1121
|
-
* ```ts
|
|
1122
|
-
* import { $module } from "alepha";
|
|
1123
|
-
* import { MyService } from "./MyService.ts";
|
|
1124
|
-
*
|
|
1125
|
-
* // export MyService so it can be used everywhere
|
|
1126
|
-
* export * from "./MyService.ts";
|
|
1127
|
-
*
|
|
1128
|
-
* export default $module({
|
|
1129
|
-
* name: "my.project.module",
|
|
1130
|
-
* // MyService will have a module context "my.project.module"
|
|
1131
|
-
* services: [MyService],
|
|
1132
|
-
* });
|
|
1133
|
-
* ```
|
|
1134
|
-
*
|
|
1135
|
-
* - Module is used for logging and other purposes.
|
|
1136
|
-
* - It's useful for large applications or libraries to group services and descriptors together.
|
|
1137
|
-
* - It's probably overkill for small applications.
|
|
1138
|
-
*/
|
|
1139
|
-
declare const $module: (args: ModuleDescriptorOptions) => ModuleDescriptor;
|
|
1140
|
-
type ModuleDescriptor = Service<Module>;
|
|
1141
|
-
interface ModuleDescriptorOptions {
|
|
1142
|
-
/**
|
|
1143
|
-
* Name of the module.
|
|
1144
|
-
*
|
|
1145
|
-
* It should be in the format of `project.module.submodule`.
|
|
1146
|
-
*/
|
|
1147
|
-
name: string;
|
|
1148
|
-
/**
|
|
1149
|
-
* List of services to register in the module.
|
|
1150
|
-
*/
|
|
1151
|
-
services?: Array<ServiceEntry>;
|
|
1152
|
-
/**
|
|
1153
|
-
* List of $descriptors to register in the module.
|
|
1154
|
-
*/
|
|
1155
|
-
descriptors?: Array<DescriptorFactoryLike>;
|
|
1156
|
-
/**
|
|
1157
|
-
* By default, module will register all services.
|
|
1158
|
-
* You can override this behavior by providing a register function.
|
|
1159
|
-
* It's useful when you want to register services conditionally or in a specific order.
|
|
1160
|
-
*/
|
|
1161
|
-
register?: (alepha: Alepha) => void;
|
|
1162
|
-
}
|
|
1163
|
-
//# sourceMappingURL=$module.d.ts.map
|
|
1164
1168
|
//#endregion
|
|
1165
1169
|
//#region src/errors/AlephaError.d.ts
|
|
1166
1170
|
/**
|
|
1167
1171
|
* Default error class for Alepha.
|
|
1168
1172
|
*/
|
|
1169
|
-
declare class AlephaError extends Error {
|
|
1173
|
+
declare class AlephaError extends Error {
|
|
1174
|
+
name: string;
|
|
1175
|
+
}
|
|
1170
1176
|
//# sourceMappingURL=AlephaError.d.ts.map
|
|
1171
1177
|
//#endregion
|
|
1172
1178
|
//#region src/errors/AppNotStartedError.d.ts
|
|
1173
1179
|
declare class AppNotStartedError extends Error {
|
|
1180
|
+
readonly name = "AppNotStartedError";
|
|
1174
1181
|
constructor();
|
|
1175
1182
|
}
|
|
1176
1183
|
//# sourceMappingURL=AppNotStartedError.d.ts.map
|
|
1177
1184
|
//#endregion
|
|
1178
1185
|
//#region src/errors/CircularDependencyError.d.ts
|
|
1179
1186
|
declare class CircularDependencyError extends Error {
|
|
1187
|
+
readonly name = "CircularDependencyError";
|
|
1180
1188
|
constructor(provider: string, parents?: string[]);
|
|
1181
1189
|
}
|
|
1182
1190
|
//# sourceMappingURL=CircularDependencyError.d.ts.map
|
|
1183
1191
|
//#endregion
|
|
1184
1192
|
//#region src/errors/ContainerLockedError.d.ts
|
|
1185
1193
|
declare class ContainerLockedError extends Error {
|
|
1194
|
+
readonly name = "ContainerLockedError";
|
|
1186
1195
|
constructor(message?: string);
|
|
1187
1196
|
}
|
|
1188
1197
|
//# sourceMappingURL=ContainerLockedError.d.ts.map
|
|
1189
1198
|
//#endregion
|
|
1190
|
-
//#region src/errors/NotImplementedError.d.ts
|
|
1191
|
-
declare class NotImplementedError extends Error {
|
|
1192
|
-
constructor(provider: string);
|
|
1193
|
-
}
|
|
1194
|
-
//# sourceMappingURL=NotImplementedError.d.ts.map
|
|
1195
|
-
//#endregion
|
|
1196
1199
|
//#region src/errors/TypeBoxError.d.ts
|
|
1197
1200
|
declare class TypeBoxError extends Error {
|
|
1201
|
+
readonly name = "TypeBoxError";
|
|
1198
1202
|
readonly value: ValueError;
|
|
1199
1203
|
constructor(value: ValueError);
|
|
1200
1204
|
}
|
|
@@ -1287,7 +1291,7 @@ declare class TypeProvider {
|
|
|
1287
1291
|
* Create a schema for a bigint. Bigint is a 64-bit integer.
|
|
1288
1292
|
* This is a workaround for TypeBox, which does not support bigint natively.
|
|
1289
1293
|
*/
|
|
1290
|
-
bigint(options?:
|
|
1294
|
+
bigint(options?: NumberOptions): TNumber$1;
|
|
1291
1295
|
/**
|
|
1292
1296
|
* Make a schema optional.
|
|
1293
1297
|
*
|
|
@@ -1448,5 +1452,5 @@ declare const run: (entry: Alepha | Service | Array<Service>, opts?: RunOptions)
|
|
|
1448
1452
|
//# sourceMappingURL=index.d.ts.map
|
|
1449
1453
|
|
|
1450
1454
|
//#endregion
|
|
1451
|
-
export { $cursor, $env, $hook, $inject, $logger, $module, AbstractClass, Alepha, AlephaError, AlephaStringOptions, AlsProvider, AppNotStartedError, Async, AsyncFn, AsyncLocalStorageData, COLORS, CircularDependencyError, ContainerLockedError, CursorDescriptor, Descriptor, DescriptorArgs, DescriptorConfig, DescriptorFactory, DescriptorFactoryLike, Env, FileLike, Hook, HookDescriptor, HookOptions, Hooks, InjectDescriptor, InstantiableClass, KIND, LEVEL_COLORS, LogLevel, Logger, LoggerDescriptorOptions, LoggerEnv, LoggerOptions, MaybePromise, MockLogger, MockLoggerStore, Module,
|
|
1455
|
+
export { $cursor, $env, $hook, $inject, $logger, $module, AbstractClass, Alepha, AlephaError, AlephaStringOptions, AlsProvider, AppNotStartedError, Async, AsyncFn, AsyncLocalStorageData, COLORS, CircularDependencyError, ContainerLockedError, CursorDescriptor, Descriptor, DescriptorArgs, DescriptorConfig, DescriptorFactory, DescriptorFactoryLike, Env, FileLike, Hook, HookDescriptor, HookOptions, Hooks, InjectDescriptor, InstantiableClass, KIND, LEVEL_COLORS, LogLevel, Logger, LoggerDescriptorOptions, LoggerEnv, LoggerOptions, MaybePromise, MockLogger, MockLoggerStore, 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 };
|
|
1452
1456
|
//# sourceMappingURL=index.d.ts.map
|
package/datetime.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alepha_core1 from "alepha";
|
|
2
2
|
import * as _alepha_core0 from "alepha";
|
|
3
3
|
import { Alepha, Descriptor, KIND } from "alepha";
|
|
4
4
|
import dayjs, { Dayjs, ManipulateType } from "dayjs";
|
|
@@ -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_core1.Logger;
|
|
15
15
|
protected ref: DateTime | null;
|
|
16
16
|
protected readonly timeouts: Timeout[];
|
|
17
17
|
protected readonly intervals: Interval[];
|
|
@@ -22,8 +22,8 @@ declare class DateTimeProvider {
|
|
|
22
22
|
* You can override this method to add custom plugins.
|
|
23
23
|
*/
|
|
24
24
|
protected plugins(api: DateTimeApi): void;
|
|
25
|
-
protected readonly start:
|
|
26
|
-
protected readonly stop:
|
|
25
|
+
protected readonly start: _alepha_core1.HookDescriptor<"start">;
|
|
26
|
+
protected readonly stop: _alepha_core1.HookDescriptor<"stop">;
|
|
27
27
|
/**
|
|
28
28
|
* Create a new DateTime instance.
|
|
29
29
|
*/
|
|
@@ -133,7 +133,7 @@ declare class IntervalDescriptor extends Descriptor<IntervalDescriptorOptions> {
|
|
|
133
133
|
//# sourceMappingURL=$interval.d.ts.map
|
|
134
134
|
//#endregion
|
|
135
135
|
//#region src/index.d.ts
|
|
136
|
-
declare const AlephaDateTime: _alepha_core0.
|
|
136
|
+
declare const AlephaDateTime: _alepha_core0.Service<_alepha_core0.Module>;
|
|
137
137
|
//# sourceMappingURL=index.d.ts.map
|
|
138
138
|
|
|
139
139
|
//#endregion
|
package/lock/redis.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ declare class RedisLockProvider implements LockProvider {
|
|
|
19
19
|
* @see {@link RedisLockProvider}
|
|
20
20
|
* @module alepha.lock.redis
|
|
21
21
|
*/
|
|
22
|
-
declare const AlephaLockRedis: _alepha_core0.
|
|
22
|
+
declare const AlephaLockRedis: _alepha_core0.Service<_alepha_core0.Module>;
|
|
23
23
|
//# sourceMappingURL=index.d.ts.map
|
|
24
24
|
|
|
25
25
|
//#endregion
|
package/lock.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import * as _alepha_core2 from "alepha";
|
|
1
2
|
import * as _alepha_core1 from "alepha";
|
|
2
|
-
import * as _alepha_core0$1 from "alepha";
|
|
3
3
|
import * as _alepha_core0 from "alepha";
|
|
4
4
|
import { AsyncFn, Descriptor, KIND, Static } from "alepha";
|
|
5
5
|
import * as _alepha_topic0 from "alepha/topic";
|
|
@@ -89,14 +89,14 @@ interface LockDescriptorOptions<TFunc extends AsyncFn> {
|
|
|
89
89
|
*/
|
|
90
90
|
gracePeriod?: ((...args: Parameters<TFunc>) => DurationLike | undefined) | DurationLike;
|
|
91
91
|
}
|
|
92
|
-
declare const envSchema:
|
|
93
|
-
LOCK_PREFIX_KEY:
|
|
92
|
+
declare const envSchema: _alepha_core2.TObject<{
|
|
93
|
+
LOCK_PREFIX_KEY: _alepha_core2.TString;
|
|
94
94
|
}>;
|
|
95
95
|
declare module "alepha" {
|
|
96
96
|
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
97
97
|
}
|
|
98
98
|
declare class LockDescriptor<TFunc extends AsyncFn> extends Descriptor<LockDescriptorOptions<TFunc>> {
|
|
99
|
-
protected readonly log:
|
|
99
|
+
protected readonly log: _alepha_core2.Logger;
|
|
100
100
|
protected readonly provider: LockProvider;
|
|
101
101
|
protected readonly env: {
|
|
102
102
|
LOCK_PREFIX_KEY: string;
|
|
@@ -105,8 +105,8 @@ declare class LockDescriptor<TFunc extends AsyncFn> extends Descriptor<LockDescr
|
|
|
105
105
|
protected readonly id: `${string}-${string}-${string}-${string}-${string}`;
|
|
106
106
|
readonly maxDuration: dayjs_plugin_duration0.Duration;
|
|
107
107
|
protected readonly topicLockEnd: _alepha_topic0.TopicDescriptor<{
|
|
108
|
-
payload:
|
|
109
|
-
name:
|
|
108
|
+
payload: _alepha_core2.TObject<{
|
|
109
|
+
name: _alepha_core2.TString;
|
|
110
110
|
}>;
|
|
111
111
|
}>;
|
|
112
112
|
run(...args: Parameters<TFunc>): Promise<void>;
|
|
@@ -137,7 +137,7 @@ declare abstract class LockTopicProvider extends TopicProvider {}
|
|
|
137
137
|
*/
|
|
138
138
|
declare class MemoryLockProvider implements LockProvider {
|
|
139
139
|
protected readonly dateTimeProvider: DateTimeProvider;
|
|
140
|
-
protected readonly log:
|
|
140
|
+
protected readonly log: _alepha_core1.Logger;
|
|
141
141
|
/**
|
|
142
142
|
* The in-memory store.
|
|
143
143
|
*/
|
|
@@ -162,7 +162,7 @@ declare class MemoryLockProvider implements LockProvider {
|
|
|
162
162
|
* @see {@link $lock}
|
|
163
163
|
* @module alepha.lock
|
|
164
164
|
*/
|
|
165
|
-
declare const AlephaLock: _alepha_core0.
|
|
165
|
+
declare const AlephaLock: _alepha_core0.Service<_alepha_core0.Module>;
|
|
166
166
|
//# sourceMappingURL=index.d.ts.map
|
|
167
167
|
|
|
168
168
|
//#endregion
|