@adonisjs/core 7.0.0-next.10 → 7.0.0-next.11

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.
Files changed (128) hide show
  1. package/build/commands/add.js +40 -110
  2. package/build/commands/build.js +51 -107
  3. package/build/commands/configure.js +82 -177
  4. package/build/commands/eject.js +17 -60
  5. package/build/commands/env/add.js +55 -134
  6. package/build/commands/generate_key.js +22 -66
  7. package/build/commands/inspect_rcfile.js +27 -55
  8. package/build/commands/list/routes.js +246 -116
  9. package/build/commands/make/command.js +15 -57
  10. package/build/commands/make/controller.js +43 -120
  11. package/build/commands/make/event.js +16 -62
  12. package/build/commands/make/exception.js +16 -62
  13. package/build/commands/make/listener.js +36 -93
  14. package/build/commands/make/middleware.js +41 -101
  15. package/build/commands/make/preload.js +47 -113
  16. package/build/commands/make/provider.js +47 -112
  17. package/build/commands/make/service.js +16 -55
  18. package/build/commands/make/test.js +47 -132
  19. package/build/commands/make/transformer.js +17 -64
  20. package/build/commands/make/validator.js +20 -80
  21. package/build/commands/make/view.js +15 -56
  22. package/build/commands/repl.js +17 -50
  23. package/build/commands/serve.js +80 -150
  24. package/build/commands/test.js +92 -202
  25. package/build/factories/app.js +2 -9
  26. package/build/factories/bodyparser.js +2 -9
  27. package/build/factories/core/ace.js +15 -46
  28. package/build/factories/core/ignitor.js +12 -180
  29. package/build/factories/core/main.js +22 -11
  30. package/build/factories/core/test_utils.js +19 -43
  31. package/build/factories/encryption.js +2 -9
  32. package/build/factories/events.js +2 -9
  33. package/build/factories/hash.js +2 -9
  34. package/build/factories/http.js +2 -9
  35. package/build/factories/logger.js +2 -9
  36. package/build/factories/stubs.js +28 -91
  37. package/build/index.js +13 -46
  38. package/build/modules/ace/codemods.js +222 -477
  39. package/build/modules/ace/main.js +2 -41
  40. package/build/modules/app.js +4 -26
  41. package/build/modules/bodyparser/bodyparser_middleware.js +2 -14
  42. package/build/modules/bodyparser/main.js +4 -9
  43. package/build/modules/config.js +4 -26
  44. package/build/modules/container.js +4 -9
  45. package/build/modules/dumper/main.js +6 -32
  46. package/build/modules/dumper/plugins/edge.js +2 -62
  47. package/build/modules/encryption.js +4 -26
  48. package/build/modules/env/editor.js +2 -9
  49. package/build/modules/env/main.js +2 -28
  50. package/build/modules/events.js +4 -9
  51. package/build/modules/hash/drivers/argon.js +2 -9
  52. package/build/modules/hash/drivers/bcrypt.js +2 -20
  53. package/build/modules/hash/drivers/scrypt.js +2 -9
  54. package/build/modules/hash/main.js +6 -28
  55. package/build/modules/hash/phc_formatter.js +2 -9
  56. package/build/modules/health.js +2 -9
  57. package/build/modules/http/main.js +4 -15
  58. package/build/modules/http/url_builder_client.js +2 -9
  59. package/build/modules/logger.d.ts +30 -0
  60. package/build/modules/logger.js +4 -9
  61. package/build/modules/repl.js +4 -9
  62. package/build/modules/transformers/main.js +4 -9
  63. package/build/providers/app_provider.js +147 -359
  64. package/build/providers/edge_provider.js +97 -165
  65. package/build/providers/hash_provider.js +29 -91
  66. package/build/providers/repl_provider.js +61 -152
  67. package/build/providers/vinejs_provider.d.ts +1 -1
  68. package/build/providers/vinejs_provider.js +20 -66
  69. package/build/services/ace.js +2 -17
  70. package/build/services/app.js +2 -21
  71. package/build/services/config.js +2 -13
  72. package/build/services/dumper.js +5 -21
  73. package/build/services/emitter.js +2 -14
  74. package/build/services/encryption.js +2 -14
  75. package/build/services/hash.js +2 -14
  76. package/build/services/logger.js +2 -14
  77. package/build/services/repl.js +2 -14
  78. package/build/services/router.js +2 -14
  79. package/build/services/server.js +2 -14
  80. package/build/services/test_utils.js +2 -17
  81. package/build/services/url_builder.js +5 -17
  82. package/build/src/exceptions.js +2 -49
  83. package/build/src/helpers/assert.js +2 -55
  84. package/build/src/helpers/http.js +2 -28
  85. package/build/src/helpers/is.js +3 -31
  86. package/build/src/helpers/main.js +5 -52
  87. package/build/src/helpers/string.js +2 -78
  88. package/build/src/helpers/types.js +26 -135
  89. package/build/src/helpers/verification_token.js +2 -120
  90. package/build/src/test_utils/main.js +5 -77
  91. package/build/src/types.js +0 -8
  92. package/build/src/vine.js +2 -105
  93. package/build/types/ace.js +2 -9
  94. package/build/types/app.js +2 -9
  95. package/build/types/bodyparser.js +2 -9
  96. package/build/types/common.js +2 -9
  97. package/build/types/container.js +2 -9
  98. package/build/types/encryption.js +2 -9
  99. package/build/types/events.js +2 -9
  100. package/build/types/hash.js +2 -9
  101. package/build/types/health.js +2 -9
  102. package/build/types/helpers.js +0 -8
  103. package/build/types/http.js +2 -9
  104. package/build/types/logger.js +2 -9
  105. package/build/types/repl.js +2 -9
  106. package/build/types/transformers.js +2 -9
  107. package/package.json +76 -19
  108. package/build/modules/ace/commands.js +0 -157
  109. package/build/modules/ace/create_kernel.js +0 -91
  110. package/build/modules/ace/kernel.js +0 -40
  111. package/build/modules/dumper/define_config.js +0 -36
  112. package/build/modules/dumper/dumper.js +0 -266
  113. package/build/modules/dumper/errors.js +0 -119
  114. package/build/modules/hash/define_config.js +0 -125
  115. package/build/modules/http/request_validator.js +0 -100
  116. package/build/src/assembler_hooks/index_entities.js +0 -112
  117. package/build/src/cli_formatters/routes_list.js +0 -397
  118. package/build/src/config_provider.js +0 -71
  119. package/build/src/debug.js +0 -25
  120. package/build/src/ignitor/ace.js +0 -102
  121. package/build/src/ignitor/http.js +0 -159
  122. package/build/src/ignitor/main.js +0 -124
  123. package/build/src/ignitor/test.js +0 -66
  124. package/build/src/test_utils/http.js +0 -82
  125. package/build/src/utils.js +0 -114
  126. package/build/stubs/main.js +0 -9
  127. package/build/toolkit/commands/index_commands.js +0 -30
  128. package/build/toolkit/main.js +0 -27
@@ -1,113 +1,48 @@
1
- /*
2
- * @adonisjs/core
3
- *
4
- * (c) AdonisJS
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
10
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1
+ import { t as stubsRoot } from "../../main-kn40V-hF.js";
2
+ import { t as string_default } from "../../string-CJ7ewUFq.js";
3
+ import { f as BaseCommand, l as flags, o as args } from "../../main-Cn_x9YY5.js";
4
+ import { t as __decorate } from "../../decorate-DM0Sx1ye.js";
5
+ import { extname, relative } from "node:path";
6
+ const ALLOWED_ENVIRONMENTS = [
7
+ "web",
8
+ "console",
9
+ "test",
10
+ "repl"
11
+ ];
12
+ var MakeProvider = class extends BaseCommand {
13
+ static commandName = "make:provider";
14
+ static description = "Create a new service provider class";
15
+ stubPath = "make/provider/main.stub";
16
+ #isEnvironmentsFlagValid() {
17
+ if (!this.environments || !this.environments.length) return true;
18
+ return this.environments.every((one) => ALLOWED_ENVIRONMENTS.includes(one));
19
+ }
20
+ async run() {
21
+ if (!this.#isEnvironmentsFlagValid()) {
22
+ this.logger.error(`Invalid environment(s) "${this.environments}". Only "${ALLOWED_ENVIRONMENTS}" are allowed`);
23
+ return;
24
+ }
25
+ if (this.register === void 0) this.register = await this.prompt.confirm("Do you want to register the provider in .adonisrc.ts file?");
26
+ const codemods = await this.createCodemods();
27
+ const { destination } = await codemods.makeUsingStub(stubsRoot, this.stubPath, {
28
+ flags: this.parsed.flags,
29
+ entity: this.app.generators.createEntity(this.name)
30
+ });
31
+ if (!this.register) return;
32
+ const providerRelativePath = string_default.toUnixSlash(relative(this.app.providersPath(), destination).replace(extname(destination), ""));
33
+ await codemods.updateRcFile((rcFile) => {
34
+ rcFile.addProvider(`#providers/${providerRelativePath}`, this.environments);
35
+ });
36
+ }
14
37
  };
15
- import { extname, relative } from 'node:path';
16
- import { stubsRoot } from "../../stubs/main.js";
17
- import stringHelpers from "../../src/helpers/string.js";
18
- import { args, BaseCommand, flags } from "../../modules/ace/main.js";
19
- const ALLOWED_ENVIRONMENTS = ['web', 'console', 'test', 'repl'];
20
- /**
21
- * Command to create a new service provider class.
22
- * Service providers are used to register bindings, configure services,
23
- * and bootstrap application components during startup.
24
- *
25
- * @example
26
- * ```
27
- * ace make:provider AuthProvider
28
- * ace make:provider DatabaseProvider --register
29
- * ace make:provider AppProvider --no-register
30
- * ace make:provider CacheProvider --environments=web,console
31
- * ```
32
- */
33
- export default class MakeProvider extends BaseCommand {
34
- /**
35
- * The command name
36
- */
37
- static commandName = 'make:provider';
38
- /**
39
- * The command description
40
- */
41
- static description = 'Create a new service provider class';
42
- /**
43
- * The stub template file to use for generating the provider class
44
- */
45
- stubPath = 'make/provider/main.stub';
46
- /**
47
- * Validate that all specified environments are valid application environments.
48
- *
49
- * @returns True if all environments are valid or none specified, false otherwise
50
- */
51
- #isEnvironmentsFlagValid() {
52
- if (!this.environments || !this.environments.length) {
53
- return true;
54
- }
55
- return this.environments.every((one) => ALLOWED_ENVIRONMENTS.includes(one));
56
- }
57
- /**
58
- * Execute the command to create a new service provider.
59
- * Validates inputs, generates the provider file, and optionally registers it in .adonisrc.ts.
60
- */
61
- async run() {
62
- /**
63
- * Ensure the environments are valid when provided via flag
64
- */
65
- if (!this.#isEnvironmentsFlagValid()) {
66
- this.logger.error(`Invalid environment(s) "${this.environments}". Only "${ALLOWED_ENVIRONMENTS}" are allowed`);
67
- return;
68
- }
69
- /**
70
- * Display prompt to know if we should register the provider
71
- * file inside the ".adonisrc.ts" file.
72
- */
73
- if (this.register === undefined) {
74
- this.register = await this.prompt.confirm('Do you want to register the provider in .adonisrc.ts file?');
75
- }
76
- const codemods = await this.createCodemods();
77
- const { destination } = await codemods.makeUsingStub(stubsRoot, this.stubPath, {
78
- flags: this.parsed.flags,
79
- entity: this.app.generators.createEntity(this.name),
80
- });
81
- /**
82
- * Do not register when prompt has been denied or "--no-register"
83
- * flag was used
84
- */
85
- if (!this.register) {
86
- return;
87
- }
88
- /**
89
- * Creative relative path for the provider file from
90
- * the "./start" directory
91
- */
92
- const providerRelativePath = stringHelpers.toUnixSlash(relative(this.app.providersPath(), destination).replace(extname(destination), ''));
93
- await codemods.updateRcFile((rcFile) => {
94
- rcFile.addProvider(`#providers/${providerRelativePath}`, this.environments);
95
- });
96
- }
97
- }
98
- __decorate([
99
- args.string({ description: 'Name of the provider' })
100
- ], MakeProvider.prototype, "name", void 0);
101
- __decorate([
102
- flags.boolean({
103
- description: 'Auto register the provider inside the .adonisrc.ts file',
104
- showNegatedVariantInHelp: true,
105
- alias: 'r',
106
- })
107
- ], MakeProvider.prototype, "register", void 0);
108
- __decorate([
109
- flags.array({
110
- description: `Define the provider environment. Accepted values are "${ALLOWED_ENVIRONMENTS}"`,
111
- alias: 'e',
112
- })
113
- ], MakeProvider.prototype, "environments", void 0);
38
+ __decorate([args.string({ description: "Name of the provider" })], MakeProvider.prototype, "name", void 0);
39
+ __decorate([flags.boolean({
40
+ description: "Auto register the provider inside the .adonisrc.ts file",
41
+ showNegatedVariantInHelp: true,
42
+ alias: "r"
43
+ })], MakeProvider.prototype, "register", void 0);
44
+ __decorate([flags.array({
45
+ description: `Define the provider environment. Accepted values are "${ALLOWED_ENVIRONMENTS}"`,
46
+ alias: "e"
47
+ })], MakeProvider.prototype, "environments", void 0);
48
+ export { MakeProvider as default };
@@ -1,56 +1,17 @@
1
- /*
2
- * @adonisjs/core
3
- *
4
- * (c) AdonisJS
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
10
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1
+ import { t as stubsRoot } from "../../main-kn40V-hF.js";
2
+ import { f as BaseCommand, o as args } from "../../main-Cn_x9YY5.js";
3
+ import { t as __decorate } from "../../decorate-DM0Sx1ye.js";
4
+ var MakeService = class extends BaseCommand {
5
+ static commandName = "make:service";
6
+ static description = "Create a new service class";
7
+ static options = { allowUnknownFlags: true };
8
+ stubPath = "make/service/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
- import { stubsRoot } from "../../stubs/main.js";
16
- import { args, BaseCommand } from "../../modules/ace/main.js";
17
- /**
18
- * Make a new service class
19
- *
20
- * @example
21
- * ```
22
- * ace make:service UserService
23
- * ace make:service AuthService
24
- * ace make:service User/ProfileService
25
- * ```
26
- */
27
- export default class MakeService extends BaseCommand {
28
- /**
29
- * The command name
30
- */
31
- static commandName = 'make:service';
32
- /**
33
- * The command description
34
- */
35
- static description = 'Create a new service class';
36
- /**
37
- * Command options configuration
38
- */
39
- static options = {
40
- allowUnknownFlags: true,
41
- };
42
- /**
43
- * The stub to use for generating the service class
44
- */
45
- stubPath = 'make/service/main.stub';
46
- async run() {
47
- const codemods = await this.createCodemods();
48
- await codemods.makeUsingStub(stubsRoot, this.stubPath, {
49
- flags: this.parsed.flags,
50
- entity: this.app.generators.createEntity(this.name),
51
- });
52
- }
53
- }
54
- __decorate([
55
- args.string({ description: 'Name of the service' })
56
- ], MakeService.prototype, "name", void 0);
16
+ __decorate([args.string({ description: "Name of the service" })], MakeService.prototype, "name", void 0);
17
+ export { MakeService as default };
@@ -1,133 +1,48 @@
1
- /*
2
- * @adonisjs/core
3
- *
4
- * (c) AdonisJS
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
10
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1
+ import { t as stubsRoot } from "../../main-kn40V-hF.js";
2
+ import { f as BaseCommand, l as flags, o as args } from "../../main-Cn_x9YY5.js";
3
+ import { t as __decorate } from "../../decorate-DM0Sx1ye.js";
4
+ var MakeTest = class extends BaseCommand {
5
+ static commandName = "make:test";
6
+ static description = "Create a new Japa test file";
7
+ stubPath = "make/test/main.stub";
8
+ async #getSuite() {
9
+ if (this.suite) return this.suite;
10
+ const rcFileSuites = this.app.rcFile.tests.suites;
11
+ if (rcFileSuites.length === 1) return rcFileSuites[0].name;
12
+ return this.prompt.choice("Select the suite for the test file", this.app.rcFile.tests.suites.map((suite) => {
13
+ return suite.name;
14
+ }), { validate(choice) {
15
+ return choice ? true : "Please select a suite";
16
+ } });
17
+ }
18
+ async #getSuiteDirectory(directories) {
19
+ if (directories.length === 1) return directories[0];
20
+ return this.prompt.choice("Select directory for the test file", directories, { validate(choice) {
21
+ return choice ? true : "Please select a directory";
22
+ } });
23
+ }
24
+ #findSuite(suiteName) {
25
+ return this.app.rcFile.tests.suites.find((suite) => {
26
+ return suite.name === suiteName;
27
+ });
28
+ }
29
+ async run() {
30
+ const suite = this.#findSuite(await this.#getSuite());
31
+ if (!suite) {
32
+ this.logger.error(`The "${this.suite}" suite is not configured inside the "adonisrc.js" file`);
33
+ this.exitCode = 1;
34
+ return;
35
+ }
36
+ await (await this.createCodemods()).makeUsingStub(stubsRoot, this.stubPath, {
37
+ flags: this.parsed.flags,
38
+ entity: this.app.generators.createEntity(this.name),
39
+ suite: { directory: await this.#getSuiteDirectory(suite.directories) }
40
+ });
41
+ }
14
42
  };
15
- import { stubsRoot } from "../../stubs/main.js";
16
- import { args, flags, BaseCommand } from "../../modules/ace/main.js";
17
- /**
18
- * Command to create a new Japa test file.
19
- * Supports multiple test suites and automatically detects or prompts for
20
- * the appropriate suite and directory based on application configuration.
21
- *
22
- * @example
23
- * ```
24
- * ace make:test UserController
25
- * ace make:test UserModel --suite=unit
26
- * ace make:test AuthService --suite=integration
27
- * ```
28
- */
29
- export default class MakeTest extends BaseCommand {
30
- /**
31
- * The command name
32
- */
33
- static commandName = 'make:test';
34
- /**
35
- * The command description
36
- */
37
- static description = 'Create a new Japa test file';
38
- /**
39
- * The stub template file to use for generating the test file
40
- */
41
- stubPath = 'make/test/main.stub';
42
- /**
43
- * Determine the test suite name for creating the test file.
44
- * Uses the provided suite flag, or automatically selects if only one suite exists,
45
- * or prompts the user to choose from available suites.
46
- *
47
- * @returns The name of the selected test suite
48
- */
49
- async #getSuite() {
50
- if (this.suite) {
51
- return this.suite;
52
- }
53
- /**
54
- * Use the first suite from the rcFile when there is only
55
- * one suite
56
- */
57
- const rcFileSuites = this.app.rcFile.tests.suites;
58
- if (rcFileSuites.length === 1) {
59
- return rcFileSuites[0].name;
60
- }
61
- /**
62
- * Prompt the user to select a suite manually
63
- */
64
- return this.prompt.choice('Select the suite for the test file', this.app.rcFile.tests.suites.map((suite) => {
65
- return suite.name;
66
- }), {
67
- validate(choice) {
68
- return choice ? true : 'Please select a suite';
69
- },
70
- });
71
- }
72
- /**
73
- * Determine the directory path for the test file within the selected suite.
74
- * Automatically selects if only one directory exists, otherwise prompts the user.
75
- *
76
- * @param directories - Array of available directories for the suite
77
- * @returns The selected directory path
78
- */
79
- async #getSuiteDirectory(directories) {
80
- if (directories.length === 1) {
81
- return directories[0];
82
- }
83
- return this.prompt.choice('Select directory for the test file', directories, {
84
- validate(choice) {
85
- return choice ? true : 'Please select a directory';
86
- },
87
- });
88
- }
89
- /**
90
- * Find suite configuration from the RC file by name.
91
- *
92
- * @param suiteName - The name of the suite to find
93
- * @returns The suite configuration or undefined if not found
94
- */
95
- #findSuite(suiteName) {
96
- return this.app.rcFile.tests.suites.find((suite) => {
97
- return suite.name === suiteName;
98
- });
99
- }
100
- /**
101
- * Execute the command to create a new test file.
102
- * Validates the suite exists, prompts for missing information,
103
- * and generates the test file in the appropriate location.
104
- */
105
- async run() {
106
- const suite = this.#findSuite(await this.#getSuite());
107
- /**
108
- * Show error when mentioned/selected suite does not exist
109
- */
110
- if (!suite) {
111
- this.logger.error(`The "${this.suite}" suite is not configured inside the "adonisrc.js" file`);
112
- this.exitCode = 1;
113
- return;
114
- }
115
- /**
116
- * Generate entity
117
- */
118
- const codemods = await this.createCodemods();
119
- await codemods.makeUsingStub(stubsRoot, this.stubPath, {
120
- flags: this.parsed.flags,
121
- entity: this.app.generators.createEntity(this.name),
122
- suite: {
123
- directory: await this.#getSuiteDirectory(suite.directories),
124
- },
125
- });
126
- }
127
- }
128
- __decorate([
129
- args.string({ description: 'Name of the test file' })
130
- ], MakeTest.prototype, "name", void 0);
131
- __decorate([
132
- flags.string({ description: 'The suite for which to create the test file', alias: 's' })
133
- ], MakeTest.prototype, "suite", void 0);
43
+ __decorate([args.string({ description: "Name of the test file" })], MakeTest.prototype, "name", void 0);
44
+ __decorate([flags.string({
45
+ description: "The suite for which to create the test file",
46
+ alias: "s"
47
+ })], MakeTest.prototype, "suite", void 0);
48
+ export { MakeTest as default };
@@ -1,65 +1,18 @@
1
- /*
2
- * @adonisjs/core
3
- *
4
- * (c) AdonisJS
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
10
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1
+ import { t as stubsRoot } from "../../main-kn40V-hF.js";
2
+ import { f as BaseCommand, o as args } from "../../main-Cn_x9YY5.js";
3
+ import { t as __decorate } from "../../decorate-DM0Sx1ye.js";
4
+ var MakeTransformer = class extends BaseCommand {
5
+ static commandName = "make:transformer";
6
+ static description = "Create a new transformer class";
7
+ static options = { allowUnknownFlags: true };
8
+ stubPath = "make/transformer/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
+ model: this.app.generators.createEntity(this.name)
14
+ });
15
+ }
14
16
  };
15
- import { stubsRoot } from "../../stubs/main.js";
16
- import { args, BaseCommand } from "../../modules/ace/main.js";
17
- /**
18
- * Command to create a new transformer class.
19
- * Transformers are used to serialize data objects (like models) into specific
20
- * formats for API responses, allowing you to control which fields are exposed
21
- * and how data is structured for clients.
22
- *
23
- * @example
24
- * ```
25
- * ace make:transformer User
26
- * ace make:transformer Post
27
- * ace make:transformer ProductTransformer
28
- * ```
29
- */
30
- export default class MakeTransformer extends BaseCommand {
31
- /**
32
- * The command name
33
- */
34
- static commandName = 'make:transformer';
35
- /**
36
- * The command description
37
- */
38
- static description = 'Create a new transformer class';
39
- /**
40
- * Command options configuration.
41
- * Allows unknown flags to be passed through.
42
- */
43
- static options = {
44
- allowUnknownFlags: true,
45
- };
46
- /**
47
- * The stub template file to use for generating the transformer class
48
- */
49
- stubPath = 'make/transformer/main.stub';
50
- /**
51
- * Execute the command to create a new transformer class.
52
- * Generates the transformer file with proper data serialization structure.
53
- */
54
- async run() {
55
- const codemods = await this.createCodemods();
56
- await codemods.makeUsingStub(stubsRoot, this.stubPath, {
57
- flags: this.parsed.flags,
58
- entity: this.app.generators.createEntity(this.name),
59
- model: this.app.generators.createEntity(this.name),
60
- });
61
- }
62
- }
63
- __decorate([
64
- args.string({ description: 'Entity name for which to generate the transformer' })
65
- ], MakeTransformer.prototype, "name", void 0);
17
+ __decorate([args.string({ description: "Entity name for which to generate the transformer" })], MakeTransformer.prototype, "name", void 0);
18
+ export { MakeTransformer as default };
@@ -1,81 +1,21 @@
1
- /*
2
- * @adonisjs/core
3
- *
4
- * (c) AdonisJS
5
- *
6
- * For the full copyright and license information, please view the LICENSE
7
- * file that was distributed with this source code.
8
- */
9
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
10
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1
+ import { t as stubsRoot } from "../../main-kn40V-hF.js";
2
+ import { f as BaseCommand, l as flags, o as args } from "../../main-Cn_x9YY5.js";
3
+ import { t as __decorate } from "../../decorate-DM0Sx1ye.js";
4
+ var MakeValidator = class extends BaseCommand {
5
+ static commandName = "make:validator";
6
+ static description = "Create a new file to define VineJS validators";
7
+ static options = { allowUnknownFlags: true };
8
+ stubPath = "make/validator/main.stub";
9
+ async prepare() {
10
+ if (this.resource) this.stubPath = "make/validator/resource.stub";
11
+ }
12
+ async run() {
13
+ await (await this.createCodemods()).makeUsingStub(stubsRoot, this.stubPath, {
14
+ flags: this.parsed.flags,
15
+ entity: this.app.generators.createEntity(this.name)
16
+ });
17
+ }
14
18
  };
15
- import { stubsRoot } from "../../stubs/main.js";
16
- import { args, flags, BaseCommand } from "../../modules/ace/main.js";
17
- /**
18
- * Command to create a new VineJS validator file.
19
- * Validators define reusable validation schemas for request validation,
20
- * and can be generated as simple validators or resource-based validators
21
- * with create and update schemas.
22
- *
23
- * @example
24
- * ```
25
- * ace make:validator UserValidator
26
- * ace make:validator PostValidator --resource
27
- * ace make:validator ContactValidator
28
- * ```
29
- */
30
- export default class MakeValidator extends BaseCommand {
31
- /**
32
- * The command name
33
- */
34
- static commandName = 'make:validator';
35
- /**
36
- * The command description
37
- */
38
- static description = 'Create a new file to define VineJS validators';
39
- /**
40
- * Command options configuration.
41
- * Allows unknown flags to be passed through.
42
- */
43
- static options = {
44
- allowUnknownFlags: true,
45
- };
46
- /**
47
- * The stub template file to use for generating the validator
48
- */
49
- stubPath = 'make/validator/main.stub';
50
- /**
51
- * Prepare the command by selecting the appropriate stub based on options.
52
- * Uses a resource stub when generating validators for CRUD operations.
53
- */
54
- async prepare() {
55
- /**
56
- * Use resource stub
57
- */
58
- if (this.resource) {
59
- this.stubPath = 'make/validator/resource.stub';
60
- }
61
- }
62
- /**
63
- * Execute the command to create a new VineJS validator file.
64
- * Generates the validator with the appropriate stub template.
65
- */
66
- async run() {
67
- const codemods = await this.createCodemods();
68
- await codemods.makeUsingStub(stubsRoot, this.stubPath, {
69
- flags: this.parsed.flags,
70
- entity: this.app.generators.createEntity(this.name),
71
- });
72
- }
73
- }
74
- __decorate([
75
- args.string({ description: 'Name of the validator file' })
76
- ], MakeValidator.prototype, "name", void 0);
77
- __decorate([
78
- flags.boolean({
79
- description: 'Create a file with pre-defined validators for create and update actions',
80
- })
81
- ], MakeValidator.prototype, "resource", void 0);
19
+ __decorate([args.string({ description: "Name of the validator file" })], MakeValidator.prototype, "name", void 0);
20
+ __decorate([flags.boolean({ description: "Create a file with pre-defined validators for create and update actions" })], MakeValidator.prototype, "resource", void 0);
21
+ export { MakeValidator as default };