@adonisjs/core 7.0.0-next.9 → 7.0.1
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 +62 -1
- package/build/chunk-iKc69rpz.js +26 -0
- package/build/commands/add.d.ts +4 -3
- package/build/commands/add.js +73 -110
- package/build/commands/build.js +51 -107
- package/build/commands/commands.json +1 -1
- package/build/commands/configure.js +81 -177
- package/build/commands/eject.js +17 -60
- package/build/commands/env/add.js +55 -134
- package/build/commands/generate_key.js +22 -66
- package/build/commands/inspect_rcfile.js +27 -55
- package/build/commands/list/routes.js +246 -116
- package/build/commands/make/command.d.ts +5 -0
- package/build/commands/make/command.js +16 -57
- package/build/commands/make/controller.d.ts +5 -0
- package/build/commands/make/controller.js +44 -120
- package/build/commands/make/event.d.ts +5 -0
- package/build/commands/make/event.js +17 -62
- package/build/commands/make/exception.d.ts +5 -0
- package/build/commands/make/exception.js +17 -62
- package/build/commands/make/listener.d.ts +5 -0
- package/build/commands/make/listener.js +37 -93
- package/build/commands/make/middleware.d.ts +5 -0
- package/build/commands/make/middleware.js +42 -101
- package/build/commands/make/preload.d.ts +5 -0
- package/build/commands/make/preload.js +48 -113
- package/build/commands/make/provider.d.ts +5 -0
- package/build/commands/make/provider.js +48 -112
- package/build/commands/make/service.d.ts +5 -0
- package/build/commands/make/service.js +17 -55
- package/build/commands/make/test.d.ts +5 -0
- package/build/commands/make/test.js +48 -132
- package/build/commands/make/transformer.d.ts +5 -0
- package/build/commands/make/transformer.js +18 -64
- package/build/commands/make/validator.d.ts +5 -0
- package/build/commands/make/validator.js +21 -80
- package/build/commands/make/view.d.ts +5 -0
- package/build/commands/make/view.js +16 -56
- package/build/commands/repl.js +17 -50
- package/build/commands/serve.js +80 -150
- package/build/commands/test.js +92 -202
- package/build/config_provider-FIAUgvae.js +13 -0
- package/build/core-IpCOCkUL.js +146 -0
- package/build/create_kernel-B7ILNhuP.js +38 -0
- package/build/create_kernel-BD0Iqi8e.js +3 -0
- package/build/debug-CGQmxzGt.js +3 -0
- package/build/decorate-DmrZA614.js +7 -0
- package/build/define_config-0oHaj43l.js +86 -0
- package/build/dumper-BBgqFX5a.js +147 -0
- package/build/errors-CrCO-k44.js +8 -0
- package/build/factories/app.js +2 -9
- package/build/factories/bodyparser.js +2 -9
- package/build/factories/core/ace.js +22 -45
- package/build/factories/core/ignitor.js +74 -180
- package/build/factories/core/main.js +18 -11
- package/build/factories/core/test_utils.js +19 -42
- package/build/factories/encryption.d.ts +1 -1
- package/build/factories/encryption.js +2 -9
- package/build/factories/events.js +2 -9
- package/build/factories/hash.js +2 -9
- package/build/factories/http.js +2 -9
- package/build/factories/logger.js +2 -9
- package/build/factories/stubs.d.ts +1 -6
- package/build/factories/stubs.js +24 -91
- package/build/index.d.ts +1 -1
- package/build/index.js +10 -46
- package/build/main--nXd7T-C.js +73 -0
- package/build/main-Cxz0TyIw.js +173 -0
- package/build/main-DN2qEEg5.js +41 -0
- package/build/main-DkNgvceD.js +52 -0
- package/build/main-MBAMnmJb.js +81 -0
- package/build/main-kn40V-hF.js +2 -0
- package/build/{stubs/make → make}/health/controller.stub +5 -2
- package/build/modules/ace/codemods.d.ts +75 -23
- package/build/modules/ace/codemods.js +291 -476
- package/build/modules/ace/main.js +2 -41
- package/build/modules/app.js +6 -26
- package/build/modules/bodyparser/bodyparser_middleware.js +3 -14
- package/build/modules/bodyparser/main.js +6 -9
- package/build/modules/config.js +6 -26
- package/build/modules/container.js +6 -9
- package/build/modules/dumper/main.js +6 -32
- package/build/modules/dumper/plugins/edge.js +46 -61
- package/build/modules/encryption/define_config.d.ts +161 -0
- package/build/modules/encryption/drivers/aes_256_cbc.d.ts +20 -0
- package/build/modules/encryption/drivers/aes_256_cbc.js +2 -0
- package/build/modules/encryption/drivers/aes_256_gcm.d.ts +21 -0
- package/build/modules/encryption/drivers/aes_256_gcm.js +2 -0
- package/build/modules/encryption/drivers/aes_siv.d.ts +19 -0
- package/build/modules/encryption/drivers/aes_siv.js +2 -0
- package/build/modules/encryption/drivers/chacha20_poly1305.d.ts +21 -0
- package/build/modules/encryption/drivers/chacha20_poly1305.js +2 -0
- package/build/modules/encryption/drivers/legacy.d.ts +84 -0
- package/build/modules/encryption/drivers/legacy.js +57 -0
- package/build/modules/encryption/errors.d.ts +16 -0
- package/build/modules/encryption/main.d.ts +89 -0
- package/build/modules/encryption/main.js +6 -0
- package/build/modules/env/editor.js +2 -9
- package/build/modules/env/main.js +2 -28
- package/build/modules/events.js +6 -9
- package/build/modules/hash/drivers/argon.js +2 -9
- package/build/modules/hash/drivers/bcrypt.js +2 -20
- package/build/modules/hash/drivers/scrypt.js +2 -9
- package/build/modules/hash/main.js +6 -28
- package/build/modules/hash/phc_formatter.js +2 -9
- package/build/modules/health.js +2 -9
- package/build/modules/http/helpers.d.ts +1 -0
- package/build/modules/http/helpers.js +2 -0
- package/build/modules/http/main.js +4 -15
- package/build/modules/http/request_validator.d.ts +3 -4
- package/build/modules/http/url_builder_client.js +2 -9
- package/build/modules/logger.d.ts +30 -0
- package/build/modules/logger.js +14 -9
- package/build/modules/repl.js +6 -9
- package/build/modules/transformers/main.js +2 -9
- package/build/providers/app_provider.d.ts +5 -13
- package/build/providers/app_provider.js +153 -359
- package/build/providers/edge_provider.js +98 -164
- package/build/providers/hash_provider.js +29 -91
- package/build/providers/repl_provider.js +66 -152
- package/build/providers/vinejs_provider.d.ts +1 -1
- package/build/providers/vinejs_provider.js +21 -65
- package/build/services/ace.js +1 -16
- package/build/services/app.js +3 -19
- package/build/services/config.js +1 -12
- package/build/services/dumper.js +4 -20
- package/build/services/emitter.js +1 -13
- package/build/services/encryption.js +1 -13
- package/build/services/hash.js +1 -13
- package/build/services/logger.js +1 -13
- package/build/services/repl.js +1 -13
- package/build/services/router.js +1 -13
- package/build/services/server.js +1 -13
- package/build/services/test_utils.js +1 -16
- package/build/services/url_builder.d.ts +3 -3
- package/build/services/url_builder.js +4 -16
- package/build/src/assembler_hooks/index_entities.d.ts +34 -1
- package/build/src/debug.d.ts +1 -1
- package/build/src/exceptions.js +2 -49
- package/build/src/helpers/assert.js +2 -55
- package/build/src/helpers/http.js +2 -28
- package/build/src/helpers/is.js +3 -31
- package/build/src/helpers/main.js +5 -52
- package/build/src/helpers/string.js +26 -76
- package/build/src/helpers/types.js +25 -134
- package/build/src/helpers/verification_token.js +46 -120
- package/build/src/test_utils/main.js +8 -77
- package/build/src/types.d.ts +53 -99
- package/build/src/types.js +0 -8
- package/build/src/utils.d.ts +1 -1
- package/build/src/vine.js +29 -101
- package/build/toolkit/main.js +19 -21
- package/build/types/ace.js +2 -9
- package/build/types/app.js +2 -9
- package/build/types/bodyparser.js +2 -9
- package/build/types/common.js +2 -9
- package/build/types/container.js +2 -9
- package/build/types/encryption.d.ts +53 -1
- package/build/types/encryption.js +1 -9
- package/build/types/events.js +2 -9
- package/build/types/hash.js +2 -9
- package/build/types/health.js +2 -9
- package/build/types/helpers.js +0 -8
- package/build/types/http.js +2 -9
- package/build/types/logger.js +2 -9
- package/build/types/repl.js +2 -9
- package/build/types/transformers.js +2 -9
- package/build/utils-rRkbAPnP.js +42 -0
- package/package.json +117 -62
- package/build/modules/ace/commands.js +0 -157
- package/build/modules/ace/create_kernel.js +0 -91
- package/build/modules/ace/kernel.js +0 -40
- package/build/modules/dumper/define_config.js +0 -36
- package/build/modules/dumper/dumper.js +0 -266
- package/build/modules/dumper/errors.js +0 -119
- package/build/modules/encryption.d.ts +0 -18
- package/build/modules/encryption.js +0 -26
- package/build/modules/hash/define_config.js +0 -125
- package/build/modules/http/request_validator.js +0 -100
- package/build/src/assembler_hooks/index_entities.js +0 -112
- package/build/src/cli_formatters/routes_list.js +0 -397
- package/build/src/config_provider.js +0 -71
- package/build/src/debug.js +0 -25
- package/build/src/ignitor/ace.js +0 -102
- package/build/src/ignitor/http.js +0 -159
- package/build/src/ignitor/main.js +0 -124
- package/build/src/ignitor/test.js +0 -66
- package/build/src/test_utils/http.js +0 -82
- package/build/src/utils.js +0 -114
- package/build/stubs/main.js +0 -9
- package/build/toolkit/commands/index_commands.js +0 -30
- /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/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
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { t as debug_default } from "./debug-CGQmxzGt.js";
|
|
2
|
+
import { t as main_exports } from "./main-DN2qEEg5.js";
|
|
3
|
+
import { Encryption } from "./modules/encryption/main.js";
|
|
4
|
+
import { IncomingMessage, ServerResponse, createServer } from "node:http";
|
|
5
|
+
import { Socket } from "node:net";
|
|
6
|
+
import Macroable from "@poppinss/macroable";
|
|
7
|
+
var HttpServerUtils = class {
|
|
8
|
+
#utils;
|
|
9
|
+
constructor(utils) {
|
|
10
|
+
this.#utils = utils;
|
|
11
|
+
}
|
|
12
|
+
#listen(nodeHttpServer) {
|
|
13
|
+
return new Promise((resolve, reject) => {
|
|
14
|
+
const host = process.env.HOST || "0.0.0.0";
|
|
15
|
+
const port = Number(process.env.PORT || "3333");
|
|
16
|
+
nodeHttpServer.listen(port, host);
|
|
17
|
+
nodeHttpServer.once("listening", () => {
|
|
18
|
+
debug_default("listening to utils http server, host :%s, port: %s", host, port);
|
|
19
|
+
resolve({
|
|
20
|
+
port,
|
|
21
|
+
host
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
nodeHttpServer.once("error", (error) => {
|
|
25
|
+
reject(error);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
async start(serverCallback) {
|
|
30
|
+
const createHTTPServer = serverCallback || createServer;
|
|
31
|
+
const server = await this.#utils.app.container.make("server");
|
|
32
|
+
await server.boot();
|
|
33
|
+
const httpServer = createHTTPServer(server.handle.bind(server));
|
|
34
|
+
server.setNodeServer(httpServer);
|
|
35
|
+
await this.#listen(httpServer);
|
|
36
|
+
return () => {
|
|
37
|
+
return new Promise((resolve, reject) => {
|
|
38
|
+
httpServer.close((error) => {
|
|
39
|
+
if (error) reject(error);
|
|
40
|
+
else resolve();
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
var TestUtils = class extends Macroable {
|
|
47
|
+
#booted = false;
|
|
48
|
+
get isBooted() {
|
|
49
|
+
return this.#booted;
|
|
50
|
+
}
|
|
51
|
+
constructor(app) {
|
|
52
|
+
super();
|
|
53
|
+
this.app = app;
|
|
54
|
+
}
|
|
55
|
+
async boot() {
|
|
56
|
+
if (!this.isBooted) {
|
|
57
|
+
this.#booted = true;
|
|
58
|
+
this.cookies = new main_exports.CookieClient(await this.app.container.make(Encryption));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
httpServer() {
|
|
62
|
+
return new HttpServerUtils(this);
|
|
63
|
+
}
|
|
64
|
+
async createHttpContext(options = {}) {
|
|
65
|
+
const req = options.req || new IncomingMessage(new Socket());
|
|
66
|
+
const res = options.res || new ServerResponse(req);
|
|
67
|
+
const server = await this.app.container.make("server");
|
|
68
|
+
const request = server.createRequest(req, res);
|
|
69
|
+
const response = server.createResponse(req, res);
|
|
70
|
+
return server.createHttpContext(request, response, this.app.container.createResolver());
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
export { TestUtils as t };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { t as debug_default } from "./debug-CGQmxzGt.js";
|
|
2
|
+
import { setApp } from "./services/app.js";
|
|
3
|
+
import { t as app_exports } from "./modules/app.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-BD0Iqi8e.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
|
+
app.terminating(() => {
|
|
31
|
+
const mainCommand = kernel.getMainCommand();
|
|
32
|
+
if (mainCommand?.staysAlive) process.exitCode = mainCommand.exitCode;
|
|
33
|
+
});
|
|
34
|
+
await kernel.handle(argv);
|
|
35
|
+
const mainCommand = kernel.getMainCommand();
|
|
36
|
+
if (!mainCommand || !mainCommand.staysAlive) {
|
|
37
|
+
process.exitCode = kernel.exitCode;
|
|
38
|
+
await app.terminate();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var TestRunnerProcess = class {
|
|
43
|
+
#ignitor;
|
|
44
|
+
#configureCallback = () => {};
|
|
45
|
+
constructor(ignitor) {
|
|
46
|
+
this.#ignitor = ignitor;
|
|
47
|
+
}
|
|
48
|
+
configure(callback) {
|
|
49
|
+
this.#configureCallback = callback;
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
async run(callback) {
|
|
53
|
+
const app = this.#ignitor.createApp("test");
|
|
54
|
+
await app.init();
|
|
55
|
+
await app.boot();
|
|
56
|
+
await app.start(this.#configureCallback);
|
|
57
|
+
await callback(app);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
var HttpServerProcess = class {
|
|
61
|
+
#ignitor;
|
|
62
|
+
constructor(ignitor) {
|
|
63
|
+
this.#ignitor = ignitor;
|
|
64
|
+
}
|
|
65
|
+
#close(nodeHttpServer) {
|
|
66
|
+
return new Promise((resolve) => {
|
|
67
|
+
debug_default("closing http server process");
|
|
68
|
+
nodeHttpServer.close(() => resolve());
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
#monitorAppAndServer(nodeHttpServer, app, logger) {
|
|
72
|
+
app.terminating(async () => {
|
|
73
|
+
debug_default("terminating signal received");
|
|
74
|
+
await this.#close(nodeHttpServer);
|
|
75
|
+
});
|
|
76
|
+
nodeHttpServer.once("error", (error) => {
|
|
77
|
+
debug_default("http server crashed with error \"%O\"", error);
|
|
78
|
+
logger.fatal({ err: error }, error.message);
|
|
79
|
+
process.exitCode = 1;
|
|
80
|
+
app.terminate();
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
#listen(nodeHttpServer) {
|
|
84
|
+
return new Promise((resolve, reject) => {
|
|
85
|
+
const host = process.env.HOST || "0.0.0.0";
|
|
86
|
+
const port = Number(process.env.PORT || "3333");
|
|
87
|
+
nodeHttpServer.listen(port, host);
|
|
88
|
+
nodeHttpServer.once("listening", () => {
|
|
89
|
+
debug_default("listening to http server, host :%s, port: %s", host, port);
|
|
90
|
+
resolve({
|
|
91
|
+
port,
|
|
92
|
+
host
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
nodeHttpServer.once("error", (error) => {
|
|
96
|
+
reject(error);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
#notifyServerHasStarted(app, logger, emitter, payload) {
|
|
101
|
+
app.notify({
|
|
102
|
+
isAdonisJS: true,
|
|
103
|
+
environment: "web",
|
|
104
|
+
...payload
|
|
105
|
+
});
|
|
106
|
+
logger.info("started HTTP server on %s:%s", payload.host, payload.port);
|
|
107
|
+
emitter.emit("http:server_ready", payload);
|
|
108
|
+
}
|
|
109
|
+
async start(serverCallback) {
|
|
110
|
+
const startTime = process.hrtime();
|
|
111
|
+
const createHTTPServer = serverCallback || createServer;
|
|
112
|
+
const app = this.#ignitor.createApp("web");
|
|
113
|
+
await app.init();
|
|
114
|
+
await app.boot();
|
|
115
|
+
await app.start(async () => {
|
|
116
|
+
const server = await app.container.make("server");
|
|
117
|
+
await server.boot();
|
|
118
|
+
const httpServer = createHTTPServer(server.handle.bind(server));
|
|
119
|
+
server.setNodeServer(httpServer);
|
|
120
|
+
const logger = await app.container.make("logger");
|
|
121
|
+
const emitter = await app.container.make("emitter");
|
|
122
|
+
const payload = await this.#listen(httpServer);
|
|
123
|
+
this.#notifyServerHasStarted(app, logger, emitter, {
|
|
124
|
+
...payload,
|
|
125
|
+
duration: process.hrtime(startTime)
|
|
126
|
+
});
|
|
127
|
+
this.#monitorAppAndServer(httpServer, app, logger);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
var Ignitor = class {
|
|
132
|
+
#options;
|
|
133
|
+
#appRoot;
|
|
134
|
+
#app;
|
|
135
|
+
#tapCallbacks = /* @__PURE__ */ new Set();
|
|
136
|
+
constructor(appRoot, options = {}) {
|
|
137
|
+
this.#appRoot = appRoot;
|
|
138
|
+
this.#options = options;
|
|
139
|
+
}
|
|
140
|
+
#runTapCallbacks(app) {
|
|
141
|
+
this.#tapCallbacks.forEach((tapCallback) => tapCallback(app));
|
|
142
|
+
}
|
|
143
|
+
getApp() {
|
|
144
|
+
return this.#app;
|
|
145
|
+
}
|
|
146
|
+
createApp(environment) {
|
|
147
|
+
debug_default("creating application instance");
|
|
148
|
+
this.#app = new app_exports.Application(this.#appRoot, {
|
|
149
|
+
environment,
|
|
150
|
+
importer: this.#options.importer
|
|
151
|
+
});
|
|
152
|
+
setApp(this.#app);
|
|
153
|
+
this.#runTapCallbacks(this.#app);
|
|
154
|
+
return this.#app;
|
|
155
|
+
}
|
|
156
|
+
tap(callback) {
|
|
157
|
+
this.#tapCallbacks.add(callback);
|
|
158
|
+
return this;
|
|
159
|
+
}
|
|
160
|
+
httpServer() {
|
|
161
|
+
return new HttpServerProcess(this);
|
|
162
|
+
}
|
|
163
|
+
ace() {
|
|
164
|
+
return new AceProcess(this);
|
|
165
|
+
}
|
|
166
|
+
testRunner() {
|
|
167
|
+
return new TestRunnerProcess(this);
|
|
168
|
+
}
|
|
169
|
+
async terminate() {
|
|
170
|
+
await this.#app?.terminate();
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
export { Ignitor as t };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { n as __reExport, t as __exportAll } from "./chunk-iKc69rpz.js";
|
|
2
|
+
import "@adonisjs/bodyparser";
|
|
3
|
+
var RequestValidator = class RequestValidator {
|
|
4
|
+
#ctx;
|
|
5
|
+
constructor(ctx) {
|
|
6
|
+
this.#ctx = ctx;
|
|
7
|
+
}
|
|
8
|
+
static errorReporter;
|
|
9
|
+
static messagesProvider;
|
|
10
|
+
#requestData() {
|
|
11
|
+
return {
|
|
12
|
+
...this.#ctx.request.all(),
|
|
13
|
+
params: this.#ctx.request.params(),
|
|
14
|
+
headers: this.#ctx.request.headers(),
|
|
15
|
+
cookies: this.#ctx.request.cookiesList()
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
#processValidatorOptions(options) {
|
|
19
|
+
const validatorOptions = options || {};
|
|
20
|
+
if (RequestValidator.errorReporter && !validatorOptions.errorReporter) {
|
|
21
|
+
const errorReporter = RequestValidator.errorReporter(this.#ctx);
|
|
22
|
+
validatorOptions.errorReporter = () => errorReporter;
|
|
23
|
+
}
|
|
24
|
+
if (RequestValidator.messagesProvider && !validatorOptions.messagesProvider) validatorOptions.messagesProvider = RequestValidator.messagesProvider(this.#ctx);
|
|
25
|
+
return validatorOptions;
|
|
26
|
+
}
|
|
27
|
+
validateUsing(validator, ...[options]) {
|
|
28
|
+
const validatorOptions = this.#processValidatorOptions(options);
|
|
29
|
+
const data = validatorOptions.data || this.#requestData();
|
|
30
|
+
return validator.validate(data, validatorOptions);
|
|
31
|
+
}
|
|
32
|
+
async tryValidateUsing(validator, ...[options]) {
|
|
33
|
+
const validatorOptions = this.#processValidatorOptions(options);
|
|
34
|
+
const data = validatorOptions.data || this.#requestData();
|
|
35
|
+
return validator.tryValidate(data, validatorOptions);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var main_exports = /* @__PURE__ */ __exportAll({ RequestValidator: () => RequestValidator });
|
|
39
|
+
import * as import__adonisjs_http_server from "@adonisjs/http-server";
|
|
40
|
+
__reExport(main_exports, import__adonisjs_http_server);
|
|
41
|
+
export { RequestValidator as n, main_exports as t };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { n as __reExport, t as __exportAll } from "./chunk-iKc69rpz.js";
|
|
2
|
+
import { t as debug_default } from "./debug-CGQmxzGt.js";
|
|
3
|
+
import { t as configProvider } from "./config_provider-FIAUgvae.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__ */ __exportAll({
|
|
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,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 };
|
|
@@ -9,9 +9,12 @@ import { healthChecks } from '#start/health'
|
|
|
9
9
|
import type { HttpContext } from '@adonisjs/core/http'
|
|
10
10
|
|
|
11
11
|
export default class {{ controllerName }} {
|
|
12
|
-
async
|
|
13
|
-
|
|
12
|
+
async live({ response }: HttpContext) {
|
|
13
|
+
return response.ok()
|
|
14
|
+
}
|
|
14
15
|
|
|
16
|
+
async ready({ response }: HttpContext) {
|
|
17
|
+
const report = await healthChecks.run()
|
|
15
18
|
if (report.isHealthy) {
|
|
16
19
|
return response.ok(report)
|
|
17
20
|
}
|
|
@@ -3,6 +3,7 @@ import type { UIPrimitives } from '@adonisjs/ace/types';
|
|
|
3
3
|
import type { CodeTransformer } from '@adonisjs/assembler/code_transformer';
|
|
4
4
|
import type { MiddlewareNode, EnvValidationNode, BouncerPolicyNode, SupportedPackageManager } from '@adonisjs/assembler/types';
|
|
5
5
|
import type { Application } from '../app.ts';
|
|
6
|
+
import { type GeneratedStub } from '../../types/app.ts';
|
|
6
7
|
/**
|
|
7
8
|
* Codemods class for programmatically modifying AdonisJS source files.
|
|
8
9
|
* This class provides APIs to modify configuration files, register middleware,
|
|
@@ -172,6 +173,76 @@ export declare class Codemods extends EventEmitter {
|
|
|
172
173
|
* ```
|
|
173
174
|
*/
|
|
174
175
|
registerJapaPlugin(...params: Parameters<CodeTransformer['addJapaPlugin']>): Promise<void>;
|
|
176
|
+
/**
|
|
177
|
+
* Add a new validator file to the validators directory.
|
|
178
|
+
* This method creates a new validator file with the provided definition.
|
|
179
|
+
*
|
|
180
|
+
* @param params - Parameters for adding the validator
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```ts
|
|
184
|
+
* await codemods.addValidator({
|
|
185
|
+
* validatorFileName: 'create_user',
|
|
186
|
+
* exportName: 'createUserValidator',
|
|
187
|
+
* contents: 'export const createUserValidator = vine.compile(...)'
|
|
188
|
+
* })
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
addValidator(...params: Parameters<CodeTransformer['addValidator']>): Promise<void>;
|
|
192
|
+
/**
|
|
193
|
+
* Add a new rate limiter file to the limiters directory.
|
|
194
|
+
* This method creates a new limiter file with the provided definition.
|
|
195
|
+
*
|
|
196
|
+
* @param params - Parameters for adding the limiter
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```ts
|
|
200
|
+
* await codemods.addLimiter({
|
|
201
|
+
* limiterFileName: 'api_throttle',
|
|
202
|
+
* exportName: 'apiThrottleLimiter',
|
|
203
|
+
* contents: 'export const apiThrottleLimiter = limiter.define(...)'
|
|
204
|
+
* })
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
addLimiter(...params: Parameters<CodeTransformer['addLimiter']>): Promise<void>;
|
|
208
|
+
/**
|
|
209
|
+
* Add mixins to a model class.
|
|
210
|
+
* This method adds mixin calls to the specified model file.
|
|
211
|
+
*
|
|
212
|
+
* @param params - Parameters for adding model mixins (modelFileName, mixins array)
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* ```ts
|
|
216
|
+
* await codemods.addModelMixins('user', [
|
|
217
|
+
* {
|
|
218
|
+
* name: 'SoftDeletes',
|
|
219
|
+
* importPath: '@adonisjs/lucid/mixins/soft_deletes',
|
|
220
|
+
* importType: 'named'
|
|
221
|
+
* }
|
|
222
|
+
* ])
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
addModelMixins(...params: Parameters<CodeTransformer['addModelMixins']>): Promise<void>;
|
|
226
|
+
/**
|
|
227
|
+
* Add a new method to an existing controller class.
|
|
228
|
+
* This method injects a new method into the specified controller file.
|
|
229
|
+
*
|
|
230
|
+
* @param params - Parameters for adding the controller method
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* ```ts
|
|
234
|
+
* await codemods.addControllerMethod({
|
|
235
|
+
* controllerFileName: 'users_controller',
|
|
236
|
+
* className: 'UsersController',
|
|
237
|
+
* name: 'destroy',
|
|
238
|
+
* contents: 'async destroy({ params, response }: HttpContext) { ... }',
|
|
239
|
+
* imports: [
|
|
240
|
+
* { isType: false, isNamed: true, name: 'HttpContext', path: '@adonisjs/core/http' }
|
|
241
|
+
* ]
|
|
242
|
+
* })
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
addControllerMethod(...params: Parameters<CodeTransformer['addControllerMethod']>): Promise<void>;
|
|
175
246
|
/**
|
|
176
247
|
* Generate a file using a stub template
|
|
177
248
|
*
|
|
@@ -192,32 +263,13 @@ export declare class Codemods extends EventEmitter {
|
|
|
192
263
|
* )
|
|
193
264
|
* ```
|
|
194
265
|
*/
|
|
195
|
-
makeUsingStub(stubsRoot: string, stubPath: string, stubState: Record<string, any
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
destination: any;
|
|
199
|
-
attributes: Record<string, any>;
|
|
200
|
-
status: "created";
|
|
201
|
-
skipReason: null;
|
|
202
|
-
} | {
|
|
203
|
-
relativeFileName: string;
|
|
204
|
-
contents: string;
|
|
205
|
-
destination: any;
|
|
206
|
-
attributes: Record<string, any>;
|
|
207
|
-
status: "force_created";
|
|
208
|
-
skipReason: null;
|
|
209
|
-
} | {
|
|
210
|
-
relativeFileName: string;
|
|
211
|
-
contents: string;
|
|
212
|
-
destination: any;
|
|
213
|
-
attributes: Record<string, any>;
|
|
214
|
-
status: "skipped";
|
|
215
|
-
skipReason: string;
|
|
216
|
-
}>;
|
|
266
|
+
makeUsingStub(stubsRoot: string, stubPath: string, stubState: Record<string, any>, options?: {
|
|
267
|
+
contentsFromFile?: string;
|
|
268
|
+
}): Promise<GeneratedStub>;
|
|
217
269
|
/**
|
|
218
270
|
* Install packages using the detected or specified package manager.
|
|
219
271
|
* Automatically detects npm, yarn, or pnpm and installs dependencies accordingly.
|
|
220
|
-
* You can specify version of each package by setting it in the name like '@adonisjs/lucid
|
|
272
|
+
* You can specify version of each package by setting it in the name like '@adonisjs/lucid'.
|
|
221
273
|
*
|
|
222
274
|
* @param packages - Array of packages with their dependency type
|
|
223
275
|
* @param packageManager - Optional package manager to use (auto-detected if not provided)
|