@adonisjs/core 7.0.0-next.11 → 7.0.0-next.12
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/ace-DDzvaSs_.js +16 -0
- package/build/app-B6oge7b3.js +5 -0
- package/build/app-BK0PN3li.js +5 -0
- package/build/bodyparser_middleware-DTW0epKM.js +3 -0
- package/build/chunk-MjwdjG2f.js +32 -0
- package/build/commands/add.js +1 -1
- package/build/commands/build.js +1 -1
- package/build/commands/configure.js +1 -1
- package/build/commands/eject.js +1 -1
- package/build/commands/env/add.js +1 -1
- package/build/commands/generate_key.js +1 -1
- package/build/commands/inspect_rcfile.js +1 -1
- package/build/commands/list/routes.js +1 -1
- package/build/commands/make/command.js +1 -1
- package/build/commands/make/controller.js +1 -1
- package/build/commands/make/event.js +1 -1
- package/build/commands/make/exception.js +1 -1
- package/build/commands/make/listener.js +1 -1
- package/build/commands/make/middleware.js +1 -1
- package/build/commands/make/preload.js +1 -1
- package/build/commands/make/provider.js +1 -1
- package/build/commands/make/service.js +1 -1
- package/build/commands/make/test.js +1 -1
- package/build/commands/make/transformer.js +1 -1
- package/build/commands/make/validator.js +1 -1
- package/build/commands/make/view.js +1 -1
- package/build/commands/repl.js +1 -1
- package/build/commands/serve.js +1 -1
- package/build/commands/test.js +1 -1
- package/build/config-B2S2xfmN.js +5 -0
- package/build/config_provider-CY-xuo2R.js +13 -0
- package/build/container-ClFvcykQ.js +5 -0
- package/build/core-CNNCwlhc.js +95 -0
- package/build/create_kernel-B7zWS8Zz.js +38 -0
- package/build/create_kernel-CsTq0pWc.js +3 -0
- package/build/debug-DURPi9xn.js +3 -0
- package/build/decorate-DM0Sx1ye.js +7 -0
- package/build/dumper-C_sMcyFb.js +147 -0
- package/build/edge-LQdCc1L3.js +47 -0
- package/build/encryption-D2HGu0bU.js +5 -0
- package/build/events-B8hK42QT.js +5 -0
- package/build/factories/core/ace.js +5 -5
- package/build/factories/core/ignitor.js +2 -2
- package/build/factories/core/main.js +6 -6
- package/build/factories/core/test_utils.js +3 -3
- package/build/factories/stubs.js +1 -1
- package/build/ignitor-Dil-rtCo.js +63 -0
- package/build/index.js +1 -1
- package/build/logger-Dha-0hp1.js +13 -0
- package/build/main-2-nm3TiB.js +72 -0
- package/build/main-BTUXw6He.js +171 -0
- package/build/main-BWftwyAK.js +81 -0
- package/build/main-BrJQ1VAM.js +52 -0
- package/build/main-CFmDHDls.js +35 -0
- package/build/main-D5xz2ZN1.js +5 -0
- package/build/main-kn40V-hF.js +2 -0
- package/build/main-q9TMzWUj.js +5 -0
- package/build/modules/ace/main.js +1 -1
- package/build/providers/app_provider.js +1 -1
- package/build/repl-CumYg2V_.js +5 -0
- package/build/string-CJ7ewUFq.js +28 -0
- package/build/test_utils-c_TEaEHW.js +10 -0
- package/build/toolkit/main.js +25 -0
- package/build/utils-CNQ4tlGM.js +41 -0
- package/build/verification_token-DXsW81rl.js +46 -0
- package/build/vine-Bt4ymkM0.js +32 -0
- package/package.json +6 -13
- /package/build/{stubs/make → make}/command/main.stub +0 -0
- /package/build/{stubs/make → make}/controller/actions.stub +0 -0
- /package/build/{stubs/make → make}/controller/api.stub +0 -0
- /package/build/{stubs/make → make}/controller/main.stub +0 -0
- /package/build/{stubs/make → make}/controller/resource.stub +0 -0
- /package/build/{stubs/make → make}/event/main.stub +0 -0
- /package/build/{stubs/make → make}/exception/main.stub +0 -0
- /package/build/{stubs/make → make}/health/controller.stub +0 -0
- /package/build/{stubs/make → make}/health/main.stub +0 -0
- /package/build/{stubs/make → make}/listener/for_event.stub +0 -0
- /package/build/{stubs/make → make}/listener/main.stub +0 -0
- /package/build/{stubs/make → make}/middleware/main.stub +0 -0
- /package/build/{stubs/make → make}/preload/main.stub +0 -0
- /package/build/{stubs/make → make}/provider/main.stub +0 -0
- /package/build/{stubs/make → make}/service/main.stub +0 -0
- /package/build/{stubs/make → make}/test/main.stub +0 -0
- /package/build/{stubs/make → make}/transformer/main.stub +0 -0
- /package/build/{stubs/make → make}/validator/main.stub +0 -0
- /package/build/{stubs/make → make}/validator/resource.stub +0 -0
- /package/build/{stubs/make → make}/view/main.stub +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import "../../chunk-MjwdjG2f.js";
|
|
2
2
|
import "../../debug-DURPi9xn.js";
|
|
3
|
-
import "../../main-
|
|
3
|
+
import "../../main-BTUXw6He.js";
|
|
4
4
|
import "../../app-B6oge7b3.js";
|
|
5
5
|
import "../../app-BK0PN3li.js";
|
|
6
6
|
import "../../config_provider-CY-xuo2R.js";
|
|
7
|
-
import "../../main-
|
|
7
|
+
import "../../main-BWftwyAK.js";
|
|
8
8
|
import "../../logger-Dha-0hp1.js";
|
|
9
9
|
import "../../main-CFmDHDls.js";
|
|
10
10
|
import "../../main-BrJQ1VAM.js";
|
|
11
11
|
import "../../main-q9TMzWUj.js";
|
|
12
|
-
import "../../ignitor-
|
|
13
|
-
import "../../create_kernel-
|
|
14
|
-
import { t as AceFactory } from "../../ace-
|
|
12
|
+
import "../../ignitor-Dil-rtCo.js";
|
|
13
|
+
import "../../create_kernel-B7zWS8Zz.js";
|
|
14
|
+
import { t as AceFactory } from "../../ace-DDzvaSs_.js";
|
|
15
15
|
export { AceFactory };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../chunk-MjwdjG2f.js";
|
|
2
2
|
import "../../debug-DURPi9xn.js";
|
|
3
|
-
import "../../main-
|
|
3
|
+
import "../../main-BTUXw6He.js";
|
|
4
4
|
import "../../app-B6oge7b3.js";
|
|
5
5
|
import "../../app-BK0PN3li.js";
|
|
6
6
|
import "../../config_provider-CY-xuo2R.js";
|
|
@@ -8,5 +8,5 @@ import "../../logger-Dha-0hp1.js";
|
|
|
8
8
|
import "../../main-CFmDHDls.js";
|
|
9
9
|
import "../../main-BrJQ1VAM.js";
|
|
10
10
|
import "../../main-q9TMzWUj.js";
|
|
11
|
-
import { t as IgnitorFactory } from "../../ignitor-
|
|
11
|
+
import { t as IgnitorFactory } from "../../ignitor-Dil-rtCo.js";
|
|
12
12
|
export { IgnitorFactory };
|
|
@@ -2,21 +2,21 @@ import "../../chunk-MjwdjG2f.js";
|
|
|
2
2
|
import "../../main-kn40V-hF.js";
|
|
3
3
|
import "../../container-ClFvcykQ.js";
|
|
4
4
|
import "../../debug-DURPi9xn.js";
|
|
5
|
-
import "../../main-
|
|
5
|
+
import "../../main-BTUXw6He.js";
|
|
6
6
|
import "../../app-B6oge7b3.js";
|
|
7
7
|
import "../../app-BK0PN3li.js";
|
|
8
8
|
import "../../config_provider-CY-xuo2R.js";
|
|
9
9
|
import "../../string-CJ7ewUFq.js";
|
|
10
10
|
import "../../utils-CNQ4tlGM.js";
|
|
11
11
|
import "../../core-CNNCwlhc.js";
|
|
12
|
-
import "../../main-
|
|
12
|
+
import "../../main-BWftwyAK.js";
|
|
13
13
|
import "../../logger-Dha-0hp1.js";
|
|
14
14
|
import "../../main-CFmDHDls.js";
|
|
15
15
|
import "../../main-BrJQ1VAM.js";
|
|
16
16
|
import "../../main-q9TMzWUj.js";
|
|
17
|
-
import { t as IgnitorFactory } from "../../ignitor-
|
|
18
|
-
import "../../create_kernel-
|
|
19
|
-
import { t as AceFactory } from "../../ace-
|
|
17
|
+
import { t as IgnitorFactory } from "../../ignitor-Dil-rtCo.js";
|
|
18
|
+
import "../../create_kernel-B7zWS8Zz.js";
|
|
19
|
+
import { t as AceFactory } from "../../ace-DDzvaSs_.js";
|
|
20
20
|
import "../../main-2-nm3TiB.js";
|
|
21
|
-
import { t as TestUtilsFactory } from "../../test_utils-
|
|
21
|
+
import { t as TestUtilsFactory } from "../../test_utils-c_TEaEHW.js";
|
|
22
22
|
export { AceFactory, IgnitorFactory, TestUtilsFactory };
|
|
@@ -2,7 +2,7 @@ import "../../chunk-MjwdjG2f.js";
|
|
|
2
2
|
import "../../main-kn40V-hF.js";
|
|
3
3
|
import "../../container-ClFvcykQ.js";
|
|
4
4
|
import "../../debug-DURPi9xn.js";
|
|
5
|
-
import "../../main-
|
|
5
|
+
import "../../main-BTUXw6He.js";
|
|
6
6
|
import "../../app-B6oge7b3.js";
|
|
7
7
|
import "../../app-BK0PN3li.js";
|
|
8
8
|
import "../../config_provider-CY-xuo2R.js";
|
|
@@ -13,7 +13,7 @@ import "../../logger-Dha-0hp1.js";
|
|
|
13
13
|
import "../../main-CFmDHDls.js";
|
|
14
14
|
import "../../main-BrJQ1VAM.js";
|
|
15
15
|
import "../../main-q9TMzWUj.js";
|
|
16
|
-
import "../../ignitor-
|
|
16
|
+
import "../../ignitor-Dil-rtCo.js";
|
|
17
17
|
import "../../main-2-nm3TiB.js";
|
|
18
|
-
import { t as TestUtilsFactory } from "../../test_utils-
|
|
18
|
+
import { t as TestUtilsFactory } from "../../test_utils-c_TEaEHW.js";
|
|
19
19
|
export { TestUtilsFactory };
|
package/build/factories/stubs.js
CHANGED
|
@@ -2,7 +2,7 @@ import "../chunk-MjwdjG2f.js";
|
|
|
2
2
|
import { t as stubsRoot } from "../main-kn40V-hF.js";
|
|
3
3
|
import "../container-ClFvcykQ.js";
|
|
4
4
|
import "../debug-DURPi9xn.js";
|
|
5
|
-
import "../main-
|
|
5
|
+
import "../main-BTUXw6He.js";
|
|
6
6
|
import "../app-B6oge7b3.js";
|
|
7
7
|
import "../app-BK0PN3li.js";
|
|
8
8
|
import "../config_provider-CY-xuo2R.js";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { t as Ignitor } from "./main-BTUXw6He.js";
|
|
2
|
+
import { t as logger_exports } from "./logger-Dha-0hp1.js";
|
|
3
|
+
import { t as main_exports } from "./main-CFmDHDls.js";
|
|
4
|
+
import { n as defineConfig, r as drivers } from "./main-BrJQ1VAM.js";
|
|
5
|
+
import { t as main_exports$1 } from "./main-q9TMzWUj.js";
|
|
6
|
+
var IgnitorFactory = class {
|
|
7
|
+
#preloadActions = [];
|
|
8
|
+
#parameters = {};
|
|
9
|
+
#loadCoreProviders = false;
|
|
10
|
+
preload(action) {
|
|
11
|
+
this.#preloadActions.push(action);
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
#mergeCoreProviders(providers) {
|
|
15
|
+
return [
|
|
16
|
+
() => import("@adonisjs/core/providers/app_provider"),
|
|
17
|
+
() => import("@adonisjs/core/providers/hash_provider"),
|
|
18
|
+
() => import("@adonisjs/core/providers/repl_provider")
|
|
19
|
+
].concat(providers || []);
|
|
20
|
+
}
|
|
21
|
+
merge(params) {
|
|
22
|
+
if (params.config) this.#parameters.config = Object.assign(this.#parameters.config || {}, params.config);
|
|
23
|
+
if (params.rcFileContents) this.#parameters.rcFileContents = Object.assign(this.#parameters.rcFileContents || {}, params.rcFileContents);
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
withCoreProviders() {
|
|
27
|
+
this.#loadCoreProviders = true;
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
withCoreConfig() {
|
|
31
|
+
this.merge({ config: {
|
|
32
|
+
app: {
|
|
33
|
+
appKey: "averylongrandomsecretkey",
|
|
34
|
+
http: (0, main_exports.defineConfig)({})
|
|
35
|
+
},
|
|
36
|
+
validator: {},
|
|
37
|
+
bodyparser: (0, main_exports$1.defineConfig)({}),
|
|
38
|
+
hash: defineConfig({
|
|
39
|
+
default: "scrypt",
|
|
40
|
+
list: { scrypt: drivers.scrypt({}) }
|
|
41
|
+
}),
|
|
42
|
+
logger: (0, logger_exports.defineConfig)({
|
|
43
|
+
default: "app",
|
|
44
|
+
loggers: { app: {} }
|
|
45
|
+
})
|
|
46
|
+
} });
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
create(appRoot, options) {
|
|
50
|
+
return new Ignitor(appRoot, options).tap((app) => {
|
|
51
|
+
app.booted(async () => {
|
|
52
|
+
for (let action of this.#preloadActions) await action(app);
|
|
53
|
+
});
|
|
54
|
+
if (this.#loadCoreProviders) {
|
|
55
|
+
this.#parameters.rcFileContents = this.#parameters.rcFileContents || {};
|
|
56
|
+
this.#parameters.rcFileContents.providers = this.#mergeCoreProviders(this.#parameters.rcFileContents.providers);
|
|
57
|
+
}
|
|
58
|
+
this.#parameters.rcFileContents && app.rcContents(this.#parameters.rcFileContents);
|
|
59
|
+
this.#parameters.config && app.useConfig(this.#parameters.config);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
export { IgnitorFactory as t };
|
package/build/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import "./chunk-MjwdjG2f.js";
|
|
|
2
2
|
import { t as stubsRoot } from "./main-kn40V-hF.js";
|
|
3
3
|
import { t as container_exports } from "./container-ClFvcykQ.js";
|
|
4
4
|
import "./debug-DURPi9xn.js";
|
|
5
|
-
import { t as Ignitor } from "./main-
|
|
5
|
+
import { t as Ignitor } from "./main-BTUXw6He.js";
|
|
6
6
|
import "./app-B6oge7b3.js";
|
|
7
7
|
import "./app-BK0PN3li.js";
|
|
8
8
|
import { t as configProvider } from "./config_provider-CY-xuo2R.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { n as __reExport, t as __export } from "./chunk-MjwdjG2f.js";
|
|
2
|
+
import { destination } from "@adonisjs/logger";
|
|
3
|
+
var logger_exports = /* @__PURE__ */ __export({ syncDestination: () => syncDestination });
|
|
4
|
+
import * as import___adonisjs_logger from "@adonisjs/logger";
|
|
5
|
+
__reExport(logger_exports, import___adonisjs_logger);
|
|
6
|
+
async function syncDestination(options) {
|
|
7
|
+
const { default: pinoPretty, isColorSupported } = await import("pino-pretty");
|
|
8
|
+
return isColorSupported ? pinoPretty({
|
|
9
|
+
...options,
|
|
10
|
+
sync: true
|
|
11
|
+
}) : destination(1);
|
|
12
|
+
}
|
|
13
|
+
export { syncDestination as n, logger_exports as t };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { t as debug_default } from "./debug-DURPi9xn.js";
|
|
2
|
+
import { t as main_exports } from "./main-CFmDHDls.js";
|
|
3
|
+
import { IncomingMessage, ServerResponse, createServer } from "node:http";
|
|
4
|
+
import { Socket } from "node:net";
|
|
5
|
+
import Macroable from "@poppinss/macroable";
|
|
6
|
+
var HttpServerUtils = class {
|
|
7
|
+
#utils;
|
|
8
|
+
constructor(utils) {
|
|
9
|
+
this.#utils = utils;
|
|
10
|
+
}
|
|
11
|
+
#listen(nodeHttpServer) {
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
const host = process.env.HOST || "0.0.0.0";
|
|
14
|
+
const port = Number(process.env.PORT || "3333");
|
|
15
|
+
nodeHttpServer.listen(port, host);
|
|
16
|
+
nodeHttpServer.once("listening", () => {
|
|
17
|
+
debug_default("listening to utils http server, host :%s, port: %s", host, port);
|
|
18
|
+
resolve({
|
|
19
|
+
port,
|
|
20
|
+
host
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
nodeHttpServer.once("error", (error) => {
|
|
24
|
+
reject(error);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
async start(serverCallback) {
|
|
29
|
+
const createHTTPServer = serverCallback || createServer;
|
|
30
|
+
const server = await this.#utils.app.container.make("server");
|
|
31
|
+
await server.boot();
|
|
32
|
+
const httpServer = createHTTPServer(server.handle.bind(server));
|
|
33
|
+
server.setNodeServer(httpServer);
|
|
34
|
+
await this.#listen(httpServer);
|
|
35
|
+
return () => {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
httpServer.close((error) => {
|
|
38
|
+
if (error) reject(error);
|
|
39
|
+
else resolve();
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var TestUtils = class extends Macroable {
|
|
46
|
+
#booted = false;
|
|
47
|
+
get isBooted() {
|
|
48
|
+
return this.#booted;
|
|
49
|
+
}
|
|
50
|
+
constructor(app) {
|
|
51
|
+
super();
|
|
52
|
+
this.app = app;
|
|
53
|
+
}
|
|
54
|
+
async boot() {
|
|
55
|
+
if (!this.isBooted) {
|
|
56
|
+
this.#booted = true;
|
|
57
|
+
this.cookies = new main_exports.CookieClient(await this.app.container.make("encryption"));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
httpServer() {
|
|
61
|
+
return new HttpServerUtils(this);
|
|
62
|
+
}
|
|
63
|
+
async createHttpContext(options = {}) {
|
|
64
|
+
const req = options.req || new IncomingMessage(new Socket());
|
|
65
|
+
const res = options.res || new ServerResponse(req);
|
|
66
|
+
const server = await this.app.container.make("server");
|
|
67
|
+
const request = server.createRequest(req, res);
|
|
68
|
+
const response = server.createResponse(req, res);
|
|
69
|
+
return server.createHttpContext(request, response, this.app.container.createResolver());
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
export { TestUtils as t };
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { t as debug_default } from "./debug-DURPi9xn.js";
|
|
2
|
+
import { n as setApp } from "./app-B6oge7b3.js";
|
|
3
|
+
import { t as app_exports } from "./app-BK0PN3li.js";
|
|
4
|
+
import { createServer } from "node:http";
|
|
5
|
+
var AceProcess = class {
|
|
6
|
+
#ignitor;
|
|
7
|
+
#configureCallback = () => {};
|
|
8
|
+
constructor(ignitor) {
|
|
9
|
+
this.#ignitor = ignitor;
|
|
10
|
+
}
|
|
11
|
+
configure(callback) {
|
|
12
|
+
this.#configureCallback = callback;
|
|
13
|
+
return this;
|
|
14
|
+
}
|
|
15
|
+
async handle(argv) {
|
|
16
|
+
const app = this.#ignitor.createApp("console");
|
|
17
|
+
await app.init();
|
|
18
|
+
const { createAceKernel } = await import("./create_kernel-CsTq0pWc.js");
|
|
19
|
+
const commandName = argv[argv.findIndex((value) => !value.startsWith("-"))];
|
|
20
|
+
const kernel = createAceKernel(app, commandName);
|
|
21
|
+
app.container.bindValue("ace", kernel);
|
|
22
|
+
kernel.loading(async (metaData) => {
|
|
23
|
+
if (metaData.options.startApp && !app.isReady) {
|
|
24
|
+
if (metaData.commandName === "repl") app.setEnvironment("repl");
|
|
25
|
+
await app.boot();
|
|
26
|
+
await app.start(() => {});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
await this.#configureCallback(app);
|
|
30
|
+
await kernel.handle(argv);
|
|
31
|
+
const mainCommand = kernel.getMainCommand();
|
|
32
|
+
if (!mainCommand || !mainCommand.staysAlive) {
|
|
33
|
+
process.exitCode = kernel.exitCode;
|
|
34
|
+
await app.terminate();
|
|
35
|
+
} else app.terminating(() => {
|
|
36
|
+
process.exitCode = mainCommand.exitCode;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var TestRunnerProcess = class {
|
|
41
|
+
#ignitor;
|
|
42
|
+
#configureCallback = () => {};
|
|
43
|
+
constructor(ignitor) {
|
|
44
|
+
this.#ignitor = ignitor;
|
|
45
|
+
}
|
|
46
|
+
configure(callback) {
|
|
47
|
+
this.#configureCallback = callback;
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
async run(callback) {
|
|
51
|
+
const app = this.#ignitor.createApp("test");
|
|
52
|
+
await app.init();
|
|
53
|
+
await app.boot();
|
|
54
|
+
await app.start(this.#configureCallback);
|
|
55
|
+
await callback(app);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
var HttpServerProcess = class {
|
|
59
|
+
#ignitor;
|
|
60
|
+
constructor(ignitor) {
|
|
61
|
+
this.#ignitor = ignitor;
|
|
62
|
+
}
|
|
63
|
+
#close(nodeHttpServer) {
|
|
64
|
+
return new Promise((resolve) => {
|
|
65
|
+
debug_default("closing http server process");
|
|
66
|
+
nodeHttpServer.close(() => resolve());
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
#monitorAppAndServer(nodeHttpServer, app, logger) {
|
|
70
|
+
app.terminating(async () => {
|
|
71
|
+
debug_default("terminating signal received");
|
|
72
|
+
await this.#close(nodeHttpServer);
|
|
73
|
+
});
|
|
74
|
+
nodeHttpServer.once("error", (error) => {
|
|
75
|
+
debug_default("http server crashed with error \"%O\"", error);
|
|
76
|
+
logger.fatal({ err: error }, error.message);
|
|
77
|
+
process.exitCode = 1;
|
|
78
|
+
app.terminate();
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
#listen(nodeHttpServer) {
|
|
82
|
+
return new Promise((resolve, reject) => {
|
|
83
|
+
const host = process.env.HOST || "0.0.0.0";
|
|
84
|
+
const port = Number(process.env.PORT || "3333");
|
|
85
|
+
nodeHttpServer.listen(port, host);
|
|
86
|
+
nodeHttpServer.once("listening", () => {
|
|
87
|
+
debug_default("listening to http server, host :%s, port: %s", host, port);
|
|
88
|
+
resolve({
|
|
89
|
+
port,
|
|
90
|
+
host
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
nodeHttpServer.once("error", (error) => {
|
|
94
|
+
reject(error);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
#notifyServerHasStarted(app, logger, emitter, payload) {
|
|
99
|
+
app.notify({
|
|
100
|
+
isAdonisJS: true,
|
|
101
|
+
environment: "web",
|
|
102
|
+
...payload
|
|
103
|
+
});
|
|
104
|
+
logger.info("started HTTP server on %s:%s", payload.host, payload.port);
|
|
105
|
+
emitter.emit("http:server_ready", payload);
|
|
106
|
+
}
|
|
107
|
+
async start(serverCallback) {
|
|
108
|
+
const startTime = process.hrtime();
|
|
109
|
+
const createHTTPServer = serverCallback || createServer;
|
|
110
|
+
const app = this.#ignitor.createApp("web");
|
|
111
|
+
await app.init();
|
|
112
|
+
await app.boot();
|
|
113
|
+
await app.start(async () => {
|
|
114
|
+
const server = await app.container.make("server");
|
|
115
|
+
await server.boot();
|
|
116
|
+
const httpServer = createHTTPServer(server.handle.bind(server));
|
|
117
|
+
server.setNodeServer(httpServer);
|
|
118
|
+
const logger = await app.container.make("logger");
|
|
119
|
+
const emitter = await app.container.make("emitter");
|
|
120
|
+
const payload = await this.#listen(httpServer);
|
|
121
|
+
this.#notifyServerHasStarted(app, logger, emitter, {
|
|
122
|
+
...payload,
|
|
123
|
+
duration: process.hrtime(startTime)
|
|
124
|
+
});
|
|
125
|
+
this.#monitorAppAndServer(httpServer, app, logger);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
var Ignitor = class {
|
|
130
|
+
#options;
|
|
131
|
+
#appRoot;
|
|
132
|
+
#app;
|
|
133
|
+
#tapCallbacks = /* @__PURE__ */ new Set();
|
|
134
|
+
constructor(appRoot, options = {}) {
|
|
135
|
+
this.#appRoot = appRoot;
|
|
136
|
+
this.#options = options;
|
|
137
|
+
}
|
|
138
|
+
#runTapCallbacks(app) {
|
|
139
|
+
this.#tapCallbacks.forEach((tapCallback) => tapCallback(app));
|
|
140
|
+
}
|
|
141
|
+
getApp() {
|
|
142
|
+
return this.#app;
|
|
143
|
+
}
|
|
144
|
+
createApp(environment) {
|
|
145
|
+
debug_default("creating application instance");
|
|
146
|
+
this.#app = new app_exports.Application(this.#appRoot, {
|
|
147
|
+
environment,
|
|
148
|
+
importer: this.#options.importer
|
|
149
|
+
});
|
|
150
|
+
setApp(this.#app);
|
|
151
|
+
this.#runTapCallbacks(this.#app);
|
|
152
|
+
return this.#app;
|
|
153
|
+
}
|
|
154
|
+
tap(callback) {
|
|
155
|
+
this.#tapCallbacks.add(callback);
|
|
156
|
+
return this;
|
|
157
|
+
}
|
|
158
|
+
httpServer() {
|
|
159
|
+
return new HttpServerProcess(this);
|
|
160
|
+
}
|
|
161
|
+
ace() {
|
|
162
|
+
return new AceProcess(this);
|
|
163
|
+
}
|
|
164
|
+
testRunner() {
|
|
165
|
+
return new TestRunnerProcess(this);
|
|
166
|
+
}
|
|
167
|
+
async terminate() {
|
|
168
|
+
await this.#app?.terminate();
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
export { Ignitor as t };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { BaseCommand, FsLoader, HelpCommand as HelpCommand$1, IndexGenerator as IndexGenerator$1, Kernel, ListCommand, ListLoader as ListLoader$1, Parser, args as args$1, cliHelpers, errors as errors$1, flags, tracingChannels } from "@adonisjs/ace";
|
|
2
|
+
var BaseCommand$1 = class extends BaseCommand {
|
|
3
|
+
static options = {};
|
|
4
|
+
get staysAlive() {
|
|
5
|
+
return this.constructor.options.staysAlive;
|
|
6
|
+
}
|
|
7
|
+
get startApp() {
|
|
8
|
+
return this.constructor.options.startApp;
|
|
9
|
+
}
|
|
10
|
+
constructor(app, kernel, parsed, ui, prompt) {
|
|
11
|
+
super(kernel, parsed, ui, prompt);
|
|
12
|
+
this.app = app;
|
|
13
|
+
this.kernel = kernel;
|
|
14
|
+
}
|
|
15
|
+
async createCodemods() {
|
|
16
|
+
const { Codemods } = await import("./modules/ace/codemods.js");
|
|
17
|
+
const codemods = new Codemods(this.app, this.logger);
|
|
18
|
+
codemods.on("error", () => {
|
|
19
|
+
this.exitCode = 1;
|
|
20
|
+
});
|
|
21
|
+
return codemods;
|
|
22
|
+
}
|
|
23
|
+
async exec() {
|
|
24
|
+
this.hydrate();
|
|
25
|
+
try {
|
|
26
|
+
this.prepare && await this.app.container.call(this, "prepare");
|
|
27
|
+
this.interact && await this.app.container.call(this, "interact");
|
|
28
|
+
const result = await this.app.container.call(this, "run");
|
|
29
|
+
this.result = this.result === void 0 ? result : this.result;
|
|
30
|
+
this.exitCode = this.exitCode ?? 0;
|
|
31
|
+
} catch (error) {
|
|
32
|
+
this.error = error;
|
|
33
|
+
this.exitCode = this.exitCode ?? 1;
|
|
34
|
+
}
|
|
35
|
+
let errorHandled = this.completed ? await this.app.container.call(this, "completed") : false;
|
|
36
|
+
if (this.error && !errorHandled) await this.kernel.errorHandler.render(this.error, this.kernel);
|
|
37
|
+
return this.result;
|
|
38
|
+
}
|
|
39
|
+
async terminate() {
|
|
40
|
+
if (this.kernel.getMainCommand() === this) await this.app.terminate();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var ListCommand$1 = class extends ListCommand {
|
|
44
|
+
static options = {};
|
|
45
|
+
get staysAlive() {
|
|
46
|
+
return this.constructor.options.staysAlive;
|
|
47
|
+
}
|
|
48
|
+
get startApp() {
|
|
49
|
+
return this.constructor.options.startApp;
|
|
50
|
+
}
|
|
51
|
+
constructor(app, kernel, parsed, ui, prompt) {
|
|
52
|
+
super(kernel, parsed, ui, prompt);
|
|
53
|
+
this.app = app;
|
|
54
|
+
this.kernel = kernel;
|
|
55
|
+
}
|
|
56
|
+
async createCodemods() {
|
|
57
|
+
const { Codemods } = await import("./modules/ace/codemods.js");
|
|
58
|
+
return new Codemods(this.app, this.logger);
|
|
59
|
+
}
|
|
60
|
+
async terminate() {
|
|
61
|
+
if (this.kernel.getMainCommand() === this) await this.app.terminate();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var Kernel$1 = class extends Kernel {
|
|
65
|
+
constructor(app) {
|
|
66
|
+
super(ListCommand$1, {
|
|
67
|
+
create: async (command, parsedOutput, $kernel) => {
|
|
68
|
+
return app.container.make(command, [
|
|
69
|
+
app,
|
|
70
|
+
$kernel,
|
|
71
|
+
parsedOutput,
|
|
72
|
+
$kernel.ui,
|
|
73
|
+
$kernel.prompt
|
|
74
|
+
]);
|
|
75
|
+
},
|
|
76
|
+
run: (command) => command.exec()
|
|
77
|
+
});
|
|
78
|
+
this.app = app;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
export { Parser as a, errors$1 as c, Kernel$1 as d, BaseCommand$1 as f, ListLoader$1 as i, flags as l, HelpCommand$1 as n, args$1 as o, ListCommand$1 as p, IndexGenerator$1 as r, cliHelpers as s, FsLoader as t, tracingChannels as u };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { n as __reExport, t as __export } from "./chunk-MjwdjG2f.js";
|
|
2
|
+
import { t as debug_default } from "./debug-DURPi9xn.js";
|
|
3
|
+
import { t as configProvider } from "./config_provider-CY-xuo2R.js";
|
|
4
|
+
import { InvalidArgumentsException } from "@poppinss/utils/exception";
|
|
5
|
+
function defineConfig(config) {
|
|
6
|
+
if (!config.list) throw new InvalidArgumentsException("Missing \"list\" property in hash config");
|
|
7
|
+
if (config.default && !config.list[config.default]) throw new InvalidArgumentsException(`Missing "list.${String(config.default)}" in hash config. It is referenced by the "default" property`);
|
|
8
|
+
return configProvider.create(async (app) => {
|
|
9
|
+
debug_default("resolving hash config");
|
|
10
|
+
const hashersList = Object.keys(config.list);
|
|
11
|
+
const hashers = {};
|
|
12
|
+
for (let hasherName of hashersList) {
|
|
13
|
+
const hasher = config.list[hasherName];
|
|
14
|
+
if (typeof hasher === "function") hashers[hasherName] = hasher;
|
|
15
|
+
else hashers[hasherName] = await hasher.resolver(app);
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
default: config.default,
|
|
19
|
+
list: hashers
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const drivers = {
|
|
24
|
+
argon2: (config) => {
|
|
25
|
+
return configProvider.create(async () => {
|
|
26
|
+
const { Argon } = await import("./modules/hash/drivers/argon.js");
|
|
27
|
+
debug_default("configuring argon driver");
|
|
28
|
+
return () => new Argon(config);
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
bcrypt: (config) => {
|
|
32
|
+
return configProvider.create(async () => {
|
|
33
|
+
const { Bcrypt } = await import("./modules/hash/drivers/bcrypt.js");
|
|
34
|
+
debug_default("configuring bcrypt driver");
|
|
35
|
+
return () => new Bcrypt(config);
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
scrypt: (config) => {
|
|
39
|
+
return configProvider.create(async () => {
|
|
40
|
+
const { Scrypt } = await import("./modules/hash/drivers/scrypt.js");
|
|
41
|
+
debug_default("configuring scrypt driver");
|
|
42
|
+
return () => new Scrypt(config);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
var main_exports = /* @__PURE__ */ __export({
|
|
47
|
+
defineConfig: () => defineConfig,
|
|
48
|
+
drivers: () => drivers
|
|
49
|
+
});
|
|
50
|
+
import * as import___adonisjs_hash from "@adonisjs/hash";
|
|
51
|
+
__reExport(main_exports, import___adonisjs_hash);
|
|
52
|
+
export { defineConfig as n, drivers as r, main_exports as t };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { n as __reExport, t as __export } from "./chunk-MjwdjG2f.js";
|
|
2
|
+
import "@adonisjs/bodyparser";
|
|
3
|
+
var RequestValidator = class RequestValidator {
|
|
4
|
+
#ctx;
|
|
5
|
+
#experimentalFlags;
|
|
6
|
+
constructor(ctx, experimentalFlags) {
|
|
7
|
+
this.#ctx = ctx;
|
|
8
|
+
this.#experimentalFlags = experimentalFlags;
|
|
9
|
+
}
|
|
10
|
+
static errorReporter;
|
|
11
|
+
static messagesProvider;
|
|
12
|
+
validateUsing(validator, ...[options]) {
|
|
13
|
+
const validatorOptions = options || {};
|
|
14
|
+
if (RequestValidator.errorReporter && !validatorOptions.errorReporter) {
|
|
15
|
+
const errorReporter = RequestValidator.errorReporter(this.#ctx);
|
|
16
|
+
validatorOptions.errorReporter = () => errorReporter;
|
|
17
|
+
}
|
|
18
|
+
if (RequestValidator.messagesProvider && !validatorOptions.messagesProvider) validatorOptions.messagesProvider = RequestValidator.messagesProvider(this.#ctx);
|
|
19
|
+
const requestBody = this.#experimentalFlags?.enabled("mergeMultipartFieldsAndFiles") ? this.#ctx.request.all() : {
|
|
20
|
+
...this.#ctx.request.all(),
|
|
21
|
+
...this.#ctx.request.allFiles()
|
|
22
|
+
};
|
|
23
|
+
const data = validatorOptions.data || {
|
|
24
|
+
...requestBody,
|
|
25
|
+
params: this.#ctx.request.params(),
|
|
26
|
+
headers: this.#ctx.request.headers(),
|
|
27
|
+
cookies: this.#ctx.request.cookiesList()
|
|
28
|
+
};
|
|
29
|
+
return validator.validate(data, validatorOptions);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var main_exports = /* @__PURE__ */ __export({ RequestValidator: () => RequestValidator });
|
|
33
|
+
import * as import___adonisjs_http_server from "@adonisjs/http-server";
|
|
34
|
+
__reExport(main_exports, import___adonisjs_http_server);
|
|
35
|
+
export { RequestValidator as n, main_exports as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as Parser, c as errors, d as Kernel, f as BaseCommand, i as ListLoader, l as flags, n as HelpCommand, o as args, p as ListCommand, r as IndexGenerator, s as cliHelpers, t as FsLoader, u as tracingChannels } from "../../main-
|
|
1
|
+
import { a as Parser, c as errors, d as Kernel, f as BaseCommand, i as ListLoader, l as flags, n as HelpCommand, o as args, p as ListCommand, r as IndexGenerator, s as cliHelpers, t as FsLoader, u as tracingChannels } from "../../main-BWftwyAK.js";
|
|
2
2
|
export { BaseCommand, FsLoader, HelpCommand, IndexGenerator, Kernel, ListCommand, ListLoader, Parser, args, cliHelpers, errors, flags, tracingChannels };
|
|
@@ -22,7 +22,7 @@ var AppServiceProvider = class {
|
|
|
22
22
|
}
|
|
23
23
|
registerAce() {
|
|
24
24
|
this.app.container.singleton("ace", async () => {
|
|
25
|
-
const { createAceKernel } = await import("../create_kernel-
|
|
25
|
+
const { createAceKernel } = await import("../create_kernel-CsTq0pWc.js");
|
|
26
26
|
return createAceKernel(this.app);
|
|
27
27
|
});
|
|
28
28
|
}
|