@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
|
@@ -1,114 +1,97 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
request: this.request,
|
|
99
|
-
});
|
|
100
|
-
}, true);
|
|
101
|
-
/**
|
|
102
|
-
* Adding brisk route to render templates without an
|
|
103
|
-
* explicit handler
|
|
104
|
-
*/
|
|
105
|
-
BriskRoute.macro('render', function (template, data) {
|
|
106
|
-
function rendersTemplate({ view }) {
|
|
107
|
-
return view.render(template, data);
|
|
108
|
-
}
|
|
109
|
-
Object.defineProperty(rendersTemplate, 'listArgs', { value: template, writable: false });
|
|
110
|
-
return this.setHandler(rendersTemplate);
|
|
111
|
-
});
|
|
112
|
-
edge.use(pluginEdgeDumper(dumper));
|
|
113
|
-
}
|
|
114
|
-
}
|
|
1
|
+
import "../chunk-B88MteZI.js";
|
|
2
|
+
import { t as main_exports } from "../main-nojlltNo.js";
|
|
3
|
+
import { t as pluginEdgeDumper } from "../edge-BVYR-Vjr.js";
|
|
4
|
+
import edge from "edge.js";
|
|
5
|
+
var EdgeServiceProvider = class {
|
|
6
|
+
constructor(app) {
|
|
7
|
+
this.app = app;
|
|
8
|
+
this.app.usingEdgeJS = true;
|
|
9
|
+
}
|
|
10
|
+
async boot() {
|
|
11
|
+
const app = this.app;
|
|
12
|
+
const qs = new main_exports.Qs(app.config.get("app.http.qs", {}));
|
|
13
|
+
const router = await this.app.container.make("router");
|
|
14
|
+
const dumper = await this.app.container.make("dumper");
|
|
15
|
+
function edgeConfigResolver(key, defaultValue) {
|
|
16
|
+
return app.config.get(key, defaultValue);
|
|
17
|
+
}
|
|
18
|
+
edgeConfigResolver.has = function(key) {
|
|
19
|
+
return app.config.has(key);
|
|
20
|
+
};
|
|
21
|
+
function clientRoutes() {
|
|
22
|
+
const routes = router.toJSON();
|
|
23
|
+
return Object.keys(routes).reduce((result, domain) => {
|
|
24
|
+
result[domain] = routes[domain].reduce((routesResult, route) => {
|
|
25
|
+
if (!route.name) return routesResult;
|
|
26
|
+
routesResult.push({
|
|
27
|
+
domain: route.domain,
|
|
28
|
+
methods: route.methods,
|
|
29
|
+
pattern: route.pattern,
|
|
30
|
+
tokens: route.tokens,
|
|
31
|
+
name: route.name
|
|
32
|
+
});
|
|
33
|
+
return routesResult;
|
|
34
|
+
}, []);
|
|
35
|
+
return result;
|
|
36
|
+
}, {});
|
|
37
|
+
}
|
|
38
|
+
edge.mount(app.viewsPath());
|
|
39
|
+
edge.configure({ cache: app.inProduction });
|
|
40
|
+
edge.global("route", function(...args) {
|
|
41
|
+
return router.makeUrl(...args);
|
|
42
|
+
});
|
|
43
|
+
edge.global("signedRoute", function(...args) {
|
|
44
|
+
return router.makeSignedUrl(...args);
|
|
45
|
+
});
|
|
46
|
+
edge.global("app", app);
|
|
47
|
+
edge.global("config", edgeConfigResolver);
|
|
48
|
+
edge.global("routes", function() {
|
|
49
|
+
return clientRoutes();
|
|
50
|
+
});
|
|
51
|
+
edge.global("routesJSON", function() {
|
|
52
|
+
return JSON.stringify(clientRoutes());
|
|
53
|
+
});
|
|
54
|
+
edge.global("urlFor", function(...args) {
|
|
55
|
+
return router.urlBuilder.urlFor(...args);
|
|
56
|
+
});
|
|
57
|
+
edge.global("signedUrlFor", function(...args) {
|
|
58
|
+
return router.urlBuilder.signedUrlFor(...args);
|
|
59
|
+
});
|
|
60
|
+
edge.global("qs", qs);
|
|
61
|
+
edge.global("formAttributes", function(route, method, params, options) {
|
|
62
|
+
options = options ?? {};
|
|
63
|
+
method = method.toUpperCase();
|
|
64
|
+
const original = method;
|
|
65
|
+
if (method !== "GET" && method !== "POST") {
|
|
66
|
+
method = "POST";
|
|
67
|
+
options = {
|
|
68
|
+
...options,
|
|
69
|
+
qs: {
|
|
70
|
+
_method: original,
|
|
71
|
+
...options.qs
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const { action } = router.urlBuilder.urlFor.method(original, route, params, options).form;
|
|
76
|
+
return {
|
|
77
|
+
action,
|
|
78
|
+
method
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
main_exports.HttpContext.getter("view", function() {
|
|
82
|
+
return edge.createRenderer().share({ request: this.request });
|
|
83
|
+
}, true);
|
|
84
|
+
main_exports.BriskRoute.macro("render", function(template, data) {
|
|
85
|
+
function rendersTemplate({ view }) {
|
|
86
|
+
return view.render(template, data);
|
|
87
|
+
}
|
|
88
|
+
Object.defineProperty(rendersTemplate, "listArgs", {
|
|
89
|
+
value: template,
|
|
90
|
+
writable: false
|
|
91
|
+
});
|
|
92
|
+
return this.setHandler(rendersTemplate);
|
|
93
|
+
});
|
|
94
|
+
edge.use(pluginEdgeDumper(dumper));
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
export { EdgeServiceProvider as default };
|
|
@@ -1,91 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
*
|
|
30
|
-
* @param app - The application service instance
|
|
31
|
-
*/
|
|
32
|
-
constructor(app) {
|
|
33
|
-
this.app = app;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Registering the hash class to resolve an instance with the
|
|
37
|
-
* default hasher.
|
|
38
|
-
*
|
|
39
|
-
* Creates a singleton binding for the Hash class that resolves
|
|
40
|
-
* the default hasher from the hash manager.
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* const hash = await container.make(Hash)
|
|
44
|
-
* const hashed = await hash.make('password')
|
|
45
|
-
*/
|
|
46
|
-
registerHash() {
|
|
47
|
-
this.app.container.singleton(Hash, async (resolver) => {
|
|
48
|
-
const hashManager = await resolver.make('hash');
|
|
49
|
-
return hashManager.use();
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Registers the hash manager with the container
|
|
54
|
-
*
|
|
55
|
-
* Creates a singleton binding for 'hash' that instantiates
|
|
56
|
-
* the HashManager with configuration from config/hash.ts file.
|
|
57
|
-
* Throws an error if the configuration is invalid.
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* const hashManager = await container.make('hash')
|
|
61
|
-
* const bcryptHasher = hashManager.use('bcrypt')
|
|
62
|
-
*/
|
|
63
|
-
registerHashManager() {
|
|
64
|
-
this.app.container.singleton('hash', async () => {
|
|
65
|
-
const hashConfigProvider = this.app.config.get('hash');
|
|
66
|
-
/**
|
|
67
|
-
* Resolve config from the provider
|
|
68
|
-
*/
|
|
69
|
-
const config = await configProvider.resolve(this.app, hashConfigProvider);
|
|
70
|
-
if (!config) {
|
|
71
|
-
throw new RuntimeException('Invalid "config/hash.ts" file. Make sure you are using the "defineConfig" method');
|
|
72
|
-
}
|
|
73
|
-
const { HashManager } = await import('../modules/hash/main.js');
|
|
74
|
-
return new HashManager(config);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Registers bindings
|
|
79
|
-
*
|
|
80
|
-
* Called during the application bootstrap phase to register
|
|
81
|
-
* the hash manager and hash class with the IoC container.
|
|
82
|
-
*
|
|
83
|
-
* @example
|
|
84
|
-
* const provider = new HashServiceProvider(app)
|
|
85
|
-
* provider.register() // Registers hash services
|
|
86
|
-
*/
|
|
87
|
-
register() {
|
|
88
|
-
this.registerHashManager();
|
|
89
|
-
this.registerHash();
|
|
90
|
-
}
|
|
91
|
-
}
|
|
1
|
+
import "../chunk-B88MteZI.js";
|
|
2
|
+
import { t as configProvider } from "../config_provider-DWVFHOQX.js";
|
|
3
|
+
import { t as main_exports } from "../main-D-WhqOOn.js";
|
|
4
|
+
import { RuntimeException } from "@poppinss/utils/exception";
|
|
5
|
+
var HashServiceProvider = class {
|
|
6
|
+
constructor(app) {
|
|
7
|
+
this.app = app;
|
|
8
|
+
}
|
|
9
|
+
registerHash() {
|
|
10
|
+
this.app.container.singleton(main_exports.Hash, async (resolver) => {
|
|
11
|
+
return (await resolver.make("hash")).use();
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
registerHashManager() {
|
|
15
|
+
this.app.container.singleton("hash", async () => {
|
|
16
|
+
const hashConfigProvider = this.app.config.get("hash");
|
|
17
|
+
const config = await configProvider.resolve(this.app, hashConfigProvider);
|
|
18
|
+
if (!config) throw new RuntimeException("Invalid \"config/hash.ts\" file. Make sure you are using the \"defineConfig\" method");
|
|
19
|
+
const { HashManager } = await import("../modules/hash/main.js");
|
|
20
|
+
return new HashManager(config);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
register() {
|
|
24
|
+
this.registerHashManager();
|
|
25
|
+
this.registerHash();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export { HashServiceProvider as default };
|
|
@@ -1,154 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* For the full copyright and license information, please view the LICENSE
|
|
7
|
-
* file that was distributed with this source code.
|
|
8
|
-
*/
|
|
9
|
-
import { join } from 'node:path';
|
|
10
|
-
import { homedir } from 'node:os';
|
|
11
|
-
import { fsImportAll } from '@poppinss/utils/fs';
|
|
12
|
-
import { Repl } from "../modules/repl.js";
|
|
13
|
-
/**
|
|
14
|
-
* Resolves a container binding and sets it on the REPL
|
|
15
|
-
* context
|
|
16
|
-
*
|
|
17
|
-
* This helper function makes a service from the container and
|
|
18
|
-
* adds it to the REPL context with a notification message.
|
|
19
|
-
*
|
|
20
|
-
* @param app - The application service instance
|
|
21
|
-
* @param repl - The REPL instance to add the binding to
|
|
22
|
-
* @param binding - The container binding key to resolve
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* await resolveBindingForRepl(app, repl, 'router')
|
|
26
|
-
* // Now 'router' variable is available in REPL
|
|
27
|
-
*/
|
|
1
|
+
import "../chunk-B88MteZI.js";
|
|
2
|
+
import { t as repl_exports } from "../repl-GSxgovJQ.js";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
|
+
import { fsImportAll } from "@poppinss/utils/fs";
|
|
28
6
|
async function resolveBindingForRepl(app, repl, binding) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* REPL Service Provider configures the interactive Node.js REPL
|
|
34
|
-
* for AdonisJS applications
|
|
35
|
-
*
|
|
36
|
-
* This provider sets up:
|
|
37
|
-
* - REPL instance with history file support
|
|
38
|
-
* - Helper methods for importing modules and making container bindings
|
|
39
|
-
* - Quick access methods for loading common services (app, router, etc.)
|
|
40
|
-
* - Utility methods for development and debugging
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* const provider = new ReplServiceProvider(app)
|
|
44
|
-
* provider.register()
|
|
45
|
-
* await provider.boot()
|
|
46
|
-
*/
|
|
47
|
-
export default class ReplServiceProvider {
|
|
48
|
-
app;
|
|
49
|
-
/**
|
|
50
|
-
* REPL service provider constructor
|
|
51
|
-
*
|
|
52
|
-
* @param app - The application service instance
|
|
53
|
-
*/
|
|
54
|
-
constructor(app) {
|
|
55
|
-
this.app = app;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Registers the REPL binding
|
|
59
|
-
*
|
|
60
|
-
* Creates a singleton binding for the REPL with history file
|
|
61
|
-
* support in the user's home directory.
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* const provider = new ReplServiceProvider(app)
|
|
65
|
-
* provider.register()
|
|
66
|
-
* const repl = await app.container.make('repl')
|
|
67
|
-
*/
|
|
68
|
-
register() {
|
|
69
|
-
this.app.container.singleton(Repl, async () => {
|
|
70
|
-
return new Repl({
|
|
71
|
-
historyFilePath: join(homedir(), '.adonisjs_v6_repl_history'),
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
this.app.container.alias('repl', Repl);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Registering REPL bindings during provider boot
|
|
78
|
-
*
|
|
79
|
-
* Adds helper methods to the REPL instance including:
|
|
80
|
-
* - importDefault: Import default export from modules
|
|
81
|
-
* - importAll: Import all files from a directory
|
|
82
|
-
* - make: Create instances using container.make
|
|
83
|
-
* - load* methods: Quick access to common services
|
|
84
|
-
* - loadHelpers: Load utility helper functions
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* await provider.boot()
|
|
88
|
-
* // REPL now has helper methods available
|
|
89
|
-
*/
|
|
90
|
-
async boot() {
|
|
91
|
-
this.app.container.resolving('repl', (repl) => {
|
|
92
|
-
repl.addMethod('importDefault', (_, modulePath) => {
|
|
93
|
-
return this.app.importDefault(modulePath);
|
|
94
|
-
}, {
|
|
95
|
-
description: 'Returns the default export for a module',
|
|
96
|
-
});
|
|
97
|
-
repl.addMethod('importAll', (_, dirPath) => {
|
|
98
|
-
return fsImportAll(this.app.makeURL(dirPath), {
|
|
99
|
-
ignoreMissingRoot: false,
|
|
100
|
-
});
|
|
101
|
-
}, {
|
|
102
|
-
description: 'Import all files from a directory and assign them to a variable',
|
|
103
|
-
});
|
|
104
|
-
repl.addMethod('make', (_, service, runtimeValues) => {
|
|
105
|
-
return this.app.container.make(service, runtimeValues);
|
|
106
|
-
}, {
|
|
107
|
-
description: 'Make class instance using "container.make" method',
|
|
108
|
-
});
|
|
109
|
-
repl.addMethod('loadApp', () => {
|
|
110
|
-
return resolveBindingForRepl(this.app, repl, 'app');
|
|
111
|
-
}, {
|
|
112
|
-
description: 'Load "app" service in the REPL context',
|
|
113
|
-
});
|
|
114
|
-
repl.addMethod('loadEncryption', () => {
|
|
115
|
-
return resolveBindingForRepl(this.app, repl, 'encryption');
|
|
116
|
-
}, {
|
|
117
|
-
description: 'Load "encryption" service in the REPL context',
|
|
118
|
-
});
|
|
119
|
-
repl.addMethod('loadHash', () => {
|
|
120
|
-
return resolveBindingForRepl(this.app, repl, 'hash');
|
|
121
|
-
}, {
|
|
122
|
-
description: 'Load "hash" service in the REPL context',
|
|
123
|
-
});
|
|
124
|
-
repl.addMethod('loadRouter', () => {
|
|
125
|
-
return resolveBindingForRepl(this.app, repl, 'router');
|
|
126
|
-
}, {
|
|
127
|
-
description: 'Load "router" service in the REPL context',
|
|
128
|
-
});
|
|
129
|
-
repl.addMethod('loadConfig', () => {
|
|
130
|
-
return resolveBindingForRepl(this.app, repl, 'config');
|
|
131
|
-
}, {
|
|
132
|
-
description: 'Load "config" service in the REPL context',
|
|
133
|
-
});
|
|
134
|
-
repl.addMethod('loadTestUtils', () => {
|
|
135
|
-
return resolveBindingForRepl(this.app, repl, 'testUtils');
|
|
136
|
-
}, {
|
|
137
|
-
description: 'Load "testUtils" service in the REPL context',
|
|
138
|
-
});
|
|
139
|
-
repl.addMethod('loadHelpers', async () => {
|
|
140
|
-
const { default: isModule } = await import('../src/helpers/is.js');
|
|
141
|
-
const { default: stringModule } = await import('../src/helpers/string.js');
|
|
142
|
-
const helpers = await import('../src/helpers/main.js');
|
|
143
|
-
repl.server.context.helpers = {
|
|
144
|
-
string: stringModule,
|
|
145
|
-
is: isModule,
|
|
146
|
-
...helpers,
|
|
147
|
-
};
|
|
148
|
-
repl.notify(`Loaded "helpers" module. You can access it using the "${repl.colors.underline('helpers')}" variable`);
|
|
149
|
-
}, {
|
|
150
|
-
description: 'Load "helpers" module in the REPL context',
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
}
|
|
7
|
+
repl.server.context[binding] = await app.container.make(binding);
|
|
8
|
+
repl.notify(`Loaded "${binding}" service. You can access it using the "${repl.colors.underline(binding)}" variable`);
|
|
154
9
|
}
|
|
10
|
+
var ReplServiceProvider = class {
|
|
11
|
+
constructor(app) {
|
|
12
|
+
this.app = app;
|
|
13
|
+
}
|
|
14
|
+
register() {
|
|
15
|
+
this.app.container.singleton(repl_exports.Repl, async () => {
|
|
16
|
+
return new repl_exports.Repl({ historyFilePath: join(homedir(), ".adonisjs_v6_repl_history") });
|
|
17
|
+
});
|
|
18
|
+
this.app.container.alias("repl", repl_exports.Repl);
|
|
19
|
+
}
|
|
20
|
+
async boot() {
|
|
21
|
+
this.app.container.resolving("repl", (repl) => {
|
|
22
|
+
repl.addMethod("importDefault", (_, modulePath) => {
|
|
23
|
+
return this.app.importDefault(modulePath);
|
|
24
|
+
}, { description: "Returns the default export for a module" });
|
|
25
|
+
repl.addMethod("importAll", (_, dirPath) => {
|
|
26
|
+
return fsImportAll(this.app.makeURL(dirPath), { ignoreMissingRoot: false });
|
|
27
|
+
}, { description: "Import all files from a directory and assign them to a variable" });
|
|
28
|
+
repl.addMethod("make", (_, service, runtimeValues) => {
|
|
29
|
+
return this.app.container.make(service, runtimeValues);
|
|
30
|
+
}, { description: "Make class instance using \"container.make\" method" });
|
|
31
|
+
repl.addMethod("loadApp", () => {
|
|
32
|
+
return resolveBindingForRepl(this.app, repl, "app");
|
|
33
|
+
}, { description: "Load \"app\" service in the REPL context" });
|
|
34
|
+
repl.addMethod("loadEncryption", () => {
|
|
35
|
+
return resolveBindingForRepl(this.app, repl, "encryption");
|
|
36
|
+
}, { description: "Load \"encryption\" service in the REPL context" });
|
|
37
|
+
repl.addMethod("loadHash", () => {
|
|
38
|
+
return resolveBindingForRepl(this.app, repl, "hash");
|
|
39
|
+
}, { description: "Load \"hash\" service in the REPL context" });
|
|
40
|
+
repl.addMethod("loadRouter", () => {
|
|
41
|
+
return resolveBindingForRepl(this.app, repl, "router");
|
|
42
|
+
}, { description: "Load \"router\" service in the REPL context" });
|
|
43
|
+
repl.addMethod("loadConfig", () => {
|
|
44
|
+
return resolveBindingForRepl(this.app, repl, "config");
|
|
45
|
+
}, { description: "Load \"config\" service in the REPL context" });
|
|
46
|
+
repl.addMethod("loadTestUtils", () => {
|
|
47
|
+
return resolveBindingForRepl(this.app, repl, "testUtils");
|
|
48
|
+
}, { description: "Load \"testUtils\" service in the REPL context" });
|
|
49
|
+
repl.addMethod("loadHelpers", async () => {
|
|
50
|
+
const { default: isModule } = await import("../src/helpers/is.js");
|
|
51
|
+
const { default: stringModule } = await import("../src/helpers/string.js");
|
|
52
|
+
const helpers = await import("../src/helpers/main.js");
|
|
53
|
+
repl.server.context.helpers = {
|
|
54
|
+
string: stringModule,
|
|
55
|
+
is: isModule,
|
|
56
|
+
...helpers
|
|
57
|
+
};
|
|
58
|
+
repl.notify(`Loaded "helpers" module. You can access it using the "${repl.colors.underline("helpers")}" variable`);
|
|
59
|
+
}, { description: "Load \"helpers\" module in the REPL context" });
|
|
60
|
+
repl.addMethod("loadUrlBuilder", async () => {
|
|
61
|
+
const router = await this.app.container.make("router");
|
|
62
|
+
repl.server.context.urlBuilder = router.urlBuilder;
|
|
63
|
+
repl.notify(`Loaded "urlBuilder" service. You can access it using the "${repl.colors.underline("urlBuilder")}" variable`);
|
|
64
|
+
}, { description: "Load \"urlBuilder\" service in the REPL context" });
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
export { ReplServiceProvider as default };
|
|
@@ -1,66 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* const provider = new VineJSServiceProvider(app)
|
|
23
|
-
* provider.boot()
|
|
24
|
-
* // Now Request has validateUsing method
|
|
25
|
-
*/
|
|
26
|
-
export default class VineJSServiceProvider {
|
|
27
|
-
app;
|
|
28
|
-
/**
|
|
29
|
-
* VineJS service provider constructor
|
|
30
|
-
*
|
|
31
|
-
* Sets the usingVineJS flag to true to indicate VineJS is being used.
|
|
32
|
-
*
|
|
33
|
-
* @param app - The application service instance
|
|
34
|
-
*/
|
|
35
|
-
constructor(app) {
|
|
36
|
-
this.app = app;
|
|
37
|
-
this.app.usingVineJS = true;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Boot the VineJS service provider
|
|
41
|
-
*
|
|
42
|
-
* Extends VineJS with file validation macro and adds validateUsing
|
|
43
|
-
* method to the Request class for easy validation in HTTP contexts.
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* provider.boot()
|
|
47
|
-
* // Now vine.file() and request.validateUsing() are available
|
|
48
|
-
*/
|
|
49
|
-
boot() {
|
|
50
|
-
const experimentalFlags = this.app.experimentalFlags;
|
|
51
|
-
/**
|
|
52
|
-
* The file method is used to validate a field to be a valid
|
|
53
|
-
* multipart file.
|
|
54
|
-
*/
|
|
55
|
-
Vine.macro('file', function (options) {
|
|
56
|
-
return new VineMultipartFile(options);
|
|
57
|
-
});
|
|
58
|
-
/**
|
|
59
|
-
* The validate method can be used to validate the request
|
|
60
|
-
* data for the current request using VineJS validators
|
|
61
|
-
*/
|
|
62
|
-
Request.macro('validateUsing', function (...args) {
|
|
63
|
-
return new RequestValidator(this.ctx, experimentalFlags).validateUsing(...args);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
1
|
+
import "../chunk-B88MteZI.js";
|
|
2
|
+
import { n as RequestValidator, t as main_exports } from "../main-nojlltNo.js";
|
|
3
|
+
import { t as VineMultipartFile } from "../vine-DGint2rk.js";
|
|
4
|
+
import { Vine } from "@vinejs/vine";
|
|
5
|
+
var VineJSServiceProvider = class {
|
|
6
|
+
constructor(app) {
|
|
7
|
+
this.app = app;
|
|
8
|
+
this.app.usingVineJS = true;
|
|
9
|
+
}
|
|
10
|
+
boot() {
|
|
11
|
+
Vine.macro("file", function(options) {
|
|
12
|
+
return new VineMultipartFile(options);
|
|
13
|
+
});
|
|
14
|
+
main_exports.HttpRequest.macro("validateUsing", function(...args) {
|
|
15
|
+
return new RequestValidator(this.ctx).validateUsing(...args);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export { VineJSServiceProvider as default };
|