@adonisjs/core 7.0.1 → 7.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/build/ace-DBm6EcQ-.js +37 -0
  2. package/build/app-BCcG_oDd.js +7 -0
  3. package/build/app-CAuSGb2P.js +15 -0
  4. package/build/bodyparser_middleware-H5FArWkI.js +9 -0
  5. package/build/{chunk-iKc69rpz.js → chunk-Do49iUES.js} +3 -0
  6. package/build/commands/add.d.ts +1 -0
  7. package/build/commands/add.js +64 -10
  8. package/build/commands/build.js +41 -3
  9. package/build/commands/commands.json +1 -1
  10. package/build/commands/configure.js +70 -4
  11. package/build/commands/eject.js +30 -4
  12. package/build/commands/env/add.js +62 -4
  13. package/build/commands/generate_key.js +23 -3
  14. package/build/commands/inspect_rcfile.js +26 -2
  15. package/build/commands/list/routes.d.ts +5 -0
  16. package/build/commands/list/routes.js +242 -3
  17. package/build/commands/make/command.js +33 -4
  18. package/build/commands/make/controller.js +46 -4
  19. package/build/commands/make/event.js +36 -4
  20. package/build/commands/make/exception.js +36 -4
  21. package/build/commands/make/listener.js +44 -4
  22. package/build/commands/make/middleware.js +53 -5
  23. package/build/commands/make/preload.js +55 -5
  24. package/build/commands/make/provider.js +54 -5
  25. package/build/commands/make/service.js +29 -4
  26. package/build/commands/make/test.js +63 -4
  27. package/build/commands/make/transformer.js +37 -4
  28. package/build/commands/make/validator.js +44 -4
  29. package/build/commands/make/view.js +33 -4
  30. package/build/commands/repl.js +31 -2
  31. package/build/commands/serve.js +54 -4
  32. package/build/commands/test.js +69 -4
  33. package/build/config-Coti2q6R.js +7 -0
  34. package/build/config_provider-Do9af1ze.js +35 -0
  35. package/build/container-CGfEwWof.js +7 -0
  36. package/build/{core-IpCOCkUL.js → core-aRg0soJX.js} +52 -3
  37. package/build/create_kernel-BV3swyCg.js +4 -0
  38. package/build/{create_kernel-B7ILNhuP.js → create_kernel-D38-0Zbt.js} +41 -1
  39. package/build/debug-DWofTfIX.js +20 -0
  40. package/build/{decorate-DmrZA614.js → decorate-B9Uz0anB.js} +2 -0
  41. package/build/{define_config-0oHaj43l.js → define_config--5euEdi8.js} +54 -3
  42. package/build/dumper-3R77st8F.js +353 -0
  43. package/build/edge-BG5ZYp6Z.js +57 -0
  44. package/build/{errors-CrCO-k44.js → errors-BScZTzBu.js} +9 -1
  45. package/build/events-DlKX1ZdL.js +7 -0
  46. package/build/exceptions-B2MzIlHY.js +2 -0
  47. package/build/factories/app.js +1 -0
  48. package/build/factories/bodyparser.js +1 -0
  49. package/build/factories/core/ace.js +16 -22
  50. package/build/factories/core/ignitor.js +13 -73
  51. package/build/factories/core/main.js +25 -17
  52. package/build/factories/core/test_utils.js +22 -19
  53. package/build/factories/encryption.js +1 -0
  54. package/build/factories/events.js +1 -0
  55. package/build/factories/hash.js +1 -0
  56. package/build/factories/http.js +1 -0
  57. package/build/factories/logger.js +1 -0
  58. package/build/factories/stubs.js +75 -7
  59. package/build/ignitor-Kym3gR-I.js +169 -0
  60. package/build/index.js +11 -8
  61. package/build/logger-DIdZPHCe.js +43 -0
  62. package/build/main-B50zECAi.js +121 -0
  63. package/build/main-CRnMnrH7.js +184 -0
  64. package/build/{main-kn40V-hF.js → main-CfTiGsiS.js} +2 -0
  65. package/build/main-Ck0GqLx4.js +117 -0
  66. package/build/main-CoZI4Ezs.js +2 -0
  67. package/build/main-D1MSq4Uu.js +435 -0
  68. package/build/{main--nXd7T-C.js → main-bRYXIHgD.js} +75 -3
  69. package/build/main-zxNP7iRl.js +7 -0
  70. package/build/modules/ace/codemods.js +301 -2
  71. package/build/modules/ace/commands.d.ts +5 -0
  72. package/build/modules/ace/main.js +2 -1
  73. package/build/modules/app.js +3 -5
  74. package/build/modules/bodyparser/bodyparser_middleware.js +2 -2
  75. package/build/modules/bodyparser/main.js +3 -5
  76. package/build/modules/config.js +3 -5
  77. package/build/modules/container.js +3 -5
  78. package/build/modules/dumper/main.js +29 -2
  79. package/build/modules/dumper/plugins/edge.js +2 -46
  80. package/build/modules/encryption/drivers/aes_256_cbc.js +1 -0
  81. package/build/modules/encryption/drivers/aes_256_gcm.js +1 -0
  82. package/build/modules/encryption/drivers/aes_siv.js +1 -0
  83. package/build/modules/encryption/drivers/chacha20_poly1305.js +1 -0
  84. package/build/modules/encryption/drivers/legacy.js +46 -1
  85. package/build/modules/encryption/main.js +7 -5
  86. package/build/modules/env/editor.js +1 -0
  87. package/build/modules/env/main.js +1 -0
  88. package/build/modules/events.js +3 -5
  89. package/build/modules/hash/drivers/argon.js +1 -0
  90. package/build/modules/hash/drivers/bcrypt.js +1 -0
  91. package/build/modules/hash/drivers/scrypt.js +1 -0
  92. package/build/modules/hash/main.js +4 -4
  93. package/build/modules/hash/phc_formatter.js +1 -0
  94. package/build/modules/health.js +1 -0
  95. package/build/modules/http/helpers.js +1 -0
  96. package/build/modules/http/main.js +2 -2
  97. package/build/modules/http/url_builder_client.js +1 -0
  98. package/build/modules/logger.js +3 -13
  99. package/build/modules/repl.js +3 -5
  100. package/build/modules/transformers/main.js +1 -0
  101. package/build/providers/app_provider.js +214 -15
  102. package/build/providers/edge_provider.js +90 -3
  103. package/build/providers/hash_provider.js +59 -4
  104. package/build/providers/repl_provider.js +64 -2
  105. package/build/providers/vinejs_provider.js +44 -3
  106. package/build/repl-C02Re0Yd.js +7 -0
  107. package/build/services/ace.js +11 -1
  108. package/build/services/app.js +2 -4
  109. package/build/services/config.js +7 -1
  110. package/build/services/dumper.js +13 -1
  111. package/build/services/emitter.js +8 -1
  112. package/build/services/encryption.js +8 -1
  113. package/build/services/hash.js +8 -1
  114. package/build/services/logger.js +8 -1
  115. package/build/services/repl.js +8 -1
  116. package/build/services/router.js +8 -1
  117. package/build/services/server.js +8 -1
  118. package/build/services/test_utils.js +11 -1
  119. package/build/services/url_builder.js +8 -1
  120. package/build/src/cli_formatters/routes_list.d.ts +7 -0
  121. package/build/src/exceptions.js +2 -1
  122. package/build/src/helpers/assert.js +1 -0
  123. package/build/src/helpers/http.js +1 -0
  124. package/build/src/helpers/is.js +24 -0
  125. package/build/src/helpers/main.js +2 -1
  126. package/build/src/helpers/string.js +2 -27
  127. package/build/src/helpers/types.js +18 -0
  128. package/build/src/helpers/verification_token.js +2 -45
  129. package/build/src/test_utils/main.js +9 -7
  130. package/build/src/types.js +1 -0
  131. package/build/src/vine.js +2 -32
  132. package/build/string-8_8He-HH.js +46 -0
  133. package/build/test_utils-DbJS_uEu.js +32 -0
  134. package/build/toolkit/main.js +13 -1
  135. package/build/types/ace.js +1 -0
  136. package/build/types/app.js +1 -0
  137. package/build/types/bodyparser.js +1 -0
  138. package/build/types/common.js +1 -0
  139. package/build/types/container.js +1 -0
  140. package/build/types/encryption.js +1 -0
  141. package/build/types/events.js +1 -0
  142. package/build/types/hash.js +1 -0
  143. package/build/types/health.js +1 -0
  144. package/build/types/helpers.js +1 -0
  145. package/build/types/http.js +1 -0
  146. package/build/types/logger.js +1 -0
  147. package/build/types/repl.js +1 -0
  148. package/build/types/transformers.js +1 -0
  149. package/build/utils-CKwka7OL.js +105 -0
  150. package/build/verification_token-WCrZtUgZ.js +108 -0
  151. package/build/vine-DkIupA3Z.js +97 -0
  152. package/package.json +12 -12
  153. package/build/config_provider-FIAUgvae.js +0 -13
  154. package/build/create_kernel-BD0Iqi8e.js +0 -3
  155. package/build/debug-CGQmxzGt.js +0 -3
  156. package/build/dumper-BBgqFX5a.js +0 -147
  157. package/build/main-Cxz0TyIw.js +0 -173
  158. package/build/main-DN2qEEg5.js +0 -41
  159. package/build/main-DkNgvceD.js +0 -52
  160. package/build/main-MBAMnmJb.js +0 -81
  161. package/build/utils-rRkbAPnP.js +0 -42
@@ -0,0 +1,184 @@
1
+ import { BaseCommand, FsLoader, HelpCommand as HelpCommand$1, IndexGenerator as IndexGenerator$1, Kernel, ListCommand, ListLoader as ListLoader$1, Parser, args as args$1, cliHelpers, errors as errors$1, flags, tracingChannels } from "@adonisjs/ace";
2
+ //#region modules/ace/commands.ts
3
+ /**
4
+ * The base command class for creating custom Ace commands in AdonisJS applications.
5
+ * This class extends the base Ace command with AdonisJS-specific functionality like
6
+ * dependency injection and application lifecycle management.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * export default class MakeUser extends BaseCommand {
11
+ * static commandName = 'make:user'
12
+ * static description = 'Create a new user'
13
+ *
14
+ * async run() {
15
+ * this.logger.info('Creating user...')
16
+ * // Command implementation
17
+ * }
18
+ * }
19
+ * ```
20
+ */
21
+ var BaseCommand$1 = class extends BaseCommand {
22
+ static options = {};
23
+ get staysAlive() {
24
+ return this.constructor.options.staysAlive;
25
+ }
26
+ get startApp() {
27
+ return this.constructor.options.startApp;
28
+ }
29
+ constructor(app, kernel, parsed, ui, prompt) {
30
+ super(kernel, parsed, ui, prompt);
31
+ this.app = app;
32
+ this.kernel = kernel;
33
+ }
34
+ /**
35
+ * Creates the codemods module to modify source files programmatically.
36
+ * This method provides access to AST-based code transformations.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const codemods = await this.createCodemods()
41
+ * await codemods.makeUsingStub(stubsRoot, 'controller.stub', {
42
+ * filename: 'UserController',
43
+ * entity: { name: 'User' }
44
+ * })
45
+ * ```
46
+ */
47
+ async createCodemods() {
48
+ const { Codemods } = await import("./modules/ace/codemods.js");
49
+ const codemods = new Codemods(this.app, this.logger);
50
+ codemods.on("error", () => {
51
+ this.exitCode = 1;
52
+ });
53
+ return codemods;
54
+ }
55
+ /**
56
+ * Executes the lifecycle hooks and the run method from the command
57
+ */
58
+ async exec() {
59
+ this.hydrate();
60
+ try {
61
+ /**
62
+ * Executing the template methods
63
+ */
64
+ this.prepare && await this.app.container.call(this, "prepare");
65
+ this.interact && await this.app.container.call(this, "interact");
66
+ const result = await this.app.container.call(this, "run");
67
+ /**
68
+ * Set exit code
69
+ */
70
+ this.result = this.result === void 0 ? result : this.result;
71
+ this.exitCode = this.exitCode ?? 0;
72
+ } catch (error) {
73
+ this.error = error;
74
+ this.exitCode = this.exitCode ?? 1;
75
+ }
76
+ /**
77
+ * Run the completed method (if exists) and check if has handled
78
+ * the error
79
+ */
80
+ let errorHandled = this.completed ? await this.app.container.call(this, "completed") : false;
81
+ if (this.error && !errorHandled) await this.kernel.errorHandler.render(this.error, this.kernel);
82
+ return this.result;
83
+ }
84
+ /**
85
+ * Terminate the application gracefully. This method should be preferred over
86
+ * calling `app.terminate()` directly as it only triggers termination when
87
+ * the current command is the main command responsible for the process.
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * export default class SomeCommand extends BaseCommand {
92
+ * async run() {
93
+ * // Do some work
94
+ * await this.terminate()
95
+ * }
96
+ * }
97
+ * ```
98
+ */
99
+ async terminate() {
100
+ if (this.kernel.getMainCommand() === this) await this.app.terminate();
101
+ }
102
+ };
103
+ /**
104
+ * The List command is used to display a list of available commands.
105
+ * This command extends the base Ace ListCommand with AdonisJS-specific functionality.
106
+ */
107
+ var ListCommand$1 = class extends ListCommand {
108
+ static options = {};
109
+ get staysAlive() {
110
+ return this.constructor.options.staysAlive;
111
+ }
112
+ get startApp() {
113
+ return this.constructor.options.startApp;
114
+ }
115
+ constructor(app, kernel, parsed, ui, prompt) {
116
+ super(kernel, parsed, ui, prompt);
117
+ this.app = app;
118
+ this.kernel = kernel;
119
+ }
120
+ /**
121
+ * Auto-select JSON output when running inside an AI agent
122
+ * and no explicit format flag is provided.
123
+ */
124
+ async run() {
125
+ if (!this.json && this.app.runningInAIAgent) this.json = true;
126
+ return super.run();
127
+ }
128
+ /**
129
+ * Creates the codemods module to modify source files programmatically.
130
+ * This method provides access to AST-based code transformations.
131
+ */
132
+ async createCodemods() {
133
+ const { Codemods } = await import("./modules/ace/codemods.js");
134
+ return new Codemods(this.app, this.logger);
135
+ }
136
+ /**
137
+ * Terminate the app. A command should prefer calling this method
138
+ * over the "app.terminate", because this method only triggers
139
+ * app termination when the current command is in the charge
140
+ * of the process.
141
+ */
142
+ async terminate() {
143
+ if (this.kernel.getMainCommand() === this) await this.app.terminate();
144
+ }
145
+ };
146
+ //#endregion
147
+ //#region modules/ace/kernel.ts
148
+ /**
149
+ * The Ace command kernel for AdonisJS applications. This kernel extends the base
150
+ * Ace kernel with AdonisJS-specific functionality like dependency injection and
151
+ * application lifecycle management.
152
+ *
153
+ * @example
154
+ * ```ts
155
+ * const app = new Application(new URL('../', import.meta.url))
156
+ * const kernel = new Kernel(app)
157
+ *
158
+ * await kernel.handle(['make:controller', 'UserController'])
159
+ * ```
160
+ */
161
+ var Kernel$1 = class extends Kernel {
162
+ /**
163
+ * Create a new Ace kernel instance
164
+ *
165
+ * @param app - The AdonisJS application instance
166
+ */
167
+ constructor(app) {
168
+ super(ListCommand$1, {
169
+ create: async (command, parsedOutput, $kernel) => {
170
+ return app.container.make(command, [
171
+ app,
172
+ $kernel,
173
+ parsedOutput,
174
+ $kernel.ui,
175
+ $kernel.prompt
176
+ ]);
177
+ },
178
+ run: (command) => command.exec()
179
+ });
180
+ this.app = app;
181
+ }
182
+ };
183
+ //#endregion
184
+ export { Parser as a, errors$1 as c, Kernel$1 as d, BaseCommand$1 as f, ListLoader$1 as i, flags as l, HelpCommand$1 as n, args$1 as o, ListCommand$1 as p, IndexGenerator$1 as r, cliHelpers as s, FsLoader as t, tracingChannels as u };
@@ -1,2 +1,4 @@
1
+ //#region stubs/main.ts
1
2
  const stubsRoot = import.meta.dirname;
3
+ //#endregion
2
4
  export { stubsRoot as t };
@@ -0,0 +1,117 @@
1
+ import { n as __reExport, t as __exportAll } from "./chunk-Do49iUES.js";
2
+ import "@adonisjs/bodyparser";
3
+ //#region modules/http/request_validator.ts
4
+ /**
5
+ * Request validator for validating HTTP request data using VineJS validators.
6
+ * This class provides a convenient way to validate request body, files, cookies,
7
+ * headers, and URL parameters in AdonisJS applications.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * // Inside a controller method
12
+ * const data = await request.validateUsing(createUserValidator, {
13
+ * messagesProvider: customMessages
14
+ * })
15
+ * ```
16
+ */
17
+ var RequestValidator = class RequestValidator {
18
+ #ctx;
19
+ constructor(ctx) {
20
+ this.#ctx = ctx;
21
+ }
22
+ /**
23
+ * The error reporter method returns the error reporter
24
+ * to use for reporting errors.
25
+ *
26
+ * You can use this function to pick a different error reporter
27
+ * for each HTTP request
28
+ */
29
+ static errorReporter;
30
+ /**
31
+ * The messages provider method returns the messages provider to use
32
+ * finding custom error messages
33
+ *
34
+ * You can use this function to pick a different messages provider for
35
+ * each HTTP request
36
+ */
37
+ static messagesProvider;
38
+ #requestData() {
39
+ return {
40
+ ...this.#ctx.request.all(),
41
+ params: this.#ctx.request.params(),
42
+ headers: this.#ctx.request.headers(),
43
+ cookies: this.#ctx.request.cookiesList()
44
+ };
45
+ }
46
+ #processValidatorOptions(options) {
47
+ const validatorOptions = options || {};
48
+ /**
49
+ * Assign request specific error reporter
50
+ */
51
+ if (RequestValidator.errorReporter && !validatorOptions.errorReporter) {
52
+ const errorReporter = RequestValidator.errorReporter(this.#ctx);
53
+ validatorOptions.errorReporter = () => errorReporter;
54
+ }
55
+ /**
56
+ * Assign request specific messages provider
57
+ */
58
+ if (RequestValidator.messagesProvider && !validatorOptions.messagesProvider) validatorOptions.messagesProvider = RequestValidator.messagesProvider(this.#ctx);
59
+ return validatorOptions;
60
+ }
61
+ /**
62
+ * Validate the current HTTP request data using a VineJS validator.
63
+ * This method automatically includes request body, files, URL parameters,
64
+ * headers, and cookies in the validation data.
65
+ *
66
+ * @param validator - VineJS validator instance
67
+ * @param options - Optional validation options including custom error reporters and messages
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * const createUserValidator = vine.compile(
72
+ * vine.object({
73
+ * email: vine.string().email(),
74
+ * name: vine.string().minLength(3)
75
+ * })
76
+ * )
77
+ *
78
+ * const data = await request.validateUsing(createUserValidator, {
79
+ * errorReporter: () => vine.errors.SimpleErrorReporter,
80
+ * messagesProvider: customMessages
81
+ * })
82
+ * ```
83
+ */
84
+ validateUsing(validator, ...[options]) {
85
+ /**
86
+ * Process the validation options
87
+ */
88
+ const validatorOptions = this.#processValidatorOptions(options);
89
+ /**
90
+ * Data to validate
91
+ */
92
+ const data = validatorOptions.data || this.#requestData();
93
+ return validator.validate(data, validatorOptions);
94
+ }
95
+ async tryValidateUsing(validator, ...[options]) {
96
+ /**
97
+ * Process the validation options
98
+ */
99
+ const validatorOptions = this.#processValidatorOptions(options);
100
+ /**
101
+ * Data to validate
102
+ */
103
+ const data = validatorOptions.data || this.#requestData();
104
+ return validator.tryValidate(data, validatorOptions);
105
+ }
106
+ };
107
+ //#endregion
108
+ //#region modules/http/main.ts
109
+ /**
110
+ * Bodyparser import is needed to merge types of Request
111
+ * class augmented by the bodyparser package
112
+ */
113
+ var main_exports = /* @__PURE__ */ __exportAll({ RequestValidator: () => RequestValidator });
114
+ import * as import__adonisjs_http_server from "@adonisjs/http-server";
115
+ __reExport(main_exports, import__adonisjs_http_server);
116
+ //#endregion
117
+ export { RequestValidator as n, main_exports as t };
@@ -0,0 +1,2 @@
1
+ import { BaseDriver as BaseDriver$1, Encryption, EncryptionManager, Hmac as Hmac$1 } from "@boringnode/encryption";
2
+ export { Hmac$1 as i, Encryption as n, EncryptionManager as r, BaseDriver$1 as t };