alepha 0.9.2 → 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 +9 -7
- package/core.d.ts +103 -100
- package/datetime.d.ts +5 -5
- package/lock/redis.d.ts +1 -1
- package/lock.d.ts +9 -9
- package/package.json +42 -49
- 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/react/form.d.ts +18 -9
- package/react/head.d.ts +46 -8
- package/react/i18n.d.ts +47 -8
- package/react.d.ts +230 -156
- package/redis.d.ts +7 -7
- package/scheduler.d.ts +9 -9
- package/security.d.ts +125 -105
- 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 +5 -5
- 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 +64 -56
- package/topic/redis.d.ts +4 -4
- package/topic.d.ts +5 -5
- package/vite.d.ts +55 -24
- package/testing.cjs +0 -8
- 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";
|
|
@@ -104,13 +104,15 @@ interface CommandHandlerArgs<T extends TObject> {
|
|
|
104
104
|
//# sourceMappingURL=$command.d.ts.map
|
|
105
105
|
//#endregion
|
|
106
106
|
//#region src/errors/CommandError.d.ts
|
|
107
|
-
declare class CommandError extends AlephaError {
|
|
107
|
+
declare class CommandError extends AlephaError {
|
|
108
|
+
readonly name = "CommandError";
|
|
109
|
+
}
|
|
108
110
|
//# sourceMappingURL=CommandError.d.ts.map
|
|
109
111
|
//#endregion
|
|
110
112
|
//#region src/providers/CliProvider.d.ts
|
|
111
113
|
declare const envSchema: TObject<{
|
|
112
|
-
CLI_NAME:
|
|
113
|
-
CLI_DESCRIPTION:
|
|
114
|
+
CLI_NAME: _alepha_core1.TString;
|
|
115
|
+
CLI_DESCRIPTION: _alepha_core1.TString;
|
|
114
116
|
}>;
|
|
115
117
|
declare module "alepha" {
|
|
116
118
|
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
@@ -131,7 +133,7 @@ declare class CliProvider {
|
|
|
131
133
|
schema: _sinclair_typebox0.TBoolean;
|
|
132
134
|
};
|
|
133
135
|
};
|
|
134
|
-
protected readonly onReady:
|
|
136
|
+
protected readonly onReady: _alepha_core1.HookDescriptor<"ready">;
|
|
135
137
|
get commands(): CommandDescriptor<any>[];
|
|
136
138
|
private findCommand;
|
|
137
139
|
protected parseCommandFlags(argv: string[], schema: TObject): Record<string, any>;
|
|
@@ -140,7 +142,7 @@ declare class CliProvider {
|
|
|
140
142
|
aliases: string[];
|
|
141
143
|
schema: TSchema;
|
|
142
144
|
}[]): Record<string, any>;
|
|
143
|
-
|
|
145
|
+
printHelp(command?: CommandDescriptor<any>): void;
|
|
144
146
|
private getMaxCmdLength;
|
|
145
147
|
private getMaxFlagLength;
|
|
146
148
|
}
|
|
@@ -155,7 +157,7 @@ declare class CliProvider {
|
|
|
155
157
|
* @see {@link $command}
|
|
156
158
|
* @module alepha.command
|
|
157
159
|
*/
|
|
158
|
-
declare const AlephaCommand: _alepha_core0.
|
|
160
|
+
declare const AlephaCommand: _alepha_core0.Service<_alepha_core0.Module>;
|
|
159
161
|
declare module "@sinclair/typebox" {
|
|
160
162
|
interface StringOptions {
|
|
161
163
|
/**
|
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,7 +198,7 @@ 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;
|
|
@@ -233,7 +298,7 @@ declare class Logger {
|
|
|
233
298
|
asLogLevel(something: string): LogLevel;
|
|
234
299
|
child(options: LoggerOptions): Logger;
|
|
235
300
|
error(message: unknown, data?: object | Error | string | unknown): void;
|
|
236
|
-
warn(message: unknown, data?: object | Error | string): void;
|
|
301
|
+
warn(message: unknown, data?: object | Error | string | unknown): void;
|
|
237
302
|
info(message: unknown, data?: object | Error | string): void;
|
|
238
303
|
debug(message: unknown, data?: object | Error | string): void;
|
|
239
304
|
trace(message: unknown, data?: object | Error | string): void;
|
|
@@ -495,10 +560,9 @@ declare class Alepha {
|
|
|
495
560
|
*
|
|
496
561
|
* Modules are used to group services and provide a way to register them in the container.
|
|
497
562
|
*/
|
|
498
|
-
protected modules: Array<
|
|
563
|
+
protected modules: Array<Module>;
|
|
499
564
|
protected substitutions: Map<Service, {
|
|
500
565
|
use: Service;
|
|
501
|
-
module?: ModuleDefinition;
|
|
502
566
|
}>;
|
|
503
567
|
protected configurations: Map<Service, object>;
|
|
504
568
|
protected descriptorRegistry: Map<Service<Descriptor<{}>>, Descriptor<{}>[]>;
|
|
@@ -667,13 +731,7 @@ declare class Alepha {
|
|
|
667
731
|
* @internal
|
|
668
732
|
*/
|
|
669
733
|
parent?: Service | null;
|
|
670
|
-
/**
|
|
671
|
-
* If the service is provided by a module, the module definition.
|
|
672
|
-
* @internal
|
|
673
|
-
*/
|
|
674
|
-
module?: ModuleDefinition;
|
|
675
734
|
}): T;
|
|
676
|
-
protected pushModule(instance: Module): void;
|
|
677
735
|
/**
|
|
678
736
|
* Configures the specified service with the provided state.
|
|
679
737
|
* If service is not registered, it will do nothing.
|
|
@@ -776,7 +834,7 @@ declare class Alepha {
|
|
|
776
834
|
descriptors<TDescriptor extends Descriptor>(factory: {
|
|
777
835
|
[KIND]: InstantiableClass<TDescriptor> | string;
|
|
778
836
|
}): Array<TDescriptor>;
|
|
779
|
-
protected new<T extends object>(service: Service<T>, args?: any[]
|
|
837
|
+
protected new<T extends object>(service: Service<T>, args?: any[]): T;
|
|
780
838
|
protected processDescriptor(value: Descriptor, propertyKey?: string): void;
|
|
781
839
|
/**
|
|
782
840
|
* @internal
|
|
@@ -804,7 +862,7 @@ interface ServiceDefinition<T extends object = any> {
|
|
|
804
862
|
/**
|
|
805
863
|
* If the service is provided by a module, the module definition.
|
|
806
864
|
*/
|
|
807
|
-
module?:
|
|
865
|
+
module?: Service;
|
|
808
866
|
}
|
|
809
867
|
interface Env extends LoggerEnv {
|
|
810
868
|
[key: string]: string | boolean | number | undefined;
|
|
@@ -901,14 +959,16 @@ interface RunOptions {
|
|
|
901
959
|
}
|
|
902
960
|
//# sourceMappingURL=Run.d.ts.map
|
|
903
961
|
//#endregion
|
|
904
|
-
//#region src/constants/
|
|
962
|
+
//#region src/constants/PRIMITIVE.d.ts
|
|
905
963
|
/**
|
|
906
|
-
*
|
|
964
|
+
* Symbol to mark a value as a primitive.
|
|
965
|
+
*
|
|
966
|
+
* Used to enhance TypeBox types with metadata. See @alepha/protobuf.
|
|
907
967
|
*
|
|
908
968
|
* @internal
|
|
909
969
|
*/
|
|
910
|
-
declare const
|
|
911
|
-
//# sourceMappingURL=
|
|
970
|
+
declare const PRIMITIVE: unique symbol;
|
|
971
|
+
//# sourceMappingURL=PRIMITIVE.d.ts.map
|
|
912
972
|
|
|
913
973
|
//#endregion
|
|
914
974
|
//#region src/descriptors/$cursor.d.ts
|
|
@@ -943,12 +1003,10 @@ declare const $cursor: () => CursorDescriptor;
|
|
|
943
1003
|
*/
|
|
944
1004
|
declare const __alephaRef: {
|
|
945
1005
|
context?: Alepha;
|
|
946
|
-
definition?: Service
|
|
947
|
-
|
|
948
|
-
$services?: {
|
|
949
|
-
module: ModuleDefinition;
|
|
950
|
-
parent: Service;
|
|
1006
|
+
definition?: Service & {
|
|
1007
|
+
[MODULE]?: Service;
|
|
951
1008
|
};
|
|
1009
|
+
parent?: Service;
|
|
952
1010
|
};
|
|
953
1011
|
/**
|
|
954
1012
|
* Cursor descriptor.
|
|
@@ -956,7 +1014,7 @@ declare const __alephaRef: {
|
|
|
956
1014
|
interface CursorDescriptor {
|
|
957
1015
|
context: Alepha;
|
|
958
1016
|
definition?: Service;
|
|
959
|
-
module?:
|
|
1017
|
+
module?: Service;
|
|
960
1018
|
}
|
|
961
1019
|
//# sourceMappingURL=$cursor.d.ts.map
|
|
962
1020
|
//#endregion
|
|
@@ -1107,95 +1165,40 @@ interface LoggerDescriptorOptions {
|
|
|
1107
1165
|
name?: string;
|
|
1108
1166
|
}
|
|
1109
1167
|
//# sourceMappingURL=$logger.d.ts.map
|
|
1110
|
-
|
|
1111
|
-
//#endregion
|
|
1112
|
-
//#region src/descriptors/$module.d.ts
|
|
1113
|
-
/**
|
|
1114
|
-
* Wrap services and descriptors into a module.
|
|
1115
|
-
*
|
|
1116
|
-
* Module is just a class.
|
|
1117
|
-
* You must attach a `name` to it.
|
|
1118
|
-
*
|
|
1119
|
-
* It's recommended to use `project.module.submodule` format.
|
|
1120
|
-
*
|
|
1121
|
-
* @example
|
|
1122
|
-
* ```ts
|
|
1123
|
-
* import { $module } from "alepha";
|
|
1124
|
-
* import { MyService } from "./MyService.ts";
|
|
1125
|
-
*
|
|
1126
|
-
* // export MyService so it can be used everywhere
|
|
1127
|
-
* export * from "./MyService.ts";
|
|
1128
|
-
*
|
|
1129
|
-
* export default $module({
|
|
1130
|
-
* name: "my.project.module",
|
|
1131
|
-
* // MyService will have a module context "my.project.module"
|
|
1132
|
-
* services: [MyService],
|
|
1133
|
-
* });
|
|
1134
|
-
* ```
|
|
1135
|
-
*
|
|
1136
|
-
* - Module is used for logging and other purposes.
|
|
1137
|
-
* - It's useful for large applications or libraries to group services and descriptors together.
|
|
1138
|
-
* - It's probably overkill for small applications.
|
|
1139
|
-
*/
|
|
1140
|
-
declare const $module: (args: ModuleDescriptorOptions) => ModuleDescriptor;
|
|
1141
|
-
type ModuleDescriptor = Service<Module>;
|
|
1142
|
-
interface ModuleDescriptorOptions {
|
|
1143
|
-
/**
|
|
1144
|
-
* Name of the module.
|
|
1145
|
-
*
|
|
1146
|
-
* It should be in the format of `project.module.submodule`.
|
|
1147
|
-
*/
|
|
1148
|
-
name: string;
|
|
1149
|
-
/**
|
|
1150
|
-
* List of services to register in the module.
|
|
1151
|
-
*/
|
|
1152
|
-
services?: Array<ServiceEntry>;
|
|
1153
|
-
/**
|
|
1154
|
-
* List of $descriptors to register in the module.
|
|
1155
|
-
*/
|
|
1156
|
-
descriptors?: Array<DescriptorFactoryLike>;
|
|
1157
|
-
/**
|
|
1158
|
-
* By default, module will register all services.
|
|
1159
|
-
* You can override this behavior by providing a register function.
|
|
1160
|
-
* It's useful when you want to register services conditionally or in a specific order.
|
|
1161
|
-
*/
|
|
1162
|
-
register?: (alepha: Alepha) => void;
|
|
1163
|
-
}
|
|
1164
|
-
//# sourceMappingURL=$module.d.ts.map
|
|
1165
1168
|
//#endregion
|
|
1166
1169
|
//#region src/errors/AlephaError.d.ts
|
|
1167
1170
|
/**
|
|
1168
1171
|
* Default error class for Alepha.
|
|
1169
1172
|
*/
|
|
1170
|
-
declare class AlephaError extends Error {
|
|
1173
|
+
declare class AlephaError extends Error {
|
|
1174
|
+
name: string;
|
|
1175
|
+
}
|
|
1171
1176
|
//# sourceMappingURL=AlephaError.d.ts.map
|
|
1172
1177
|
//#endregion
|
|
1173
1178
|
//#region src/errors/AppNotStartedError.d.ts
|
|
1174
1179
|
declare class AppNotStartedError extends Error {
|
|
1180
|
+
readonly name = "AppNotStartedError";
|
|
1175
1181
|
constructor();
|
|
1176
1182
|
}
|
|
1177
1183
|
//# sourceMappingURL=AppNotStartedError.d.ts.map
|
|
1178
1184
|
//#endregion
|
|
1179
1185
|
//#region src/errors/CircularDependencyError.d.ts
|
|
1180
1186
|
declare class CircularDependencyError extends Error {
|
|
1187
|
+
readonly name = "CircularDependencyError";
|
|
1181
1188
|
constructor(provider: string, parents?: string[]);
|
|
1182
1189
|
}
|
|
1183
1190
|
//# sourceMappingURL=CircularDependencyError.d.ts.map
|
|
1184
1191
|
//#endregion
|
|
1185
1192
|
//#region src/errors/ContainerLockedError.d.ts
|
|
1186
1193
|
declare class ContainerLockedError extends Error {
|
|
1194
|
+
readonly name = "ContainerLockedError";
|
|
1187
1195
|
constructor(message?: string);
|
|
1188
1196
|
}
|
|
1189
1197
|
//# sourceMappingURL=ContainerLockedError.d.ts.map
|
|
1190
1198
|
//#endregion
|
|
1191
|
-
//#region src/errors/NotImplementedError.d.ts
|
|
1192
|
-
declare class NotImplementedError extends Error {
|
|
1193
|
-
constructor(provider: string);
|
|
1194
|
-
}
|
|
1195
|
-
//# sourceMappingURL=NotImplementedError.d.ts.map
|
|
1196
|
-
//#endregion
|
|
1197
1199
|
//#region src/errors/TypeBoxError.d.ts
|
|
1198
1200
|
declare class TypeBoxError extends Error {
|
|
1201
|
+
readonly name = "TypeBoxError";
|
|
1199
1202
|
readonly value: ValueError;
|
|
1200
1203
|
constructor(value: ValueError);
|
|
1201
1204
|
}
|
|
@@ -1288,7 +1291,7 @@ declare class TypeProvider {
|
|
|
1288
1291
|
* Create a schema for a bigint. Bigint is a 64-bit integer.
|
|
1289
1292
|
* This is a workaround for TypeBox, which does not support bigint natively.
|
|
1290
1293
|
*/
|
|
1291
|
-
bigint(options?:
|
|
1294
|
+
bigint(options?: NumberOptions): TNumber$1;
|
|
1292
1295
|
/**
|
|
1293
1296
|
* Make a schema optional.
|
|
1294
1297
|
*
|
|
@@ -1449,5 +1452,5 @@ declare const run: (entry: Alepha | Service | Array<Service>, opts?: RunOptions)
|
|
|
1449
1452
|
//# sourceMappingURL=index.d.ts.map
|
|
1450
1453
|
|
|
1451
1454
|
//#endregion
|
|
1452
|
-
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 };
|
|
1453
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
|
|
2
|
-
import * as
|
|
1
|
+
import * as _alepha_core2 from "alepha";
|
|
2
|
+
import * as _alepha_core1 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
|