alepha 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +47 -44
- package/batch.d.ts +87 -88
- package/bucket.cjs +8 -0
- package/bucket.d.ts +194 -0
- package/bucket.js +1 -0
- package/cache/redis.d.ts +14 -16
- package/cache.d.ts +101 -170
- package/command.d.ts +70 -77
- package/core.d.ts +1043 -887
- package/datetime.d.ts +91 -117
- package/file.cjs +8 -0
- package/file.d.ts +56 -0
- package/file.js +1 -0
- package/lock/redis.d.ts +11 -13
- package/lock.d.ts +125 -117
- package/package.json +66 -38
- package/postgres.d.ts +232 -275
- package/queue/redis.d.ts +13 -15
- package/queue.d.ts +88 -116
- package/react/auth.d.ts +50 -55
- package/react/head.d.ts +5 -8
- package/react.d.ts +71 -73
- package/redis.d.ts +32 -14
- package/retry.d.ts +70 -58
- package/router.cjs +8 -0
- package/router.d.ts +45 -0
- package/router.js +1 -0
- package/scheduler.d.ts +54 -96
- package/security.d.ts +117 -119
- package/server/cache.d.ts +22 -31
- package/server/compress.d.ts +16 -7
- package/server/cookies.d.ts +70 -61
- package/server/cors.d.ts +15 -13
- package/server/health.d.ts +23 -26
- package/server/helmet.d.ts +17 -20
- package/server/links.d.ts +113 -90
- package/server/metrics.d.ts +25 -23
- package/server/multipart.d.ts +12 -16
- package/server/proxy.d.ts +25 -20
- package/server/security.cjs +8 -0
- package/server/security.d.ts +90 -0
- package/server/security.js +1 -0
- package/server/static.d.ts +67 -68
- package/server/swagger.d.ts +77 -65
- package/server.d.ts +265 -308
- package/topic/redis.d.ts +25 -26
- package/topic.d.ts +76 -122
- package/vite.d.ts +52 -36
package/cache.d.ts
CHANGED
|
@@ -1,122 +1,122 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _alepha_core0$1 from "alepha";
|
|
2
|
+
import * as _alepha_core0 from "alepha";
|
|
3
|
+
import { Descriptor, InstantiableClass, KIND } from "alepha";
|
|
2
4
|
import { DateTimeProvider, DurationLike, Timeout } from "alepha/datetime";
|
|
3
5
|
|
|
4
6
|
//#region src/providers/CacheProvider.d.ts
|
|
5
|
-
|
|
6
7
|
/**
|
|
7
|
-
* Cache provider interface.
|
|
8
|
-
*
|
|
9
|
-
* All methods are asynchronous and return promises.
|
|
10
|
-
* Values are stored as Uint8Array.
|
|
11
|
-
*/
|
|
8
|
+
* Cache provider interface.
|
|
9
|
+
*
|
|
10
|
+
* All methods are asynchronous and return promises.
|
|
11
|
+
* Values are stored as Uint8Array.
|
|
12
|
+
*/
|
|
12
13
|
declare abstract class CacheProvider {
|
|
13
14
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
* Get the value of a key.
|
|
16
|
+
*
|
|
17
|
+
* @param name Cache name, used to group keys. Should be Redis-like "some:group:name" format.
|
|
18
|
+
* @param key The key of the value to get.
|
|
19
|
+
*
|
|
20
|
+
* @return The value of the key, or undefined if the key does not exist.
|
|
21
|
+
*/
|
|
21
22
|
abstract get(name: string, key: string): Promise<Uint8Array | undefined>;
|
|
22
23
|
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
* Set the string value of a key.
|
|
25
|
+
*
|
|
26
|
+
* @param name Cache name, used to group keys. Should be Redis-like "some:group:name" format.
|
|
27
|
+
* @param key The key of the value to set.
|
|
28
|
+
* @param value The value to set.
|
|
29
|
+
* @param ttl The time-to-live of the key, in milliseconds.
|
|
30
|
+
*
|
|
31
|
+
* @return The value of the key.
|
|
32
|
+
*/
|
|
32
33
|
abstract set(name: string, key: string, value: Uint8Array, ttl?: number): Promise<Uint8Array>;
|
|
33
34
|
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
* Remove the specified keys.
|
|
36
|
+
*
|
|
37
|
+
* @param name Cache name, used to group keys. Should be Redis-like "some:group:name" format.
|
|
38
|
+
* @param keys The keys to delete.
|
|
39
|
+
*/
|
|
39
40
|
abstract del(name: string, ...keys: string[]): Promise<void>;
|
|
40
41
|
abstract has(name: string, key: string): Promise<boolean>;
|
|
41
|
-
abstract keys(name: string): Promise<string[]>;
|
|
42
|
+
abstract keys(name: string, filter?: string): Promise<string[]>;
|
|
42
43
|
}
|
|
44
|
+
//# sourceMappingURL=CacheProvider.d.ts.map
|
|
43
45
|
//#endregion
|
|
44
46
|
//#region src/descriptors/$cache.d.ts
|
|
45
|
-
declare const KEY = "CACHE";
|
|
46
47
|
/**
|
|
47
|
-
*
|
|
48
|
-
*/
|
|
48
|
+
* Creates a cache storage or a cache function.
|
|
49
|
+
*/
|
|
49
50
|
declare const $cache: {
|
|
50
|
-
<TReturn = string, TParameter extends any[] = any[]>(options?: CacheDescriptorOptions<TReturn, TParameter>):
|
|
51
|
-
[KIND]:
|
|
51
|
+
<TReturn = string, TParameter extends any[] = any[]>(options?: CacheDescriptorOptions<TReturn, TParameter>): CacheDescriptorFn<TReturn, TParameter>;
|
|
52
|
+
[KIND]: typeof CacheDescriptor;
|
|
52
53
|
};
|
|
53
|
-
// ---------------------------------------------------------------------------------------------------------------------
|
|
54
54
|
interface CacheDescriptorOptions<TReturn, TParameter extends any[] = any[]> {
|
|
55
55
|
/**
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
* The cache name. This is useful for invalidating multiple caches at once.
|
|
57
|
+
*
|
|
58
|
+
* Store key as `cache:$name:$key`.
|
|
59
|
+
*
|
|
60
|
+
* @default Name of the key of the class.
|
|
61
|
+
*/
|
|
62
62
|
name?: string;
|
|
63
63
|
/**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
*/
|
|
64
|
+
* Function which returns cached data.
|
|
65
|
+
*/
|
|
67
66
|
handler?: (...args: TParameter) => TReturn;
|
|
68
67
|
/**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
* The key generator for the cache.
|
|
69
|
+
* If not provided, the arguments will be json.stringify().
|
|
70
|
+
*/
|
|
72
71
|
key?: (...args: TParameter) => string;
|
|
73
72
|
/**
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
provider?: CacheProvider |
|
|
73
|
+
* The store provider for the cache.
|
|
74
|
+
* If not provided, the default store provider will be used.
|
|
75
|
+
*/
|
|
76
|
+
provider?: InstantiableClass<CacheProvider> | "memory";
|
|
78
77
|
/**
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
78
|
+
* The time-to-live for the cache in seconds.
|
|
79
|
+
* Set 0 to skip expiration.
|
|
80
|
+
*
|
|
81
|
+
* @default 300 (5 minutes).
|
|
82
|
+
*/
|
|
84
83
|
ttl?: DurationLike;
|
|
85
84
|
/**
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
* If the cache is disabled.
|
|
86
|
+
*/
|
|
88
87
|
disabled?: boolean;
|
|
89
88
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
declare class CacheDescriptor<TReturn = any, TParameter extends any[] = any[]> extends Descriptor<CacheDescriptorOptions<TReturn, TParameter>> {
|
|
90
|
+
protected readonly env: {
|
|
91
|
+
CACHE_ENABLED: boolean;
|
|
92
|
+
CACHE_DEFAULT_TTL: number;
|
|
93
|
+
};
|
|
94
|
+
protected readonly dateTimeProvider: DateTimeProvider;
|
|
95
|
+
protected readonly provider: CacheProvider;
|
|
96
|
+
protected encoder: TextEncoder;
|
|
97
|
+
protected decoder: TextDecoder;
|
|
98
|
+
protected codes: {
|
|
99
|
+
BINARY: number;
|
|
100
|
+
JSON: number;
|
|
101
|
+
STRING: number;
|
|
102
|
+
};
|
|
103
|
+
get container(): string;
|
|
104
|
+
run(...args: TParameter): Promise<TReturn>;
|
|
105
|
+
key(...args: TParameter): string;
|
|
106
|
+
invalidate(...keys: string[]): Promise<void>;
|
|
107
|
+
set(key: string, value: TReturn, ttl?: DurationLike): Promise<void>;
|
|
108
|
+
get(key: string): Promise<TReturn | undefined>;
|
|
109
|
+
protected serialize<TReturn>(value: TReturn): Uint8Array;
|
|
110
|
+
protected deserialize<TReturn>(uint8Array: Uint8Array): Promise<TReturn>;
|
|
111
|
+
protected $provider(): CacheProvider;
|
|
112
|
+
}
|
|
113
|
+
interface CacheDescriptorFn<TReturn = any, TParameter extends any[] = any[]> extends CacheDescriptor<TReturn, TParameter> {
|
|
93
114
|
/**
|
|
94
|
-
|
|
95
|
-
|
|
115
|
+
* Run the cache descriptor with the provided arguments.
|
|
116
|
+
*/
|
|
96
117
|
(...args: TParameter): Promise<TReturn>;
|
|
97
|
-
/**
|
|
98
|
-
* Cache key generator.
|
|
99
|
-
*/
|
|
100
|
-
key: (...args: TParameter) => string;
|
|
101
|
-
/**
|
|
102
|
-
* Invalidate cache by keys.
|
|
103
|
-
*/
|
|
104
|
-
invalidate: (...keys: string[]) => Promise<void>;
|
|
105
|
-
/**
|
|
106
|
-
* Set cache with key, value and ttl.
|
|
107
|
-
*
|
|
108
|
-
* @param key
|
|
109
|
-
* @param value
|
|
110
|
-
* @param ttl
|
|
111
|
-
*/
|
|
112
|
-
set: (key: string, value: TReturn, ttl?: DurationLike) => Promise<void>;
|
|
113
|
-
/**
|
|
114
|
-
* Get cache by key.
|
|
115
|
-
*
|
|
116
|
-
* @param key
|
|
117
|
-
*/
|
|
118
|
-
get: (key: string) => Promise<TReturn | undefined>;
|
|
119
118
|
}
|
|
119
|
+
//# sourceMappingURL=$cache.d.ts.map
|
|
120
120
|
//#endregion
|
|
121
121
|
//#region src/providers/MemoryCacheProvider.d.ts
|
|
122
122
|
type CacheName = string;
|
|
@@ -127,99 +127,30 @@ type CacheValue = {
|
|
|
127
127
|
};
|
|
128
128
|
declare class MemoryCacheProvider implements CacheProvider {
|
|
129
129
|
protected readonly dateTimeProvider: DateTimeProvider;
|
|
130
|
-
protected readonly log: Logger;
|
|
130
|
+
protected readonly log: _alepha_core0$1.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>;
|
|
134
134
|
del(name: string, ...keys: string[]): Promise<void>;
|
|
135
135
|
has(name: string, key: string): Promise<boolean>;
|
|
136
|
-
keys(name: string): Promise<string[]>;
|
|
137
|
-
}
|
|
138
|
-
//#endregion
|
|
139
|
-
//#region src/providers/CacheDescriptorProvider.d.ts
|
|
140
|
-
declare const envSchema: TObject<{
|
|
141
|
-
CACHE_DEFAULT_TTL: TNumber;
|
|
142
|
-
CACHE_PREFIX: TOptional<TString>;
|
|
143
|
-
CACHE_ENABLED: TBoolean;
|
|
144
|
-
}>;
|
|
145
|
-
declare module "alepha" {
|
|
146
|
-
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
147
|
-
}
|
|
148
|
-
declare class CacheDescriptorProvider {
|
|
149
|
-
protected readonly alepha: Alepha;
|
|
150
|
-
protected readonly cacheProvider: CacheProvider;
|
|
151
|
-
protected readonly memoryCacheProvider: MemoryCacheProvider;
|
|
152
|
-
protected readonly dateTimeProvider: DateTimeProvider;
|
|
153
|
-
protected readonly env: Static<typeof envSchema>;
|
|
154
|
-
protected readonly caches: Cache[];
|
|
155
|
-
protected encoder: TextEncoder;
|
|
156
|
-
protected decoder: TextDecoder;
|
|
157
|
-
protected codes: {
|
|
158
|
-
BINARY: number;
|
|
159
|
-
JSON: number;
|
|
160
|
-
STRING: number;
|
|
161
|
-
};
|
|
162
|
-
protected readonly configure: HookDescriptor<"configure">;
|
|
163
|
-
register(cache: Cache): Cache;
|
|
164
|
-
processDescriptors(): void;
|
|
165
|
-
getCaches(): Cache[];
|
|
166
|
-
/**
|
|
167
|
-
* Clear all cache entries.
|
|
168
|
-
*/
|
|
169
|
-
clear(): Promise<void>;
|
|
170
|
-
/**
|
|
171
|
-
* Get the store provider for the given cache options.
|
|
172
|
-
*
|
|
173
|
-
* @param options
|
|
174
|
-
*/
|
|
175
|
-
provider(options: Pick<CacheDescriptorOptions<any[], any>, "provider">): CacheProvider;
|
|
176
|
-
/**
|
|
177
|
-
* Get the cache key for the given state and arguments.
|
|
178
|
-
*/
|
|
179
|
-
key(cache: Cache, ...args: any[]): string;
|
|
180
|
-
/**
|
|
181
|
-
* Invalidate the cache for the given state and arguments.
|
|
182
|
-
*/
|
|
183
|
-
invalidate(cache: Cache, ...keys: string[]): Promise<void>;
|
|
184
|
-
/**
|
|
185
|
-
* Run the cache handler with the given state and arguments.
|
|
186
|
-
* You must run on a $cache with a handler defined.
|
|
187
|
-
*/
|
|
188
|
-
run<TReturn, TParameter extends any[]>(cache: Cache<TReturn, TParameter>, ...args: TParameter): Promise<TReturn>;
|
|
189
|
-
get<TReturn>(cache: Cache<TReturn>, key: string): Promise<TReturn | undefined>;
|
|
190
|
-
/**
|
|
191
|
-
* Manually set a value in the cache.
|
|
192
|
-
* It's used by .run() method, but you will need it when you don't have cache handler defined.
|
|
193
|
-
*
|
|
194
|
-
* @param cache Cache object with all configuration and options (even TTL).
|
|
195
|
-
* @param key Cache key, build with .key() method or manually.
|
|
196
|
-
* @param value Value to store in cache.
|
|
197
|
-
* @param ttl Override cache.ttl option.
|
|
198
|
-
*/
|
|
199
|
-
set<TReturn>(cache: Cache<TReturn>, key: string, value: TReturn, ttl?: DurationLike): Promise<void>;
|
|
200
|
-
protected serialize<TReturn>(value: TReturn): Uint8Array;
|
|
201
|
-
protected deserialize<TReturn>(uint8Array: Uint8Array): Promise<TReturn>;
|
|
202
|
-
}
|
|
203
|
-
interface Cache<TReturn = any, TParameter extends any[] = any[]> {
|
|
204
|
-
name: string;
|
|
205
|
-
options: CacheDescriptorOptions<TReturn, TParameter>;
|
|
136
|
+
keys(name: string, filter?: string): Promise<string[]>;
|
|
206
137
|
}
|
|
207
138
|
//#endregion
|
|
208
139
|
//#region src/index.d.ts
|
|
209
|
-
// ---------------------------------------------------------------------------------------------------------------------
|
|
210
140
|
/**
|
|
211
|
-
* Alepha
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
* @
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
141
|
+
* Provides high-performance caching capabilities for Alepha applications with configurable TTL and multiple storage backends.
|
|
142
|
+
*
|
|
143
|
+
* The cache module enables declarative caching through the `$cache` descriptor, allowing you to cache method results,
|
|
144
|
+
* API responses, or computed values with automatic invalidation and type safety. It supports both in-memory and
|
|
145
|
+
* persistent storage backends for different performance and durability requirements.
|
|
146
|
+
*
|
|
147
|
+
* @see {@link $cache}
|
|
148
|
+
* @see {@link CacheProvider}
|
|
149
|
+
* @module alepha.cache
|
|
150
|
+
*/
|
|
151
|
+
declare const AlephaCache: _alepha_core0.ModuleDescriptor;
|
|
152
|
+
//# sourceMappingURL=index.d.ts.map
|
|
153
|
+
|
|
223
154
|
//#endregion
|
|
224
|
-
export { $cache, AlephaCache,
|
|
155
|
+
export { $cache, AlephaCache, CacheDescriptor, CacheDescriptorFn, CacheDescriptorOptions, CacheProvider, MemoryCacheProvider };
|
|
225
156
|
//# sourceMappingURL=index.d.ts.map
|
package/command.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _alepha_core0$1 from "alepha";
|
|
2
|
+
import * as _alepha_core0 from "alepha";
|
|
3
|
+
import { Alepha, AlephaError, Async, Descriptor, KIND, Logger, Static, TObject, TSchema } from "alepha";
|
|
2
4
|
import * as fs from "node:fs/promises";
|
|
3
5
|
import { glob } from "node:fs/promises";
|
|
6
|
+
import * as _sinclair_typebox0 from "@sinclair/typebox";
|
|
4
7
|
|
|
5
8
|
//#region src/helpers/Runner.d.ts
|
|
6
9
|
type Task = {
|
|
@@ -23,105 +26,97 @@ declare class Runner {
|
|
|
23
26
|
constructor(log: Logger);
|
|
24
27
|
protected exec(cmd: string): Promise<string>;
|
|
25
28
|
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
* Executes one or more tasks.
|
|
30
|
+
*
|
|
31
|
+
* @param task - A single task or an array of tasks to run in parallel.
|
|
32
|
+
*/
|
|
30
33
|
protected execute(task: Task | Task[]): Promise<string>;
|
|
31
34
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
* Prints a summary of all executed tasks and their durations.
|
|
36
|
+
*/
|
|
34
37
|
summary(): void;
|
|
35
38
|
protected executeTask(task: Task): Promise<string>;
|
|
36
39
|
protected renderTable(data: string[][]): void;
|
|
37
40
|
}
|
|
38
41
|
//#endregion
|
|
39
42
|
//#region src/descriptors/$command.d.ts
|
|
40
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Declares a CLI command.
|
|
45
|
+
*
|
|
46
|
+
* This descriptor allows you to define a command, its flags, and its handler
|
|
47
|
+
* within your Alepha application structure.
|
|
48
|
+
*/
|
|
49
|
+
declare const $command: {
|
|
50
|
+
<T extends TObject>(options: CommandDescriptorOptions<T>): CommandDescriptor<T>;
|
|
51
|
+
[KIND]: typeof CommandDescriptor;
|
|
52
|
+
};
|
|
41
53
|
interface CommandDescriptorOptions<T extends TObject> {
|
|
42
54
|
/**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
handler: (args:
|
|
46
|
-
flags: Static<T>;
|
|
47
|
-
run: RunnerMethod;
|
|
48
|
-
glob: typeof glob;
|
|
49
|
-
fs: typeof fs;
|
|
50
|
-
}) => Async<void>;
|
|
55
|
+
* The handler function to execute when the command is matched.
|
|
56
|
+
*/
|
|
57
|
+
handler: (args: CommandHandlerArgs<T>) => Async<void>;
|
|
51
58
|
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
59
|
+
* The name of the command. If omitted, the property key is used.
|
|
60
|
+
*
|
|
61
|
+
* An empty string "" denotes the root command.
|
|
62
|
+
*/
|
|
56
63
|
name?: string;
|
|
57
64
|
/**
|
|
58
|
-
|
|
59
|
-
|
|
65
|
+
* A short description of the command, shown in the help message.
|
|
66
|
+
*/
|
|
60
67
|
description?: string;
|
|
61
68
|
/**
|
|
62
|
-
|
|
63
|
-
|
|
69
|
+
* An array of alternative names for the command.
|
|
70
|
+
*/
|
|
64
71
|
aliases?: string[];
|
|
65
72
|
/**
|
|
66
|
-
|
|
67
|
-
|
|
73
|
+
* A TypeBox object schema defining the flags for the command.
|
|
74
|
+
*/
|
|
68
75
|
flags?: T;
|
|
69
76
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
[
|
|
73
|
-
|
|
74
|
-
* Executes the command. This is a placeholder and will be replaced by the provider.
|
|
75
|
-
*/
|
|
76
|
-
(flags: Static<T>): Promise<void>;
|
|
77
|
+
declare class CommandDescriptor<T extends TObject = TObject> extends Descriptor<CommandDescriptorOptions<T>> {
|
|
78
|
+
readonly flags: TObject<{}>;
|
|
79
|
+
readonly aliases: string[];
|
|
80
|
+
get name(): string;
|
|
77
81
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
<T extends TObject>(options: CommandDescriptorOptions<T>): CommandDescriptor<T>;
|
|
86
|
-
[KIND]: string;
|
|
87
|
-
};
|
|
82
|
+
interface CommandHandlerArgs<T extends TObject> {
|
|
83
|
+
flags: Static<T>;
|
|
84
|
+
run: RunnerMethod;
|
|
85
|
+
glob: typeof glob;
|
|
86
|
+
fs: typeof fs;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=$command.d.ts.map
|
|
88
89
|
//#endregion
|
|
89
90
|
//#region src/errors/CommandError.d.ts
|
|
90
91
|
declare class CommandError extends AlephaError {}
|
|
92
|
+
//# sourceMappingURL=CommandError.d.ts.map
|
|
91
93
|
//#endregion
|
|
92
|
-
//#region src/providers/
|
|
93
|
-
interface Command {
|
|
94
|
-
key: string;
|
|
95
|
-
name: string;
|
|
96
|
-
description?: string;
|
|
97
|
-
aliases: string[];
|
|
98
|
-
flags: TObject<TProperties>;
|
|
99
|
-
handler: (flags: any) => Promise<void>;
|
|
100
|
-
}
|
|
94
|
+
//#region src/providers/CliProvider.d.ts
|
|
101
95
|
declare const envSchema: TObject<{
|
|
102
|
-
CLI_NAME: TString;
|
|
103
|
-
CLI_DESCRIPTION: TString;
|
|
96
|
+
CLI_NAME: _alepha_core0$1.TString;
|
|
97
|
+
CLI_DESCRIPTION: _alepha_core0$1.TString;
|
|
104
98
|
}>;
|
|
105
99
|
declare module "alepha" {
|
|
106
100
|
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
107
101
|
}
|
|
108
|
-
declare class
|
|
102
|
+
declare class CliProvider {
|
|
109
103
|
protected readonly env: Static<typeof envSchema>;
|
|
110
104
|
protected readonly alepha: Alepha;
|
|
111
105
|
protected readonly log: Logger;
|
|
112
|
-
protected commands: Command[];
|
|
113
106
|
options: {
|
|
114
107
|
name: string;
|
|
115
108
|
description: string;
|
|
116
109
|
argv: string[];
|
|
117
110
|
};
|
|
118
|
-
protected readonly globalFlags:
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
111
|
+
protected readonly globalFlags: {
|
|
112
|
+
help: {
|
|
113
|
+
aliases: string[];
|
|
114
|
+
description: string;
|
|
115
|
+
schema: _sinclair_typebox0.TBoolean;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
protected readonly onReady: _alepha_core0$1.HookDescriptor<"ready">;
|
|
119
|
+
get commands(): CommandDescriptor<any>[];
|
|
125
120
|
private findCommand;
|
|
126
121
|
protected parseCommandFlags(argv: string[], schema: TObject): Record<string, any>;
|
|
127
122
|
protected parseFlags(argv: string[], flagDefs: {
|
|
@@ -135,20 +130,18 @@ declare class CommandDescriptorProvider {
|
|
|
135
130
|
}
|
|
136
131
|
//#endregion
|
|
137
132
|
//#region src/index.d.ts
|
|
138
|
-
// ---------------------------------------------------------------------------------------------------------------------
|
|
139
133
|
/**
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
* @see {@link $command}
|
|
146
|
-
* @module alepha.command
|
|
147
|
-
*/
|
|
148
|
-
declare
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
134
|
+
* This module provides a powerful way to build command-line interfaces
|
|
135
|
+
* directly within your Alepha application, using declarative descriptors.
|
|
136
|
+
*
|
|
137
|
+
* It allows you to define commands using the `$command` descriptor.
|
|
138
|
+
*
|
|
139
|
+
* @see {@link $command}
|
|
140
|
+
* @module alepha.command
|
|
141
|
+
*/
|
|
142
|
+
declare const AlephaCommand: _alepha_core0.ModuleDescriptor;
|
|
143
|
+
//# sourceMappingURL=index.d.ts.map
|
|
144
|
+
|
|
152
145
|
//#endregion
|
|
153
|
-
export { $command, AlephaCommand, CommandDescriptor, CommandDescriptorOptions,
|
|
146
|
+
export { $command, AlephaCommand, CliProvider, CommandDescriptor, CommandDescriptorOptions, CommandError, CommandHandlerArgs, Runner, RunnerMethod, Task };
|
|
154
147
|
//# sourceMappingURL=index.d.ts.map
|