@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,121 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { t as stubsRoot } from "../../main-kn40V-hF.js";
|
|
2
|
+
import { f as BaseCommand, l as flags, o as args } from "../../main-BlJhxJJ2.js";
|
|
3
|
+
import { t as __decorate } from "../../decorate-CJcHOoD-.js";
|
|
4
|
+
import string from "@poppinss/utils/string";
|
|
5
|
+
var MakeController = class extends BaseCommand {
|
|
6
|
+
static commandName = "make:controller";
|
|
7
|
+
static description = "Create a new HTTP controller class";
|
|
8
|
+
static options = { allowUnknownFlags: true };
|
|
9
|
+
stubPath = "make/controller/main.stub";
|
|
10
|
+
async prepare() {
|
|
11
|
+
if (this.actions) this.stubPath = "make/controller/actions.stub";
|
|
12
|
+
if (this.resource) if (this.actions) this.logger.warning("Cannot use --resource flag with actions. Ignoring --resource");
|
|
13
|
+
else this.stubPath = "make/controller/resource.stub";
|
|
14
|
+
if (this.api) if (this.actions) this.logger.warning("Cannot use --api flag with actions. Ignoring --api");
|
|
15
|
+
else this.stubPath = "make/controller/api.stub";
|
|
16
|
+
if (this.resource && this.api && !this.actions) this.logger.warning("--api and --resource flags cannot be used together. Ignoring --resource");
|
|
17
|
+
}
|
|
18
|
+
async run() {
|
|
19
|
+
await (await this.createCodemods()).makeUsingStub(stubsRoot, this.stubPath, {
|
|
20
|
+
flags: this.parsed.flags,
|
|
21
|
+
actions: this.actions?.map((action) => string.camelCase(action)),
|
|
22
|
+
entity: this.app.generators.createEntity(this.name),
|
|
23
|
+
singular: this.singular
|
|
24
|
+
});
|
|
25
|
+
}
|
|
14
26
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
*/
|
|
34
|
-
static commandName = 'make:controller';
|
|
35
|
-
/**
|
|
36
|
-
* The command description
|
|
37
|
-
*/
|
|
38
|
-
static description = 'Create a new HTTP controller class';
|
|
39
|
-
/**
|
|
40
|
-
* Command options configuration
|
|
41
|
-
*/
|
|
42
|
-
static options = {
|
|
43
|
-
allowUnknownFlags: true,
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* The stub to use for generating the controller
|
|
47
|
-
*/
|
|
48
|
-
stubPath = 'make/controller/main.stub';
|
|
49
|
-
/**
|
|
50
|
-
* Preparing the command state
|
|
51
|
-
*/
|
|
52
|
-
async prepare() {
|
|
53
|
-
/**
|
|
54
|
-
* Use actions stub
|
|
55
|
-
*/
|
|
56
|
-
if (this.actions) {
|
|
57
|
-
this.stubPath = 'make/controller/actions.stub';
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Use resource stub
|
|
61
|
-
*/
|
|
62
|
-
if (this.resource) {
|
|
63
|
-
if (this.actions) {
|
|
64
|
-
this.logger.warning('Cannot use --resource flag with actions. Ignoring --resource');
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
this.stubPath = 'make/controller/resource.stub';
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Use api stub
|
|
72
|
-
*/
|
|
73
|
-
if (this.api) {
|
|
74
|
-
if (this.actions) {
|
|
75
|
-
this.logger.warning('Cannot use --api flag with actions. Ignoring --api');
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
this.stubPath = 'make/controller/api.stub';
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Log warning when both flags are used together
|
|
83
|
-
*/
|
|
84
|
-
if (this.resource && this.api && !this.actions) {
|
|
85
|
-
this.logger.warning('--api and --resource flags cannot be used together. Ignoring --resource');
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
async run() {
|
|
89
|
-
const codemods = await this.createCodemods();
|
|
90
|
-
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
91
|
-
flags: this.parsed.flags,
|
|
92
|
-
actions: this.actions?.map((action) => string.camelCase(action)),
|
|
93
|
-
entity: this.app.generators.createEntity(this.name),
|
|
94
|
-
singular: this.singular,
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
__decorate([
|
|
99
|
-
args.string({ description: 'The name of the controller' })
|
|
100
|
-
], MakeController.prototype, "name", void 0);
|
|
101
|
-
__decorate([
|
|
102
|
-
args.spread({ description: 'Create controller with custom method names', required: false })
|
|
103
|
-
], MakeController.prototype, "actions", void 0);
|
|
104
|
-
__decorate([
|
|
105
|
-
flags.boolean({
|
|
106
|
-
description: 'Generate controller in singular form',
|
|
107
|
-
alias: 's',
|
|
108
|
-
})
|
|
109
|
-
], MakeController.prototype, "singular", void 0);
|
|
110
|
-
__decorate([
|
|
111
|
-
flags.boolean({
|
|
112
|
-
description: 'Generate resourceful controller with methods to perform CRUD actions on a resource',
|
|
113
|
-
alias: 'r',
|
|
114
|
-
})
|
|
115
|
-
], MakeController.prototype, "resource", void 0);
|
|
116
|
-
__decorate([
|
|
117
|
-
flags.boolean({
|
|
118
|
-
description: 'Generate resourceful controller without the "edit" and the "create" methods',
|
|
119
|
-
alias: 'a',
|
|
120
|
-
})
|
|
121
|
-
], MakeController.prototype, "api", void 0);
|
|
27
|
+
__decorate([args.string({ description: "The name of the controller" })], MakeController.prototype, "name", void 0);
|
|
28
|
+
__decorate([args.spread({
|
|
29
|
+
description: "Create controller with custom method names",
|
|
30
|
+
required: false
|
|
31
|
+
})], MakeController.prototype, "actions", void 0);
|
|
32
|
+
__decorate([flags.boolean({
|
|
33
|
+
description: "Generate controller in singular form",
|
|
34
|
+
alias: "s"
|
|
35
|
+
})], MakeController.prototype, "singular", void 0);
|
|
36
|
+
__decorate([flags.boolean({
|
|
37
|
+
description: "Generate resourceful controller with methods to perform CRUD actions on a resource",
|
|
38
|
+
alias: "r"
|
|
39
|
+
})], MakeController.prototype, "resource", void 0);
|
|
40
|
+
__decorate([flags.boolean({
|
|
41
|
+
description: "Generate resourceful controller without the \"edit\" and the \"create\" methods",
|
|
42
|
+
alias: "a"
|
|
43
|
+
})], MakeController.prototype, "api", void 0);
|
|
44
|
+
export { MakeController as default };
|
|
@@ -1,63 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { t as stubsRoot } from "../../main-kn40V-hF.js";
|
|
2
|
+
import { f as BaseCommand, o as args } from "../../main-BlJhxJJ2.js";
|
|
3
|
+
import { t as __decorate } from "../../decorate-CJcHOoD-.js";
|
|
4
|
+
var MakeEvent = class extends BaseCommand {
|
|
5
|
+
static commandName = "make:event";
|
|
6
|
+
static description = "Create a new event class";
|
|
7
|
+
static options = { allowUnknownFlags: true };
|
|
8
|
+
stubPath = "make/event/main.stub";
|
|
9
|
+
async run() {
|
|
10
|
+
await (await this.createCodemods()).makeUsingStub(stubsRoot, this.stubPath, {
|
|
11
|
+
flags: this.parsed.flags,
|
|
12
|
+
entity: this.app.generators.createEntity(this.name)
|
|
13
|
+
});
|
|
14
|
+
}
|
|
14
15
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Command to create a new event class.
|
|
19
|
-
* Events are data objects that encapsulate information about something
|
|
20
|
-
* that happened in your application and can be dispatched to listeners.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```
|
|
24
|
-
* ace make:event UserRegistered
|
|
25
|
-
* ace make:event OrderCompleted
|
|
26
|
-
* ace make:event EmailSent
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export default class MakeEvent extends BaseCommand {
|
|
30
|
-
/**
|
|
31
|
-
* The command name
|
|
32
|
-
*/
|
|
33
|
-
static commandName = 'make:event';
|
|
34
|
-
/**
|
|
35
|
-
* The command description
|
|
36
|
-
*/
|
|
37
|
-
static description = 'Create a new event class';
|
|
38
|
-
/**
|
|
39
|
-
* Command options configuration.
|
|
40
|
-
* Allows unknown flags to be passed through.
|
|
41
|
-
*/
|
|
42
|
-
static options = {
|
|
43
|
-
allowUnknownFlags: true,
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* The stub template file to use for generating the event class
|
|
47
|
-
*/
|
|
48
|
-
stubPath = 'make/event/main.stub';
|
|
49
|
-
/**
|
|
50
|
-
* Execute the command to create a new event class.
|
|
51
|
-
* Generates the event file with proper event structure.
|
|
52
|
-
*/
|
|
53
|
-
async run() {
|
|
54
|
-
const codemods = await this.createCodemods();
|
|
55
|
-
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
56
|
-
flags: this.parsed.flags,
|
|
57
|
-
entity: this.app.generators.createEntity(this.name),
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
__decorate([
|
|
62
|
-
args.string({ description: 'Name of the event' })
|
|
63
|
-
], MakeEvent.prototype, "name", void 0);
|
|
16
|
+
__decorate([args.string({ description: "Name of the event" })], MakeEvent.prototype, "name", void 0);
|
|
17
|
+
export { MakeEvent as default };
|
|
@@ -1,63 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { t as stubsRoot } from "../../main-kn40V-hF.js";
|
|
2
|
+
import { f as BaseCommand, o as args } from "../../main-BlJhxJJ2.js";
|
|
3
|
+
import { t as __decorate } from "../../decorate-CJcHOoD-.js";
|
|
4
|
+
var MakeException = class extends BaseCommand {
|
|
5
|
+
static commandName = "make:exception";
|
|
6
|
+
static description = "Create a new custom exception class";
|
|
7
|
+
static options = { allowUnknownFlags: true };
|
|
8
|
+
stubPath = "make/exception/main.stub";
|
|
9
|
+
async run() {
|
|
10
|
+
await (await this.createCodemods()).makeUsingStub(stubsRoot, this.stubPath, {
|
|
11
|
+
flags: this.parsed.flags,
|
|
12
|
+
entity: this.app.generators.createEntity(this.name)
|
|
13
|
+
});
|
|
14
|
+
}
|
|
14
15
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Command to create a new custom exception class.
|
|
19
|
-
* Custom exceptions allow you to define specific error types for your application
|
|
20
|
-
* with custom error messages, status codes, and error handling logic.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```
|
|
24
|
-
* ace make:exception ValidationException
|
|
25
|
-
* ace make:exception UnauthorizedException
|
|
26
|
-
* ace make:exception ResourceNotFoundException
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export default class MakeException extends BaseCommand {
|
|
30
|
-
/**
|
|
31
|
-
* The command name
|
|
32
|
-
*/
|
|
33
|
-
static commandName = 'make:exception';
|
|
34
|
-
/**
|
|
35
|
-
* The command description
|
|
36
|
-
*/
|
|
37
|
-
static description = 'Create a new custom exception class';
|
|
38
|
-
/**
|
|
39
|
-
* Command options configuration.
|
|
40
|
-
* Allows unknown flags to be passed through.
|
|
41
|
-
*/
|
|
42
|
-
static options = {
|
|
43
|
-
allowUnknownFlags: true,
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* The stub template file to use for generating the exception class
|
|
47
|
-
*/
|
|
48
|
-
stubPath = 'make/exception/main.stub';
|
|
49
|
-
/**
|
|
50
|
-
* Execute the command to create a new custom exception class.
|
|
51
|
-
* Generates the exception file with proper error handling structure.
|
|
52
|
-
*/
|
|
53
|
-
async run() {
|
|
54
|
-
const codemods = await this.createCodemods();
|
|
55
|
-
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
56
|
-
flags: this.parsed.flags,
|
|
57
|
-
entity: this.app.generators.createEntity(this.name),
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
__decorate([
|
|
62
|
-
args.string({ description: 'Name of the exception' })
|
|
63
|
-
], MakeException.prototype, "name", void 0);
|
|
16
|
+
__decorate([args.string({ description: "Name of the exception" })], MakeException.prototype, "name", void 0);
|
|
17
|
+
export { MakeException as default };
|
|
@@ -1,94 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { t as stubsRoot } from "../../main-kn40V-hF.js";
|
|
2
|
+
import { f as BaseCommand, l as flags, o as args } from "../../main-BlJhxJJ2.js";
|
|
3
|
+
import { t as __decorate } from "../../decorate-CJcHOoD-.js";
|
|
4
|
+
var MakeListener = class extends BaseCommand {
|
|
5
|
+
static commandName = "make:listener";
|
|
6
|
+
static description = "Create a new event listener class";
|
|
7
|
+
static options = { allowUnknownFlags: true };
|
|
8
|
+
stubPath = "make/listener/main.stub";
|
|
9
|
+
prepare() {
|
|
10
|
+
if (this.event) this.stubPath = "make/listener/for_event.stub";
|
|
11
|
+
}
|
|
12
|
+
async run() {
|
|
13
|
+
const codemods = await this.createCodemods();
|
|
14
|
+
if (this.event) {
|
|
15
|
+
const { exitCode } = await this.kernel.exec("make:event", [this.event]);
|
|
16
|
+
if (exitCode === 0) {
|
|
17
|
+
const eventEntity = this.app.generators.createEntity(this.event);
|
|
18
|
+
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
19
|
+
event: eventEntity,
|
|
20
|
+
flags: this.parsed.flags,
|
|
21
|
+
entity: this.app.generators.createEntity(this.name)
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
27
|
+
flags: this.parsed.flags,
|
|
28
|
+
entity: this.app.generators.createEntity(this.name)
|
|
29
|
+
});
|
|
30
|
+
}
|
|
14
31
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```
|
|
24
|
-
* ace make:listener UserRegistered
|
|
25
|
-
* ace make:listener EmailSent --event=EmailSent
|
|
26
|
-
* ace make:listener OrderCompleted --event=OrderEvent
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export default class MakeListener extends BaseCommand {
|
|
30
|
-
/**
|
|
31
|
-
* The command name
|
|
32
|
-
*/
|
|
33
|
-
static commandName = 'make:listener';
|
|
34
|
-
/**
|
|
35
|
-
* The command description
|
|
36
|
-
*/
|
|
37
|
-
static description = 'Create a new event listener class';
|
|
38
|
-
/**
|
|
39
|
-
* Command options configuration.
|
|
40
|
-
* Allows unknown flags to be passed through.
|
|
41
|
-
*/
|
|
42
|
-
static options = {
|
|
43
|
-
allowUnknownFlags: true,
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* The stub template file to use for generating the event listener
|
|
47
|
-
*/
|
|
48
|
-
stubPath = 'make/listener/main.stub';
|
|
49
|
-
/**
|
|
50
|
-
* Prepare the command by selecting the appropriate stub based on options.
|
|
51
|
-
* Uses a different stub when generating a listener for a specific event.
|
|
52
|
-
*/
|
|
53
|
-
prepare() {
|
|
54
|
-
if (this.event) {
|
|
55
|
-
this.stubPath = 'make/listener/for_event.stub';
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Execute the command to create a new event listener.
|
|
60
|
-
* If an event is specified, creates the event class first,
|
|
61
|
-
* then generates the listener with proper event binding.
|
|
62
|
-
*/
|
|
63
|
-
async run() {
|
|
64
|
-
const codemods = await this.createCodemods();
|
|
65
|
-
if (this.event) {
|
|
66
|
-
const { exitCode } = await this.kernel.exec('make:event', [this.event]);
|
|
67
|
-
/**
|
|
68
|
-
* Create listener only when make:event is completed successfully
|
|
69
|
-
*/
|
|
70
|
-
if (exitCode === 0) {
|
|
71
|
-
const eventEntity = this.app.generators.createEntity(this.event);
|
|
72
|
-
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
73
|
-
event: eventEntity,
|
|
74
|
-
flags: this.parsed.flags,
|
|
75
|
-
entity: this.app.generators.createEntity(this.name),
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
81
|
-
flags: this.parsed.flags,
|
|
82
|
-
entity: this.app.generators.createEntity(this.name),
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
__decorate([
|
|
87
|
-
args.string({ description: 'Name of the event listener' })
|
|
88
|
-
], MakeListener.prototype, "name", void 0);
|
|
89
|
-
__decorate([
|
|
90
|
-
flags.string({
|
|
91
|
-
description: 'Generate an event class alongside the listener',
|
|
92
|
-
alias: 'e',
|
|
93
|
-
})
|
|
94
|
-
], MakeListener.prototype, "event", void 0);
|
|
32
|
+
__decorate([args.string({ description: "Name of the event listener" })], MakeListener.prototype, "name", void 0);
|
|
33
|
+
__decorate([flags.string({
|
|
34
|
+
description: "Generate an event class alongside the listener",
|
|
35
|
+
alias: "e"
|
|
36
|
+
})], MakeListener.prototype, "event", void 0);
|
|
37
|
+
export { MakeListener as default };
|
|
@@ -1,102 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { t as stubsRoot } from "../../main-kn40V-hF.js";
|
|
2
|
+
import { t as string_default } from "../../string-Cx6q_win.js";
|
|
3
|
+
import { f as BaseCommand, l as flags, o as args } from "../../main-BlJhxJJ2.js";
|
|
4
|
+
import { t as __decorate } from "../../decorate-CJcHOoD-.js";
|
|
5
|
+
import string from "@poppinss/utils/string";
|
|
6
|
+
import { basename, extname, relative } from "node:path";
|
|
7
|
+
var MakeMiddleware = class extends BaseCommand {
|
|
8
|
+
static commandName = "make:middleware";
|
|
9
|
+
static description = "Create a new middleware class for HTTP requests";
|
|
10
|
+
static options = { allowUnknownFlags: true };
|
|
11
|
+
stubPath = "make/middleware/main.stub";
|
|
12
|
+
async run() {
|
|
13
|
+
const stackChoices = [
|
|
14
|
+
"server",
|
|
15
|
+
"router",
|
|
16
|
+
"named"
|
|
17
|
+
];
|
|
18
|
+
if (!this.stack) this.stack = await this.prompt.choice("Under which stack you want to register the middleware?", stackChoices);
|
|
19
|
+
if (!stackChoices.includes(this.stack)) {
|
|
20
|
+
this.exitCode = 1;
|
|
21
|
+
this.logger.error(`Invalid middleware stack "${this.stack}". Select from "${stackChoices.join(", ")}"`);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const codemods = await this.createCodemods();
|
|
25
|
+
const { destination } = await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
26
|
+
flags: this.parsed.flags,
|
|
27
|
+
entity: this.app.generators.createEntity(this.name)
|
|
28
|
+
});
|
|
29
|
+
const middlewareRelativePath = string_default.toUnixSlash(relative(this.app.middlewarePath(), destination).replace(extname(destination), ""));
|
|
30
|
+
const name = string.camelCase(basename(middlewareRelativePath).replace(/_middleware$/, ""));
|
|
31
|
+
await codemods.registerMiddleware(this.stack, [{
|
|
32
|
+
name,
|
|
33
|
+
path: `#middleware/${middlewareRelativePath}`
|
|
34
|
+
}]);
|
|
35
|
+
}
|
|
14
36
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* The make middleware command to create a new middleware
|
|
22
|
-
* class.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```
|
|
26
|
-
* ace make:middleware Auth
|
|
27
|
-
* ace make:middleware Auth --stack=server
|
|
28
|
-
* ace make:middleware Auth --stack=named
|
|
29
|
-
* ace make:middleware Auth --stack=router
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export default class MakeMiddleware extends BaseCommand {
|
|
33
|
-
/**
|
|
34
|
-
* The command name
|
|
35
|
-
*/
|
|
36
|
-
static commandName = 'make:middleware';
|
|
37
|
-
/**
|
|
38
|
-
* The command description
|
|
39
|
-
*/
|
|
40
|
-
static description = 'Create a new middleware class for HTTP requests';
|
|
41
|
-
/**
|
|
42
|
-
* Command options configuration
|
|
43
|
-
*/
|
|
44
|
-
static options = {
|
|
45
|
-
allowUnknownFlags: true,
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* The stub to use for generating the middleware
|
|
49
|
-
*/
|
|
50
|
-
stubPath = 'make/middleware/main.stub';
|
|
51
|
-
async run() {
|
|
52
|
-
const stackChoices = ['server', 'router', 'named'];
|
|
53
|
-
/**
|
|
54
|
-
* Prompt to select the stack under which to register
|
|
55
|
-
* the middleware
|
|
56
|
-
*/
|
|
57
|
-
if (!this.stack) {
|
|
58
|
-
this.stack = await this.prompt.choice('Under which stack you want to register the middleware?', stackChoices);
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Error out when mentioned stack is invalid
|
|
62
|
-
*/
|
|
63
|
-
if (!stackChoices.includes(this.stack)) {
|
|
64
|
-
this.exitCode = 1;
|
|
65
|
-
this.logger.error(`Invalid middleware stack "${this.stack}". Select from "${stackChoices.join(', ')}"`);
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Create middleware
|
|
70
|
-
*/
|
|
71
|
-
const codemods = await this.createCodemods();
|
|
72
|
-
const { destination } = await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
73
|
-
flags: this.parsed.flags,
|
|
74
|
-
entity: this.app.generators.createEntity(this.name),
|
|
75
|
-
});
|
|
76
|
-
/**
|
|
77
|
-
* Creative relative path for the middleware file from
|
|
78
|
-
* the "./app/middleware" directory
|
|
79
|
-
*/
|
|
80
|
-
const middlewareRelativePath = stringHelpers.toUnixSlash(relative(this.app.middlewarePath(), destination).replace(extname(destination), ''));
|
|
81
|
-
/**
|
|
82
|
-
* Take the middleware relative path, remove `_middleware` prefix from it
|
|
83
|
-
* and convert everything to camelcase
|
|
84
|
-
*/
|
|
85
|
-
const name = string.camelCase(basename(middlewareRelativePath).replace(/_middleware$/, ''));
|
|
86
|
-
/**
|
|
87
|
-
* Register middleware
|
|
88
|
-
*/
|
|
89
|
-
await codemods.registerMiddleware(this.stack, [
|
|
90
|
-
{
|
|
91
|
-
name: name,
|
|
92
|
-
path: `#middleware/${middlewareRelativePath}`,
|
|
93
|
-
},
|
|
94
|
-
]);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
__decorate([
|
|
98
|
-
args.string({ description: 'Name of the middleware' })
|
|
99
|
-
], MakeMiddleware.prototype, "name", void 0);
|
|
100
|
-
__decorate([
|
|
101
|
-
flags.string({ description: 'The stack in which to register the middleware', alias: 's' })
|
|
102
|
-
], MakeMiddleware.prototype, "stack", void 0);
|
|
37
|
+
__decorate([args.string({ description: "Name of the middleware" })], MakeMiddleware.prototype, "name", void 0);
|
|
38
|
+
__decorate([flags.string({
|
|
39
|
+
description: "The stack in which to register the middleware",
|
|
40
|
+
alias: "s"
|
|
41
|
+
})], MakeMiddleware.prototype, "stack", void 0);
|
|
42
|
+
export { MakeMiddleware as default };
|