@adonisjs/core 6.1.5-2 → 6.1.5-21
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/build/commands/build.d.ts +10 -0
- package/build/commands/build.js +65 -22
- package/build/commands/commands.json +1 -1
- package/build/commands/configure.d.ts +30 -3
- package/build/commands/configure.js +103 -25
- package/build/commands/eject.d.ts +4 -0
- package/build/commands/eject.js +16 -8
- package/build/commands/generate_key.d.ts +4 -0
- package/build/commands/generate_key.js +15 -8
- package/build/commands/inspect_rcfile.d.ts +9 -0
- package/build/commands/inspect_rcfile.js +36 -0
- package/build/commands/list/routes.d.ts +23 -0
- package/build/commands/list/routes.js +29 -13
- package/build/commands/main.d.ts +4 -0
- package/build/commands/make/command.d.ts +7 -1
- package/build/commands/make/command.js +20 -7
- package/build/commands/make/controller.d.ts +10 -1
- package/build/commands/make/controller.js +35 -14
- package/build/commands/make/event.d.ts +7 -1
- package/build/commands/make/event.js +20 -8
- package/build/commands/make/exception.d.ts +14 -0
- package/build/commands/make/exception.js +37 -0
- package/build/commands/make/listener.d.ts +8 -1
- package/build/commands/make/listener.js +28 -12
- package/build/commands/make/middleware.d.ts +8 -1
- package/build/commands/make/middleware.js +21 -8
- package/build/commands/make/preload.d.ts +22 -0
- package/build/commands/make/preload.js +99 -0
- package/build/commands/make/provider.d.ts +7 -1
- package/build/commands/make/provider.js +28 -8
- package/build/commands/make/service.d.ts +14 -0
- package/build/commands/make/service.js +37 -0
- package/build/commands/make/test.d.ts +10 -1
- package/build/commands/make/test.js +46 -10
- package/build/commands/make/validator.d.ts +14 -0
- package/build/commands/make/validator.js +37 -0
- package/build/commands/make/view.d.ts +14 -0
- package/build/commands/make/view.js +37 -0
- package/build/commands/repl.d.ts +14 -0
- package/build/commands/repl.js +30 -0
- package/build/commands/serve.d.ts +12 -0
- package/build/commands/serve.js +78 -27
- package/build/commands/test.d.ts +32 -0
- package/build/commands/test.js +203 -0
- package/build/factories/app.js +8 -0
- package/build/factories/bodyparser.js +8 -0
- package/build/factories/core/ace.d.ts +4 -1
- package/build/factories/core/ace.js +11 -0
- package/build/factories/core/ignitor.d.ts +20 -1
- package/build/factories/core/ignitor.js +35 -1
- package/build/factories/core/main.js +8 -0
- package/build/factories/core/test_utils.d.ts +4 -1
- package/build/factories/core/test_utils.js +11 -0
- package/build/factories/encryption.js +8 -0
- package/build/factories/events.js +8 -0
- package/build/factories/hash.js +8 -0
- package/build/factories/http.js +8 -0
- package/build/factories/logger.js +8 -0
- package/build/factories/stubs.d.ts +10 -0
- package/build/factories/stubs.js +23 -1
- package/build/index.d.ts +6 -2
- package/build/index.js +14 -1
- package/build/modules/ace/codemods.d.ts +54 -0
- package/build/modules/ace/codemods.js +133 -0
- package/build/modules/ace/commands.d.ts +48 -0
- package/build/modules/ace/commands.js +54 -0
- package/build/modules/ace/create_kernel.d.ts +9 -0
- package/build/modules/ace/create_kernel.js +32 -1
- package/build/modules/ace/kernel.d.ts +4 -0
- package/build/modules/ace/kernel.js +12 -0
- package/build/modules/ace/main.js +8 -0
- package/build/modules/ace/shell.d.ts +9 -1
- package/build/modules/ace/shell.js +21 -0
- package/build/modules/app.js +8 -0
- package/build/modules/bodyparser/bodyparser_middleware.d.ts +4 -0
- package/build/modules/bodyparser/bodyparser_middleware.js +12 -0
- package/build/modules/bodyparser/main.js +8 -0
- package/build/modules/config.js +8 -0
- package/build/modules/container.js +8 -0
- package/build/modules/encryption.js +8 -0
- package/build/modules/env.js +8 -0
- package/build/modules/events.js +8 -0
- package/build/modules/hash/define_config.d.ts +4 -0
- package/build/modules/hash/define_config.js +23 -0
- package/build/modules/hash/drivers/argon.d.ts +1 -0
- package/build/modules/hash/drivers/argon.js +9 -0
- package/build/modules/hash/drivers/bcrypt.d.ts +1 -0
- package/build/modules/hash/drivers/bcrypt.js +9 -0
- package/build/modules/hash/drivers/scrypt.d.ts +1 -0
- package/build/modules/hash/drivers/scrypt.js +9 -0
- package/build/modules/hash/drivers_collection.d.ts +16 -4
- package/build/modules/hash/drivers_collection.js +31 -8
- package/build/modules/hash/main.d.ts +1 -0
- package/build/modules/hash/main.js +9 -0
- package/build/modules/http/main.d.ts +2 -0
- package/build/modules/http/main.js +10 -0
- package/build/modules/http/request_validator.d.ts +34 -0
- package/build/modules/http/request_validator.js +66 -0
- package/build/modules/logger.js +8 -0
- package/build/modules/repl.d.ts +1 -0
- package/build/modules/repl.js +9 -0
- package/build/providers/app_provider.d.ts +31 -2
- package/build/providers/app_provider.js +44 -15
- package/build/providers/edge_provider.d.ts +31 -0
- package/build/providers/edge_provider.js +69 -0
- package/build/providers/hash_provider.d.ts +22 -2
- package/build/providers/hash_provider.js +49 -7
- package/build/providers/http_provider.d.ts +17 -0
- package/build/providers/http_provider.js +26 -1
- package/build/providers/repl_provider.d.ts +13 -0
- package/build/providers/repl_provider.js +98 -0
- package/build/providers/vinejs_provider.d.ts +33 -0
- package/build/providers/vinejs_provider.js +84 -0
- package/build/services/ace.js +15 -0
- package/build/services/app.d.ts +8 -0
- package/build/services/app.js +16 -0
- package/build/services/config.js +11 -0
- package/build/services/emitter.js +13 -2
- package/build/services/encryption.js +13 -2
- package/build/services/hash.js +13 -2
- package/build/services/logger.js +13 -2
- package/build/services/repl.d.ts +3 -0
- package/build/services/repl.js +18 -0
- package/build/services/router.js +13 -2
- package/build/services/server.js +13 -2
- package/build/services/test_utils.js +15 -0
- package/build/src/cli_formatters/routes_list.d.ts +24 -1
- package/build/src/cli_formatters/routes_list.js +118 -0
- package/build/src/debug.d.ts +1 -1
- package/build/src/debug.js +8 -0
- package/build/src/exceptions.d.ts +1 -0
- package/build/src/exceptions.js +9 -0
- package/build/src/helpers/is.js +8 -0
- package/build/src/helpers/main.d.ts +1 -1
- package/build/src/helpers/main.js +9 -1
- package/build/src/helpers/parse_binding_reference.d.ts +40 -0
- package/build/src/helpers/parse_binding_reference.js +60 -0
- package/build/src/helpers/string.d.ts +26 -0
- package/build/src/helpers/string.js +15 -0
- package/build/src/helpers/types.d.ts +114 -16
- package/build/src/helpers/types.js +13 -0
- package/build/src/ignitor/ace.d.ts +12 -0
- package/build/src/ignitor/ace.js +50 -1
- package/build/src/ignitor/http.d.ts +9 -2
- package/build/src/ignitor/http.js +67 -0
- package/build/src/ignitor/main.d.ts +29 -1
- package/build/src/ignitor/main.js +56 -0
- package/build/src/ignitor/test.d.ts +10 -0
- package/build/src/ignitor/test.js +25 -0
- package/build/src/internal_helpers.d.ts +12 -5
- package/build/src/internal_helpers.js +35 -7
- package/build/src/test_utils/http.d.ts +10 -2
- package/build/src/test_utils/http.js +19 -0
- package/build/src/test_utils/main.d.ts +21 -3
- package/build/src/test_utils/main.js +27 -1
- package/build/src/types.d.ts +65 -4
- package/build/src/types.js +8 -0
- package/build/stubs/main.js +10 -0
- package/build/stubs/make/exception/main.stub +10 -0
- package/build/stubs/make/preload_file/main.stub +4 -0
- package/build/stubs/make/service/main.stub +4 -0
- package/build/stubs/make/validator/main.stub +5 -0
- package/build/stubs/make/view/main.stub +4 -0
- package/build/toolkit/commands/index_commands.d.ts +4 -0
- package/build/toolkit/commands/index_commands.js +13 -5
- package/build/toolkit/main.js +11 -0
- package/build/types/ace.js +8 -0
- package/build/types/app.js +8 -0
- package/build/types/bodyparser.js +8 -0
- package/build/types/container.js +8 -0
- package/build/types/encryption.js +8 -0
- package/build/types/events.js +8 -0
- package/build/types/hash.js +8 -0
- package/build/types/http.d.ts +7 -0
- package/build/types/http.js +8 -0
- package/build/types/logger.js +8 -0
- package/build/types/repl.d.ts +1 -0
- package/build/types/repl.js +9 -0
- package/package.json +83 -121
- package/build/commands/make/_base.d.ts +0 -6
- package/build/commands/make/_base.js +0 -19
- package/build/legacy/validator.d.ts +0 -1
- package/build/legacy/validator.js +0 -1
- package/build/modules/http.d.ts +0 -1
- package/build/modules/http.js +0 -1
- package/build/src/helpers/string_builder.d.ts +0 -23
- package/build/src/helpers/string_builder.js +0 -86
- package/build/stubs/index.js +0 -2
- /package/build/stubs/{index.d.ts → main.d.ts} +0 -0
|
@@ -1,32 +1,60 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* @adonisjs/core
|
|
3
|
+
*
|
|
4
|
+
* (c) AdonisJS
|
|
5
|
+
*
|
|
6
|
+
* For the full copyright and license information, please view the LICENSE
|
|
7
|
+
* file that was distributed with this source code.
|
|
8
|
+
*/
|
|
9
|
+
import { existsSync } from 'node:fs';
|
|
10
|
+
/**
|
|
11
|
+
* Imports assembler optionally
|
|
12
|
+
*/
|
|
2
13
|
export async function importAssembler(app) {
|
|
3
14
|
try {
|
|
4
15
|
return await app.import('@adonisjs/assembler');
|
|
5
16
|
}
|
|
6
17
|
catch { }
|
|
7
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Imports typescript optionally
|
|
21
|
+
*/
|
|
8
22
|
export async function importTypeScript(app) {
|
|
9
23
|
try {
|
|
10
24
|
return await app.importDefault('typescript');
|
|
11
25
|
}
|
|
12
26
|
catch { }
|
|
13
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Generates an array of filenames with different JavaScript
|
|
30
|
+
* extensions for the given filename
|
|
31
|
+
*/
|
|
32
|
+
function generateJsFilenames(filename) {
|
|
33
|
+
const extensions = ['.js', '.ts', '.cjs', '.mjs', '.cts', '.mts'];
|
|
34
|
+
return extensions.map((extension) => filename + extension);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Detects the assets bundler in use. The rcFile.assetsBundler is
|
|
38
|
+
* used when exists.
|
|
39
|
+
*/
|
|
14
40
|
export async function detectAssetsBundler(app) {
|
|
15
41
|
if (app.rcFile.assetsBundler) {
|
|
16
42
|
return app.rcFile.assetsBundler;
|
|
17
43
|
}
|
|
18
|
-
|
|
44
|
+
const possibleViteConfigFiles = generateJsFilenames('vite.config');
|
|
45
|
+
if (possibleViteConfigFiles.some((config) => existsSync(app.makePath(config)))) {
|
|
19
46
|
return {
|
|
20
47
|
name: 'vite',
|
|
21
|
-
|
|
22
|
-
|
|
48
|
+
devServer: { command: 'vite' },
|
|
49
|
+
build: { command: 'vite', args: ['build'] },
|
|
23
50
|
};
|
|
24
51
|
}
|
|
25
|
-
|
|
52
|
+
const possibleEncoreConfigFiles = generateJsFilenames('webpack.config');
|
|
53
|
+
if (possibleEncoreConfigFiles.some((config) => existsSync(app.makePath(config)))) {
|
|
26
54
|
return {
|
|
27
55
|
name: 'encore',
|
|
28
|
-
|
|
29
|
-
|
|
56
|
+
devServer: { command: 'encore', args: ['dev-server'] },
|
|
57
|
+
build: { command: 'encore', args: ['production'] },
|
|
30
58
|
};
|
|
31
59
|
}
|
|
32
60
|
}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
1
|
+
/// <reference types="@types/node" resolution-mode="require"/>
|
|
2
|
+
/// <reference types="@types/node" resolution-mode="require"/>
|
|
3
3
|
import type { TestUtils } from './main.js';
|
|
4
4
|
import type { Server as NodeHttpsServer } from 'node:https';
|
|
5
5
|
import { IncomingMessage, ServerResponse, Server as NodeHttpServer } from 'node:http';
|
|
6
|
+
/**
|
|
7
|
+
* Http server utils are used to start the AdonisJS HTTP server
|
|
8
|
+
* during testing
|
|
9
|
+
*/
|
|
6
10
|
export declare class HttpServerUtils {
|
|
7
11
|
#private;
|
|
8
12
|
constructor(utils: TestUtils);
|
|
13
|
+
/**
|
|
14
|
+
* Testing hook to start the HTTP server to listen for new request.
|
|
15
|
+
* The return value is a function to close the HTTP server.
|
|
16
|
+
*/
|
|
9
17
|
start(serverCallback?: (handler: (req: IncomingMessage, res: ServerResponse) => any) => NodeHttpsServer | NodeHttpServer): Promise<() => Promise<void>>;
|
|
10
18
|
}
|
|
@@ -1,10 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @adonisjs/core
|
|
3
|
+
*
|
|
4
|
+
* (c) AdonisJS
|
|
5
|
+
*
|
|
6
|
+
* For the full copyright and license information, please view the LICENSE
|
|
7
|
+
* file that was distributed with this source code.
|
|
8
|
+
*/
|
|
1
9
|
import debug from '../debug.js';
|
|
2
10
|
import { createServer } from 'node:http';
|
|
11
|
+
/**
|
|
12
|
+
* Http server utils are used to start the AdonisJS HTTP server
|
|
13
|
+
* during testing
|
|
14
|
+
*/
|
|
3
15
|
export class HttpServerUtils {
|
|
4
16
|
#utils;
|
|
5
17
|
constructor(utils) {
|
|
6
18
|
this.#utils = utils;
|
|
7
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Starts the http server a given host and port
|
|
22
|
+
*/
|
|
8
23
|
#listen(nodeHttpServer) {
|
|
9
24
|
return new Promise((resolve, reject) => {
|
|
10
25
|
const host = process.env.HOST || '0.0.0.0';
|
|
@@ -19,6 +34,10 @@ export class HttpServerUtils {
|
|
|
19
34
|
});
|
|
20
35
|
});
|
|
21
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Testing hook to start the HTTP server to listen for new request.
|
|
39
|
+
* The return value is a function to close the HTTP server.
|
|
40
|
+
*/
|
|
22
41
|
async start(serverCallback) {
|
|
23
42
|
const createHTTPServer = serverCallback || createServer;
|
|
24
43
|
const server = await this.#utils.app.container.make('server');
|
|
@@ -1,19 +1,37 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
1
|
+
/// <reference types="@types/node" resolution-mode="require"/>
|
|
2
2
|
import Macroable from '@poppinss/macroable';
|
|
3
3
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
4
4
|
import { HttpServerUtils } from './http.js';
|
|
5
|
+
import { CookieClient } from '../../modules/http/main.js';
|
|
5
6
|
import type { ApplicationService } from '../types.js';
|
|
6
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Test utils has a collection of helper methods to make testing
|
|
9
|
+
* experience great for AdonisJS applications
|
|
10
|
+
*/
|
|
7
11
|
export declare class TestUtils extends Macroable {
|
|
8
12
|
#private;
|
|
9
13
|
app: ApplicationService;
|
|
14
|
+
/**
|
|
15
|
+
* Check if utils have been booted
|
|
16
|
+
*/
|
|
10
17
|
get isBooted(): boolean;
|
|
11
18
|
cookies: CookieClient;
|
|
12
19
|
constructor(app: ApplicationService);
|
|
20
|
+
/**
|
|
21
|
+
* Boot test utils. It requires the app to be booted
|
|
22
|
+
* and container to have all the bindings
|
|
23
|
+
*/
|
|
13
24
|
boot(): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Returns an instance of the HTTP server testing
|
|
27
|
+
* utils
|
|
28
|
+
*/
|
|
14
29
|
httpServer(): HttpServerUtils;
|
|
30
|
+
/**
|
|
31
|
+
* Create an instance of HTTP context for testing
|
|
32
|
+
*/
|
|
15
33
|
createHttpContext(options?: {
|
|
16
34
|
req?: IncomingMessage;
|
|
17
35
|
res?: ServerResponse;
|
|
18
|
-
}): Promise<import("
|
|
36
|
+
}): Promise<import("@adonisjs/core/http").HttpContext>;
|
|
19
37
|
}
|
|
@@ -1,11 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @adonisjs/core
|
|
3
|
+
*
|
|
4
|
+
* (c) AdonisJS
|
|
5
|
+
*
|
|
6
|
+
* For the full copyright and license information, please view the LICENSE
|
|
7
|
+
* file that was distributed with this source code.
|
|
8
|
+
*/
|
|
1
9
|
import { Socket } from 'node:net';
|
|
2
10
|
import Macroable from '@poppinss/macroable';
|
|
3
11
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
4
12
|
import { HttpServerUtils } from './http.js';
|
|
5
|
-
import { CookieClient } from '../../modules/http.js';
|
|
13
|
+
import { CookieClient } from '../../modules/http/main.js';
|
|
14
|
+
/**
|
|
15
|
+
* Test utils has a collection of helper methods to make testing
|
|
16
|
+
* experience great for AdonisJS applications
|
|
17
|
+
*/
|
|
6
18
|
export class TestUtils extends Macroable {
|
|
7
19
|
app;
|
|
8
20
|
#booted = false;
|
|
21
|
+
/**
|
|
22
|
+
* Check if utils have been booted
|
|
23
|
+
*/
|
|
9
24
|
get isBooted() {
|
|
10
25
|
return this.#booted;
|
|
11
26
|
}
|
|
@@ -13,15 +28,26 @@ export class TestUtils extends Macroable {
|
|
|
13
28
|
super();
|
|
14
29
|
this.app = app;
|
|
15
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Boot test utils. It requires the app to be booted
|
|
33
|
+
* and container to have all the bindings
|
|
34
|
+
*/
|
|
16
35
|
async boot() {
|
|
17
36
|
if (!this.isBooted) {
|
|
18
37
|
this.#booted = true;
|
|
19
38
|
this.cookies = new CookieClient(await this.app.container.make('encryption'));
|
|
20
39
|
}
|
|
21
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Returns an instance of the HTTP server testing
|
|
43
|
+
* utils
|
|
44
|
+
*/
|
|
22
45
|
httpServer() {
|
|
23
46
|
return new HttpServerUtils(this);
|
|
24
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Create an instance of HTTP context for testing
|
|
50
|
+
*/
|
|
25
51
|
async createHttpContext(options = {}) {
|
|
26
52
|
const req = options.req || new IncomingMessage(new Socket());
|
|
27
53
|
const res = options.res || new ServerResponse(req);
|
package/build/src/types.d.ts
CHANGED
|
@@ -1,53 +1,114 @@
|
|
|
1
|
+
import type { Repl } from '../modules/repl.js';
|
|
1
2
|
import type { Importer } from '../types/app.js';
|
|
2
3
|
import type { Emitter } from '../modules/events.js';
|
|
3
4
|
import type { Kernel } from '../modules/ace/main.js';
|
|
4
5
|
import type { Application } from '../modules/app.js';
|
|
5
6
|
import type { TestUtils } from './test_utils/main.js';
|
|
6
|
-
import type { Router, Server } from '../modules/http.js';
|
|
7
7
|
import type { LoggerManager } from '../modules/logger.js';
|
|
8
|
+
import type { HashManager } from '../modules/hash/main.js';
|
|
8
9
|
import type { Encryption } from '../modules/encryption.js';
|
|
10
|
+
import type { Router, Server } from '../modules/http/main.js';
|
|
9
11
|
import type { HttpRequestFinishedPayload } from '../types/http.js';
|
|
12
|
+
import type { ContainerResolveEventData } from '../types/container.js';
|
|
10
13
|
import type { LoggerConfig, LoggerManagerConfig } from '../types/logger.js';
|
|
11
|
-
import type hashDriversCollection from '../modules/hash/drivers_collection.js';
|
|
12
|
-
import type { Argon, Bcrypt, HashManager, Scrypt } from '../modules/hash/main.js';
|
|
13
14
|
import type { ArgonConfig, BcryptConfig, ScryptConfig, ManagerDriverFactory } from '../types/hash.js';
|
|
15
|
+
import type { Argon } from '../modules/hash/drivers/argon.js';
|
|
16
|
+
import type { Bcrypt } from '../modules/hash/drivers/bcrypt.js';
|
|
17
|
+
import type { Scrypt } from '../modules/hash/drivers/scrypt.js';
|
|
18
|
+
/**
|
|
19
|
+
* Options accepted by ignitor
|
|
20
|
+
*/
|
|
14
21
|
export type IgnitorOptions = {
|
|
15
22
|
importer: Importer;
|
|
16
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* A list of known events. The interface must be extended in
|
|
26
|
+
* user land code or packages to register events and their
|
|
27
|
+
* types.
|
|
28
|
+
*/
|
|
17
29
|
export interface EventsList {
|
|
30
|
+
'container:resolved': ContainerResolveEventData<ContainerBindings>;
|
|
18
31
|
'http:request_handled': HttpRequestFinishedPayload;
|
|
19
32
|
'http:server_ready': {
|
|
20
33
|
port: number;
|
|
21
34
|
host: string;
|
|
22
35
|
};
|
|
23
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* The loggers list inferred from the user application
|
|
39
|
+
* config
|
|
40
|
+
*/
|
|
24
41
|
export interface LoggersList {
|
|
25
42
|
}
|
|
26
43
|
export type InferLoggers<T extends LoggerManagerConfig<any>> = T['loggers'];
|
|
44
|
+
/**
|
|
45
|
+
* A list of globally available hash drivers
|
|
46
|
+
*/
|
|
27
47
|
export interface HashDriversList {
|
|
28
48
|
bcrypt: (config: BcryptConfig) => Bcrypt;
|
|
29
49
|
argon2: (config: ArgonConfig) => Argon;
|
|
30
50
|
scrypt: (config: ScryptConfig) => Scrypt;
|
|
31
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* A list of known hashers inferred from the user config
|
|
54
|
+
*/
|
|
32
55
|
export interface HashersList {
|
|
33
56
|
}
|
|
34
57
|
export type InferHashers<T extends {
|
|
35
58
|
list: Record<string, ManagerDriverFactory>;
|
|
36
59
|
}> = T['list'];
|
|
60
|
+
/**
|
|
61
|
+
* ----------------------------------------------------------------
|
|
62
|
+
* Container services
|
|
63
|
+
* -----------------------------------------------------------------
|
|
64
|
+
*
|
|
65
|
+
* Types for the container singleton services. Defining them
|
|
66
|
+
* upfront so that we do not have to define them in
|
|
67
|
+
* multiple places.
|
|
68
|
+
*/
|
|
69
|
+
/**
|
|
70
|
+
* Application service is a singleton resolved from
|
|
71
|
+
* the container
|
|
72
|
+
*/
|
|
37
73
|
export interface ApplicationService extends Application<ContainerBindings extends Record<any, any> ? ContainerBindings : never> {
|
|
38
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Logger service is a singleton logger instance registered
|
|
77
|
+
* to the container.
|
|
78
|
+
*/
|
|
39
79
|
export interface LoggerService extends LoggerManager<LoggersList extends Record<string, LoggerConfig> ? LoggersList : never> {
|
|
40
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Emitter service is a singleton emitter instance registered
|
|
83
|
+
* to the container.
|
|
84
|
+
*/
|
|
41
85
|
export interface EmitterService extends Emitter<EventsList> {
|
|
42
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Encryption service is a singleton Encryption class instance
|
|
89
|
+
* registered to the container.
|
|
90
|
+
*/
|
|
43
91
|
export interface EncryptionService extends Encryption {
|
|
44
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Http server service added to the container as a singleton
|
|
95
|
+
*/
|
|
45
96
|
export interface HttpServerService extends Server {
|
|
46
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Http server service added to the container as a singleton
|
|
100
|
+
*/
|
|
47
101
|
export interface HttpRouterService extends Router {
|
|
48
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Hash service is a singleton instance of the HashManager
|
|
105
|
+
* registered in the container
|
|
106
|
+
*/
|
|
49
107
|
export interface HashService extends HashManager<HashersList extends Record<string, ManagerDriverFactory> ? HashersList : never> {
|
|
50
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* A list of known container bindings.
|
|
111
|
+
*/
|
|
51
112
|
export interface ContainerBindings {
|
|
52
113
|
ace: Kernel;
|
|
53
114
|
app: ApplicationService;
|
|
@@ -56,8 +117,8 @@ export interface ContainerBindings {
|
|
|
56
117
|
emitter: EmitterService;
|
|
57
118
|
encryption: EncryptionService;
|
|
58
119
|
hash: HashService;
|
|
59
|
-
hashDrivers: typeof hashDriversCollection;
|
|
60
120
|
server: HttpServerService;
|
|
61
121
|
router: HttpRouterService;
|
|
62
122
|
testUtils: TestUtils;
|
|
123
|
+
repl: Repl;
|
|
63
124
|
}
|
package/build/src/types.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @adonisjs/core
|
|
3
|
+
*
|
|
4
|
+
* (c) AdonisJS
|
|
5
|
+
*
|
|
6
|
+
* For the full copyright and license information, please view the LICENSE
|
|
7
|
+
* file that was distributed with this source code.
|
|
8
|
+
*/
|
|
9
|
+
import { getDirname } from '@poppinss/utils';
|
|
10
|
+
export const stubsRoot = getDirname(import.meta.url);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{{#var exceptionName = generators.exceptionName(entity.name)}}
|
|
2
|
+
{{#var exceptionFileName = generators.exceptionFileName(entity.name)}}
|
|
3
|
+
---
|
|
4
|
+
to: {{ app.exceptionsPath(entity.path, exceptionFileName) }}
|
|
5
|
+
---
|
|
6
|
+
import { Exception } from '@adonisjs/core/exceptions'
|
|
7
|
+
|
|
8
|
+
export default class {{ exceptionName }} extends Exception {
|
|
9
|
+
static status = 500
|
|
10
|
+
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { BaseCommand } from '@adonisjs/ace';
|
|
2
|
+
/**
|
|
3
|
+
* Generates index of commands with a loader. Must be called against
|
|
4
|
+
* the TypeScript compiled output.
|
|
5
|
+
*/
|
|
2
6
|
export default class IndexCommand extends BaseCommand {
|
|
3
7
|
static commandName: string;
|
|
4
8
|
static description: string;
|
|
@@ -1,14 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @adonisjs/core
|
|
3
|
+
*
|
|
4
|
+
* (c) AdonisJS
|
|
5
|
+
*
|
|
6
|
+
* For the full copyright and license information, please view the LICENSE
|
|
7
|
+
* file that was distributed with this source code.
|
|
8
|
+
*/
|
|
1
9
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
10
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
11
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
12
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
13
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
14
|
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
15
|
import { join } from 'node:path';
|
|
11
16
|
import { args, BaseCommand, IndexGenerator } from '@adonisjs/ace';
|
|
17
|
+
/**
|
|
18
|
+
* Generates index of commands with a loader. Must be called against
|
|
19
|
+
* the TypeScript compiled output.
|
|
20
|
+
*/
|
|
12
21
|
export default class IndexCommand extends BaseCommand {
|
|
13
22
|
static commandName = 'index';
|
|
14
23
|
static description = 'Create an index of commands along with a lazy loader';
|
|
@@ -17,6 +26,5 @@ export default class IndexCommand extends BaseCommand {
|
|
|
17
26
|
}
|
|
18
27
|
}
|
|
19
28
|
__decorate([
|
|
20
|
-
args.string({ description: 'Relative path from cwd to the commands directory' })
|
|
21
|
-
__metadata("design:type", String)
|
|
29
|
+
args.string({ description: 'Relative path from cwd to the commands directory' })
|
|
22
30
|
], IndexCommand.prototype, "commandsDir", void 0);
|
package/build/toolkit/main.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
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
|
+
*/
|
|
2
10
|
import IndexCommand from './commands/index_commands.js';
|
|
3
11
|
import { Kernel, ListLoader, HelpCommand } from '@adonisjs/ace';
|
|
4
12
|
const kernel = Kernel.create();
|
|
@@ -7,6 +15,9 @@ kernel.defineFlag('help', {
|
|
|
7
15
|
type: 'boolean',
|
|
8
16
|
description: HelpCommand.description,
|
|
9
17
|
});
|
|
18
|
+
/**
|
|
19
|
+
* Flag listener to display the help
|
|
20
|
+
*/
|
|
10
21
|
kernel.on('help', async (command, $kernel, parsed) => {
|
|
11
22
|
parsed.args.unshift(command.commandName);
|
|
12
23
|
const help = new HelpCommand($kernel, parsed, kernel.ui, kernel.prompt);
|
package/build/types/ace.js
CHANGED
package/build/types/app.js
CHANGED
package/build/types/container.js
CHANGED
package/build/types/events.js
CHANGED
package/build/types/hash.js
CHANGED
package/build/types/http.d.ts
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
1
|
export * from '@adonisjs/http-server/types';
|
|
2
|
+
import type { ValidationOptions } from '@vinejs/vine/types';
|
|
3
|
+
/**
|
|
4
|
+
* Validation options accepted by the "request.validateUsing" method
|
|
5
|
+
*/
|
|
6
|
+
export type RequestValidationOptions<MetaData extends undefined | Record<string, any>> = ValidationOptions<MetaData> & {
|
|
7
|
+
data?: any;
|
|
8
|
+
};
|
package/build/types/http.js
CHANGED
package/build/types/logger.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@adonisjs/repl/types';
|