@adonisjs/core 7.0.0-next.2 → 7.0.0-next.20
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-sWl9sgM1.js +16 -0
- package/build/app-B6oge7b3.js +5 -0
- package/build/app-DNvbxVWl.js +5 -0
- package/build/bodyparser_middleware-BmARtnYe.js +3 -0
- package/build/chunk-B88MteZI.js +26 -0
- package/build/commands/add.d.ts +4 -3
- package/build/commands/add.js +76 -110
- package/build/commands/build.js +51 -107
- package/build/commands/commands.json +1 -1
- package/build/commands/configure.js +82 -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.js +15 -57
- package/build/commands/make/controller.js +43 -120
- package/build/commands/make/event.js +16 -62
- package/build/commands/make/exception.js +16 -62
- package/build/commands/make/listener.js +36 -93
- package/build/commands/make/middleware.js +41 -101
- package/build/commands/make/preload.js +47 -113
- package/build/commands/make/provider.js +47 -112
- package/build/commands/make/service.js +16 -55
- package/build/commands/make/test.js +47 -132
- package/build/commands/make/transformer.js +17 -64
- package/build/commands/make/validator.js +20 -80
- package/build/commands/make/view.js +15 -56
- package/build/commands/repl.js +17 -50
- package/build/commands/serve.js +80 -156
- package/build/commands/test.js +92 -208
- package/build/config-Dd2H6-_e.js +5 -0
- package/build/config_provider-DWVFHOQX.js +15 -0
- package/build/container-uxa8LpGI.js +5 -0
- package/build/core-BuPP8K6N.js +140 -0
- package/build/create_kernel-Cn8zVtvt.js +3 -0
- package/build/create_kernel-Cpqqa931.js +38 -0
- package/build/decorate-CJcHOoD-.js +7 -0
- package/build/define_config-CoWy5lbf.js +62 -0
- package/build/dumper-BTjb8j4y.js +147 -0
- package/build/edge-BVYR-Vjr.js +47 -0
- package/build/events-C4d0OPUI.js +5 -0
- package/build/exceptions-DNMesP42.js +2 -0
- package/build/factories/app.js +2 -9
- package/build/factories/bodyparser.js +2 -9
- package/build/factories/core/ace.js +16 -46
- package/build/factories/core/ignitor.js +13 -180
- package/build/factories/core/main.js +24 -11
- package/build/factories/core/test_utils.js +21 -43
- 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.js +27 -91
- package/build/ignitor-BrmVPN5N.js +71 -0
- package/build/index.d.ts +1 -1
- package/build/index.js +12 -46
- package/build/logger-0KKSqgPG.js +13 -0
- package/build/main-BU8NWUEG.js +73 -0
- package/build/main-Bfnr5tAw.js +2 -0
- package/build/main-BlJhxJJ2.js +81 -0
- package/build/main-C4B2SPOT.js +5 -0
- package/build/main-CZZ21eXm.js +171 -0
- package/build/main-D-WhqOOn.js +51 -0
- package/build/main-DOY5Q8Av.js +5 -0
- package/build/main-kn40V-hF.js +2 -0
- package/build/main-nojlltNo.js +30 -0
- package/build/{stubs/make → make}/health/controller.stub +5 -2
- package/build/modules/ace/codemods.d.ts +109 -14
- package/build/modules/ace/codemods.js +222 -382
- package/build/modules/ace/main.d.ts +30 -0
- package/build/modules/ace/main.js +2 -11
- package/build/modules/app.d.ts +17 -0
- package/build/modules/app.js +4 -9
- package/build/modules/bodyparser/bodyparser_middleware.js +2 -14
- package/build/modules/bodyparser/main.js +4 -9
- package/build/modules/config.d.ts +17 -0
- package/build/modules/config.js +4 -9
- package/build/modules/container.js +4 -9
- package/build/modules/dumper/dumper.d.ts +5 -0
- package/build/modules/dumper/main.d.ts +21 -0
- package/build/modules/dumper/main.js +6 -11
- package/build/modules/dumper/plugins/edge.js +2 -62
- package/build/modules/encryption/define_config.d.ts +128 -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/chacha20_poly1305.d.ts +21 -0
- package/build/modules/encryption/drivers/chacha20_poly1305.js +2 -0
- package/build/modules/encryption/main.d.ts +85 -0
- package/build/modules/encryption/main.js +5 -0
- package/build/modules/env/editor.js +2 -9
- package/build/modules/env/main.d.ts +19 -0
- package/build/modules/env/main.js +2 -9
- package/build/modules/events.js +4 -9
- package/build/modules/hash/drivers/argon.js +2 -9
- package/build/modules/hash/drivers/bcrypt.d.ts +11 -0
- package/build/modules/hash/drivers/bcrypt.js +2 -9
- package/build/modules/hash/drivers/scrypt.js +2 -9
- package/build/modules/hash/main.d.ts +18 -0
- package/build/modules/hash/main.js +5 -10
- package/build/modules/hash/phc_formatter.js +2 -9
- package/build/modules/health.js +2 -9
- package/build/modules/http/main.js +4 -15
- package/build/modules/http/request_validator.d.ts +1 -3
- package/build/modules/http/url_builder_client.d.ts +1 -0
- package/build/modules/http/url_builder_client.js +2 -0
- package/build/modules/logger.d.ts +30 -0
- package/build/modules/logger.js +4 -9
- package/build/modules/repl.js +4 -9
- package/build/modules/transformers/main.js +4 -9
- package/build/providers/app_provider.d.ts +14 -25
- package/build/providers/app_provider.js +155 -363
- package/build/providers/edge_provider.js +97 -114
- package/build/providers/hash_provider.js +28 -91
- package/build/providers/repl_provider.js +66 -152
- package/build/providers/vinejs_provider.d.ts +1 -1
- package/build/providers/vinejs_provider.js +19 -66
- package/build/repl-GSxgovJQ.js +5 -0
- package/build/services/ace.js +2 -17
- package/build/services/app.js +2 -21
- package/build/services/config.js +2 -13
- package/build/services/dumper.js +5 -21
- package/build/services/emitter.js +2 -14
- package/build/services/encryption.js +2 -14
- package/build/services/hash.js +2 -14
- package/build/services/logger.js +2 -14
- package/build/services/repl.js +2 -14
- package/build/services/router.js +2 -14
- package/build/services/server.js +2 -14
- package/build/services/test_utils.js +2 -17
- package/build/services/url_builder.d.ts +3 -3
- package/build/services/url_builder.js +5 -17
- package/build/src/assembler_hooks/index_entities.d.ts +29 -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.d.ts +20 -0
- package/build/src/helpers/http.js +2 -0
- package/build/src/helpers/is.js +3 -31
- package/build/src/helpers/main.d.ts +1 -5
- package/build/src/helpers/main.js +5 -56
- package/build/src/helpers/string.js +2 -60
- package/build/src/helpers/types.js +26 -135
- package/build/src/helpers/verification_token.js +2 -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 +2 -97
- package/build/string-Cx6q_win.js +28 -0
- package/build/test_utils-hkQDmNpX.js +10 -0
- 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 +39 -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.d.ts +20 -0
- 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-CtGytdtt.js +42 -0
- package/build/verification_token-DrdoU4RH.js +46 -0
- package/build/vine-DGint2rk.js +32 -0
- package/package.json +113 -60
- 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 -256
- package/build/modules/dumper/errors.js +0 -119
- package/build/modules/encryption.d.ts +0 -1
- package/build/modules/encryption.js +0 -9
- 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 -107
- package/build/src/cli_formatters/routes_list.js +0 -381
- 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 -146
- 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 -104
- 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
package/build/factories/stubs.js
CHANGED
|
@@ -1,91 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
*
|
|
29
|
-
* console.log(preparedStub.contents)
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export class StubsFactory {
|
|
33
|
-
#parameters = {};
|
|
34
|
-
/**
|
|
35
|
-
* Returns an instance of application, either from parameters or creates a default one
|
|
36
|
-
*/
|
|
37
|
-
#getApp() {
|
|
38
|
-
return this.#parameters.app || new AppFactory().create(new URL('./', import.meta.url));
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Merge custom factory parameters to override defaults.
|
|
42
|
-
* This allows you to provide a custom application instance.
|
|
43
|
-
*
|
|
44
|
-
* @param params - Parameters to merge
|
|
45
|
-
* @param params.app - Custom application service instance
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```ts
|
|
49
|
-
* const customApp = new AppFactory().create(appRoot)
|
|
50
|
-
* const stubsFactory = new StubsFactory().merge({ app: customApp })
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
merge(params) {
|
|
54
|
-
this.#parameters = Object.assign(this.#parameters, params);
|
|
55
|
-
return this;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Prepare a stub template with the provided data and return the processed content.
|
|
59
|
-
* This method initializes the application, loads the stub, and processes it with
|
|
60
|
-
* the given template variables.
|
|
61
|
-
*
|
|
62
|
-
* @param stubPath - Path to the stub file relative to the stubs root
|
|
63
|
-
* @param data - Template data to populate the stub placeholders
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* ```ts
|
|
67
|
-
* const stubsFactory = new StubsFactory()
|
|
68
|
-
* const preparedStub = await stubsFactory.prepare('controller.stub', {
|
|
69
|
-
* filename: 'UserController',
|
|
70
|
-
* entity: {
|
|
71
|
-
* name: 'User',
|
|
72
|
-
* modelName: 'User',
|
|
73
|
-
* pluralName: 'users'
|
|
74
|
-
* },
|
|
75
|
-
* resourceful: true
|
|
76
|
-
* })
|
|
77
|
-
*
|
|
78
|
-
* // Access the processed stub content
|
|
79
|
-
* console.log(preparedStub.contents)
|
|
80
|
-
* ```
|
|
81
|
-
*/
|
|
82
|
-
async prepare(stubPath, data) {
|
|
83
|
-
const app = this.#getApp();
|
|
84
|
-
await app.init();
|
|
85
|
-
const stubs = await app.stubs.create();
|
|
86
|
-
const stub = await stubs.build(stubPath, {
|
|
87
|
-
source: stubsRoot,
|
|
88
|
-
});
|
|
89
|
-
return stub.prepare(data);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
1
|
+
import "../chunk-B88MteZI.js";
|
|
2
|
+
import { t as stubsRoot } from "../main-kn40V-hF.js";
|
|
3
|
+
import "../container-uxa8LpGI.js";
|
|
4
|
+
import "../config_provider-DWVFHOQX.js";
|
|
5
|
+
import "../main-CZZ21eXm.js";
|
|
6
|
+
import "../app-B6oge7b3.js";
|
|
7
|
+
import "../app-DNvbxVWl.js";
|
|
8
|
+
import "../string-Cx6q_win.js";
|
|
9
|
+
import "../utils-CtGytdtt.js";
|
|
10
|
+
import "../core-BuPP8K6N.js";
|
|
11
|
+
import { AppFactory } from "@adonisjs/application/factories";
|
|
12
|
+
var StubsFactory = class {
|
|
13
|
+
#parameters = {};
|
|
14
|
+
#getApp() {
|
|
15
|
+
return this.#parameters.app || new AppFactory().create(new URL("./", import.meta.url));
|
|
16
|
+
}
|
|
17
|
+
merge(params) {
|
|
18
|
+
this.#parameters = Object.assign(this.#parameters, params);
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
async prepare(stubPath, data) {
|
|
22
|
+
const app = this.#getApp();
|
|
23
|
+
await app.init();
|
|
24
|
+
return (await (await app.stubs.create()).build(stubPath, { source: stubsRoot })).prepare(data);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export { StubsFactory };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { t as Ignitor } from "./main-CZZ21eXm.js";
|
|
2
|
+
import { t as logger_exports } from "./logger-0KKSqgPG.js";
|
|
3
|
+
import { t as main_exports } from "./main-nojlltNo.js";
|
|
4
|
+
import { n as drivers, t as defineConfig } from "./define_config-CoWy5lbf.js";
|
|
5
|
+
import { n as defineConfig$1, r as drivers$1 } from "./main-D-WhqOOn.js";
|
|
6
|
+
import { t as main_exports$1 } from "./main-DOY5Q8Av.js";
|
|
7
|
+
var IgnitorFactory = class {
|
|
8
|
+
#preloadActions = [];
|
|
9
|
+
#parameters = {};
|
|
10
|
+
#loadCoreProviders = false;
|
|
11
|
+
preload(action) {
|
|
12
|
+
this.#preloadActions.push(action);
|
|
13
|
+
return this;
|
|
14
|
+
}
|
|
15
|
+
#mergeCoreProviders(providers) {
|
|
16
|
+
return [
|
|
17
|
+
() => import("@adonisjs/core/providers/app_provider"),
|
|
18
|
+
() => import("@adonisjs/core/providers/hash_provider"),
|
|
19
|
+
() => import("@adonisjs/core/providers/repl_provider")
|
|
20
|
+
].concat(providers || []);
|
|
21
|
+
}
|
|
22
|
+
merge(params) {
|
|
23
|
+
if (params.config) this.#parameters.config = Object.assign(this.#parameters.config || {}, params.config);
|
|
24
|
+
if (params.rcFileContents) this.#parameters.rcFileContents = Object.assign(this.#parameters.rcFileContents || {}, params.rcFileContents);
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
withCoreProviders() {
|
|
28
|
+
this.#loadCoreProviders = true;
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
withCoreConfig() {
|
|
32
|
+
this.merge({ config: {
|
|
33
|
+
app: {
|
|
34
|
+
appUrl: "http://localhost:3333",
|
|
35
|
+
http: (0, main_exports.defineConfig)({})
|
|
36
|
+
},
|
|
37
|
+
validator: {},
|
|
38
|
+
encryption: defineConfig({
|
|
39
|
+
default: "gcm",
|
|
40
|
+
list: { gcm: drivers.aes256gcm({
|
|
41
|
+
id: "gcm",
|
|
42
|
+
keys: ["averylongrandomsecretkey"]
|
|
43
|
+
}) }
|
|
44
|
+
}),
|
|
45
|
+
bodyparser: (0, main_exports$1.defineConfig)({}),
|
|
46
|
+
hash: defineConfig$1({
|
|
47
|
+
default: "scrypt",
|
|
48
|
+
list: { scrypt: drivers$1.scrypt({}) }
|
|
49
|
+
}),
|
|
50
|
+
logger: (0, logger_exports.defineConfig)({
|
|
51
|
+
default: "app",
|
|
52
|
+
loggers: { app: {} }
|
|
53
|
+
})
|
|
54
|
+
} });
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
create(appRoot, options) {
|
|
58
|
+
return new Ignitor(appRoot, options).tap((app) => {
|
|
59
|
+
app.booted(async () => {
|
|
60
|
+
for (let action of this.#preloadActions) await action(app);
|
|
61
|
+
});
|
|
62
|
+
if (this.#loadCoreProviders) {
|
|
63
|
+
this.#parameters.rcFileContents = this.#parameters.rcFileContents || {};
|
|
64
|
+
this.#parameters.rcFileContents.providers = this.#mergeCoreProviders(this.#parameters.rcFileContents.providers);
|
|
65
|
+
}
|
|
66
|
+
this.#parameters.rcFileContents && app.rcContents(this.#parameters.rcFileContents);
|
|
67
|
+
this.#parameters.config && app.useConfig(this.#parameters.config);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
export { IgnitorFactory as t };
|
package/build/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { errors as aceErrors } from '@adonisjs/ace';
|
|
2
2
|
import { errors as envErrors } from '@adonisjs/env';
|
|
3
3
|
import { errors as appErrors } from '@adonisjs/application';
|
|
4
|
-
import { errors as encryptionErrors } from '@
|
|
4
|
+
import { errors as encryptionErrors } from '@boringnode/encryption';
|
|
5
5
|
import { errors as httpServerErrors } from '@adonisjs/http-server';
|
|
6
6
|
export { stubsRoot } from './stubs/main.ts';
|
|
7
7
|
export { inject } from './modules/container.ts';
|
package/build/index.js
CHANGED
|
@@ -1,46 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import { errors as httpServerErrors } from '@adonisjs/http-server';
|
|
14
|
-
export { stubsRoot } from "./stubs/main.js";
|
|
15
|
-
export { inject } from "./modules/container.js";
|
|
16
|
-
export { Ignitor } from "./src/ignitor/main.js";
|
|
17
|
-
export { configProvider } from "./src/config_provider.js";
|
|
18
|
-
export { indexEntities } from "./src/assembler_hooks/index_entities.js";
|
|
19
|
-
/**
|
|
20
|
-
* Aggregated errors from all modules.
|
|
21
|
-
*/
|
|
22
|
-
export const errors = {
|
|
23
|
-
...encryptionErrors,
|
|
24
|
-
...httpServerErrors,
|
|
25
|
-
...appErrors,
|
|
26
|
-
...aceErrors,
|
|
27
|
-
...envErrors,
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Pretty prints an error with colorful output using
|
|
31
|
-
* Youch terminal
|
|
32
|
-
*/
|
|
33
|
-
export async function prettyPrintError(error) {
|
|
34
|
-
if (error && typeof error === 'object' && error.code === 'E_DUMP_DIE_EXCEPTION') {
|
|
35
|
-
console.error(error);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
try {
|
|
39
|
-
const { Youch } = await import('youch');
|
|
40
|
-
const youch = new Youch();
|
|
41
|
-
console.error(await youch.toANSI(error));
|
|
42
|
-
}
|
|
43
|
-
catch {
|
|
44
|
-
console.error(error);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
1
|
+
import "./chunk-B88MteZI.js";
|
|
2
|
+
import { t as stubsRoot } from "./main-kn40V-hF.js";
|
|
3
|
+
import { t as container_exports } from "./container-uxa8LpGI.js";
|
|
4
|
+
import { t as configProvider } from "./config_provider-DWVFHOQX.js";
|
|
5
|
+
import { t as Ignitor } from "./main-CZZ21eXm.js";
|
|
6
|
+
import "./app-B6oge7b3.js";
|
|
7
|
+
import "./app-DNvbxVWl.js";
|
|
8
|
+
import "./string-Cx6q_win.js";
|
|
9
|
+
import "./utils-CtGytdtt.js";
|
|
10
|
+
import { n as prettyPrintError, r as indexEntities, t as errors } from "./core-BuPP8K6N.js";
|
|
11
|
+
var inject = container_exports.inject;
|
|
12
|
+
export { Ignitor, configProvider, errors, indexEntities, inject, prettyPrintError, stubsRoot };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { n as __reExport, t as __exportAll } from "./chunk-B88MteZI.js";
|
|
2
|
+
import { destination } from "@adonisjs/logger";
|
|
3
|
+
var logger_exports = /* @__PURE__ */ __exportAll({ 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,73 @@
|
|
|
1
|
+
import { n as debug_default } from "./config_provider-DWVFHOQX.js";
|
|
2
|
+
import { t as main_exports } from "./main-nojlltNo.js";
|
|
3
|
+
import { n as Encryption } from "./main-Bfnr5tAw.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,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,171 @@
|
|
|
1
|
+
import { n as debug_default } from "./config_provider-DWVFHOQX.js";
|
|
2
|
+
import { n as setApp } from "./app-B6oge7b3.js";
|
|
3
|
+
import { t as app_exports } from "./app-DNvbxVWl.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-Cn8zVtvt.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,51 @@
|
|
|
1
|
+
import { n as __reExport, t as __exportAll } from "./chunk-B88MteZI.js";
|
|
2
|
+
import { n as debug_default, t as configProvider } from "./config_provider-DWVFHOQX.js";
|
|
3
|
+
import { InvalidArgumentsException } from "@poppinss/utils/exception";
|
|
4
|
+
function defineConfig(config) {
|
|
5
|
+
if (!config.list) throw new InvalidArgumentsException("Missing \"list\" property in hash config");
|
|
6
|
+
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`);
|
|
7
|
+
return configProvider.create(async (app) => {
|
|
8
|
+
debug_default("resolving hash config");
|
|
9
|
+
const hashersList = Object.keys(config.list);
|
|
10
|
+
const hashers = {};
|
|
11
|
+
for (let hasherName of hashersList) {
|
|
12
|
+
const hasher = config.list[hasherName];
|
|
13
|
+
if (typeof hasher === "function") hashers[hasherName] = hasher;
|
|
14
|
+
else hashers[hasherName] = await hasher.resolver(app);
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
default: config.default,
|
|
18
|
+
list: hashers
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
const drivers = {
|
|
23
|
+
argon2: (config) => {
|
|
24
|
+
return configProvider.create(async () => {
|
|
25
|
+
const { Argon } = await import("./modules/hash/drivers/argon.js");
|
|
26
|
+
debug_default("configuring argon driver");
|
|
27
|
+
return () => new Argon(config);
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
bcrypt: (config) => {
|
|
31
|
+
return configProvider.create(async () => {
|
|
32
|
+
const { Bcrypt } = await import("./modules/hash/drivers/bcrypt.js");
|
|
33
|
+
debug_default("configuring bcrypt driver");
|
|
34
|
+
return () => new Bcrypt(config);
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
scrypt: (config) => {
|
|
38
|
+
return configProvider.create(async () => {
|
|
39
|
+
const { Scrypt } = await import("./modules/hash/drivers/scrypt.js");
|
|
40
|
+
debug_default("configuring scrypt driver");
|
|
41
|
+
return () => new Scrypt(config);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var main_exports = /* @__PURE__ */ __exportAll({
|
|
46
|
+
defineConfig: () => defineConfig,
|
|
47
|
+
drivers: () => drivers
|
|
48
|
+
});
|
|
49
|
+
import * as import__adonisjs_hash from "@adonisjs/hash";
|
|
50
|
+
__reExport(main_exports, import__adonisjs_hash);
|
|
51
|
+
export { defineConfig as n, drivers as r, main_exports as t };
|