alepha 0.11.9 → 0.11.10

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.
Files changed (166) hide show
  1. package/README.md +55 -17
  2. package/dist/index.cjs +15805 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +1 -0
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.js +15804 -0
  7. package/dist/index.js.map +1 -0
  8. package/package.json +36 -365
  9. package/src/assets/biomeJson.ts +33 -0
  10. package/src/assets/tsconfigJson.ts +17 -0
  11. package/src/assets/viteConfigTs.ts +14 -0
  12. package/src/commands/BiomeCommands.ts +60 -0
  13. package/src/commands/CoreCommands.ts +266 -0
  14. package/src/commands/DrizzleCommands.ts +403 -0
  15. package/src/commands/VerifyCommands.ts +48 -0
  16. package/src/commands/ViteCommands.ts +152 -0
  17. package/src/index.ts +35 -0
  18. package/src/services/ProcessRunner.ts +89 -0
  19. package/src/version.ts +7 -0
  20. package/api/files.cjs +0 -8
  21. package/api/files.d.ts +0 -438
  22. package/api/files.js +0 -1
  23. package/api/jobs.cjs +0 -8
  24. package/api/jobs.d.ts +0 -327
  25. package/api/jobs.js +0 -1
  26. package/api/notifications.cjs +0 -8
  27. package/api/notifications.d.ts +0 -263
  28. package/api/notifications.js +0 -1
  29. package/api/users.cjs +0 -8
  30. package/api/users.d.ts +0 -923
  31. package/api/users.js +0 -1
  32. package/api/verifications.cjs +0 -8
  33. package/api/verifications.d.ts +0 -1
  34. package/api/verifications.js +0 -1
  35. package/batch.cjs +0 -8
  36. package/batch.d.ts +0 -154
  37. package/batch.js +0 -1
  38. package/bucket.cjs +0 -8
  39. package/bucket.d.ts +0 -520
  40. package/bucket.js +0 -1
  41. package/cache/redis.cjs +0 -8
  42. package/cache/redis.d.ts +0 -40
  43. package/cache/redis.js +0 -1
  44. package/cache.cjs +0 -8
  45. package/cache.d.ts +0 -288
  46. package/cache.js +0 -1
  47. package/command.cjs +0 -8
  48. package/command.d.ts +0 -269
  49. package/command.js +0 -1
  50. package/core.cjs +0 -8
  51. package/core.d.ts +0 -1904
  52. package/core.js +0 -1
  53. package/datetime.cjs +0 -8
  54. package/datetime.d.ts +0 -144
  55. package/datetime.js +0 -1
  56. package/devtools.cjs +0 -8
  57. package/devtools.d.ts +0 -252
  58. package/devtools.js +0 -1
  59. package/email.cjs +0 -8
  60. package/email.d.ts +0 -187
  61. package/email.js +0 -1
  62. package/fake.cjs +0 -8
  63. package/fake.d.ts +0 -73
  64. package/fake.js +0 -1
  65. package/file.cjs +0 -8
  66. package/file.d.ts +0 -528
  67. package/file.js +0 -1
  68. package/lock/redis.cjs +0 -8
  69. package/lock/redis.d.ts +0 -24
  70. package/lock/redis.js +0 -1
  71. package/lock.cjs +0 -8
  72. package/lock.d.ts +0 -552
  73. package/lock.js +0 -1
  74. package/logger.cjs +0 -8
  75. package/logger.d.ts +0 -287
  76. package/logger.js +0 -1
  77. package/postgres.cjs +0 -8
  78. package/postgres.d.ts +0 -2143
  79. package/postgres.js +0 -1
  80. package/queue/redis.cjs +0 -8
  81. package/queue/redis.d.ts +0 -29
  82. package/queue/redis.js +0 -1
  83. package/queue.cjs +0 -8
  84. package/queue.d.ts +0 -760
  85. package/queue.js +0 -1
  86. package/react/auth.cjs +0 -8
  87. package/react/auth.d.ts +0 -504
  88. package/react/auth.js +0 -1
  89. package/react/form.cjs +0 -8
  90. package/react/form.d.ts +0 -211
  91. package/react/form.js +0 -1
  92. package/react/head.cjs +0 -8
  93. package/react/head.d.ts +0 -120
  94. package/react/head.js +0 -1
  95. package/react/i18n.cjs +0 -8
  96. package/react/i18n.d.ts +0 -168
  97. package/react/i18n.js +0 -1
  98. package/react.cjs +0 -8
  99. package/react.d.ts +0 -1263
  100. package/react.js +0 -1
  101. package/redis.cjs +0 -8
  102. package/redis.d.ts +0 -82
  103. package/redis.js +0 -1
  104. package/retry.cjs +0 -8
  105. package/retry.d.ts +0 -162
  106. package/retry.js +0 -1
  107. package/router.cjs +0 -8
  108. package/router.d.ts +0 -45
  109. package/router.js +0 -1
  110. package/scheduler.cjs +0 -8
  111. package/scheduler.d.ts +0 -145
  112. package/scheduler.js +0 -1
  113. package/security.cjs +0 -8
  114. package/security.d.ts +0 -586
  115. package/security.js +0 -1
  116. package/server/cache.cjs +0 -8
  117. package/server/cache.d.ts +0 -163
  118. package/server/cache.js +0 -1
  119. package/server/compress.cjs +0 -8
  120. package/server/compress.d.ts +0 -38
  121. package/server/compress.js +0 -1
  122. package/server/cookies.cjs +0 -8
  123. package/server/cookies.d.ts +0 -144
  124. package/server/cookies.js +0 -1
  125. package/server/cors.cjs +0 -8
  126. package/server/cors.d.ts +0 -45
  127. package/server/cors.js +0 -1
  128. package/server/health.cjs +0 -8
  129. package/server/health.d.ts +0 -58
  130. package/server/health.js +0 -1
  131. package/server/helmet.cjs +0 -8
  132. package/server/helmet.d.ts +0 -98
  133. package/server/helmet.js +0 -1
  134. package/server/links.cjs +0 -8
  135. package/server/links.d.ts +0 -322
  136. package/server/links.js +0 -1
  137. package/server/metrics.cjs +0 -8
  138. package/server/metrics.d.ts +0 -35
  139. package/server/metrics.js +0 -1
  140. package/server/multipart.cjs +0 -8
  141. package/server/multipart.d.ts +0 -42
  142. package/server/multipart.js +0 -1
  143. package/server/proxy.cjs +0 -8
  144. package/server/proxy.d.ts +0 -234
  145. package/server/proxy.js +0 -1
  146. package/server/security.cjs +0 -8
  147. package/server/security.d.ts +0 -92
  148. package/server/security.js +0 -1
  149. package/server/static.cjs +0 -8
  150. package/server/static.d.ts +0 -119
  151. package/server/static.js +0 -1
  152. package/server/swagger.cjs +0 -8
  153. package/server/swagger.d.ts +0 -161
  154. package/server/swagger.js +0 -1
  155. package/server.cjs +0 -8
  156. package/server.d.ts +0 -849
  157. package/server.js +0 -1
  158. package/topic/redis.cjs +0 -8
  159. package/topic/redis.d.ts +0 -42
  160. package/topic/redis.js +0 -1
  161. package/topic.cjs +0 -8
  162. package/topic.d.ts +0 -819
  163. package/topic.js +0 -1
  164. package/vite.cjs +0 -8
  165. package/vite.d.ts +0 -186
  166. package/vite.js +0 -1
package/cache.d.ts DELETED
@@ -1,288 +0,0 @@
1
- import * as _alepha_core0 from "alepha";
2
- import { Descriptor, InstantiableClass, KIND } from "alepha";
3
- import { DateTimeProvider, DurationLike, Timeout } from "alepha/datetime";
4
- import * as _alepha_logger0 from "alepha/logger";
5
-
6
- //#region src/providers/CacheProvider.d.ts
7
- /**
8
- * Cache provider interface.
9
- *
10
- * All methods are asynchronous and return promises.
11
- * Values are stored as Uint8Array.
12
- */
13
- declare abstract class CacheProvider {
14
- /**
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
- */
22
- abstract get(name: string, key: string): Promise<Uint8Array | undefined>;
23
- /**
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
- */
33
- abstract set(name: string, key: string, value: Uint8Array, ttl?: number): Promise<Uint8Array>;
34
- /**
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
- */
40
- abstract del(name: string, ...keys: string[]): Promise<void>;
41
- abstract has(name: string, key: string): Promise<boolean>;
42
- abstract keys(name: string, filter?: string): Promise<string[]>;
43
- /**
44
- * Remove all keys from all cache names.
45
- */
46
- abstract clear(): Promise<void>;
47
- }
48
- //#endregion
49
- //#region src/descriptors/$cache.d.ts
50
- /**
51
- * Creates a cache descriptor for high-performance data caching with automatic cache management.
52
- *
53
- * This descriptor provides a powerful caching layer that can significantly improve application performance
54
- * by storing frequently accessed data in memory or external cache stores like Redis. It supports both
55
- * function result caching and manual cache operations with intelligent serialization and TTL management.
56
- *
57
- * **Key Features**
58
- *
59
- * - **Function Result Caching**: Automatically cache function results based on input parameters
60
- * - **Multiple Storage Backends**: Support for in-memory, Redis, and custom cache providers
61
- * - **Intelligent Serialization**: Automatic handling of JSON, strings, and binary data
62
- * - **TTL Management**: Configurable time-to-live with automatic expiration
63
- * - **Cache Invalidation**: Pattern-based cache invalidation with wildcard support
64
- * - **Environment Controls**: Enable/disable caching via environment variables
65
- * - **Type Safety**: Full TypeScript support with generic type parameters
66
- *
67
- * ## Cache Strategies
68
- *
69
- * ### 1. Function Result Caching (Memoization)
70
- * Automatically cache the results of expensive operations based on input parameters.
71
- *
72
- * ### 2. Manual Cache Operations
73
- * Direct cache operations for custom caching logic and data storage.
74
- *
75
- * ## Storage Backends
76
- *
77
- * - **Memory**: Fast in-memory cache (default for development)
78
- * - **Redis**: Distributed cache for production environments
79
- * - **Custom Providers**: Implement your own cache storage backend
80
- *
81
- * @example
82
- * **Basic function result caching:**
83
- * ```ts
84
- * import { $cache } from "alepha/cache";
85
- *
86
- * class DataService {
87
- * // Cache expensive database queries
88
- * getUserData = $cache({
89
- * name: "user-data",
90
- * ttl: [10, "minutes"],
91
- * handler: async (userId: string) => {
92
- * // Expensive database operation
93
- * return await database.users.findById(userId);
94
- * }
95
- * });
96
- *
97
- * async getUser(id: string) {
98
- * // This will hit cache on subsequent calls with same ID
99
- * return await this.getUserData(id);
100
- * }
101
- * }
102
- * ```
103
- *
104
- * @example
105
- * **API response caching with custom key generation:**
106
- * ```ts
107
- * class ApiService {
108
- * fetchUserPosts = $cache({
109
- * name: "user-posts",
110
- * ttl: [5, "minutes"],
111
- * key: (userId: string, page: number) => `${userId}:page:${page}`,
112
- * handler: async (userId: string, page: number = 1) => {
113
- * const response = await fetch(`/api/users/${userId}/posts?page=${page}`);
114
- * return await response.json();
115
- * }
116
- * });
117
- * }
118
- * ```
119
- *
120
- * @example
121
- * **Manual cache operations for custom logic:**
122
- * ```ts
123
- * class SessionService {
124
- * sessionCache = $cache<UserSession>({
125
- * name: "user-sessions",
126
- * ttl: [1, "hour"],
127
- * provider: "memory" // Use memory cache for sessions
128
- * });
129
- *
130
- * async storeSession(sessionId: string, session: UserSession) {
131
- * await this.sessionCache.set(sessionId, session);
132
- * }
133
- *
134
- * async getSession(sessionId: string): Promise<UserSession | undefined> {
135
- * return await this.sessionCache.get(sessionId);
136
- * }
137
- *
138
- * async invalidateUserSessions(userId: string) {
139
- * // Invalidate all sessions for a user using wildcards
140
- * await this.sessionCache.invalidate(`user:${userId}:*`);
141
- * }
142
- * }
143
- * ```
144
- *
145
- * @example
146
- * **Redis-backed caching for production:**
147
- * ```ts
148
- * class ProductService {
149
- * productCache = $cache({
150
- * name: "products",
151
- * ttl: [1, "hour"],
152
- * provider: RedisCacheProvider, // Use Redis for distributed caching
153
- * handler: async (productId: string) => {
154
- * return await this.database.products.findById(productId);
155
- * }
156
- * });
157
- *
158
- * async invalidateProduct(productId: string) {
159
- * await this.productCache.invalidate(productId);
160
- * }
161
- *
162
- * async invalidateAllProducts() {
163
- * await this.productCache.invalidate("*");
164
- * }
165
- * }
166
- * ```
167
- *
168
- * @example
169
- * **Conditional caching with environment controls:**
170
- * ```ts
171
- * class ExpensiveService {
172
- * computation = $cache({
173
- * name: "heavy-computation",
174
- * ttl: [1, "day"],
175
- * disabled: process.env.NODE_ENV === "development", // Disable in dev
176
- * handler: async (input: ComplexInput) => {
177
- * // Very expensive computation that should be cached in production
178
- * return await performHeavyComputation(input);
179
- * }
180
- * });
181
- * }
182
- * ```
183
- */
184
- declare const $cache: {
185
- <TReturn = string, TParameter extends any[] = any[]>(options?: CacheDescriptorOptions<TReturn, TParameter>): CacheDescriptorFn<TReturn, TParameter>;
186
- [KIND]: typeof CacheDescriptor;
187
- };
188
- interface CacheDescriptorOptions<TReturn = any, TParameter extends any[] = any[]> {
189
- /**
190
- * The cache name. This is useful for invalidating multiple caches at once.
191
- *
192
- * Store key as `cache:$name:$key`.
193
- *
194
- * @default Name of the key of the class.
195
- */
196
- name?: string;
197
- /**
198
- * Function which returns cached data.
199
- */
200
- handler?: (...args: TParameter) => TReturn;
201
- /**
202
- * The key generator for the cache.
203
- * If not provided, the arguments will be json.stringify().
204
- */
205
- key?: (...args: TParameter) => string;
206
- /**
207
- * The store provider for the cache.
208
- * If not provided, the default store provider will be used.
209
- */
210
- provider?: InstantiableClass<CacheProvider> | "memory";
211
- /**
212
- * The time-to-live for the cache in seconds.
213
- * Set 0 to skip expiration.
214
- *
215
- * @default 300 (5 minutes).
216
- */
217
- ttl?: DurationLike;
218
- /**
219
- * If the cache is disabled.
220
- */
221
- disabled?: boolean;
222
- }
223
- declare class CacheDescriptor<TReturn = any, TParameter extends any[] = any[]> extends Descriptor<CacheDescriptorOptions<TReturn, TParameter>> {
224
- protected readonly env: {
225
- CACHE_ENABLED: boolean;
226
- CACHE_DEFAULT_TTL: number;
227
- };
228
- protected readonly dateTimeProvider: DateTimeProvider;
229
- protected readonly provider: CacheProvider;
230
- protected encoder: TextEncoder;
231
- protected decoder: TextDecoder;
232
- protected codes: {
233
- BINARY: number;
234
- JSON: number;
235
- STRING: number;
236
- };
237
- get container(): string;
238
- run(...args: TParameter): Promise<TReturn>;
239
- key(...args: TParameter): string;
240
- invalidate(...keys: string[]): Promise<void>;
241
- set(key: string, value: TReturn, ttl?: DurationLike): Promise<void>;
242
- get(key: string): Promise<TReturn | undefined>;
243
- protected serialize<TReturn>(value: TReturn): Uint8Array;
244
- protected deserialize<TReturn>(uint8Array: Uint8Array): Promise<TReturn>;
245
- protected $provider(): CacheProvider;
246
- }
247
- interface CacheDescriptorFn<TReturn = any, TParameter extends any[] = any[]> extends CacheDescriptor<TReturn, TParameter> {
248
- /**
249
- * Run the cache descriptor with the provided arguments.
250
- */
251
- (...args: TParameter): Promise<TReturn>;
252
- }
253
- //#endregion
254
- //#region src/providers/MemoryCacheProvider.d.ts
255
- type CacheName = string;
256
- type CacheKey = string;
257
- type CacheValue = {
258
- data?: Uint8Array;
259
- timeout?: Timeout;
260
- };
261
- declare class MemoryCacheProvider implements CacheProvider {
262
- protected readonly dateTimeProvider: DateTimeProvider;
263
- protected readonly log: _alepha_logger0.Logger;
264
- protected store: Record<CacheName, Record<CacheKey, CacheValue>>;
265
- get(name: string, key: string): Promise<Uint8Array | undefined>;
266
- set(name: string, key: string, value: Uint8Array, ttl?: number): Promise<Uint8Array>;
267
- del(name: string, ...keys: string[]): Promise<void>;
268
- has(name: string, key: string): Promise<boolean>;
269
- keys(name: string, filter?: string): Promise<string[]>;
270
- clear(): Promise<void>;
271
- }
272
- //#endregion
273
- //#region src/index.d.ts
274
- /**
275
- * Provides high-performance caching capabilities for Alepha applications with configurable TTL and multiple storage backends.
276
- *
277
- * The cache module enables declarative caching through the `$cache` descriptor, allowing you to cache method results,
278
- * API responses, or computed values with automatic invalidation and type safety. It supports both in-memory and
279
- * persistent storage backends for different performance and durability requirements.
280
- *
281
- * @see {@link $cache}
282
- * @see {@link CacheProvider}
283
- * @module alepha.cache
284
- */
285
- declare const AlephaCache: _alepha_core0.Service<_alepha_core0.Module>;
286
- //#endregion
287
- export { $cache, AlephaCache, CacheDescriptor, CacheDescriptorFn, CacheDescriptorOptions, CacheProvider, MemoryCacheProvider };
288
- //# sourceMappingURL=index.d.ts.map
package/cache.js DELETED
@@ -1 +0,0 @@
1
- export * from '@alepha/cache'
package/command.cjs DELETED
@@ -1,8 +0,0 @@
1
- 'use strict';
2
- var m = require('@alepha/command');
3
- Object.keys(m).forEach(function (k) {
4
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
5
- enumerable: true,
6
- get: function () { return m[k]; }
7
- });
8
- });
package/command.d.ts DELETED
@@ -1,269 +0,0 @@
1
- import * as _alepha_core1 from "alepha";
2
- import { Alepha, AlephaError, Async, Descriptor, KIND, Static, TObject, TSchema, TString } from "alepha";
3
- import * as _alepha_logger0 from "alepha/logger";
4
- import * as fs from "node:fs/promises";
5
- import { glob } from "node:fs/promises";
6
- import * as readline_promises0 from "readline/promises";
7
- import * as typebox0 from "typebox";
8
-
9
- //#region src/helpers/Asker.d.ts
10
- interface AskOptions<T extends TSchema = TString> {
11
- /**
12
- * Response schema expected.
13
- *
14
- * Recommended schemas:
15
- * - t.text() - for free text input
16
- * - t.number() - for numeric input
17
- * - t.boolean() - for yes/no input (accepts "true", "false", "1", "0")
18
- * - t.enum(["option1", "option2"]) - for predefined options
19
- *
20
- * You can use schema.default to provide a default value.
21
- *
22
- * @example
23
- * ```ts
24
- * ask("What is your name?", { schema: t.text({ default: "John Doe" }) })
25
- * ```
26
- *
27
- * @default TString
28
- */
29
- schema?: T;
30
- /**
31
- * Custom validation function.
32
- * Throws an AlephaError in case of validation failure.
33
- */
34
- validate?: (value: Static<T>) => void;
35
- }
36
- interface AskMethod {
37
- <T extends TSchema = TString>(question: string, options?: AskOptions<T>): Promise<Static<T>>;
38
- }
39
- declare class Asker {
40
- protected readonly log: _alepha_logger0.Logger;
41
- readonly ask: AskMethod;
42
- protected readonly alepha: Alepha;
43
- constructor();
44
- protected createAskMethod(): AskMethod;
45
- protected prompt<T extends TSchema = TString>(question: string, options: AskOptions<T>): Promise<Static<T>>;
46
- protected createPromptInterface(): readline_promises0.Interface;
47
- }
48
- //#endregion
49
- //#region src/helpers/Runner.d.ts
50
- type Task = {
51
- name: string;
52
- handler: () => any;
53
- };
54
- interface Timer {
55
- name: string;
56
- duration: string;
57
- }
58
- interface RunOptions {
59
- /**
60
- * Rename the command for logging purposes.
61
- */
62
- alias?: string;
63
- }
64
- interface RunnerMethod {
65
- (cmd: string | Task | Array<string | Task>, options?: RunOptions | (() => any)): Promise<string>;
66
- rm: (glob: string | string[], options?: RunOptions) => Promise<string>;
67
- cp: (source: string, dest: string, options?: RunOptions) => Promise<string>;
68
- }
69
- declare class Runner {
70
- protected readonly log: _alepha_logger0.Logger;
71
- protected readonly timers: Timer[];
72
- protected readonly startTime: number;
73
- readonly run: RunnerMethod;
74
- constructor();
75
- protected createRunMethod(): RunnerMethod;
76
- protected exec(cmd: string): Promise<string>;
77
- /**
78
- * Executes one or more tasks.
79
- *
80
- * @param task - A single task or an array of tasks to run in parallel.
81
- */
82
- protected execute(task: Task | Task[]): Promise<string>;
83
- /**
84
- * Prints a summary of all executed tasks and their durations.
85
- */
86
- summary(): void;
87
- protected executeTask(task: Task): Promise<string>;
88
- protected renderTable(data: string[][]): void;
89
- }
90
- //#endregion
91
- //#region src/descriptors/$command.d.ts
92
- /**
93
- * Declares a CLI command.
94
- *
95
- * This descriptor allows you to define a command, its flags, and its handler
96
- * within your Alepha application structure.
97
- */
98
- declare const $command: {
99
- <T extends TObject, A extends TSchema>(options: CommandDescriptorOptions<T, A>): CommandDescriptor<T, A>;
100
- [KIND]: typeof CommandDescriptor;
101
- };
102
- interface CommandDescriptorOptions<T extends TObject, A extends TSchema> {
103
- /**
104
- * The handler function to execute when the command is matched.
105
- */
106
- handler: (args: CommandHandlerArgs<T, A>) => Async<void>;
107
- /**
108
- * The name of the command. If omitted, the property key is used.
109
- *
110
- * An empty string "" denotes the root command.
111
- */
112
- name?: string;
113
- /**
114
- * A short description of the command, shown in the help message.
115
- */
116
- description?: string;
117
- /**
118
- * An array of alternative names for the command.
119
- */
120
- aliases?: string[];
121
- /**
122
- * A TypeBox object schema defining the flags for the command.
123
- */
124
- flags?: T;
125
- /**
126
- * An optional TypeBox schema defining the arguments for the command.
127
- *
128
- * @example
129
- * args: t.text()
130
- * my-cli command <arg1: string>
131
- *
132
- * args: t.optional(t.text())
133
- * my-cli command [arg1: string]
134
- *
135
- * args: t.tuple([t.text(), t.number()])
136
- * my-cli command <arg1: string> <arg2: number>
137
- *
138
- * args: t.tuple([t.text(), t.optional(t.number())])
139
- * my-cli command <arg1: string> [arg2: number]
140
- */
141
- args?: A;
142
- /**
143
- * If false, skip summary message at the end of the command execution.
144
- * Summary will display only if ({ run }) method calls were made.
145
- */
146
- summary?: boolean;
147
- /**
148
- * Marks this command as the root command.
149
- * Equivalent to setting name to an empty string "".
150
- */
151
- root?: boolean;
152
- }
153
- declare class CommandDescriptor<T extends TObject = TObject, A extends TSchema = TSchema> extends Descriptor<CommandDescriptorOptions<T, A>> {
154
- readonly flags: TObject<{}>;
155
- readonly aliases: string[];
156
- get name(): string;
157
- }
158
- interface CommandHandlerArgs<T extends TObject, A extends TSchema = TSchema> {
159
- flags: Static<T>;
160
- args: A extends TSchema ? Static<A> : Array<string>;
161
- run: RunnerMethod;
162
- ask: AskMethod;
163
- glob: typeof glob;
164
- fs: typeof fs;
165
- }
166
- //#endregion
167
- //#region src/errors/CommandError.d.ts
168
- declare class CommandError extends AlephaError {
169
- readonly name = "CommandError";
170
- }
171
- //#endregion
172
- //#region src/providers/CliProvider.d.ts
173
- declare const envSchema: TObject<{
174
- CLI_NAME: _alepha_core1.TString;
175
- CLI_DESCRIPTION: _alepha_core1.TString;
176
- }>;
177
- declare module "alepha" {
178
- interface Env extends Partial<Static<typeof envSchema>> {}
179
- }
180
- /**
181
- * CLI provider configuration atom
182
- */
183
- declare const cliOptions: _alepha_core1.Atom<TObject<{
184
- name: typebox0.TOptional<_alepha_core1.TString>;
185
- description: typebox0.TOptional<_alepha_core1.TString>;
186
- argv: typebox0.TOptional<typebox0.TArray<_alepha_core1.TString>>;
187
- }>, "alepha.command.cli.options">;
188
- type CliProviderOptions = Static<typeof cliOptions.schema>;
189
- declare module "alepha" {
190
- interface State {
191
- [cliOptions.key]: CliProviderOptions;
192
- }
193
- }
194
- declare class CliProvider {
195
- protected readonly env: {
196
- CLI_NAME: string;
197
- CLI_DESCRIPTION: string;
198
- };
199
- protected readonly alepha: Alepha;
200
- protected readonly log: _alepha_logger0.Logger;
201
- protected readonly runner: Runner;
202
- protected readonly asker: Asker;
203
- protected readonly options: Readonly<{
204
- description?: string | undefined;
205
- name?: string | undefined;
206
- argv?: string[] | undefined;
207
- }>;
208
- protected get name(): string;
209
- protected get description(): string;
210
- protected get argv(): string[];
211
- protected readonly globalFlags: {
212
- help: {
213
- aliases: string[];
214
- description: string;
215
- schema: typebox0.TBoolean;
216
- };
217
- };
218
- protected readonly onReady: _alepha_core1.HookDescriptor<"ready">;
219
- get commands(): CommandDescriptor<any>[];
220
- private findCommand;
221
- /**
222
- * Get all global flags including those from the root command (name === "")
223
- */
224
- protected getAllGlobalFlags(): Record<string, {
225
- aliases: string[];
226
- description?: string;
227
- schema: TSchema;
228
- }>;
229
- protected parseCommandFlags(argv: string[], schema: TObject): Record<string, any>;
230
- protected parseFlags(argv: string[], flagDefs: {
231
- key: string;
232
- aliases: string[];
233
- schema: TSchema;
234
- }[]): Record<string, any>;
235
- protected parseCommandArgs(argv: string[], schema?: TSchema): any;
236
- protected parseArgumentValue(value: string, schema: TSchema): any;
237
- protected generateArgsUsage(schema?: TSchema): string;
238
- protected getTypeName(schema: TSchema): string;
239
- printHelp(command?: CommandDescriptor<any>): void;
240
- private getMaxCmdLength;
241
- private getMaxFlagLength;
242
- }
243
- //#endregion
244
- //#region src/index.d.ts
245
- /**
246
- * This module provides a powerful way to build command-line interfaces
247
- * directly within your Alepha application, using declarative descriptors.
248
- *
249
- * It allows you to define commands using the `$command` descriptor.
250
- *
251
- * @see {@link $command}
252
- * @module alepha.command
253
- */
254
- declare const AlephaCommand: _alepha_core1.Service<_alepha_core1.Module>;
255
- declare module "typebox" {
256
- interface StringOptions {
257
- /**
258
- * Additional aliases for the flags.
259
- *
260
- * @module alepha.command
261
- */
262
- aliases?: string[];
263
- }
264
- }
265
- //# sourceMappingURL=index.d.ts.map
266
-
267
- //#endregion
268
- export { $command, AlephaCommand, AskMethod, AskOptions, Asker, CliProvider, CliProviderOptions, CommandDescriptor, CommandDescriptorOptions, CommandError, CommandHandlerArgs, RunOptions, Runner, RunnerMethod, Task, cliOptions };
269
- //# sourceMappingURL=index.d.ts.map
package/command.js DELETED
@@ -1 +0,0 @@
1
- export * from '@alepha/command'
package/core.cjs DELETED
@@ -1,8 +0,0 @@
1
- 'use strict';
2
- var m = require('@alepha/core');
3
- Object.keys(m).forEach(function (k) {
4
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
5
- enumerable: true,
6
- get: function () { return m[k]; }
7
- });
8
- });