@adonisjs/core 6.19.0 → 7.0.0-next.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 (177) hide show
  1. package/build/commands/add.d.ts +36 -5
  2. package/build/commands/add.js +24 -60
  3. package/build/commands/build.d.ts +23 -3
  4. package/build/commands/build.js +22 -36
  5. package/build/commands/commands.json +1 -1
  6. package/build/commands/configure.d.ts +35 -12
  7. package/build/commands/configure.js +39 -12
  8. package/build/commands/eject.d.ts +28 -3
  9. package/build/commands/eject.js +24 -5
  10. package/build/commands/env/add.d.ts +41 -4
  11. package/build/commands/env/add.js +32 -5
  12. package/build/commands/generate_key.d.ts +20 -1
  13. package/build/commands/generate_key.js +14 -1
  14. package/build/commands/inspect_rcfile.d.ts +20 -2
  15. package/build/commands/inspect_rcfile.js +20 -2
  16. package/build/commands/list/routes.d.ts +33 -11
  17. package/build/commands/list/routes.js +28 -5
  18. package/build/commands/make/command.d.ts +26 -3
  19. package/build/commands/make/command.js +25 -5
  20. package/build/commands/make/controller.d.ts +35 -2
  21. package/build/commands/make/controller.js +20 -2
  22. package/build/commands/make/event.d.ts +30 -4
  23. package/build/commands/make/event.js +27 -4
  24. package/build/commands/make/exception.d.ts +30 -4
  25. package/build/commands/make/exception.js +27 -4
  26. package/build/commands/make/listener.d.ts +38 -5
  27. package/build/commands/make/listener.js +32 -5
  28. package/build/commands/make/middleware.d.ts +25 -2
  29. package/build/commands/make/middleware.js +21 -4
  30. package/build/commands/make/preload.d.ts +31 -4
  31. package/build/commands/make/preload.js +28 -8
  32. package/build/commands/make/provider.d.ts +32 -3
  33. package/build/commands/make/provider.js +29 -7
  34. package/build/commands/make/service.d.ts +21 -2
  35. package/build/commands/make/service.js +18 -2
  36. package/build/commands/make/test.d.ts +27 -4
  37. package/build/commands/make/test.js +36 -8
  38. package/build/commands/make/transformer.d.ts +43 -0
  39. package/build/commands/make/transformer.js +65 -0
  40. package/build/commands/make/validator.d.ts +36 -5
  41. package/build/commands/make/validator.js +30 -5
  42. package/build/commands/make/view.d.ts +26 -3
  43. package/build/commands/make/view.js +24 -4
  44. package/build/commands/repl.d.ts +24 -4
  45. package/build/commands/repl.js +23 -3
  46. package/build/commands/serve.d.ts +38 -4
  47. package/build/commands/serve.js +34 -43
  48. package/build/commands/test.d.ts +68 -7
  49. package/build/commands/test.js +39 -37
  50. package/build/factories/core/ace.d.ts +31 -4
  51. package/build/factories/core/ace.js +20 -4
  52. package/build/factories/core/ignitor.d.ts +80 -9
  53. package/build/factories/core/ignitor.js +84 -13
  54. package/build/factories/core/main.d.ts +3 -3
  55. package/build/factories/core/main.js +3 -3
  56. package/build/factories/core/test_utils.d.ts +32 -4
  57. package/build/factories/core/test_utils.js +21 -4
  58. package/build/factories/stubs.d.ts +54 -5
  59. package/build/factories/stubs.js +55 -6
  60. package/build/index.d.ts +5 -4
  61. package/build/index.js +13 -9
  62. package/build/modules/ace/codemods.d.ts +71 -11
  63. package/build/modules/ace/codemods.js +90 -22
  64. package/build/modules/ace/commands.d.ts +48 -13
  65. package/build/modules/ace/commands.js +45 -10
  66. package/build/modules/ace/create_kernel.d.ts +19 -8
  67. package/build/modules/ace/create_kernel.js +19 -8
  68. package/build/modules/ace/kernel.d.ts +18 -4
  69. package/build/modules/ace/kernel.js +17 -3
  70. package/build/modules/ace/main.d.ts +3 -3
  71. package/build/modules/ace/main.js +3 -3
  72. package/build/modules/dumper/define_config.d.ts +25 -4
  73. package/build/modules/dumper/define_config.js +23 -2
  74. package/build/modules/dumper/dumper.d.ts +82 -12
  75. package/build/modules/dumper/dumper.js +82 -12
  76. package/build/modules/dumper/errors.d.ts +31 -10
  77. package/build/modules/dumper/errors.js +28 -7
  78. package/build/modules/dumper/main.d.ts +3 -3
  79. package/build/modules/dumper/main.js +3 -3
  80. package/build/modules/dumper/plugins/edge.d.ts +1 -1
  81. package/build/modules/hash/define_config.d.ts +53 -8
  82. package/build/modules/hash/define_config.js +51 -6
  83. package/build/modules/hash/main.d.ts +1 -1
  84. package/build/modules/hash/main.js +1 -1
  85. package/build/modules/http/main.d.ts +1 -1
  86. package/build/modules/http/main.js +1 -1
  87. package/build/modules/http/request_validator.d.ts +36 -9
  88. package/build/modules/http/request_validator.js +32 -5
  89. package/build/modules/transformers/main.d.ts +1 -0
  90. package/build/modules/transformers/main.js +9 -0
  91. package/build/providers/app_provider.d.ts +173 -1
  92. package/build/providers/app_provider.js +204 -8
  93. package/build/providers/edge_provider.d.ts +31 -2
  94. package/build/providers/edge_provider.js +31 -2
  95. package/build/providers/hash_provider.d.ts +38 -1
  96. package/build/providers/hash_provider.js +40 -3
  97. package/build/providers/repl_provider.d.ts +40 -1
  98. package/build/providers/repl_provider.js +52 -2
  99. package/build/providers/vinejs_provider.d.ts +32 -5
  100. package/build/providers/vinejs_provider.js +31 -4
  101. package/build/services/ace.d.ts +1 -1
  102. package/build/services/ace.js +1 -1
  103. package/build/services/app.d.ts +1 -1
  104. package/build/services/config.d.ts +1 -1
  105. package/build/services/config.js +1 -1
  106. package/build/services/dumper.js +1 -1
  107. package/build/services/emitter.d.ts +1 -1
  108. package/build/services/emitter.js +1 -1
  109. package/build/services/encryption.d.ts +1 -1
  110. package/build/services/encryption.js +1 -1
  111. package/build/services/hash.d.ts +1 -1
  112. package/build/services/hash.js +1 -1
  113. package/build/services/logger.d.ts +1 -1
  114. package/build/services/logger.js +1 -1
  115. package/build/services/repl.d.ts +1 -1
  116. package/build/services/repl.js +1 -1
  117. package/build/services/router.d.ts +1 -1
  118. package/build/services/router.js +1 -1
  119. package/build/services/server.d.ts +1 -1
  120. package/build/services/server.js +1 -1
  121. package/build/services/test_utils.d.ts +1 -1
  122. package/build/services/test_utils.js +1 -1
  123. package/build/services/url_builder.d.ts +4 -0
  124. package/build/services/url_builder.js +21 -0
  125. package/build/src/assembler_hooks/index_entities.d.ts +37 -0
  126. package/build/src/assembler_hooks/index_entities.js +106 -0
  127. package/build/src/cli_formatters/routes_list.d.ts +24 -12
  128. package/build/src/cli_formatters/routes_list.js +43 -46
  129. package/build/src/config_provider.d.ts +48 -3
  130. package/build/src/config_provider.js +47 -2
  131. package/build/src/debug.d.ts +15 -0
  132. package/build/src/debug.js +15 -0
  133. package/build/src/exceptions.d.ts +41 -1
  134. package/build/src/exceptions.js +41 -1
  135. package/build/src/helpers/assert.d.ts +47 -1
  136. package/build/src/helpers/assert.js +47 -1
  137. package/build/src/helpers/is.d.ts +21 -0
  138. package/build/src/helpers/is.js +21 -0
  139. package/build/src/helpers/main.d.ts +48 -5
  140. package/build/src/helpers/main.js +48 -5
  141. package/build/src/helpers/string.d.ts +89 -9
  142. package/build/src/helpers/string.js +21 -2
  143. package/build/src/helpers/types.d.ts +97 -2
  144. package/build/src/helpers/types.js +96 -2
  145. package/build/src/helpers/verification_token.d.ts +22 -1
  146. package/build/src/helpers/verification_token.js +24 -2
  147. package/build/src/ignitor/ace.d.ts +23 -3
  148. package/build/src/ignitor/ace.js +21 -1
  149. package/build/src/ignitor/http.d.ts +16 -3
  150. package/build/src/ignitor/http.js +16 -3
  151. package/build/src/ignitor/main.d.ts +29 -6
  152. package/build/src/ignitor/main.js +30 -7
  153. package/build/src/ignitor/test.d.ts +26 -3
  154. package/build/src/ignitor/test.js +24 -1
  155. package/build/src/test_utils/http.d.ts +19 -3
  156. package/build/src/test_utils/http.js +24 -3
  157. package/build/src/test_utils/main.d.ts +22 -4
  158. package/build/src/test_utils/main.js +21 -3
  159. package/build/src/types.d.ts +283 -26
  160. package/build/src/utils.d.ts +60 -0
  161. package/build/src/utils.js +104 -0
  162. package/build/src/vine.d.ts +24 -1
  163. package/build/src/vine.js +27 -1
  164. package/build/stubs/main.js +1 -2
  165. package/build/stubs/make/transformer/main.stub +18 -0
  166. package/build/toolkit/main.js +1 -1
  167. package/build/types/common.d.ts +1 -0
  168. package/build/types/common.js +9 -0
  169. package/build/types/helpers.d.ts +2 -1
  170. package/build/types/http.d.ts +1 -0
  171. package/build/types/transformers.d.ts +1 -0
  172. package/build/types/transformers.js +9 -0
  173. package/package.json +55 -52
  174. package/build/src/helpers/parse_binding_reference.d.ts +0 -45
  175. package/build/src/helpers/parse_binding_reference.js +0 -83
  176. package/build/src/internal_helpers.d.ts +0 -15
  177. package/build/src/internal_helpers.js +0 -63
@@ -1,6 +1,6 @@
1
1
  import type { HTMLDumpConfig } from '@poppinss/dumper/html/types';
2
2
  import type { ConsoleDumpConfig } from '@poppinss/dumper/console/types';
3
- import type { Application } from '../app.js';
3
+ import type { Application } from '../app.ts';
4
4
  /**
5
5
  * Dumper exposes the API to dump or die/dump values in your
6
6
  * AdonisJS application. An singleton instance of the Dumper
@@ -30,20 +30,64 @@ export declare class Dumper {
30
30
  #private;
31
31
  constructor(app: Application<any>);
32
32
  /**
33
- * Configure the HTML formatter output
33
+ * Configure the HTML formatter output options
34
+ *
35
+ * @param config - Configuration options for HTML dump formatting
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * dumper.configureHtmlOutput({
40
+ * showHidden: true,
41
+ * depth: 5,
42
+ * colors: false
43
+ * })
44
+ * ```
34
45
  */
35
46
  configureHtmlOutput(config: HTMLDumpConfig): this;
36
47
  /**
37
- * Configure the ANSI formatter output
48
+ * Configure the ANSI formatter output options for console display
49
+ *
50
+ * @param config - Configuration options for ANSI console formatting
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * dumper.configureAnsiOutput({
55
+ * showHidden: true,
56
+ * depth: 3,
57
+ * collapse: ['Date', 'DateTime']
58
+ * })
59
+ * ```
38
60
  */
39
61
  configureAnsiOutput(config: ConsoleDumpConfig): this;
40
62
  /**
41
- * Returns the style and the script elements for the
42
- * HTML document
63
+ * Returns the style and script elements that need to be injected into
64
+ * the HTML document head for proper dump visualization
65
+ *
66
+ * @param cspNonce - Optional Content Security Policy nonce for inline scripts
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * const headElements = dumper.getHeadElements('abc123')
71
+ * // Insert into your HTML head section
72
+ * ```
43
73
  */
44
74
  getHeadElements(cspNonce?: string): string;
45
75
  /**
46
- * Dump value to HTML ouput
76
+ * Dump a value to formatted HTML output
77
+ *
78
+ * @param value - The value to dump and inspect
79
+ * @param options - Options for HTML output formatting
80
+ * @param options.cspNonce - Optional Content Security Policy nonce
81
+ * @param options.title - Optional title to display in the dump header
82
+ * @param options.source - Optional source file information for editor links
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * const htmlOutput = dumper.dumpToHtml(user, {
87
+ * title: 'User Object',
88
+ * source: { location: '/app/controllers/user.ts', line: 42 }
89
+ * })
90
+ * ```
47
91
  */
48
92
  dumpToHtml(value: unknown, options?: {
49
93
  cspNonce?: string;
@@ -54,7 +98,21 @@ export declare class Dumper {
54
98
  };
55
99
  }): string;
56
100
  /**
57
- * Dump value to ANSI output
101
+ * Dump a value to formatted ANSI output for console display
102
+ *
103
+ * @param value - The value to dump and inspect
104
+ * @param options - Options for ANSI output formatting
105
+ * @param options.title - Optional title to display in the dump header
106
+ * @param options.source - Optional source file information for editor links
107
+ *
108
+ * @example
109
+ * ```ts
110
+ * const ansiOutput = dumper.dumpToAnsi(user, {
111
+ * title: 'User Debug',
112
+ * source: { location: '/app/controllers/user.ts', line: 42 }
113
+ * })
114
+ * console.log(ansiOutput)
115
+ * ```
58
116
  */
59
117
  dumpToAnsi(value: unknown, options?: {
60
118
  title?: string;
@@ -64,12 +122,24 @@ export declare class Dumper {
64
122
  };
65
123
  }): string;
66
124
  /**
67
- * Dump values and die. The formatter will be picked
68
- * based upon where your app is running.
125
+ * Dump values and die. This method dumps the provided value and then
126
+ * terminates the application. The output format is automatically chosen
127
+ * based on the execution context.
128
+ *
129
+ * - During an HTTP request, HTML output will be sent to the browser
130
+ * - Otherwise the value will be logged to the console in ANSI format
131
+ *
132
+ * @param value - The value to dump before terminating
133
+ * @param traceSourceIndex - Stack trace index for source location (default: 1)
134
+ *
135
+ * @example
136
+ * ```ts
137
+ * // This will dump the user object and terminate the application
138
+ * dumper.dd(user)
69
139
  *
70
- * - During an HTTP request, the HTML output will be
71
- * sent to the server.
72
- * - Otherwise the value will be logged in the console
140
+ * // This will never execute
141
+ * console.log('This line will not run')
142
+ * ```
73
143
  */
74
144
  dd(value: unknown, traceSourceIndex?: number): void;
75
145
  }
@@ -9,7 +9,7 @@
9
9
  import useColors from '@poppinss/colors';
10
10
  import { dump as consoleDump } from '@poppinss/dumper/console';
11
11
  import { createScript, createStyleSheet, dump } from '@poppinss/dumper/html';
12
- import { E_DUMP_DIE_EXCEPTION } from './errors.js';
12
+ import { E_DUMP_DIE_EXCEPTION } from "./errors.js";
13
13
  const colors = useColors.ansi();
14
14
  const DUMP_TITLE_STYLES = `
15
15
  .adonisjs-dump-header {
@@ -107,22 +107,52 @@ export class Dumper {
107
107
  };
108
108
  }
109
109
  /**
110
- * Configure the HTML formatter output
110
+ * Configure the HTML formatter output options
111
+ *
112
+ * @param config - Configuration options for HTML dump formatting
113
+ *
114
+ * @example
115
+ * ```ts
116
+ * dumper.configureHtmlOutput({
117
+ * showHidden: true,
118
+ * depth: 5,
119
+ * colors: false
120
+ * })
121
+ * ```
111
122
  */
112
123
  configureHtmlOutput(config) {
113
124
  this.#htmlConfig = config;
114
125
  return this;
115
126
  }
116
127
  /**
117
- * Configure the ANSI formatter output
128
+ * Configure the ANSI formatter output options for console display
129
+ *
130
+ * @param config - Configuration options for ANSI console formatting
131
+ *
132
+ * @example
133
+ * ```ts
134
+ * dumper.configureAnsiOutput({
135
+ * showHidden: true,
136
+ * depth: 3,
137
+ * collapse: ['Date', 'DateTime']
138
+ * })
139
+ * ```
118
140
  */
119
141
  configureAnsiOutput(config) {
120
142
  this.#consoleConfig = config;
121
143
  return this;
122
144
  }
123
145
  /**
124
- * Returns the style and the script elements for the
125
- * HTML document
146
+ * Returns the style and script elements that need to be injected into
147
+ * the HTML document head for proper dump visualization
148
+ *
149
+ * @param cspNonce - Optional Content Security Policy nonce for inline scripts
150
+ *
151
+ * @example
152
+ * ```ts
153
+ * const headElements = dumper.getHeadElements('abc123')
154
+ * // Insert into your HTML head section
155
+ * ```
126
156
  */
127
157
  getHeadElements(cspNonce) {
128
158
  return (`<style id="dumper-styles">` +
@@ -134,7 +164,21 @@ export class Dumper {
134
164
  '</script>');
135
165
  }
136
166
  /**
137
- * Dump value to HTML ouput
167
+ * Dump a value to formatted HTML output
168
+ *
169
+ * @param value - The value to dump and inspect
170
+ * @param options - Options for HTML output formatting
171
+ * @param options.cspNonce - Optional Content Security Policy nonce
172
+ * @param options.title - Optional title to display in the dump header
173
+ * @param options.source - Optional source file information for editor links
174
+ *
175
+ * @example
176
+ * ```ts
177
+ * const htmlOutput = dumper.dumpToHtml(user, {
178
+ * title: 'User Object',
179
+ * source: { location: '/app/controllers/user.ts', line: 42 }
180
+ * })
181
+ * ```
138
182
  */
139
183
  dumpToHtml(value, options = {}) {
140
184
  const link = this.#getEditorLink(options.source) ?? null;
@@ -146,7 +190,21 @@ export class Dumper {
146
190
  dump(value, { cspNonce: options.cspNonce, ...this.#htmlConfig }));
147
191
  }
148
192
  /**
149
- * Dump value to ANSI output
193
+ * Dump a value to formatted ANSI output for console display
194
+ *
195
+ * @param value - The value to dump and inspect
196
+ * @param options - Options for ANSI output formatting
197
+ * @param options.title - Optional title to display in the dump header
198
+ * @param options.source - Optional source file information for editor links
199
+ *
200
+ * @example
201
+ * ```ts
202
+ * const ansiOutput = dumper.dumpToAnsi(user, {
203
+ * title: 'User Debug',
204
+ * source: { location: '/app/controllers/user.ts', line: 42 }
205
+ * })
206
+ * console.log(ansiOutput)
207
+ * ```
150
208
  */
151
209
  dumpToAnsi(value, options = {}) {
152
210
  const columns = process.stdout.columns;
@@ -171,12 +229,24 @@ export class Dumper {
171
229
  return `${heading}\n${consoleDump(value, this.#consoleConfig)}`;
172
230
  }
173
231
  /**
174
- * Dump values and die. The formatter will be picked
175
- * based upon where your app is running.
232
+ * Dump values and die. This method dumps the provided value and then
233
+ * terminates the application. The output format is automatically chosen
234
+ * based on the execution context.
235
+ *
236
+ * - During an HTTP request, HTML output will be sent to the browser
237
+ * - Otherwise the value will be logged to the console in ANSI format
238
+ *
239
+ * @param value - The value to dump before terminating
240
+ * @param traceSourceIndex - Stack trace index for source location (default: 1)
241
+ *
242
+ * @example
243
+ * ```ts
244
+ * // This will dump the user object and terminate the application
245
+ * dumper.dd(user)
176
246
  *
177
- * - During an HTTP request, the HTML output will be
178
- * sent to the server.
179
- * - Otherwise the value will be logged in the console
247
+ * // This will never execute
248
+ * console.log('This line will not run')
249
+ * ```
180
250
  */
181
251
  dd(value, traceSourceIndex = 1) {
182
252
  const error = new E_DUMP_DIE_EXCEPTION(value, this);
@@ -1,12 +1,21 @@
1
1
  import { inspect } from 'node:util';
2
- import type { Kernel } from '@adonisjs/core/ace';
3
2
  import { Exception } from '@poppinss/utils/exception';
4
- import type { HttpContext } from '@adonisjs/core/http';
5
- import type { Dumper } from './dumper.js';
3
+ import type { Dumper } from './dumper.ts';
4
+ import type { Kernel } from '../ace/kernel.ts';
5
+ import type { HttpContext } from '../http/main.ts';
6
6
  /**
7
- * DumpDie exception is raised by the "dd" function. It will
8
- * result in dumping the value in response to an HTTP
9
- * request or printing the value to the console
7
+ * DumpDie exception raised by the "dd" (dump and die) function.
8
+ * This special exception terminates execution while dumping the provided
9
+ * value as HTML (during HTTP requests) or ANSI (in console/CLI).
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * // This will dump the user object and terminate
14
+ * dumper.dd(user)
15
+ *
16
+ * // In HTTP context: sends HTML dump to browser
17
+ * // In CLI context: prints ANSI dump to console
18
+ * ```
10
19
  */
11
20
  declare class DumpDieException extends Exception {
12
21
  #private;
@@ -17,8 +26,10 @@ declare class DumpDieException extends Exception {
17
26
  value: unknown;
18
27
  constructor(value: unknown, dumper: Dumper);
19
28
  /**
20
- * Set the index for the trace source. This is helpful when
21
- * you build nested helpers on top of Die/Dump
29
+ * Set the stack trace index for determining the source location.
30
+ * This is useful when building nested helpers on top of dump/die functionality.
31
+ *
32
+ * @param index - Stack trace index (0 = current function, 1 = caller, etc.)
22
33
  */
23
34
  setTraceSourceIndex(index: number): this;
24
35
  /**
@@ -27,11 +38,21 @@ declare class DumpDieException extends Exception {
27
38
  */
28
39
  report(): void;
29
40
  /**
30
- * Handler called by the AdonisJS HTTP exception handler
41
+ * HTTP exception handler that renders the dump as HTML output.
42
+ * This method is called automatically by AdonisJS when a DumpDieException
43
+ * is thrown during an HTTP request.
44
+ *
45
+ * @param error - The DumpDieException instance
46
+ * @param ctx - HTTP context for the current request
31
47
  */
32
48
  handle(error: DumpDieException, ctx: HttpContext): Promise<void>;
33
49
  /**
34
- * Handler called by the AdonisJS Ace kernel
50
+ * Ace command exception handler that renders the dump as ANSI output.
51
+ * This method is called automatically by the Ace kernel when a DumpDieException
52
+ * is thrown during command execution.
53
+ *
54
+ * @param error - The DumpDieException instance
55
+ * @param kernel - Ace kernel instance
35
56
  */
36
57
  render(error: DumpDieException, kernel: Kernel): Promise<void>;
37
58
  /**
@@ -10,9 +10,18 @@ import { inspect } from 'node:util';
10
10
  import { parse } from 'error-stack-parser-es';
11
11
  import { Exception } from '@poppinss/utils/exception';
12
12
  /**
13
- * DumpDie exception is raised by the "dd" function. It will
14
- * result in dumping the value in response to an HTTP
15
- * request or printing the value to the console
13
+ * DumpDie exception raised by the "dd" (dump and die) function.
14
+ * This special exception terminates execution while dumping the provided
15
+ * value as HTML (during HTTP requests) or ANSI (in console/CLI).
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * // This will dump the user object and terminate
20
+ * dumper.dd(user)
21
+ *
22
+ * // In HTTP context: sends HTML dump to browser
23
+ * // In CLI context: prints ANSI dump to console
24
+ * ```
16
25
  */
17
26
  class DumpDieException extends Exception {
18
27
  static status = 500;
@@ -45,8 +54,10 @@ class DumpDieException extends Exception {
45
54
  };
46
55
  }
47
56
  /**
48
- * Set the index for the trace source. This is helpful when
49
- * you build nested helpers on top of Die/Dump
57
+ * Set the stack trace index for determining the source location.
58
+ * This is useful when building nested helpers on top of dump/die functionality.
59
+ *
60
+ * @param index - Stack trace index (0 = current function, 1 = caller, etc.)
50
61
  */
51
62
  setTraceSourceIndex(index) {
52
63
  this.#traceSourceIndex = index;
@@ -58,7 +69,12 @@ class DumpDieException extends Exception {
58
69
  */
59
70
  report() { }
60
71
  /**
61
- * Handler called by the AdonisJS HTTP exception handler
72
+ * HTTP exception handler that renders the dump as HTML output.
73
+ * This method is called automatically by AdonisJS when a DumpDieException
74
+ * is thrown during an HTTP request.
75
+ *
76
+ * @param error - The DumpDieException instance
77
+ * @param ctx - HTTP context for the current request
62
78
  */
63
79
  async handle(error, ctx) {
64
80
  const source = this.#getErrorSource();
@@ -81,7 +97,12 @@ class DumpDieException extends Exception {
81
97
  '</html>');
82
98
  }
83
99
  /**
84
- * Handler called by the AdonisJS Ace kernel
100
+ * Ace command exception handler that renders the dump as ANSI output.
101
+ * This method is called automatically by the Ace kernel when a DumpDieException
102
+ * is thrown during command execution.
103
+ *
104
+ * @param error - The DumpDieException instance
105
+ * @param kernel - Ace kernel instance
85
106
  */
86
107
  async render(error, kernel) {
87
108
  const source = this.#getErrorSource();
@@ -1,3 +1,3 @@
1
- export * as errors from './errors.js';
2
- export { Dumper } from './dumper.js';
3
- export { defineConfig } from './define_config.js';
1
+ export * as errors from './errors.ts';
2
+ export { Dumper } from './dumper.ts';
3
+ export { defineConfig } from './define_config.ts';
@@ -6,6 +6,6 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- export * as errors from './errors.js';
10
- export { Dumper } from './dumper.js';
11
- export { defineConfig } from './define_config.js';
9
+ export * as errors from "./errors.js";
10
+ export { Dumper } from "./dumper.js";
11
+ export { defineConfig } from "./define_config.js";
@@ -1,5 +1,5 @@
1
1
  import { type Edge } from 'edge.js';
2
- import { type Dumper } from '../dumper.js';
2
+ import { type Dumper } from '../dumper.ts';
3
3
  /**
4
4
  * Returns an edge plugin that integrates with a given
5
5
  * dumper instance
@@ -1,8 +1,8 @@
1
- import type { Argon } from './drivers/argon.js';
2
- import type { Scrypt } from './drivers/scrypt.js';
3
- import type { Bcrypt } from './drivers/bcrypt.js';
4
- import type { ConfigProvider } from '../../src/types.js';
5
- import type { ArgonConfig, BcryptConfig, ScryptConfig, ManagerDriverFactory } from '../../types/hash.js';
1
+ import type { Argon } from './drivers/argon.ts';
2
+ import type { Scrypt } from './drivers/scrypt.ts';
3
+ import type { Bcrypt } from './drivers/bcrypt.ts';
4
+ import type { ConfigProvider } from '../../src/types.ts';
5
+ import type { ArgonConfig, BcryptConfig, ScryptConfig, ManagerDriverFactory } from '../../types/hash.ts';
6
6
  /**
7
7
  * Resolved config from the config provider will be
8
8
  * the config accepted by the hash manager
@@ -14,18 +14,63 @@ type ResolvedConfig<KnownHashers extends Record<string, ManagerDriverFactory | C
14
14
  };
15
15
  };
16
16
  /**
17
- * Define config for the hash service.
17
+ * Define config for the hash service. This function creates a configuration
18
+ * provider that lazily imports and resolves hash drivers when needed.
19
+ *
20
+ * @param config - Configuration object containing default hasher and list of hashers
21
+ * @param config.default - Optional default hasher name (must exist in the list)
22
+ * @param config.list - Record of hasher configurations or config providers
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const hashConfig = defineConfig({
27
+ * default: 'scrypt',
28
+ * list: {
29
+ * scrypt: drivers.scrypt({
30
+ * cost: 16384,
31
+ * blockSize: 8,
32
+ * parallelization: 1,
33
+ * saltSize: 16,
34
+ * keyLength: 64,
35
+ * }),
36
+ * bcrypt: drivers.bcrypt({
37
+ * rounds: 10,
38
+ * })
39
+ * }
40
+ * })
41
+ * ```
18
42
  */
19
43
  export declare function defineConfig<KnownHashers extends Record<string, ManagerDriverFactory | ConfigProvider<ManagerDriverFactory>>>(config: {
20
44
  default?: keyof KnownHashers;
21
45
  list: KnownHashers;
22
46
  }): ConfigProvider<ResolvedConfig<KnownHashers>>;
23
47
  /**
24
- * Helpers to configure drivers inside the config file. The
25
- * drivers will be imported and constructed lazily.
48
+ * Helpers to configure drivers inside the config file. These functions create
49
+ * configuration providers that lazily import and instantiate hash drivers.
26
50
  *
27
51
  * - Import happens when you first use the hash module
28
52
  * - Construction of drivers happens when you first use a driver
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * const hashConfig = defineConfig({
57
+ * default: 'bcrypt',
58
+ * list: {
59
+ * bcrypt: drivers.bcrypt({ rounds: 12 }),
60
+ * argon2: drivers.argon2({
61
+ * variant: 'id',
62
+ * memory: 65536,
63
+ * time: 3,
64
+ * parallelism: 4
65
+ * }),
66
+ * scrypt: drivers.scrypt({
67
+ * cost: 16384,
68
+ * blockSize: 8,
69
+ * parallelization: 1
70
+ * })
71
+ * }
72
+ * })
73
+ * ```
29
74
  */
30
75
  export declare const drivers: {
31
76
  argon2: (config: ArgonConfig) => ConfigProvider<() => Argon>;
@@ -6,11 +6,35 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
- import { InvalidArgumentsException } from '@poppinss/utils';
10
- import debug from '../../src/debug.js';
11
- import { configProvider } from '../../src/config_provider.js';
9
+ import { InvalidArgumentsException } from '@poppinss/utils/exception';
10
+ import debug from "../../src/debug.js";
11
+ import { configProvider } from "../../src/config_provider.js";
12
12
  /**
13
- * Define config for the hash service.
13
+ * Define config for the hash service. This function creates a configuration
14
+ * provider that lazily imports and resolves hash drivers when needed.
15
+ *
16
+ * @param config - Configuration object containing default hasher and list of hashers
17
+ * @param config.default - Optional default hasher name (must exist in the list)
18
+ * @param config.list - Record of hasher configurations or config providers
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const hashConfig = defineConfig({
23
+ * default: 'scrypt',
24
+ * list: {
25
+ * scrypt: drivers.scrypt({
26
+ * cost: 16384,
27
+ * blockSize: 8,
28
+ * parallelization: 1,
29
+ * saltSize: 16,
30
+ * keyLength: 64,
31
+ * }),
32
+ * bcrypt: drivers.bcrypt({
33
+ * rounds: 10,
34
+ * })
35
+ * }
36
+ * })
37
+ * ```
14
38
  */
15
39
  export function defineConfig(config) {
16
40
  /**
@@ -49,11 +73,32 @@ export function defineConfig(config) {
49
73
  });
50
74
  }
51
75
  /**
52
- * Helpers to configure drivers inside the config file. The
53
- * drivers will be imported and constructed lazily.
76
+ * Helpers to configure drivers inside the config file. These functions create
77
+ * configuration providers that lazily import and instantiate hash drivers.
54
78
  *
55
79
  * - Import happens when you first use the hash module
56
80
  * - Construction of drivers happens when you first use a driver
81
+ *
82
+ * @example
83
+ * ```ts
84
+ * const hashConfig = defineConfig({
85
+ * default: 'bcrypt',
86
+ * list: {
87
+ * bcrypt: drivers.bcrypt({ rounds: 12 }),
88
+ * argon2: drivers.argon2({
89
+ * variant: 'id',
90
+ * memory: 65536,
91
+ * time: 3,
92
+ * parallelism: 4
93
+ * }),
94
+ * scrypt: drivers.scrypt({
95
+ * cost: 16384,
96
+ * blockSize: 8,
97
+ * parallelization: 1
98
+ * })
99
+ * }
100
+ * })
101
+ * ```
57
102
  */
58
103
  export const drivers = {
59
104
  argon2: (config) => {
@@ -1,2 +1,2 @@
1
1
  export * from '@adonisjs/hash';
2
- export { defineConfig, drivers } from './define_config.js';
2
+ export { defineConfig, drivers } from './define_config.ts';
@@ -7,4 +7,4 @@
7
7
  * file that was distributed with this source code.
8
8
  */
9
9
  export * from '@adonisjs/hash';
10
- export { defineConfig, drivers } from './define_config.js';
10
+ export { defineConfig, drivers } from "./define_config.js";
@@ -4,4 +4,4 @@
4
4
  */
5
5
  import '@adonisjs/bodyparser';
6
6
  export * from '@adonisjs/http-server';
7
- export { RequestValidator } from './request_validator.js';
7
+ export { RequestValidator } from './request_validator.ts';
@@ -12,4 +12,4 @@
12
12
  */
13
13
  import '@adonisjs/bodyparser';
14
14
  export * from '@adonisjs/http-server';
15
- export { RequestValidator } from './request_validator.js';
15
+ export { RequestValidator } from "./request_validator.js";
@@ -1,13 +1,21 @@
1
1
  import type { VineValidator } from '@vinejs/vine';
2
2
  import type { Infer, SchemaTypes, ErrorReporterContract, MessagesProviderContact } from '@vinejs/vine/types';
3
- import type { HttpContext } from './main.js';
4
- import type { FeatureFlags } from '../app.js';
5
- import type { ExperimentalFlagsList } from '../../types/app.js';
6
- import type { RequestValidationOptions } from '../../types/http.js';
3
+ import type { HttpContext } from './main.ts';
4
+ import type { FeatureFlags } from '../app.ts';
5
+ import type { ExperimentalFlagsList } from '../../types/app.ts';
6
+ import type { RequestValidationOptions } from '../../types/http.ts';
7
7
  /**
8
- * Request validator is used validate HTTP request data using
9
- * VineJS validators. You may validate the request body,
10
- * files, cookies, and headers.
8
+ * Request validator for validating HTTP request data using VineJS validators.
9
+ * This class provides a convenient way to validate request body, files, cookies,
10
+ * headers, and URL parameters in AdonisJS applications.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * // Inside a controller method
15
+ * const data = await request.validateUsing(createUserValidator, {
16
+ * messagesProvider: customMessages
17
+ * })
18
+ * ```
11
19
  */
12
20
  export declare class RequestValidator {
13
21
  #private;
@@ -29,8 +37,27 @@ export declare class RequestValidator {
29
37
  */
30
38
  static messagesProvider?: (_: HttpContext) => MessagesProviderContact;
31
39
  /**
32
- * The validate method can be used to validate the request
33
- * data for the current request using VineJS validators
40
+ * Validate the current HTTP request data using a VineJS validator.
41
+ * This method automatically includes request body, files, URL parameters,
42
+ * headers, and cookies in the validation data.
43
+ *
44
+ * @param validator - VineJS validator instance
45
+ * @param options - Optional validation options including custom error reporters and messages
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const createUserValidator = vine.compile(
50
+ * vine.object({
51
+ * email: vine.string().email(),
52
+ * name: vine.string().minLength(3)
53
+ * })
54
+ * )
55
+ *
56
+ * const data = await request.validateUsing(createUserValidator, {
57
+ * errorReporter: () => vine.errors.SimpleErrorReporter,
58
+ * messagesProvider: customMessages
59
+ * })
60
+ * ```
34
61
  */
35
62
  validateUsing<Schema extends SchemaTypes, MetaData extends undefined | Record<string, any>>(validator: VineValidator<Schema, MetaData>, ...[options]: [undefined] extends MetaData ? [options?: RequestValidationOptions<MetaData> | undefined] : [options: RequestValidationOptions<MetaData>]): Promise<Infer<Schema>>;
36
63
  }