@adonisjs/core 5.9.0 → 6.0.0-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/README.md +6 -15
- package/build/commands/commands.json +1 -0
- package/build/commands/eject.d.ts +8 -0
- package/build/commands/eject.js +34 -0
- package/build/commands/{GenerateKey.d.ts → generate_key.d.ts} +3 -4
- package/build/commands/generate_key.js +47 -0
- package/build/commands/main.js +36 -0
- package/build/commands/make/_base.d.ts +6 -0
- package/build/commands/make/_base.js +19 -0
- package/build/commands/make/command.d.ts +8 -0
- package/build/commands/make/command.js +25 -0
- package/build/commands/make/controller.d.ts +12 -0
- package/build/commands/make/controller.js +57 -0
- package/build/commands/make/event.d.ts +8 -0
- package/build/commands/make/event.js +25 -0
- package/build/commands/make/listener.d.ts +10 -0
- package/build/commands/make/listener.js +48 -0
- package/build/commands/make/middleware.d.ts +8 -0
- package/build/commands/make/middleware.js +25 -0
- package/build/commands/make/provider.d.ts +8 -0
- package/build/commands/make/provider.js +25 -0
- package/build/index.d.ts +140 -0
- package/build/index.js +21 -0
- package/build/legacy/validator.d.ts +1 -0
- package/build/legacy/validator.js +1 -0
- package/build/modules/ace/commands.d.ts +26 -0
- package/build/modules/ace/commands.js +63 -0
- package/build/modules/ace/create_kernel.d.ts +3 -0
- package/build/modules/ace/create_kernel.js +33 -0
- package/build/modules/ace/kernel.d.ts +7 -0
- package/build/modules/ace/kernel.js +14 -0
- package/build/modules/ace/main.d.ts +3 -0
- package/build/modules/ace/main.js +3 -0
- package/build/modules/app.d.ts +1 -0
- package/build/modules/app.js +1 -0
- package/build/modules/bodyparser/bodyparser_middleware.d.ts +2 -0
- package/build/modules/bodyparser/bodyparser_middleware.js +2 -0
- package/build/modules/bodyparser/main.d.ts +1 -0
- package/build/modules/bodyparser/main.js +1 -0
- package/build/modules/config.d.ts +1 -0
- package/build/modules/config.js +1 -0
- package/build/modules/container.d.ts +1 -0
- package/build/modules/container.js +1 -0
- package/build/modules/encryption.d.ts +1 -0
- package/build/modules/encryption.js +1 -0
- package/build/modules/env.d.ts +1 -0
- package/build/modules/env.js +1 -0
- package/build/modules/events.d.ts +1 -0
- package/build/modules/events.js +1 -0
- package/build/modules/hash/define_config.d.ts +15 -0
- package/build/modules/hash/define_config.js +19 -0
- package/build/modules/hash/drivers_collection.d.ts +9 -0
- package/build/modules/hash/drivers_collection.js +22 -0
- package/build/modules/hash/main.d.ts +2 -0
- package/build/modules/hash/main.js +2 -0
- package/build/modules/http.d.ts +1 -0
- package/build/modules/http.js +1 -0
- package/build/modules/logger.d.ts +1 -0
- package/build/modules/logger.js +1 -0
- package/build/providers/app_provider.d.ts +16 -0
- package/build/providers/app_provider.js +74 -0
- package/build/providers/hash_provider.d.ts +9 -0
- package/build/providers/hash_provider.js +29 -0
- package/build/providers/http_provider.d.ts +9 -0
- package/build/providers/http_provider.js +36 -0
- package/build/services/ace.d.ts +3 -0
- package/build/services/ace.js +6 -0
- package/build/services/app.d.ts +4 -12
- package/build/services/app.js +5 -12
- package/build/services/config.d.ts +3 -3
- package/build/services/config.js +6 -12
- package/build/services/emitter.d.ts +3 -0
- package/build/services/emitter.js +7 -0
- package/build/services/encryption.d.ts +3 -3
- package/build/services/encryption.js +7 -12
- package/build/services/hash.d.ts +3 -3
- package/build/services/hash.js +7 -12
- package/build/services/logger.d.ts +3 -0
- package/build/services/logger.js +7 -0
- package/build/services/router.d.ts +3 -0
- package/build/services/router.js +7 -0
- package/build/services/server.d.ts +3 -0
- package/build/services/server.js +7 -0
- package/build/services/test_utils.d.ts +3 -0
- package/build/services/test_utils.js +6 -0
- package/build/src/debug.d.ts +3 -0
- package/build/src/debug.js +2 -0
- package/build/src/helpers/is.d.ts +2 -0
- package/build/src/helpers/is.js +2 -0
- package/build/src/helpers/main.d.ts +2 -0
- package/build/src/helpers/main.js +2 -0
- package/build/src/helpers/string.d.ts +17 -0
- package/build/src/helpers/string.js +26 -0
- package/build/src/helpers/string_builder.d.ts +23 -0
- package/build/src/helpers/string_builder.js +86 -0
- package/build/src/helpers/types.d.ts +24 -0
- package/build/src/helpers/types.js +29 -0
- package/build/src/ignitor/ace.d.ts +8 -0
- package/build/src/ignitor/ace.js +31 -0
- package/build/src/ignitor/http.d.ts +10 -0
- package/build/src/ignitor/http.js +62 -0
- package/build/src/ignitor/main.d.ts +17 -0
- package/build/src/ignitor/main.js +45 -0
- package/build/src/ignitor/test.d.ts +8 -0
- package/build/src/ignitor/test.js +18 -0
- package/build/src/test_utils/http.d.ts +10 -0
- package/build/src/test_utils/http.js +42 -0
- package/build/src/test_utils/main.d.ts +19 -0
- package/build/src/test_utils/main.js +33 -0
- package/build/src/types.d.ts +63 -0
- package/build/src/types.js +1 -0
- package/build/stubs/index.d.ts +1 -0
- package/build/stubs/index.js +2 -0
- package/build/stubs/make/command/main.stub +19 -0
- package/build/stubs/make/controller/api.stub +33 -0
- package/build/stubs/make/controller/main.stub +9 -0
- package/build/stubs/make/controller/resource.stub +43 -0
- package/build/stubs/make/event/main.stub +15 -0
- package/build/stubs/make/listener/for_event.stub +13 -0
- package/build/stubs/make/listener/main.stub +7 -0
- package/build/stubs/make/middleware/main.stub +22 -0
- package/build/stubs/make/provider/main.stub +35 -0
- package/build/types/ace.d.ts +5 -0
- package/build/types/ace.js +1 -0
- package/build/types/app.d.ts +1 -0
- package/build/types/app.js +1 -0
- package/build/types/bodyparser.d.ts +1 -0
- package/build/types/bodyparser.js +1 -0
- package/build/types/container.d.ts +1 -0
- package/build/types/container.js +1 -0
- package/build/types/encryption.d.ts +1 -0
- package/build/types/encryption.js +1 -0
- package/build/types/events.d.ts +1 -0
- package/build/types/events.js +1 -0
- package/build/types/hash.d.ts +1 -0
- package/build/types/hash.js +1 -0
- package/build/types/http.d.ts +1 -0
- package/build/types/http.js +1 -0
- package/build/types/logger.d.ts +1 -0
- package/build/types/logger.js +1 -0
- package/package.json +226 -245
- package/build/adonis-typings/ace.d.ts +0 -5
- package/build/adonis-typings/ace.js +0 -8
- package/build/adonis-typings/assets-manager.d.ts +0 -92
- package/build/adonis-typings/assets-manager.js +0 -8
- package/build/adonis-typings/container.d.ts +0 -14
- package/build/adonis-typings/container.js +0 -8
- package/build/adonis-typings/cors.d.ts +0 -15
- package/build/adonis-typings/cors.js +0 -8
- package/build/adonis-typings/exception-handler.d.ts +0 -31
- package/build/adonis-typings/exception-handler.js +0 -8
- package/build/adonis-typings/health-check.d.ts +0 -40
- package/build/adonis-typings/health-check.js +0 -8
- package/build/adonis-typings/index.d.ts +0 -17
- package/build/adonis-typings/index.js +0 -25
- package/build/adonis-typings/static.d.ts +0 -15
- package/build/adonis-typings/static.js +0 -8
- package/build/adonis-typings/test-utils.d.ts +0 -24
- package/build/adonis-typings/test-utils.js +0 -8
- package/build/adonis-typings/tests.d.ts +0 -13
- package/build/adonis-typings/tests.js +0 -11
- package/build/commands/DumpRc.d.ts +0 -13
- package/build/commands/DumpRc.js +0 -33
- package/build/commands/GenerateKey.js +0 -25
- package/build/commands/ListRoutes/Renderers/Base.d.ts +0 -31
- package/build/commands/ListRoutes/Renderers/Base.js +0 -70
- package/build/commands/ListRoutes/Renderers/PrettyRenderer.d.ts +0 -51
- package/build/commands/ListRoutes/Renderers/PrettyRenderer.js +0 -135
- package/build/commands/ListRoutes/Renderers/TableRenderer.d.ts +0 -36
- package/build/commands/ListRoutes/Renderers/TableRenderer.js +0 -137
- package/build/commands/ListRoutes/index.d.ts +0 -75
- package/build/commands/ListRoutes/index.js +0 -166
- package/build/commands/index.d.ts +0 -2
- package/build/commands/index.js +0 -15
- package/build/config.d.ts +0 -2
- package/build/config.js +0 -15
- package/build/instructions.js +0 -81
- package/build/providers/AppProvider.d.ts +0 -68
- package/build/providers/AppProvider.js +0 -201
- package/build/services/base.d.ts +0 -3
- package/build/services/base.js +0 -23
- package/build/services/bodyparser.d.ts +0 -2
- package/build/services/bodyparser.js +0 -12
- package/build/services/drive.d.ts +0 -3
- package/build/services/drive.js +0 -12
- package/build/services/event.d.ts +0 -3
- package/build/services/event.js +0 -12
- package/build/services/healthChecks.d.ts +0 -3
- package/build/services/healthChecks.js +0 -12
- package/build/services/httpContext.d.ts +0 -3
- package/build/services/httpContext.js +0 -12
- package/build/services/route.d.ts +0 -3
- package/build/services/route.js +0 -12
- package/build/services/validator.d.ts +0 -3
- package/build/services/validator.js +0 -12
- package/build/src/AssetsManager/Drivers/Base.d.ts +0 -27
- package/build/src/AssetsManager/Drivers/Base.js +0 -66
- package/build/src/AssetsManager/Drivers/Encore.d.ts +0 -58
- package/build/src/AssetsManager/Drivers/Encore.js +0 -93
- package/build/src/AssetsManager/Drivers/Fake.d.ts +0 -38
- package/build/src/AssetsManager/Drivers/Fake.js +0 -61
- package/build/src/AssetsManager/Drivers/Vite.d.ts +0 -84
- package/build/src/AssetsManager/Drivers/Vite.js +0 -139
- package/build/src/AssetsManager/index.d.ts +0 -87
- package/build/src/AssetsManager/index.js +0 -184
- package/build/src/Bindings/Repl.d.ts +0 -8
- package/build/src/Bindings/Repl.js +0 -90
- package/build/src/Bindings/Tests.d.ts +0 -7
- package/build/src/Bindings/Tests.js +0 -66
- package/build/src/HealthCheck/Checkers/AppKey.d.ts +0 -6
- package/build/src/HealthCheck/Checkers/AppKey.js +0 -60
- package/build/src/HealthCheck/Checkers/Env.d.ts +0 -6
- package/build/src/HealthCheck/Checkers/Env.js +0 -42
- package/build/src/HealthCheck/index.d.ts +0 -48
- package/build/src/HealthCheck/index.js +0 -99
- package/build/src/Hooks/Cors/index.d.ts +0 -70
- package/build/src/Hooks/Cors/index.js +0 -314
- package/build/src/Hooks/Static/index.d.ts +0 -18
- package/build/src/Hooks/Static/index.js +0 -66
- package/build/src/HttpExceptionHandler/index.d.ts +0 -82
- package/build/src/HttpExceptionHandler/index.js +0 -213
- package/build/src/Ignitor/Ace/App/index.d.ts +0 -60
- package/build/src/Ignitor/Ace/App/index.js +0 -236
- package/build/src/Ignitor/Ace/Exceptions/index.d.ts +0 -4
- package/build/src/Ignitor/Ace/Exceptions/index.js +0 -19
- package/build/src/Ignitor/Ace/GenerateManifest/index.d.ts +0 -28
- package/build/src/Ignitor/Ace/GenerateManifest/index.js +0 -75
- package/build/src/Ignitor/Ace/index.d.ts +0 -11
- package/build/src/Ignitor/Ace/index.js +0 -36
- package/build/src/Ignitor/HttpServer/index.d.ts +0 -56
- package/build/src/Ignitor/HttpServer/index.js +0 -127
- package/build/src/Ignitor/Kernel/index.d.ts +0 -56
- package/build/src/Ignitor/Kernel/index.js +0 -123
- package/build/src/Ignitor/SignalsListener/index.d.ts +0 -23
- package/build/src/Ignitor/SignalsListener/index.js +0 -66
- package/build/src/Ignitor/index.d.ts +0 -32
- package/build/src/Ignitor/index.js +0 -58
- package/build/src/TestUtils/HttpServer/index.d.ts +0 -27
- package/build/src/TestUtils/HttpServer/index.js +0 -56
- package/build/src/TestUtils/index.d.ts +0 -24
- package/build/src/TestUtils/index.js +0 -43
- package/build/src/utils/index.d.ts +0 -18
- package/build/src/utils/index.js +0 -82
- package/build/standalone.d.ts +0 -9
- package/build/standalone.js +0 -52
- package/build/templates/config/app.txt +0 -303
- package/build/templates/config/bodyparser.txt +0 -211
- package/build/templates/config/cors.txt +0 -134
- package/build/templates/config/drive.txt +0 -149
- package/build/templates/config/hash.txt +0 -96
- package/build/templates/config/static.txt +0 -89
- package/build/templates/contracts/drive.txt +0 -13
- package/build/templates/contracts/env.txt +0 -24
- package/build/templates/contracts/events.txt +0 -31
- package/build/templates/contracts/hash.txt +0 -13
- package/build/templates/env.txt +0 -31
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/// <reference types="@adonisjs/http-server/build/adonis-typings" />
|
|
2
|
-
declare module '@ioc:Adonis/Core/Cors' {
|
|
3
|
-
import { RequestContract } from '@ioc:Adonis/Core/Request';
|
|
4
|
-
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';
|
|
5
|
-
type AllowedValuesTypes = boolean | string | string[];
|
|
6
|
-
type CorsConfig = {
|
|
7
|
-
enabled: boolean | ((request: RequestContract, ctx: HttpContextContract) => boolean);
|
|
8
|
-
origin: AllowedValuesTypes | ((origin: string, ctx: HttpContextContract) => AllowedValuesTypes);
|
|
9
|
-
methods: string[];
|
|
10
|
-
headers: AllowedValuesTypes | ((headers: string[], ctx: HttpContextContract) => AllowedValuesTypes);
|
|
11
|
-
exposeHeaders: string[];
|
|
12
|
-
credentials: boolean;
|
|
13
|
-
maxAge: number;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/// <reference types="@adonisjs/logger/build/adonis-typings/logger" />
|
|
2
|
-
/// <reference types="@adonisjs/http-server/build/adonis-typings" />
|
|
3
|
-
/**
|
|
4
|
-
* The binding for the given module is defined inside `providers/AppProvider.ts`
|
|
5
|
-
* file.
|
|
6
|
-
*/
|
|
7
|
-
declare module '@ioc:Adonis/Core/HttpExceptionHandler' {
|
|
8
|
-
import { LoggerContract } from '@ioc:Adonis/Core/Logger';
|
|
9
|
-
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';
|
|
10
|
-
export default abstract class HttpExceptionHandler {
|
|
11
|
-
constructor(logger: LoggerContract);
|
|
12
|
-
protected logger: LoggerContract;
|
|
13
|
-
protected ignoreCodes: string[];
|
|
14
|
-
protected ignoreStatuses: number[];
|
|
15
|
-
protected internalIgnoreCodes: string[];
|
|
16
|
-
protected statusPages: {
|
|
17
|
-
[key: string]: string;
|
|
18
|
-
};
|
|
19
|
-
expandedStatusPages: {
|
|
20
|
-
[key: string]: string;
|
|
21
|
-
};
|
|
22
|
-
protected disableStatusPagesInDevelopment: boolean;
|
|
23
|
-
protected context(ctx: HttpContextContract): any;
|
|
24
|
-
protected shouldReport(error: any): boolean;
|
|
25
|
-
protected makeJSONResponse(error: any, ctx: HttpContextContract): Promise<void>;
|
|
26
|
-
protected makeJSONAPIResponse(error: any, ctx: HttpContextContract): Promise<void>;
|
|
27
|
-
protected makeHtmlResponse(error: any, ctx: HttpContextContract): Promise<void>;
|
|
28
|
-
report(error: any, ctx: HttpContextContract): void;
|
|
29
|
-
handle(error: any, ctx: HttpContextContract): Promise<any>;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The binding for the given module is defined inside `providers/AppProvider.ts`
|
|
3
|
-
* file.
|
|
4
|
-
*/
|
|
5
|
-
declare module '@ioc:Adonis/Core/HealthCheck' {
|
|
6
|
-
export type Checker = string | (() => Promise<HealthReportEntry>);
|
|
7
|
-
/**
|
|
8
|
-
* Shape of health report entry. Each checker must
|
|
9
|
-
* return an object with similar shape.
|
|
10
|
-
*/
|
|
11
|
-
export type HealthReportEntry = {
|
|
12
|
-
displayName: string;
|
|
13
|
-
health: {
|
|
14
|
-
healthy: boolean;
|
|
15
|
-
message?: string;
|
|
16
|
-
};
|
|
17
|
-
meta?: any;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* The shape of entire report
|
|
21
|
-
*/
|
|
22
|
-
export type HealthReport = {
|
|
23
|
-
[service: string]: HealthReportEntry;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Shape of health check contract
|
|
27
|
-
*/
|
|
28
|
-
export interface HealthCheckContract {
|
|
29
|
-
servicesList: string[];
|
|
30
|
-
addChecker(service: string, checker: Checker): void;
|
|
31
|
-
isLive(): Promise<boolean>;
|
|
32
|
-
isReady(): boolean;
|
|
33
|
-
getReport(): Promise<{
|
|
34
|
-
healthy: boolean;
|
|
35
|
-
report: HealthReport;
|
|
36
|
-
}>;
|
|
37
|
-
}
|
|
38
|
-
const HealthCheck: HealthCheckContract;
|
|
39
|
-
export default HealthCheck;
|
|
40
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/// <reference path="ace.d.ts" />
|
|
2
|
-
/// <reference path="cors.d.ts" />
|
|
3
|
-
/// <reference path="health-check.d.ts" />
|
|
4
|
-
/// <reference path="exception-handler.d.ts" />
|
|
5
|
-
/// <reference path="static.d.ts" />
|
|
6
|
-
/// <reference path="assets-manager.d.ts" />
|
|
7
|
-
/// <reference path="container.d.ts" />
|
|
8
|
-
/// <reference path="test-utils.d.ts" />
|
|
9
|
-
/// <reference path="tests.d.ts" />
|
|
10
|
-
/// <reference types="@adonisjs/application/build/adonis-typings" />
|
|
11
|
-
/// <reference types="@adonisjs/events/build/adonis-typings" />
|
|
12
|
-
/// <reference types="@adonisjs/hash/build/adonis-typings" />
|
|
13
|
-
/// <reference types="@adonisjs/http-server/build/adonis-typings" />
|
|
14
|
-
/// <reference types="@adonisjs/encryption/build/adonis-typings" />
|
|
15
|
-
/// <reference types="@adonisjs/bodyparser/build/adonis-typings" />
|
|
16
|
-
/// <reference types="@adonisjs/validator" />
|
|
17
|
-
/// <reference types="@adonisjs/drive/build/adonis-typings" />
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @adonisjs/core
|
|
3
|
-
*
|
|
4
|
-
* (c) Harminder Virk <virk@adonisjs.com>
|
|
5
|
-
*
|
|
6
|
-
* For the full copyright and license information, please view the LICENSE
|
|
7
|
-
* file that was distributed with this source code.
|
|
8
|
-
*/
|
|
9
|
-
/// <reference path="../node_modules/@adonisjs/application/build/adonis-typings/index.d.ts" />
|
|
10
|
-
/// <reference path="../node_modules/@adonisjs/events/build/adonis-typings/index.d.ts" />
|
|
11
|
-
/// <reference path="../node_modules/@adonisjs/hash/build/adonis-typings/index.d.ts" />
|
|
12
|
-
/// <reference path="../node_modules/@adonisjs/http-server/build/adonis-typings/index.d.ts" />
|
|
13
|
-
/// <reference path="../node_modules/@adonisjs/encryption/build/adonis-typings/index.d.ts" />
|
|
14
|
-
/// <reference path="../node_modules/@adonisjs/bodyparser/build/adonis-typings/index.d.ts" />
|
|
15
|
-
/// <reference path="../node_modules/@adonisjs/validator/build/adonis-typings/index.d.ts" />
|
|
16
|
-
/// <reference path="../node_modules/@adonisjs/drive/build/adonis-typings/index.d.ts" />
|
|
17
|
-
/// <reference path="./ace.ts" />
|
|
18
|
-
/// <reference path="./cors.ts" />
|
|
19
|
-
/// <reference path="./health-check.ts" />
|
|
20
|
-
/// <reference path="./exception-handler.ts" />
|
|
21
|
-
/// <reference path="./static.ts" />
|
|
22
|
-
/// <reference path="./assets-manager.ts" />
|
|
23
|
-
/// <reference path="./container.ts" />
|
|
24
|
-
/// <reference path="./test-utils.ts" />
|
|
25
|
-
/// <reference path="./tests.ts" />
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
declare module '@ioc:Adonis/Core/Static' {
|
|
3
|
-
import { Stats } from 'fs';
|
|
4
|
-
type AssetsConfig = {
|
|
5
|
-
enabled: boolean;
|
|
6
|
-
acceptRanges?: boolean;
|
|
7
|
-
cacheControl?: boolean;
|
|
8
|
-
dotFiles?: 'ignore' | 'allow' | 'deny';
|
|
9
|
-
etag?: boolean;
|
|
10
|
-
lastModified?: boolean;
|
|
11
|
-
maxAge?: number | string;
|
|
12
|
-
immutable?: boolean;
|
|
13
|
-
headers?: (path: string, stats: Stats) => Record<string, any>;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
declare module '@ioc:Adonis/Core/TestUtils' {
|
|
4
|
-
import type { Server as HttpsServer } from 'https';
|
|
5
|
-
import type { MacroableConstructorContract } from 'macroable';
|
|
6
|
-
import type { IncomingMessage, ServerResponse, Server } from 'http';
|
|
7
|
-
export type ServerHandler = (req: IncomingMessage, res: ServerResponse) => any;
|
|
8
|
-
export type CustomServerCallback = (handler: ServerHandler) => Server | HttpsServer;
|
|
9
|
-
export interface TestUtilsContract {
|
|
10
|
-
constructor: MacroableConstructorContract<TestUtilsContract>;
|
|
11
|
-
ace(): {
|
|
12
|
-
loadCommands(): Promise<void>;
|
|
13
|
-
};
|
|
14
|
-
httpServer(): {
|
|
15
|
-
start(serverCallback?: CustomServerCallback): Promise<() => Promise<void>>;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Test utils module is meant to be extended to add custom
|
|
20
|
-
* utilities required for testing AdonisJS applications.
|
|
21
|
-
*/
|
|
22
|
-
const TestUtils: TestUtilsContract;
|
|
23
|
-
export default TestUtils;
|
|
24
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import '@japa/api-client';
|
|
2
|
-
declare module '@japa/api-client' {
|
|
3
|
-
interface ApiRequest {
|
|
4
|
-
/**
|
|
5
|
-
* Define encrypted cookie
|
|
6
|
-
*/
|
|
7
|
-
encryptedCookie(key: string, value: any): this;
|
|
8
|
-
/**
|
|
9
|
-
* Define plain cookie
|
|
10
|
-
*/
|
|
11
|
-
plainCookie(key: string, value: any): this;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* @adonisjs/core
|
|
4
|
-
*
|
|
5
|
-
* (c) AdonisJS
|
|
6
|
-
*
|
|
7
|
-
* For the full copyright and license information, please view the LICENSE
|
|
8
|
-
* file that was distributed with this source code.
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
require("@japa/api-client");
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { BaseCommand } from '@adonisjs/ace';
|
|
2
|
-
/**
|
|
3
|
-
* A command to display a list of routes
|
|
4
|
-
*/
|
|
5
|
-
export default class DumpRcFile extends BaseCommand {
|
|
6
|
-
static commandName: string;
|
|
7
|
-
static description: string;
|
|
8
|
-
/**
|
|
9
|
-
* Log message
|
|
10
|
-
*/
|
|
11
|
-
private log;
|
|
12
|
-
run(): Promise<void>;
|
|
13
|
-
}
|
package/build/commands/DumpRc.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* @adonisjs/core
|
|
4
|
-
*
|
|
5
|
-
* (c) Harminder Virk <virk@adonisjs.com>
|
|
6
|
-
*
|
|
7
|
-
* For the full copyright and license information, please view the LICENSE
|
|
8
|
-
* file that was distributed with this source code.
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
const ace_1 = require("@adonisjs/ace");
|
|
12
|
-
/**
|
|
13
|
-
* A command to display a list of routes
|
|
14
|
-
*/
|
|
15
|
-
class DumpRcFile extends ace_1.BaseCommand {
|
|
16
|
-
/**
|
|
17
|
-
* Log message
|
|
18
|
-
*/
|
|
19
|
-
log(message) {
|
|
20
|
-
if (this.application.environment === 'test') {
|
|
21
|
-
this.logger.log(message);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
console.log(message);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
async run() {
|
|
28
|
-
this.log(JSON.stringify(this.application.rcFile, null, 2));
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.default = DumpRcFile;
|
|
32
|
-
DumpRcFile.commandName = 'dump:rcfile';
|
|
33
|
-
DumpRcFile.description = 'Dump contents of .adonisrc.json file along with defaults';
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* @adonisjs/core
|
|
4
|
-
*
|
|
5
|
-
* (c) Harminder Virk <virk@adonisjs.com>
|
|
6
|
-
*
|
|
7
|
-
* For the full copyright and license information, please view the LICENSE
|
|
8
|
-
* file that was distributed with this source code.
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
const ace_1 = require("@adonisjs/ace");
|
|
12
|
-
const helpers_1 = require("@poppinss/utils/build/helpers");
|
|
13
|
-
/**
|
|
14
|
-
* A command to generate a secure app key
|
|
15
|
-
*/
|
|
16
|
-
class GenerateKey extends ace_1.BaseCommand {
|
|
17
|
-
async run() {
|
|
18
|
-
const secret = helpers_1.string.generateRandom(32);
|
|
19
|
-
console.log(this.colors.green(secret));
|
|
20
|
-
console.log(this.colors.gray(' > During development, you may want to set the above secret as "APP_KEY" inside the .env file'));
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
exports.default = GenerateKey;
|
|
24
|
-
GenerateKey.commandName = 'generate:key';
|
|
25
|
-
GenerateKey.description = 'Generate a new APP_KEY secret';
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { BaseCommand } from '@adonisjs/core/build/standalone';
|
|
2
|
-
import ListRoutes from '..';
|
|
3
|
-
export declare class BaseRender {
|
|
4
|
-
protected command: ListRoutes;
|
|
5
|
-
constructor(command: ListRoutes);
|
|
6
|
-
/**
|
|
7
|
-
* The colors associated with each HTTP method
|
|
8
|
-
*/
|
|
9
|
-
private methodColors;
|
|
10
|
-
/**
|
|
11
|
-
* Returns the color name for a HTTP method
|
|
12
|
-
*/
|
|
13
|
-
getHttpMethodColor(method: string): keyof BaseCommand['colors'];
|
|
14
|
-
/**
|
|
15
|
-
* Find if the route contains all the methods registered by
|
|
16
|
-
* the "Route.any" method
|
|
17
|
-
*/
|
|
18
|
-
hasAllMethods(methods: string[]): boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Colorize the route methods
|
|
21
|
-
*/
|
|
22
|
-
colorizeRouteMethods(methods: string[]): string;
|
|
23
|
-
/**
|
|
24
|
-
* Colorize the route pattern
|
|
25
|
-
*/
|
|
26
|
-
colorizeRoutePattern(pattern: string): string;
|
|
27
|
-
/**
|
|
28
|
-
* Returns the rendering width.
|
|
29
|
-
*/
|
|
30
|
-
getRenderingWidth(): number;
|
|
31
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* @adonisjs/core
|
|
4
|
-
*
|
|
5
|
-
* (c) AdonisJS
|
|
6
|
-
*
|
|
7
|
-
* For the full copyright and license information, please view the LICENSE
|
|
8
|
-
* file that was distributed with this source code.
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.BaseRender = void 0;
|
|
12
|
-
/**
|
|
13
|
-
* Methods registered by "Route.any" method
|
|
14
|
-
*/
|
|
15
|
-
const ALL_METHODS = ['HEAD', 'OPTIONS', 'GET', 'POST', 'PUT', 'PATCH', 'DELETE'];
|
|
16
|
-
class BaseRender {
|
|
17
|
-
constructor(command) {
|
|
18
|
-
this.command = command;
|
|
19
|
-
/**
|
|
20
|
-
* The colors associated with each HTTP method
|
|
21
|
-
*/
|
|
22
|
-
this.methodColors = {
|
|
23
|
-
GET: 'cyan',
|
|
24
|
-
POST: 'green',
|
|
25
|
-
PUT: 'yellow',
|
|
26
|
-
PATCH: 'yellow',
|
|
27
|
-
DELETE: 'red',
|
|
28
|
-
HEAD: 'gray',
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Returns the color name for a HTTP method
|
|
33
|
-
*/
|
|
34
|
-
getHttpMethodColor(method) {
|
|
35
|
-
const methodColor = this.methodColors[method];
|
|
36
|
-
return methodColor ? methodColor : 'gray';
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Find if the route contains all the methods registered by
|
|
40
|
-
* the "Route.any" method
|
|
41
|
-
*/
|
|
42
|
-
hasAllMethods(methods) {
|
|
43
|
-
return ALL_METHODS.every((method) => methods.includes(method));
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Colorize the route methods
|
|
47
|
-
*/
|
|
48
|
-
colorizeRouteMethods(methods) {
|
|
49
|
-
return this.hasAllMethods(methods)
|
|
50
|
-
? this.command.colors.cyan('ANY')
|
|
51
|
-
: methods
|
|
52
|
-
.map((method) => this.command.colors[this.getHttpMethodColor(method)](method))
|
|
53
|
-
.join(this.command.colors.gray('|'));
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Colorize the route pattern
|
|
57
|
-
*/
|
|
58
|
-
colorizeRoutePattern(pattern) {
|
|
59
|
-
return pattern
|
|
60
|
-
.replace(/:([^/]+)/gm, `${this.command.colors.yellow('$&')}`)
|
|
61
|
-
.replace(/\*/gm, `${this.command.colors.red('$&')}`);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Returns the rendering width.
|
|
65
|
-
*/
|
|
66
|
-
getRenderingWidth() {
|
|
67
|
-
return this.command.maxWidth || process.stdout.columns || 80;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
exports.BaseRender = BaseRender;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { BaseRender } from './Base';
|
|
2
|
-
import ListRoutes from '../index';
|
|
3
|
-
/**
|
|
4
|
-
* Renders the routes as a pretty list
|
|
5
|
-
*/
|
|
6
|
-
export declare class RoutesPrettyRenderer extends BaseRender {
|
|
7
|
-
private routes;
|
|
8
|
-
private renderingWidth;
|
|
9
|
-
private longestMethodName;
|
|
10
|
-
constructor(command: ListRoutes);
|
|
11
|
-
/**
|
|
12
|
-
* Returns a list of serialized routes
|
|
13
|
-
*/
|
|
14
|
-
private serializeRotues;
|
|
15
|
-
/**
|
|
16
|
-
* Returns the name of the longest method name
|
|
17
|
-
* across all the routes
|
|
18
|
-
*/
|
|
19
|
-
private findLongestMethodName;
|
|
20
|
-
/**
|
|
21
|
-
* Render a single route by concatenating and colorizing each part of it
|
|
22
|
-
*/
|
|
23
|
-
private outputRoute;
|
|
24
|
-
/**
|
|
25
|
-
* Log message
|
|
26
|
-
*/
|
|
27
|
-
private log;
|
|
28
|
-
/**
|
|
29
|
-
* Crop the handler name
|
|
30
|
-
*/
|
|
31
|
-
private cropHandlerName;
|
|
32
|
-
/**
|
|
33
|
-
* Returns the whitespace to be rendered between the
|
|
34
|
-
* route methods and the route pattern
|
|
35
|
-
*/
|
|
36
|
-
private getWhiteSpace;
|
|
37
|
-
/**
|
|
38
|
-
* Returns the rendering width with and without the
|
|
39
|
-
* route handler
|
|
40
|
-
*/
|
|
41
|
-
private getRenderingWidths;
|
|
42
|
-
/**
|
|
43
|
-
* Returns the dashes to be rendered between pattern and the
|
|
44
|
-
* route handler name.
|
|
45
|
-
*/
|
|
46
|
-
private getDashes;
|
|
47
|
-
/**
|
|
48
|
-
* Renders routes to the console
|
|
49
|
-
*/
|
|
50
|
-
render(): void;
|
|
51
|
-
}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* @adonisjs/core
|
|
4
|
-
*
|
|
5
|
-
* (c) AdonisJS
|
|
6
|
-
*
|
|
7
|
-
* For the full copyright and license information, please view the LICENSE.md
|
|
8
|
-
* file that was distributed with this source code.
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.RoutesPrettyRenderer = void 0;
|
|
12
|
-
const Base_1 = require("./Base");
|
|
13
|
-
/**
|
|
14
|
-
* Renders the routes as a pretty list
|
|
15
|
-
*/
|
|
16
|
-
class RoutesPrettyRenderer extends Base_1.BaseRender {
|
|
17
|
-
constructor(command) {
|
|
18
|
-
super(command);
|
|
19
|
-
this.routes = this.serializeRotues();
|
|
20
|
-
this.renderingWidth = this.getRenderingWidth();
|
|
21
|
-
this.longestMethodName = this.findLongestMethodName();
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Returns a list of serialized routes
|
|
25
|
-
*/
|
|
26
|
-
serializeRotues() {
|
|
27
|
-
const serializedRoutes = this.command.serializeRoutes();
|
|
28
|
-
return Object.keys(serializedRoutes)
|
|
29
|
-
.map((domain) => serializedRoutes[domain])
|
|
30
|
-
.flat();
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Returns the name of the longest method name
|
|
34
|
-
* across all the routes
|
|
35
|
-
*/
|
|
36
|
-
findLongestMethodName() {
|
|
37
|
-
return (Math.max(...this.routes.map((route) => {
|
|
38
|
-
return this.hasAllMethods(route.methods) ? 'ANY'.length : route.methods.join('|').length;
|
|
39
|
-
})) - 1);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Render a single route by concatenating and colorizing each part of it
|
|
43
|
-
*/
|
|
44
|
-
outputRoute(route, renderingOptions) {
|
|
45
|
-
const methodsOutput = this.colorizeRouteMethods(route.methods);
|
|
46
|
-
const patternOutput = this.colorizeRoutePattern(route.pattern);
|
|
47
|
-
const nameAndHandlerOutput = this.command.colors.gray(route.handler);
|
|
48
|
-
const dashesOutput = this.command.colors.gray(renderingOptions.dashes);
|
|
49
|
-
this.log(methodsOutput + renderingOptions.spaces + patternOutput + dashesOutput + nameAndHandlerOutput);
|
|
50
|
-
/**
|
|
51
|
-
* Display middleware in verbose mode
|
|
52
|
-
*/
|
|
53
|
-
if (route.middleware.length && this.command.verbose) {
|
|
54
|
-
const middleware = route.middleware
|
|
55
|
-
.map((one) => {
|
|
56
|
-
const glyph = '├──';
|
|
57
|
-
const spaces = ' '.repeat(Math.max(this.longestMethodName + 5, 0));
|
|
58
|
-
return this.command.colors.gray(`${spaces} ${glyph} ${one}`);
|
|
59
|
-
})
|
|
60
|
-
.join('\n');
|
|
61
|
-
this.log(middleware);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Log message
|
|
66
|
-
*/
|
|
67
|
-
log(message) {
|
|
68
|
-
if (this.command.application.environment === 'test') {
|
|
69
|
-
this.command.logger.log(message);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
console.log(message);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Crop the handler name
|
|
77
|
-
*/
|
|
78
|
-
cropHandlerName(handlerName, totalLength) {
|
|
79
|
-
return handlerName.substring(0, this.renderingWidth - totalLength - 1) + '…';
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Returns the whitespace to be rendered between the
|
|
83
|
-
* route methods and the route pattern
|
|
84
|
-
*/
|
|
85
|
-
getWhiteSpace(methods) {
|
|
86
|
-
return ' '.repeat(Math.max(this.longestMethodName + 5 - methods.length, 0));
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Returns the rendering width with and without the
|
|
90
|
-
* route handler
|
|
91
|
-
*/
|
|
92
|
-
getRenderingWidths(methods, spaces, pattern, nameAndHandler) {
|
|
93
|
-
const widthWithoutHandler = (methods + spaces + pattern).length + 1;
|
|
94
|
-
const totalWidth = widthWithoutHandler + nameAndHandler.length;
|
|
95
|
-
return { widthWithoutHandler, totalWidth };
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Returns the dashes to be rendered between pattern and the
|
|
99
|
-
* route handler name.
|
|
100
|
-
*/
|
|
101
|
-
getDashes(totalWidth) {
|
|
102
|
-
return ` ${'─'.repeat(Math.max(this.renderingWidth - totalWidth, 0))}`;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Renders routes to the console
|
|
106
|
-
*/
|
|
107
|
-
render() {
|
|
108
|
-
this.routes.forEach((route) => {
|
|
109
|
-
const methods = this.hasAllMethods(route.methods) ? 'ANY' : route.methods.join('|');
|
|
110
|
-
const pattern = route.domain !== 'root' ? `${route.domain}${route.pattern}` : route.pattern;
|
|
111
|
-
let handler = route.name ? ` ${route.name} › ${route.handler}` : ` ${route.handler}`;
|
|
112
|
-
const spaces = this.getWhiteSpace(methods);
|
|
113
|
-
const widths = this.getRenderingWidths(methods, spaces, pattern, handler);
|
|
114
|
-
const dashes = this.getDashes(widths.totalWidth);
|
|
115
|
-
/**
|
|
116
|
-
* If name and handler output is too long we crop it
|
|
117
|
-
*/
|
|
118
|
-
if (widths.totalWidth > this.renderingWidth) {
|
|
119
|
-
handler = this.cropHandlerName(handler, widths.widthWithoutHandler);
|
|
120
|
-
}
|
|
121
|
-
this.outputRoute({
|
|
122
|
-
pattern,
|
|
123
|
-
handler,
|
|
124
|
-
middleware: route.middleware,
|
|
125
|
-
methods: route.methods,
|
|
126
|
-
domain: route.domain,
|
|
127
|
-
name: route.name,
|
|
128
|
-
}, {
|
|
129
|
-
spaces,
|
|
130
|
-
dashes,
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
exports.RoutesPrettyRenderer = RoutesPrettyRenderer;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import ListRoutes from '../index';
|
|
2
|
-
import { BaseRender } from './Base';
|
|
3
|
-
/**
|
|
4
|
-
* Renders the routes in a table
|
|
5
|
-
*/
|
|
6
|
-
export declare class RoutesTableRenderer extends BaseRender {
|
|
7
|
-
private routes;
|
|
8
|
-
private domains;
|
|
9
|
-
private columns;
|
|
10
|
-
private longestPatternName;
|
|
11
|
-
constructor(command: ListRoutes);
|
|
12
|
-
/**
|
|
13
|
-
* Returns the length of the longest pattern name among
|
|
14
|
-
* all the routes
|
|
15
|
-
*/
|
|
16
|
-
private getLongestPatterName;
|
|
17
|
-
/**
|
|
18
|
-
* Returns the width for methods column. We limit them at 15 max and
|
|
19
|
-
* return the left over from the column size
|
|
20
|
-
*/
|
|
21
|
-
private getMethodsColumnWidth;
|
|
22
|
-
/**
|
|
23
|
-
* Returns the width for all the columns.
|
|
24
|
-
*/
|
|
25
|
-
private getColumnsSize;
|
|
26
|
-
/**
|
|
27
|
-
* Distributing the left over from the methods column between
|
|
28
|
-
* the pattern column and the handler column.
|
|
29
|
-
*/
|
|
30
|
-
private distributeLeftOverBetweenColumns;
|
|
31
|
-
private getTable;
|
|
32
|
-
/**
|
|
33
|
-
* Render the serialized routes to the console
|
|
34
|
-
*/
|
|
35
|
-
render(): void;
|
|
36
|
-
}
|