@guren/server 2.1.0 → 2.2.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/dist/{McpServiceProvider-7BB5FPF3.js → McpServiceProvider-GRDYNEQG.js} +1 -1
- package/dist/auth/AuthManager.d.ts +30 -0
- package/dist/auth/AuthenticatableModel.d.ts +25 -0
- package/dist/auth/RequestAuthContext.d.ts +24 -0
- package/dist/auth/SessionGuard.d.ts +31 -0
- package/dist/auth/api-token.d.ts +299 -0
- package/dist/auth/email-verification.d.ts +203 -0
- package/dist/auth/index.d.ts +18 -110
- package/dist/auth/index.js +3 -1
- package/dist/auth/oauth/index.d.ts +239 -0
- package/dist/auth/password/DefaultHasher.d.ts +13 -0
- package/dist/auth/password/NodeHasher.d.ts +22 -0
- package/dist/auth/password/PasswordHasher.d.ts +5 -0
- package/dist/auth/password/ScryptHasher.d.ts +26 -0
- package/dist/auth/password-reset.d.ts +91 -0
- package/dist/auth/providers/ModelUserProvider.d.ts +36 -0
- package/dist/auth/providers/UserProvider.d.ts +9 -0
- package/dist/auth/types.d.ts +102 -0
- package/dist/auth/utils.d.ts +39 -0
- package/dist/{Gate-CynjZCtS.d.ts → authorization/Gate.d.ts} +30 -111
- package/dist/authorization/Policy.d.ts +77 -0
- package/dist/authorization/index.d.ts +5 -129
- package/dist/authorization/index.js +3 -1
- package/dist/authorization/middleware.d.ts +49 -0
- package/dist/authorization/types.d.ts +108 -0
- package/dist/broadcasting/BroadcastManager.d.ts +205 -0
- package/dist/broadcasting/channels/Channel.d.ts +28 -0
- package/dist/broadcasting/channels/PresenceChannel.d.ts +72 -0
- package/dist/broadcasting/channels/PrivateChannel.d.ts +32 -0
- package/dist/broadcasting/channels/index.d.ts +3 -0
- package/dist/broadcasting/drivers/MemoryDriver.d.ts +93 -0
- package/dist/broadcasting/drivers/RedisDriver.d.ts +112 -0
- package/dist/broadcasting/drivers/index.d.ts +2 -0
- package/dist/broadcasting/index.d.ts +6 -233
- package/dist/broadcasting/index.js +1 -1
- package/dist/broadcasting/typed.d.ts +23 -0
- package/dist/broadcasting/types.d.ts +155 -0
- package/dist/cache/CacheManager.d.ts +87 -0
- package/dist/cache/TaggedCache.d.ts +62 -0
- package/dist/cache/index.d.ts +6 -233
- package/dist/cache/index.js +1 -1
- package/dist/cache/stores/FileStore.d.ts +64 -0
- package/dist/cache/stores/MemoryStore.d.ts +52 -0
- package/dist/cache/stores/RedisStore.d.ts +53 -0
- package/dist/{CacheManager-BmDzUKrF.d.ts → cache/types.d.ts} +26 -99
- package/dist/{chunk-TVY72CLV.js → chunk-4VE3LYOM.js} +3 -2
- package/dist/{chunk-FZD2AKJI.js → chunk-7OB2YXRE.js} +56 -28
- package/dist/{chunk-HONCNQXZ.js → chunk-BUQXOZCT.js} +97 -10
- package/dist/{chunk-DSDX3ASM.js → chunk-CDZUNKI6.js} +65 -83
- package/dist/{chunk-CWI4AJ47.js → chunk-HPET6XY5.js} +13 -9
- package/dist/{chunk-A3ISJVEV.js → chunk-HR2KZ3WL.js} +23 -5
- package/dist/{chunk-EARA7JM4.js → chunk-PZKUDFMW.js} +11 -8
- package/dist/console/Command.d.ts +179 -0
- package/dist/{ConsoleKernel-CJg975mp.d.ts → console/ConsoleKernel.d.ts} +4 -6
- package/dist/console/Input.d.ts +140 -0
- package/dist/console/Output.d.ts +161 -0
- package/dist/console/index.d.ts +5 -0
- package/dist/console/types.d.ts +106 -0
- package/dist/container/Container.d.ts +148 -0
- package/dist/container/ServiceProvider.d.ts +103 -0
- package/dist/container/bindings.d.ts +55 -0
- package/dist/container/defineModule.d.ts +88 -0
- package/dist/container/definePlugin.d.ts +62 -0
- package/dist/container/index.d.ts +8 -0
- package/dist/container/types.d.ts +73 -0
- package/dist/database/Factory.d.ts +82 -0
- package/dist/database/Seeder.d.ts +35 -0
- package/dist/database/SeederRunner.d.ts +41 -0
- package/dist/database/index.d.ts +4 -0
- package/dist/database/types.d.ts +49 -0
- package/dist/discovery/AutoDiscovery.d.ts +113 -0
- package/dist/discovery/index.d.ts +2 -0
- package/dist/docs-viewer/DocsViewerServiceProvider.d.ts +12 -0
- package/dist/docs-viewer/endpoint.d.ts +19 -0
- package/dist/encryption/Encrypter.d.ts +96 -0
- package/dist/encryption/Hash.d.ts +69 -0
- package/dist/encryption/MessageSigner.d.ts +21 -0
- package/dist/encryption/Random.d.ts +119 -0
- package/dist/encryption/app-key.d.ts +12 -0
- package/dist/encryption/index.d.ts +10 -222
- package/dist/encryption/signed-url.d.ts +9 -0
- package/dist/encryption/types.d.ts +103 -0
- package/dist/errors/ExceptionHandler.d.ts +118 -0
- package/dist/errors/HttpException.d.ts +106 -0
- package/dist/errors/debug-page.d.ts +22 -0
- package/dist/errors/error-page.d.ts +1 -0
- package/dist/errors/exceptions/AuthenticationException.d.ts +32 -0
- package/dist/errors/exceptions/AuthorizationException.d.ts +32 -0
- package/dist/errors/exceptions/MethodNotAllowedException.d.ts +31 -0
- package/dist/errors/exceptions/NotFoundHttpException.d.ts +36 -0
- package/dist/errors/exceptions/ValidationException.d.ts +60 -0
- package/dist/errors/exceptions/index.d.ts +5 -0
- package/dist/errors/index.d.ts +5 -0
- package/dist/errors/types.d.ts +43 -0
- package/dist/events/Event.d.ts +33 -0
- package/dist/{EventManager-CmIoLt7r.d.ts → events/EventManager.d.ts} +4 -86
- package/dist/events/Listener.d.ts +79 -0
- package/dist/events/builtin.d.ts +73 -0
- package/dist/events/index.d.ts +6 -155
- package/dist/events/types.d.ts +48 -0
- package/dist/facades/index.d.ts +31 -0
- package/dist/health/HealthCheck.d.ts +34 -0
- package/dist/health/HealthManager.d.ts +53 -0
- package/dist/health/checks/CacheCheck.d.ts +35 -0
- package/dist/health/checks/CustomCheck.d.ts +23 -0
- package/dist/health/checks/DatabaseCheck.d.ts +33 -0
- package/dist/health/checks/MemoryCheck.d.ts +32 -0
- package/dist/health/checks/RedisCheck.d.ts +27 -0
- package/dist/health/checks/StorageCheck.d.ts +35 -0
- package/dist/health/checks/index.d.ts +12 -0
- package/dist/health/index.d.ts +5 -185
- package/dist/health/types.d.ts +52 -0
- package/dist/hot-reload/hot-disposables.d.ts +96 -0
- package/dist/hot-reload/testing.d.ts +14 -0
- package/dist/http/Application.d.ts +187 -0
- package/dist/http/FormRequest.d.ts +73 -0
- package/dist/http/dev-assets.d.ts +51 -0
- package/dist/http/dev-banner.d.ts +7 -0
- package/dist/http/inertia-assets.d.ts +22 -0
- package/dist/http/middleware/auth.d.ts +13 -0
- package/dist/http/middleware/capabilities.d.ts +22 -0
- package/dist/http/middleware/cors.d.ts +40 -0
- package/dist/http/middleware/csp.d.ts +59 -0
- package/dist/http/middleware/csrf.d.ts +121 -0
- package/dist/http/middleware/detect-locale.d.ts +65 -0
- package/dist/http/middleware/force-https.d.ts +34 -0
- package/dist/http/middleware/host-authorization.d.ts +24 -0
- package/dist/http/middleware/index.d.ts +19 -0
- package/dist/http/middleware/loopback-guard.d.ts +38 -0
- package/dist/{rate-limit-D9J2b4S1.d.ts → http/middleware/rate-limit.d.ts} +22 -50
- package/dist/http/middleware/redirect-safety.d.ts +29 -0
- package/dist/http/middleware/request-id.d.ts +19 -0
- package/dist/http/middleware/request-logging.d.ts +16 -0
- package/dist/http/middleware/security-headers.d.ts +49 -0
- package/dist/http/middleware/session.d.ts +93 -0
- package/dist/http/middleware/validation.d.ts +94 -0
- package/dist/http/public-assets.d.ts +15 -0
- package/dist/http/request.d.ts +24 -0
- package/dist/http/resources/CursorPaginator.d.ts +106 -0
- package/dist/http/resources/Paginator.d.ts +130 -0
- package/dist/http/resources/Resource.d.ts +67 -0
- package/dist/http/resources/ResourceCollection.d.ts +60 -0
- package/dist/http/resources/index.d.ts +6 -0
- package/dist/http/resources/types.d.ts +91 -0
- package/dist/http/validation/Validator.d.ts +128 -0
- package/dist/http/validation/index.d.ts +3 -0
- package/dist/http/validation/rules.d.ts +196 -0
- package/dist/http/validation/types.d.ts +96 -0
- package/dist/http/vite-dev-server.d.ts +27 -0
- package/dist/i18n/I18nManager.d.ts +114 -0
- package/dist/i18n/Translator.d.ts +80 -0
- package/dist/i18n/index.d.ts +6 -101
- package/dist/i18n/index.js +5 -3
- package/dist/i18n/loaders/JsonLoader.d.ts +47 -0
- package/dist/i18n/loaders/MemoryLoader.d.ts +37 -0
- package/dist/i18n/pluralization.d.ts +19 -0
- package/dist/i18n/types.d.ts +106 -0
- package/dist/index.d.ts +69 -2605
- package/dist/index.js +332 -152
- package/dist/lambda/index.d.ts +17 -37
- package/dist/logging/LogManager.d.ts +83 -0
- package/dist/logging/Logger.d.ts +76 -0
- package/dist/logging/channels/ConsoleChannel.d.ts +11 -0
- package/dist/logging/channels/DailyFileChannel.d.ts +20 -0
- package/dist/logging/channels/FileChannel.d.ts +15 -0
- package/dist/logging/index.d.ts +8 -50
- package/dist/logging/types.d.ts +96 -0
- package/dist/mail/Mail.d.ts +138 -0
- package/dist/mail/MailManager.d.ts +79 -0
- package/dist/mail/address.d.ts +8 -0
- package/dist/mail/index.d.ts +7 -316
- package/dist/mail/transports/LogTransport.d.ts +19 -0
- package/dist/mail/transports/MemoryTransport.d.ts +84 -0
- package/dist/mail/transports/ResendTransport.d.ts +32 -0
- package/dist/mail/transports/SmtpTransport.d.ts +40 -0
- package/dist/{MailManager-DpMvYiP9.d.ts → mail/types.d.ts} +11 -92
- package/dist/mcp/McpServiceProvider.d.ts +17 -0
- package/dist/mcp/create-mcp-server.d.ts +144 -0
- package/dist/mcp/endpoint.d.ts +29 -0
- package/dist/mcp/index.d.ts +3 -185
- package/dist/mcp/index.js +1 -1
- package/dist/mvc/Controller.d.ts +326 -0
- package/dist/mvc/Router.d.ts +239 -0
- package/dist/mvc/ViewEngine.d.ts +11 -0
- package/dist/mvc/inertia/InertiaEngine.d.ts +114 -0
- package/dist/mvc/inertia/shared.d.ts +90 -0
- package/dist/mvc/mount-route.d.ts +10 -0
- package/dist/notifications/Notification.d.ts +99 -0
- package/dist/notifications/NotificationManager.d.ts +150 -0
- package/dist/notifications/channels/DatabaseChannel.d.ts +55 -0
- package/dist/notifications/channels/MailChannel.d.ts +45 -0
- package/dist/notifications/channels/MemoryChannel.d.ts +85 -0
- package/dist/notifications/channels/SlackChannel.d.ts +73 -0
- package/dist/notifications/channels/index.d.ts +4 -0
- package/dist/notifications/index.d.ts +6 -322
- package/dist/notifications/notifiable-type.d.ts +10 -0
- package/dist/notifications/registry.d.ts +39 -0
- package/dist/notifications/types.d.ts +162 -0
- package/dist/providers/AuthServiceProvider.d.ts +7 -0
- package/dist/providers/AuthorizationServiceProvider.d.ts +9 -0
- package/dist/providers/BroadcastServiceProvider.d.ts +7 -0
- package/dist/providers/CacheServiceProvider.d.ts +7 -0
- package/dist/providers/EncryptionServiceProvider.d.ts +7 -0
- package/dist/providers/ErrorServiceProvider.d.ts +9 -0
- package/dist/providers/EventServiceProvider.d.ts +7 -0
- package/dist/providers/HealthServiceProvider.d.ts +7 -0
- package/dist/providers/I18nServiceProvider.d.ts +27 -0
- package/dist/providers/InertiaServiceProvider.d.ts +20 -0
- package/dist/providers/LogServiceProvider.d.ts +7 -0
- package/dist/providers/MailServiceProvider.d.ts +7 -0
- package/dist/providers/NotificationServiceProvider.d.ts +8 -0
- package/dist/providers/OAuthServiceProvider.d.ts +7 -0
- package/dist/providers/QueueServiceProvider.d.ts +7 -0
- package/dist/providers/SchedulingServiceProvider.d.ts +7 -0
- package/dist/providers/StorageServiceProvider.d.ts +7 -0
- package/dist/providers/index.d.ts +17 -0
- package/dist/queue/FailedJobReporter.d.ts +40 -0
- package/dist/queue/Job.d.ts +140 -0
- package/dist/queue/QueueManager.d.ts +79 -0
- package/dist/queue/Worker.d.ts +99 -0
- package/dist/queue/drivers/MemoryDriver.d.ts +60 -0
- package/dist/queue/drivers/RedisDriver.d.ts +96 -0
- package/dist/queue/drivers/SqsDriver.d.ts +108 -0
- package/dist/queue/drivers/SyncDriver.d.ts +28 -0
- package/dist/queue/index.d.ts +9 -453
- package/dist/queue/types.d.ts +171 -0
- package/dist/redis/RedisApiTokenStore.d.ts +78 -0
- package/dist/redis/RedisEmailVerificationStore.d.ts +54 -0
- package/dist/redis/RedisOAuthStateStore.d.ts +26 -0
- package/dist/redis/RedisPasswordResetStore.d.ts +57 -0
- package/dist/redis/RedisRateLimitStore.d.ts +77 -0
- package/dist/redis/RedisSessionStore.d.ts +61 -0
- package/dist/redis/client.d.ts +41 -0
- package/dist/redis/index.d.ts +14 -356
- package/dist/redis/index.js +5 -2
- package/dist/redis/scan-keys.d.ts +6 -0
- package/dist/runtime/index.d.ts +8 -95
- package/dist/runtime/index.js +1 -1
- package/dist/scheduling/CronParser.d.ts +37 -0
- package/dist/scheduling/Schedule.d.ts +229 -0
- package/dist/scheduling/ScheduledTask.d.ts +47 -0
- package/dist/scheduling/Scheduler.d.ts +99 -0
- package/dist/scheduling/index.d.ts +5 -41
- package/dist/scheduling/types.d.ts +97 -0
- package/dist/storage/StorageManager.d.ts +65 -0
- package/dist/storage/drivers/LocalDriver.d.ts +55 -0
- package/dist/storage/drivers/MemoryDriver.d.ts +66 -0
- package/dist/storage/drivers/S3Driver.d.ts +72 -0
- package/dist/storage/index.d.ts +5 -197
- package/dist/{StorageManager-oZTHqaza.d.ts → storage/types.d.ts} +10 -77
- package/dist/support/error-polyfill.d.ts +9 -0
- package/dist/support/import-map.d.ts +13 -0
- package/dist/support/redirect-target.d.ts +11 -0
- package/dist/support/stack-frames.d.ts +56 -0
- package/dist/support/trim-slashes.d.ts +11 -0
- package/dist/vite/index.d.ts +2 -35
- package/dist/vite/index.js +0 -3
- package/dist/vite/plugin.d.ts +34 -0
- package/package.json +3 -3
- package/dist/AuthManager-DBP4KYsx.d.ts +0 -79
- package/dist/BroadcastManager-D8KoJxiV.d.ts +0 -492
- package/dist/HealthManager-DUyMIzsZ.d.ts +0 -141
- package/dist/I18nManager-BiSoczfV.d.ts +0 -275
- package/dist/LogManager-7mxnkaPM.d.ts +0 -256
- package/dist/Scheduler-pZiT8i57.d.ts +0 -471
- package/dist/api-token-D24VPr_E.d.ts +0 -663
- package/dist/app-key-CsBfRC_Q.d.ts +0 -214
- package/dist/email-verification-D60YF2ZO.d.ts +0 -329
- package/dist/index-9_Jzj5jo.d.ts +0 -7
- package/dist/validation-yAL53e1S.d.ts +0 -2610
|
@@ -6,7 +6,7 @@ import standard from "figlet/importable-fonts/Standard.js";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@guren/server",
|
|
9
|
-
version: "2.
|
|
9
|
+
version: "2.2.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
license: "MIT",
|
|
12
12
|
repository: {
|
|
@@ -109,13 +109,13 @@ var package_default = {
|
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
111
|
scripts: {
|
|
112
|
-
build: "
|
|
112
|
+
build: "tsup && tsc -p tsconfig.build.json && bun ../../scripts/fix-dts-extensions.ts dist",
|
|
113
113
|
dev: "bun --watch src/index.ts",
|
|
114
114
|
typecheck: "tsc --noEmit",
|
|
115
115
|
test: "bun test"
|
|
116
116
|
},
|
|
117
117
|
dependencies: {
|
|
118
|
-
"@guren/orm": "^2.
|
|
118
|
+
"@guren/orm": "^2.2.0",
|
|
119
119
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
120
120
|
chalk: "^5.3.0",
|
|
121
121
|
consola: "^3.4.2",
|
|
@@ -201,10 +201,9 @@ function logDevServerBanner({
|
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
// src/http/vite-dev-server.ts
|
|
204
|
-
|
|
205
|
-
const { root = process.cwd(), config = {}, host
|
|
206
|
-
|
|
207
|
-
const mergedConfig = {
|
|
204
|
+
function resolveViteDevServerConfig(options = {}) {
|
|
205
|
+
const { root = process.cwd(), config = {}, host, port } = options;
|
|
206
|
+
return {
|
|
208
207
|
clearScreen: false,
|
|
209
208
|
...config,
|
|
210
209
|
root: config.root ?? root,
|
|
@@ -214,7 +213,11 @@ async function startViteDevServer(options = {}) {
|
|
|
214
213
|
...config.server ?? {}
|
|
215
214
|
}
|
|
216
215
|
};
|
|
217
|
-
|
|
216
|
+
}
|
|
217
|
+
async function startViteDevServer(options = {}) {
|
|
218
|
+
const { host, port } = options;
|
|
219
|
+
const { createServer } = await import("vite");
|
|
220
|
+
const server = await createServer(resolveViteDevServerConfig(options));
|
|
218
221
|
await server.listen();
|
|
219
222
|
const resolved = server.resolvedUrls;
|
|
220
223
|
const localUrls = resolved?.local?.length ? resolved.local : [`http://${typeof host === "string" ? host : "localhost"}:${server.config.server.port ?? port ?? 5173}`];
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import type { Container } from '../container/index.js';
|
|
2
|
+
import type { OutputInterface, CommandInstance } from './types.js';
|
|
3
|
+
import { Input } from './Input.js';
|
|
4
|
+
import * as readline from 'readline';
|
|
5
|
+
/**
|
|
6
|
+
* Base command class for console commands.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* export class CreateUserCommand extends Command {
|
|
11
|
+
* static signature = 'users:create {email} {--admin} {--role=user}'
|
|
12
|
+
* static description = 'Create a new user'
|
|
13
|
+
*
|
|
14
|
+
* async handle(): Promise<void> {
|
|
15
|
+
* const email = this.argument('email')
|
|
16
|
+
* const isAdmin = this.hasOption('admin')
|
|
17
|
+
* const role = this.option('role', 'user')
|
|
18
|
+
*
|
|
19
|
+
* const password = await this.secret('Enter password:')
|
|
20
|
+
* const confirm = await this.confirm(`Create user ${email}?`)
|
|
21
|
+
*
|
|
22
|
+
* if (!confirm) {
|
|
23
|
+
* this.warn('Cancelled')
|
|
24
|
+
* return
|
|
25
|
+
* }
|
|
26
|
+
*
|
|
27
|
+
* this.info(`Creating user: ${email}`)
|
|
28
|
+
* this.success('User created!')
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare abstract class Command implements CommandInstance {
|
|
34
|
+
/**
|
|
35
|
+
* The command signature.
|
|
36
|
+
* Format: 'command:name {arg} {--option}'
|
|
37
|
+
* Tokens may carry a description: 'command:name {arg : What it is}'
|
|
38
|
+
* See `parseSignature` for the full grammar.
|
|
39
|
+
*/
|
|
40
|
+
static signature: string;
|
|
41
|
+
/**
|
|
42
|
+
* The command description.
|
|
43
|
+
*/
|
|
44
|
+
static description: string;
|
|
45
|
+
/**
|
|
46
|
+
* The command input.
|
|
47
|
+
*/
|
|
48
|
+
protected input: Input;
|
|
49
|
+
/**
|
|
50
|
+
* The command output.
|
|
51
|
+
*/
|
|
52
|
+
protected output: OutputInterface;
|
|
53
|
+
/**
|
|
54
|
+
* The service container.
|
|
55
|
+
*/
|
|
56
|
+
protected container?: Container;
|
|
57
|
+
constructor(container?: Container);
|
|
58
|
+
/**
|
|
59
|
+
* Set the input for this command.
|
|
60
|
+
*/
|
|
61
|
+
setInput(argv: string[]): void;
|
|
62
|
+
/**
|
|
63
|
+
* Set the output for this command.
|
|
64
|
+
*/
|
|
65
|
+
setOutput(output: OutputInterface): void;
|
|
66
|
+
/**
|
|
67
|
+
* Execute the command.
|
|
68
|
+
*/
|
|
69
|
+
run(): Promise<number>;
|
|
70
|
+
/**
|
|
71
|
+
* Handle the command.
|
|
72
|
+
* Must be implemented by subclasses.
|
|
73
|
+
*/
|
|
74
|
+
abstract handle(): Promise<number | void>;
|
|
75
|
+
/**
|
|
76
|
+
* Get an argument value.
|
|
77
|
+
*/
|
|
78
|
+
argument<T = string>(name: string): T;
|
|
79
|
+
/**
|
|
80
|
+
* Get all arguments.
|
|
81
|
+
*/
|
|
82
|
+
arguments(): Record<string, string | string[]>;
|
|
83
|
+
/**
|
|
84
|
+
* Get an option value with optional default.
|
|
85
|
+
*/
|
|
86
|
+
option<T = string>(name: string, defaultValue?: T): T;
|
|
87
|
+
/**
|
|
88
|
+
* Get all options.
|
|
89
|
+
*/
|
|
90
|
+
options(): Record<string, string | boolean | string[]>;
|
|
91
|
+
/**
|
|
92
|
+
* Check if an option was provided.
|
|
93
|
+
*/
|
|
94
|
+
hasOption(name: string): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Output an info message.
|
|
97
|
+
*/
|
|
98
|
+
info(message: string): void;
|
|
99
|
+
/**
|
|
100
|
+
* Output an error message.
|
|
101
|
+
*/
|
|
102
|
+
error(message: string): void;
|
|
103
|
+
/**
|
|
104
|
+
* Output a warning message.
|
|
105
|
+
*/
|
|
106
|
+
warn(message: string): void;
|
|
107
|
+
/**
|
|
108
|
+
* Output a success message.
|
|
109
|
+
*/
|
|
110
|
+
success(message: string): void;
|
|
111
|
+
/**
|
|
112
|
+
* Output a plain line.
|
|
113
|
+
*/
|
|
114
|
+
line(message: string): void;
|
|
115
|
+
/**
|
|
116
|
+
* Output new lines.
|
|
117
|
+
*/
|
|
118
|
+
newLine(count?: number): void;
|
|
119
|
+
/**
|
|
120
|
+
* Output a table.
|
|
121
|
+
*/
|
|
122
|
+
table(headers: string[], rows: string[][]): void;
|
|
123
|
+
/**
|
|
124
|
+
* Ask a question and get user input.
|
|
125
|
+
*/
|
|
126
|
+
ask(question: string, defaultValue?: string): Promise<string>;
|
|
127
|
+
/**
|
|
128
|
+
* Ask for confirmation.
|
|
129
|
+
*/
|
|
130
|
+
confirm(question: string, defaultValue?: boolean): Promise<boolean>;
|
|
131
|
+
/**
|
|
132
|
+
* Present choices to the user.
|
|
133
|
+
*/
|
|
134
|
+
choice<T extends string>(question: string, choices: T[], defaultValue?: T): Promise<T>;
|
|
135
|
+
/**
|
|
136
|
+
* Ask for secret input (password).
|
|
137
|
+
*/
|
|
138
|
+
secret(question: string): Promise<string>;
|
|
139
|
+
/**
|
|
140
|
+
* Create a readline interface.
|
|
141
|
+
*/
|
|
142
|
+
protected createReadline(): readline.Interface;
|
|
143
|
+
/**
|
|
144
|
+
* Process items with progress output.
|
|
145
|
+
*/
|
|
146
|
+
withProgress<T>(items: T[], callback: (item: T, index: number) => Promise<void>): Promise<void>;
|
|
147
|
+
/**
|
|
148
|
+
* Kernel reference for calling other commands.
|
|
149
|
+
*/
|
|
150
|
+
protected kernel?: {
|
|
151
|
+
handle(argv: string[]): Promise<number>;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Set the kernel reference.
|
|
155
|
+
*/
|
|
156
|
+
setKernel(kernel: {
|
|
157
|
+
handle(argv: string[]): Promise<number>;
|
|
158
|
+
}): void;
|
|
159
|
+
/**
|
|
160
|
+
* Call another command.
|
|
161
|
+
*/
|
|
162
|
+
call(command: string, args?: string[]): Promise<number>;
|
|
163
|
+
/**
|
|
164
|
+
* Resolve a service from the container.
|
|
165
|
+
*/
|
|
166
|
+
protected resolve<T>(key: string): T;
|
|
167
|
+
/**
|
|
168
|
+
* Get the command signature.
|
|
169
|
+
*/
|
|
170
|
+
getSignature(): string;
|
|
171
|
+
/**
|
|
172
|
+
* Get the command description.
|
|
173
|
+
*/
|
|
174
|
+
getDescription(): string;
|
|
175
|
+
/**
|
|
176
|
+
* Get the command name.
|
|
177
|
+
*/
|
|
178
|
+
getName(): string;
|
|
179
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { Container } from '../container/index.js';
|
|
2
|
+
import type { CommandClass, ConsoleKernelOptions, OutputInterface } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Console kernel for managing and executing commands.
|
|
5
5
|
*
|
|
@@ -14,7 +14,7 @@ import { C as CommandClass, a as Container, O as OutputInterface, b as ConsoleKe
|
|
|
14
14
|
* const exitCode = await kernel.handle(['users:create', 'john@example.com', '--admin'])
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
|
-
declare class ConsoleKernel {
|
|
17
|
+
export declare class ConsoleKernel {
|
|
18
18
|
/**
|
|
19
19
|
* Registered commands.
|
|
20
20
|
*/
|
|
@@ -96,6 +96,4 @@ declare class ConsoleKernel {
|
|
|
96
96
|
/**
|
|
97
97
|
* Create a console kernel.
|
|
98
98
|
*/
|
|
99
|
-
declare function createConsoleKernel(options?: ConsoleKernelOptions): ConsoleKernel;
|
|
100
|
-
|
|
101
|
-
export { ConsoleKernel as C, createConsoleKernel as c };
|
|
99
|
+
export declare function createConsoleKernel(options?: ConsoleKernelOptions): ConsoleKernel;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { ParsedSignature, ArgumentDefinition, OptionDefinition, InputInterface } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Parse a command signature into argument and option definitions.
|
|
4
|
+
*
|
|
5
|
+
* Signature format:
|
|
6
|
+
* - `command:name` - Command name
|
|
7
|
+
* - `{argument}` - Required argument
|
|
8
|
+
* - `{argument?}` - Optional argument
|
|
9
|
+
* - `{argument=default}` - Argument with default
|
|
10
|
+
* - `{argument*}` - Array argument (must be last)
|
|
11
|
+
* - `{--option}` - Boolean option (flag)
|
|
12
|
+
* - `{--option=}` - Option that requires a value
|
|
13
|
+
* - `{--option=default}` - Option with default value
|
|
14
|
+
* - `{-o|--option}` - Option with shortcut
|
|
15
|
+
* - `{--option=*}` - Array option
|
|
16
|
+
* - `{argument : Description}` - Argument with a description
|
|
17
|
+
* - `{--option= : Description}` - Option with a description
|
|
18
|
+
*
|
|
19
|
+
* A description is separated from the token by a colon with whitespace on at
|
|
20
|
+
* least one side, so it may contain spaces and colons freely. Requiring that
|
|
21
|
+
* whitespace keeps colons inside default values (`{--url=https://example.com}`)
|
|
22
|
+
* out of descriptions.
|
|
23
|
+
*
|
|
24
|
+
* A colon with no whitespace at all (`{argument:Description}`) is accepted for
|
|
25
|
+
* a single-word description, but only on a token carrying no other marker:
|
|
26
|
+
* `{argument?}`, `{argument*}` and `{--option=default}` must use the spaced
|
|
27
|
+
* form, since their markers are stripped before that fallback runs.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* parseSignature('users:create {name} {--admin} {--role=user}')
|
|
32
|
+
* // => {
|
|
33
|
+
* // name: 'users:create',
|
|
34
|
+
* // arguments: [{ name: 'name', required: true, array: false }],
|
|
35
|
+
* // options: [
|
|
36
|
+
* // { name: 'admin', requiresValue: false },
|
|
37
|
+
* // { name: 'role', requiresValue: true, defaultValue: 'user' }
|
|
38
|
+
* // ]
|
|
39
|
+
* // }
|
|
40
|
+
*
|
|
41
|
+
* parseSignature('users:create {name : The full name} {--admin : Grant admin rights}')
|
|
42
|
+
* // => arguments[0].description === 'The full name'
|
|
43
|
+
* // options[0].description === 'Grant admin rights'
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function parseSignature(signature: string): ParsedSignature;
|
|
47
|
+
/**
|
|
48
|
+
* The label an argument is displayed with in help output.
|
|
49
|
+
*/
|
|
50
|
+
export declare function argumentLabel(arg: ArgumentDefinition): string;
|
|
51
|
+
/**
|
|
52
|
+
* The label an option is displayed with in help output, carrying whether it
|
|
53
|
+
* takes a value and whether it may be repeated.
|
|
54
|
+
*/
|
|
55
|
+
export declare function optionLabel(opt: OptionDefinition): string;
|
|
56
|
+
/**
|
|
57
|
+
* Build a usage line from a parsed signature.
|
|
58
|
+
*/
|
|
59
|
+
export declare function formatUsage(parsed: ParsedSignature): string;
|
|
60
|
+
/**
|
|
61
|
+
* Console input handler.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const input = new Input('users:create {name} {--admin}', ['John', '--admin'])
|
|
66
|
+
* input.argument('name') // => 'John'
|
|
67
|
+
* input.option('admin') // => true
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare class Input implements InputInterface {
|
|
71
|
+
/**
|
|
72
|
+
* Parsed signature.
|
|
73
|
+
*/
|
|
74
|
+
protected parsed: ParsedSignature;
|
|
75
|
+
/**
|
|
76
|
+
* Parsed argument values.
|
|
77
|
+
*/
|
|
78
|
+
protected argumentValues: Record<string, string | string[]>;
|
|
79
|
+
/**
|
|
80
|
+
* Parsed option values.
|
|
81
|
+
*/
|
|
82
|
+
protected optionValues: Record<string, string | boolean | string[]>;
|
|
83
|
+
constructor(signature: string, argv?: string[]);
|
|
84
|
+
/**
|
|
85
|
+
* Parse command line arguments.
|
|
86
|
+
*/
|
|
87
|
+
protected parseArgv(argv: string[]): void;
|
|
88
|
+
/**
|
|
89
|
+
* Parse a long option.
|
|
90
|
+
*/
|
|
91
|
+
protected parseLongOption(option: string, argv: string[], index: number): void;
|
|
92
|
+
/**
|
|
93
|
+
* Parse a short option.
|
|
94
|
+
*/
|
|
95
|
+
protected parseShortOption(option: string, argv: string[], index: number): void;
|
|
96
|
+
/**
|
|
97
|
+
* Map positional arguments to definitions.
|
|
98
|
+
*/
|
|
99
|
+
protected mapArguments(args: string[]): void;
|
|
100
|
+
/**
|
|
101
|
+
* Find an option definition by name.
|
|
102
|
+
*/
|
|
103
|
+
protected findOption(name: string): OptionDefinition | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Find an option definition by shortcut.
|
|
106
|
+
*/
|
|
107
|
+
protected findOptionByShortcut(shortcut: string): OptionDefinition | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* Check if an option requires a value.
|
|
110
|
+
*/
|
|
111
|
+
protected optionRequiresValue(name: string): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Get an argument value.
|
|
114
|
+
*/
|
|
115
|
+
argument<T = string>(name: string): T;
|
|
116
|
+
/**
|
|
117
|
+
* Get all argument values.
|
|
118
|
+
*/
|
|
119
|
+
arguments(): Record<string, string | string[]>;
|
|
120
|
+
/**
|
|
121
|
+
* Get an option value.
|
|
122
|
+
*/
|
|
123
|
+
option<T = string | boolean>(name: string): T | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* Get all option values.
|
|
126
|
+
*/
|
|
127
|
+
options(): Record<string, string | boolean | string[]>;
|
|
128
|
+
/**
|
|
129
|
+
* Check if an option was provided.
|
|
130
|
+
*/
|
|
131
|
+
hasOption(name: string): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Get the parsed signature.
|
|
134
|
+
*/
|
|
135
|
+
getSignature(): ParsedSignature;
|
|
136
|
+
/**
|
|
137
|
+
* Get the command name.
|
|
138
|
+
*/
|
|
139
|
+
getCommandName(): string;
|
|
140
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import type { OutputInterface } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* ANSI color codes.
|
|
4
|
+
*/
|
|
5
|
+
declare const COLORS: {
|
|
6
|
+
readonly reset: "\u001B[0m";
|
|
7
|
+
readonly bold: "\u001B[1m";
|
|
8
|
+
readonly dim: "\u001B[2m";
|
|
9
|
+
readonly black: "\u001B[30m";
|
|
10
|
+
readonly red: "\u001B[31m";
|
|
11
|
+
readonly green: "\u001B[32m";
|
|
12
|
+
readonly yellow: "\u001B[33m";
|
|
13
|
+
readonly blue: "\u001B[34m";
|
|
14
|
+
readonly magenta: "\u001B[35m";
|
|
15
|
+
readonly cyan: "\u001B[36m";
|
|
16
|
+
readonly white: "\u001B[37m";
|
|
17
|
+
readonly bgRed: "\u001B[41m";
|
|
18
|
+
readonly bgGreen: "\u001B[42m";
|
|
19
|
+
readonly bgYellow: "\u001B[43m";
|
|
20
|
+
readonly bgBlue: "\u001B[44m";
|
|
21
|
+
readonly bgMagenta: "\u001B[45m";
|
|
22
|
+
readonly bgCyan: "\u001B[46m";
|
|
23
|
+
readonly bgWhite: "\u001B[47m";
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Console output handler.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* const output = new Output()
|
|
31
|
+
* output.info('Processing...')
|
|
32
|
+
* output.success('Done!')
|
|
33
|
+
* output.table(['Name', 'Age'], [['John', '30'], ['Jane', '25']])
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare class Output implements OutputInterface {
|
|
37
|
+
/**
|
|
38
|
+
* Whether to use colors.
|
|
39
|
+
*/
|
|
40
|
+
protected useColors: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Output stream.
|
|
43
|
+
*/
|
|
44
|
+
protected stdout: NodeJS.WriteStream;
|
|
45
|
+
/**
|
|
46
|
+
* Error stream.
|
|
47
|
+
*/
|
|
48
|
+
protected stderr: NodeJS.WriteStream;
|
|
49
|
+
constructor(options?: {
|
|
50
|
+
colors?: boolean;
|
|
51
|
+
stdout?: NodeJS.WriteStream;
|
|
52
|
+
stderr?: NodeJS.WriteStream;
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* Apply color to text.
|
|
56
|
+
*/
|
|
57
|
+
protected color(text: string, ...codes: string[]): string;
|
|
58
|
+
/**
|
|
59
|
+
* Output an info message.
|
|
60
|
+
*/
|
|
61
|
+
info(message: string): void;
|
|
62
|
+
/**
|
|
63
|
+
* Output an error message.
|
|
64
|
+
*/
|
|
65
|
+
error(message: string): void;
|
|
66
|
+
/**
|
|
67
|
+
* Output a warning message.
|
|
68
|
+
*/
|
|
69
|
+
warn(message: string): void;
|
|
70
|
+
/**
|
|
71
|
+
* Output a success message.
|
|
72
|
+
*/
|
|
73
|
+
success(message: string): void;
|
|
74
|
+
/**
|
|
75
|
+
* Output a plain line.
|
|
76
|
+
*/
|
|
77
|
+
line(message: string): void;
|
|
78
|
+
/**
|
|
79
|
+
* Output new lines.
|
|
80
|
+
*/
|
|
81
|
+
newLine(count?: number): void;
|
|
82
|
+
/**
|
|
83
|
+
* Output a table.
|
|
84
|
+
*/
|
|
85
|
+
table(headers: string[], rows: string[][]): void;
|
|
86
|
+
/**
|
|
87
|
+
* Write raw text without newline.
|
|
88
|
+
*/
|
|
89
|
+
write(message: string): void;
|
|
90
|
+
/**
|
|
91
|
+
* Write a line to stdout.
|
|
92
|
+
*/
|
|
93
|
+
protected writeLine(message: string): void;
|
|
94
|
+
/**
|
|
95
|
+
* Write a line to stderr.
|
|
96
|
+
*/
|
|
97
|
+
protected writeErrorLine(message: string): void;
|
|
98
|
+
/**
|
|
99
|
+
* Output a comment.
|
|
100
|
+
*/
|
|
101
|
+
comment(message: string): void;
|
|
102
|
+
/**
|
|
103
|
+
* Output a question.
|
|
104
|
+
*/
|
|
105
|
+
question(message: string): void;
|
|
106
|
+
/**
|
|
107
|
+
* Output a bulleted list.
|
|
108
|
+
*/
|
|
109
|
+
listing(items: string[]): void;
|
|
110
|
+
/**
|
|
111
|
+
* Output text with specific color.
|
|
112
|
+
*/
|
|
113
|
+
colored(message: string, color: keyof typeof COLORS): void;
|
|
114
|
+
/**
|
|
115
|
+
* Create a progress bar string.
|
|
116
|
+
*/
|
|
117
|
+
progressBar(current: number, total: number, width?: number): string;
|
|
118
|
+
/**
|
|
119
|
+
* Clear the current line.
|
|
120
|
+
*/
|
|
121
|
+
clearLine(): void;
|
|
122
|
+
/**
|
|
123
|
+
* Check if colors are enabled.
|
|
124
|
+
*/
|
|
125
|
+
isColored(): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Enable or disable colors.
|
|
128
|
+
*/
|
|
129
|
+
setColors(enabled: boolean): void;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Output that collects messages instead of printing.
|
|
133
|
+
* Useful for testing.
|
|
134
|
+
*/
|
|
135
|
+
export declare class BufferedOutput extends Output {
|
|
136
|
+
/**
|
|
137
|
+
* Collected messages.
|
|
138
|
+
*/
|
|
139
|
+
protected buffer: string[];
|
|
140
|
+
constructor();
|
|
141
|
+
protected writeLine(message: string): void;
|
|
142
|
+
protected writeErrorLine(message: string): void;
|
|
143
|
+
write(message: string): void;
|
|
144
|
+
/**
|
|
145
|
+
* Get all output as array.
|
|
146
|
+
*/
|
|
147
|
+
getLines(): string[];
|
|
148
|
+
/**
|
|
149
|
+
* Get all output as string.
|
|
150
|
+
*/
|
|
151
|
+
getOutput(): string;
|
|
152
|
+
/**
|
|
153
|
+
* Clear the buffer.
|
|
154
|
+
*/
|
|
155
|
+
clear(): void;
|
|
156
|
+
/**
|
|
157
|
+
* Check if buffer contains a string.
|
|
158
|
+
*/
|
|
159
|
+
contains(text: string): boolean;
|
|
160
|
+
}
|
|
161
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { ArgumentDefinition, OptionDefinition, ParsedSignature, CommandClass, CommandInstance, ConsoleKernelOptions, OutputInterface, InputInterface, ScheduledCommand, PromptInterface, ProgressInterface, } from './types.js';
|
|
2
|
+
export { Command } from './Command.js';
|
|
3
|
+
export { Input, parseSignature } from './Input.js';
|
|
4
|
+
export { Output, BufferedOutput } from './Output.js';
|
|
5
|
+
export { ConsoleKernel, createConsoleKernel } from './ConsoleKernel.js';
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { Container } from '../container/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Parsed argument definition.
|
|
4
|
+
*/
|
|
5
|
+
export interface ArgumentDefinition {
|
|
6
|
+
name: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
required: boolean;
|
|
9
|
+
array: boolean;
|
|
10
|
+
defaultValue?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Parsed option definition.
|
|
14
|
+
*/
|
|
15
|
+
export interface OptionDefinition {
|
|
16
|
+
name: string;
|
|
17
|
+
shortcut?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
requiresValue: boolean;
|
|
20
|
+
defaultValue?: string | boolean;
|
|
21
|
+
array: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Parsed signature.
|
|
25
|
+
*/
|
|
26
|
+
export interface ParsedSignature {
|
|
27
|
+
name: string;
|
|
28
|
+
arguments: ArgumentDefinition[];
|
|
29
|
+
options: OptionDefinition[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Command class type.
|
|
33
|
+
*/
|
|
34
|
+
export interface CommandClass {
|
|
35
|
+
signature: string;
|
|
36
|
+
description: string;
|
|
37
|
+
new (container?: Container): CommandInstance;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Command instance type.
|
|
41
|
+
*/
|
|
42
|
+
export interface CommandInstance {
|
|
43
|
+
setInput(argv: string[]): void;
|
|
44
|
+
setOutput(output: OutputInterface): void;
|
|
45
|
+
setKernel(kernel: {
|
|
46
|
+
handle(argv: string[]): Promise<number>;
|
|
47
|
+
}): void;
|
|
48
|
+
run(): Promise<number>;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Output interface.
|
|
52
|
+
*/
|
|
53
|
+
export interface OutputInterface {
|
|
54
|
+
info(message: string): void;
|
|
55
|
+
error(message: string): void;
|
|
56
|
+
warn(message: string): void;
|
|
57
|
+
success(message: string): void;
|
|
58
|
+
line(message: string): void;
|
|
59
|
+
newLine(count?: number): void;
|
|
60
|
+
table(headers: string[], rows: string[][]): void;
|
|
61
|
+
write(message: string): void;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Input interface.
|
|
65
|
+
*/
|
|
66
|
+
export interface InputInterface {
|
|
67
|
+
argument<T = string>(name: string): T;
|
|
68
|
+
arguments(): Record<string, string | string[]>;
|
|
69
|
+
option<T = string | boolean>(name: string): T | undefined;
|
|
70
|
+
options(): Record<string, string | boolean | string[]>;
|
|
71
|
+
hasOption(name: string): boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Console kernel options.
|
|
75
|
+
*/
|
|
76
|
+
export interface ConsoleKernelOptions {
|
|
77
|
+
container?: Container;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Schedule definition for a command.
|
|
81
|
+
*/
|
|
82
|
+
export interface ScheduledCommand {
|
|
83
|
+
command: string;
|
|
84
|
+
args?: string[];
|
|
85
|
+
expression: string;
|
|
86
|
+
timezone?: string;
|
|
87
|
+
description?: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Interactive prompt types.
|
|
91
|
+
*/
|
|
92
|
+
export interface PromptInterface {
|
|
93
|
+
ask(question: string, defaultValue?: string): Promise<string>;
|
|
94
|
+
confirm(question: string, defaultValue?: boolean): Promise<boolean>;
|
|
95
|
+
choice<T extends string>(question: string, choices: T[], defaultValue?: T): Promise<T>;
|
|
96
|
+
secret(question: string): Promise<string>;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Progress bar interface.
|
|
100
|
+
*/
|
|
101
|
+
export interface ProgressInterface {
|
|
102
|
+
start(total: number): void;
|
|
103
|
+
advance(step?: number): void;
|
|
104
|
+
finish(): void;
|
|
105
|
+
setProgress(current: number): void;
|
|
106
|
+
}
|