@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.
Files changed (217) hide show
  1. package/build/ace-sWl9sgM1.js +16 -0
  2. package/build/app-B6oge7b3.js +5 -0
  3. package/build/app-DNvbxVWl.js +5 -0
  4. package/build/bodyparser_middleware-BmARtnYe.js +3 -0
  5. package/build/chunk-B88MteZI.js +26 -0
  6. package/build/commands/add.d.ts +4 -3
  7. package/build/commands/add.js +76 -110
  8. package/build/commands/build.js +51 -107
  9. package/build/commands/commands.json +1 -1
  10. package/build/commands/configure.js +82 -177
  11. package/build/commands/eject.js +17 -60
  12. package/build/commands/env/add.js +55 -134
  13. package/build/commands/generate_key.js +22 -66
  14. package/build/commands/inspect_rcfile.js +27 -55
  15. package/build/commands/list/routes.js +246 -116
  16. package/build/commands/make/command.js +15 -57
  17. package/build/commands/make/controller.js +43 -120
  18. package/build/commands/make/event.js +16 -62
  19. package/build/commands/make/exception.js +16 -62
  20. package/build/commands/make/listener.js +36 -93
  21. package/build/commands/make/middleware.js +41 -101
  22. package/build/commands/make/preload.js +47 -113
  23. package/build/commands/make/provider.js +47 -112
  24. package/build/commands/make/service.js +16 -55
  25. package/build/commands/make/test.js +47 -132
  26. package/build/commands/make/transformer.js +17 -64
  27. package/build/commands/make/validator.js +20 -80
  28. package/build/commands/make/view.js +15 -56
  29. package/build/commands/repl.js +17 -50
  30. package/build/commands/serve.js +80 -156
  31. package/build/commands/test.js +92 -208
  32. package/build/config-Dd2H6-_e.js +5 -0
  33. package/build/config_provider-DWVFHOQX.js +15 -0
  34. package/build/container-uxa8LpGI.js +5 -0
  35. package/build/core-BuPP8K6N.js +140 -0
  36. package/build/create_kernel-Cn8zVtvt.js +3 -0
  37. package/build/create_kernel-Cpqqa931.js +38 -0
  38. package/build/decorate-CJcHOoD-.js +7 -0
  39. package/build/define_config-CoWy5lbf.js +62 -0
  40. package/build/dumper-BTjb8j4y.js +147 -0
  41. package/build/edge-BVYR-Vjr.js +47 -0
  42. package/build/events-C4d0OPUI.js +5 -0
  43. package/build/exceptions-DNMesP42.js +2 -0
  44. package/build/factories/app.js +2 -9
  45. package/build/factories/bodyparser.js +2 -9
  46. package/build/factories/core/ace.js +16 -46
  47. package/build/factories/core/ignitor.js +13 -180
  48. package/build/factories/core/main.js +24 -11
  49. package/build/factories/core/test_utils.js +21 -43
  50. package/build/factories/encryption.d.ts +1 -1
  51. package/build/factories/encryption.js +2 -9
  52. package/build/factories/events.js +2 -9
  53. package/build/factories/hash.js +2 -9
  54. package/build/factories/http.js +2 -9
  55. package/build/factories/logger.js +2 -9
  56. package/build/factories/stubs.js +27 -91
  57. package/build/ignitor-BrmVPN5N.js +71 -0
  58. package/build/index.d.ts +1 -1
  59. package/build/index.js +12 -46
  60. package/build/logger-0KKSqgPG.js +13 -0
  61. package/build/main-BU8NWUEG.js +73 -0
  62. package/build/main-Bfnr5tAw.js +2 -0
  63. package/build/main-BlJhxJJ2.js +81 -0
  64. package/build/main-C4B2SPOT.js +5 -0
  65. package/build/main-CZZ21eXm.js +171 -0
  66. package/build/main-D-WhqOOn.js +51 -0
  67. package/build/main-DOY5Q8Av.js +5 -0
  68. package/build/main-kn40V-hF.js +2 -0
  69. package/build/main-nojlltNo.js +30 -0
  70. package/build/{stubs/make → make}/health/controller.stub +5 -2
  71. package/build/modules/ace/codemods.d.ts +109 -14
  72. package/build/modules/ace/codemods.js +222 -382
  73. package/build/modules/ace/main.d.ts +30 -0
  74. package/build/modules/ace/main.js +2 -11
  75. package/build/modules/app.d.ts +17 -0
  76. package/build/modules/app.js +4 -9
  77. package/build/modules/bodyparser/bodyparser_middleware.js +2 -14
  78. package/build/modules/bodyparser/main.js +4 -9
  79. package/build/modules/config.d.ts +17 -0
  80. package/build/modules/config.js +4 -9
  81. package/build/modules/container.js +4 -9
  82. package/build/modules/dumper/dumper.d.ts +5 -0
  83. package/build/modules/dumper/main.d.ts +21 -0
  84. package/build/modules/dumper/main.js +6 -11
  85. package/build/modules/dumper/plugins/edge.js +2 -62
  86. package/build/modules/encryption/define_config.d.ts +128 -0
  87. package/build/modules/encryption/drivers/aes_256_cbc.d.ts +20 -0
  88. package/build/modules/encryption/drivers/aes_256_cbc.js +2 -0
  89. package/build/modules/encryption/drivers/aes_256_gcm.d.ts +21 -0
  90. package/build/modules/encryption/drivers/aes_256_gcm.js +2 -0
  91. package/build/modules/encryption/drivers/chacha20_poly1305.d.ts +21 -0
  92. package/build/modules/encryption/drivers/chacha20_poly1305.js +2 -0
  93. package/build/modules/encryption/main.d.ts +85 -0
  94. package/build/modules/encryption/main.js +5 -0
  95. package/build/modules/env/editor.js +2 -9
  96. package/build/modules/env/main.d.ts +19 -0
  97. package/build/modules/env/main.js +2 -9
  98. package/build/modules/events.js +4 -9
  99. package/build/modules/hash/drivers/argon.js +2 -9
  100. package/build/modules/hash/drivers/bcrypt.d.ts +11 -0
  101. package/build/modules/hash/drivers/bcrypt.js +2 -9
  102. package/build/modules/hash/drivers/scrypt.js +2 -9
  103. package/build/modules/hash/main.d.ts +18 -0
  104. package/build/modules/hash/main.js +5 -10
  105. package/build/modules/hash/phc_formatter.js +2 -9
  106. package/build/modules/health.js +2 -9
  107. package/build/modules/http/main.js +4 -15
  108. package/build/modules/http/request_validator.d.ts +1 -3
  109. package/build/modules/http/url_builder_client.d.ts +1 -0
  110. package/build/modules/http/url_builder_client.js +2 -0
  111. package/build/modules/logger.d.ts +30 -0
  112. package/build/modules/logger.js +4 -9
  113. package/build/modules/repl.js +4 -9
  114. package/build/modules/transformers/main.js +4 -9
  115. package/build/providers/app_provider.d.ts +14 -25
  116. package/build/providers/app_provider.js +155 -363
  117. package/build/providers/edge_provider.js +97 -114
  118. package/build/providers/hash_provider.js +28 -91
  119. package/build/providers/repl_provider.js +66 -152
  120. package/build/providers/vinejs_provider.d.ts +1 -1
  121. package/build/providers/vinejs_provider.js +19 -66
  122. package/build/repl-GSxgovJQ.js +5 -0
  123. package/build/services/ace.js +2 -17
  124. package/build/services/app.js +2 -21
  125. package/build/services/config.js +2 -13
  126. package/build/services/dumper.js +5 -21
  127. package/build/services/emitter.js +2 -14
  128. package/build/services/encryption.js +2 -14
  129. package/build/services/hash.js +2 -14
  130. package/build/services/logger.js +2 -14
  131. package/build/services/repl.js +2 -14
  132. package/build/services/router.js +2 -14
  133. package/build/services/server.js +2 -14
  134. package/build/services/test_utils.js +2 -17
  135. package/build/services/url_builder.d.ts +3 -3
  136. package/build/services/url_builder.js +5 -17
  137. package/build/src/assembler_hooks/index_entities.d.ts +29 -1
  138. package/build/src/debug.d.ts +1 -1
  139. package/build/src/exceptions.js +2 -49
  140. package/build/src/helpers/assert.js +2 -55
  141. package/build/src/helpers/http.d.ts +20 -0
  142. package/build/src/helpers/http.js +2 -0
  143. package/build/src/helpers/is.js +3 -31
  144. package/build/src/helpers/main.d.ts +1 -5
  145. package/build/src/helpers/main.js +5 -56
  146. package/build/src/helpers/string.js +2 -60
  147. package/build/src/helpers/types.js +26 -135
  148. package/build/src/helpers/verification_token.js +2 -120
  149. package/build/src/test_utils/main.js +8 -77
  150. package/build/src/types.d.ts +53 -99
  151. package/build/src/types.js +0 -8
  152. package/build/src/utils.d.ts +1 -1
  153. package/build/src/vine.js +2 -97
  154. package/build/string-Cx6q_win.js +28 -0
  155. package/build/test_utils-hkQDmNpX.js +10 -0
  156. package/build/toolkit/main.js +19 -21
  157. package/build/types/ace.js +2 -9
  158. package/build/types/app.js +2 -9
  159. package/build/types/bodyparser.js +2 -9
  160. package/build/types/common.js +2 -9
  161. package/build/types/container.js +2 -9
  162. package/build/types/encryption.d.ts +39 -1
  163. package/build/types/encryption.js +1 -9
  164. package/build/types/events.js +2 -9
  165. package/build/types/hash.js +2 -9
  166. package/build/types/health.js +2 -9
  167. package/build/types/helpers.d.ts +20 -0
  168. package/build/types/helpers.js +0 -8
  169. package/build/types/http.js +2 -9
  170. package/build/types/logger.js +2 -9
  171. package/build/types/repl.js +2 -9
  172. package/build/types/transformers.js +2 -9
  173. package/build/utils-CtGytdtt.js +42 -0
  174. package/build/verification_token-DrdoU4RH.js +46 -0
  175. package/build/vine-DGint2rk.js +32 -0
  176. package/package.json +113 -60
  177. package/build/modules/ace/commands.js +0 -157
  178. package/build/modules/ace/create_kernel.js +0 -91
  179. package/build/modules/ace/kernel.js +0 -40
  180. package/build/modules/dumper/define_config.js +0 -36
  181. package/build/modules/dumper/dumper.js +0 -256
  182. package/build/modules/dumper/errors.js +0 -119
  183. package/build/modules/encryption.d.ts +0 -1
  184. package/build/modules/encryption.js +0 -9
  185. package/build/modules/hash/define_config.js +0 -125
  186. package/build/modules/http/request_validator.js +0 -100
  187. package/build/src/assembler_hooks/index_entities.js +0 -107
  188. package/build/src/cli_formatters/routes_list.js +0 -381
  189. package/build/src/config_provider.js +0 -71
  190. package/build/src/debug.js +0 -25
  191. package/build/src/ignitor/ace.js +0 -102
  192. package/build/src/ignitor/http.js +0 -146
  193. package/build/src/ignitor/main.js +0 -124
  194. package/build/src/ignitor/test.js +0 -66
  195. package/build/src/test_utils/http.js +0 -82
  196. package/build/src/utils.js +0 -104
  197. package/build/stubs/main.js +0 -9
  198. package/build/toolkit/commands/index_commands.js +0 -30
  199. /package/build/{stubs/make → make}/command/main.stub +0 -0
  200. /package/build/{stubs/make → make}/controller/actions.stub +0 -0
  201. /package/build/{stubs/make → make}/controller/api.stub +0 -0
  202. /package/build/{stubs/make → make}/controller/main.stub +0 -0
  203. /package/build/{stubs/make → make}/controller/resource.stub +0 -0
  204. /package/build/{stubs/make → make}/event/main.stub +0 -0
  205. /package/build/{stubs/make → make}/exception/main.stub +0 -0
  206. /package/build/{stubs/make → make}/health/main.stub +0 -0
  207. /package/build/{stubs/make → make}/listener/for_event.stub +0 -0
  208. /package/build/{stubs/make → make}/listener/main.stub +0 -0
  209. /package/build/{stubs/make → make}/middleware/main.stub +0 -0
  210. /package/build/{stubs/make → make}/preload/main.stub +0 -0
  211. /package/build/{stubs/make → make}/provider/main.stub +0 -0
  212. /package/build/{stubs/make → make}/service/main.stub +0 -0
  213. /package/build/{stubs/make → make}/test/main.stub +0 -0
  214. /package/build/{stubs/make → make}/transformer/main.stub +0 -0
  215. /package/build/{stubs/make → make}/validator/main.stub +0 -0
  216. /package/build/{stubs/make → make}/validator/resource.stub +0 -0
  217. /package/build/{stubs/make → make}/view/main.stub +0 -0
@@ -1,60 +1,2 @@
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
- import prettyHrTime from 'pretty-hrtime';
10
- import string from '@poppinss/utils/string';
11
- import he from 'he';
12
- import StringBuilder from '@poppinss/utils/string_builder';
13
- /**
14
- * Collection of string helpers to transform a string value. This object extends
15
- * the base string utilities from @poppinss/utils with additional AdonisJS-specific
16
- * string manipulation methods.
17
- *
18
- * @example
19
- * // Basic string transformations
20
- * stringHelpers.camelCase('hello_world') // 'helloWorld'
21
- * stringHelpers.snakeCase('HelloWorld') // 'hello_world'
22
- * stringHelpers.pascalCase('hello world') // 'HelloWorld'
23
- *
24
- * @example
25
- * // HTML escaping and encoding
26
- * stringHelpers.escapeHTML('<script>alert("xss")</script>')
27
- * stringHelpers.encodeSymbols('© 2023 AdonisJS')
28
- */
29
- const stringHelpers = {
30
- ...string,
31
- toSentence: string.sentence,
32
- ordinalize: string.ordinal,
33
- generateRandom: string.random,
34
- create(value) {
35
- return new StringBuilder(value);
36
- },
37
- /**
38
- * Formats Node.js hrtime output into a human-readable string.
39
- *
40
- * @param time - Tuple of [seconds, nanoseconds] from process.hrtime()
41
- * @param options - Formatting options for output style and precision
42
- */
43
- prettyHrTime(time, options) {
44
- return prettyHrTime(time, options);
45
- },
46
- isEmpty(value) {
47
- return value.trim().length === 0;
48
- },
49
- escapeHTML(value, options) {
50
- value = he.escape(value);
51
- if (options && options.encodeSymbols) {
52
- value = this.encodeSymbols(value, { allowUnsafeSymbols: true });
53
- }
54
- return value;
55
- },
56
- encodeSymbols(value, options) {
57
- return he.encode(value, options);
58
- },
59
- };
60
- export default stringHelpers;
1
+ import { t as string_default } from "../../string-Cx6q_win.js";
2
+ export { string_default as default };
@@ -1,136 +1,27 @@
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
- import is from '@sindresorhus/is';
10
- /**
11
- * @deprecated
12
- * Use "is" helpers instead. The types helpers exist for backward compatibility.
13
- *
14
- * @example
15
- * // Instead of using types helpers (deprecated)
16
- * types.isString('hello')
17
- * types.isNumber(42)
18
- *
19
- * @example
20
- * // Use the new "is" helpers
21
- * import { is } from '@adonisjs/core/helpers'
22
- * is.string('hello')
23
- * is.number(42)
24
- */
25
- const types = {
26
- /**
27
- * Direct reference to the is utility for type checking lookups.
28
- * @deprecated Use the is helpers directly instead
29
- */
30
- lookup: is,
31
- /**
32
- * Check if value is null.
33
- * @deprecated Use is.null instead
34
- */
35
- isNull: is.null,
36
- /**
37
- * Check if value is a boolean.
38
- * @deprecated Use is.boolean instead
39
- */
40
- isBoolean: is.boolean,
41
- /**
42
- * Check if value is a Buffer.
43
- * @deprecated Use is.buffer instead
44
- */
45
- isBuffer: is.buffer,
46
- /**
47
- * Check if value is a number.
48
- * @deprecated Use is.number instead
49
- */
50
- isNumber: is.number,
51
- /**
52
- * Check if value is a string.
53
- * @deprecated Use is.string instead
54
- */
55
- isString: is.string,
56
- /**
57
- * Check if value is an arguments object.
58
- * @deprecated Use is.arguments instead
59
- */
60
- isArguments: is.arguments,
61
- /**
62
- * Check if value is an object.
63
- * @deprecated Use is.object instead
64
- */
65
- isObject: is.object,
66
- /**
67
- * Check if value is a Date.
68
- * @deprecated Use is.date instead
69
- */
70
- isDate: is.date,
71
- /**
72
- * Check if value is an array.
73
- * @deprecated Use is.array instead
74
- */
75
- isArray: is.array,
76
- /**
77
- * Check if value is a regular expression.
78
- * @deprecated Use is.regExp instead
79
- */
80
- isRegexp: is.regExp,
81
- /**
82
- * Check if value is an error object.
83
- * @deprecated Use is.error instead
84
- */
85
- isError: is.error,
86
- /**
87
- * Check if value is a function.
88
- * @deprecated Use is.function instead
89
- */
90
- isFunction: is.function,
91
- /**
92
- * Check if value is a class.
93
- * @deprecated Use is.class instead
94
- */
95
- isClass: is.class,
96
- /**
97
- * Check if value is an integer.
98
- * @deprecated Use is.integer instead
99
- */
100
- isInteger: is.integer,
101
- /**
102
- * Check if a number is a float (has decimal places).
103
- *
104
- * @param value - The number to check
105
- * @deprecated Use is.decimal or custom logic instead
106
- *
107
- * @example
108
- * types.isFloat(3.14) // true
109
- * types.isFloat(42) // false
110
- */
111
- isFloat(value) {
112
- return value !== (value | 0);
113
- },
114
- /**
115
- * Check if a value represents a decimal number with specific decimal places.
116
- *
117
- * @param value - The value to check (string or number)
118
- * @param options - Options for decimal validation
119
- * @param options.decimalPlaces - Regex pattern for allowed decimal places (default: '1,')
120
- * @deprecated Use a validation library like Vine or custom logic instead
121
- *
122
- * @example
123
- * types.isDecimal('3.14') // true
124
- * types.isDecimal('42.0') // true
125
- * types.isDecimal('42') // false
126
- * types.isDecimal('3.141', { decimalPlaces: '1,3' }) // true
127
- */
128
- isDecimal(value, options) {
129
- if (typeof value === 'number') {
130
- value = value.toString();
131
- }
132
- const decimalPlaces = (options && options.decimalPlaces) || '1,';
133
- return new RegExp(`^[-+]?([0-9]+)?(\\.[0-9]{${decimalPlaces}})$`).test(value);
134
- },
1
+ import is from "@sindresorhus/is";
2
+ var types_default = {
3
+ lookup: is,
4
+ isNull: is.null,
5
+ isBoolean: is.boolean,
6
+ isBuffer: is.buffer,
7
+ isNumber: is.number,
8
+ isString: is.string,
9
+ isArguments: is.arguments,
10
+ isObject: is.object,
11
+ isDate: is.date,
12
+ isArray: is.array,
13
+ isRegexp: is.regExp,
14
+ isError: is.error,
15
+ isFunction: is.function,
16
+ isClass: is.class,
17
+ isInteger: is.integer,
18
+ isFloat(value) {
19
+ return value !== (value | 0);
20
+ },
21
+ isDecimal(value, options) {
22
+ if (typeof value === "number") value = value.toString();
23
+ const decimalPlaces = options && options.decimalPlaces || "1,";
24
+ return (/* @__PURE__ */ new RegExp(`^[-+]?([0-9]+)?(\\.[0-9]{${decimalPlaces}})$`)).test(value);
25
+ }
135
26
  };
136
- export default types;
27
+ export { types_default as default };
@@ -1,120 +1,2 @@
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
- import { createHash } from 'node:crypto';
10
- import string from '@poppinss/utils/string';
11
- import { safeEqual, Secret } from '@poppinss/utils';
12
- import base64 from '@poppinss/utils/base64';
13
- /**
14
- * Verification token class can be used to create tokens publicly
15
- * shareable tokens while storing the token hash within the database.
16
- *
17
- * This class is used by the Auth and the Persona packages to manage
18
- * tokens for authentication and authorization purposes.
19
- *
20
- * @example
21
- * class UserToken extends VerificationToken {
22
- * constructor(user: User, secret: Secret<string>) {
23
- * super()
24
- * this.tokenableId = user.id
25
- * this.computeValue(secret)
26
- * }
27
- * }
28
- */
29
- export class VerificationToken {
30
- /**
31
- * Decodes a publicly shared token and return the series
32
- * and the token value from it.
33
- *
34
- * Returns null when unable to decode the token because of
35
- * invalid format or encoding.
36
- *
37
- * @param value - The token string to decode
38
- */
39
- static decode(value) {
40
- /**
41
- * Ensure value is a string and starts with the prefix.
42
- */
43
- if (typeof value !== 'string') {
44
- return null;
45
- }
46
- /**
47
- * Remove prefix from the rest of the token.
48
- */
49
- if (!value) {
50
- return null;
51
- }
52
- const [identifier, ...tokenValue] = value.split('.');
53
- if (!identifier || tokenValue.length === 0) {
54
- return null;
55
- }
56
- const decodedIdentifier = base64.urlDecode(identifier);
57
- const decodedSecret = base64.urlDecode(tokenValue.join('.'));
58
- if (!decodedIdentifier || !decodedSecret) {
59
- return null;
60
- }
61
- return {
62
- identifier: decodedIdentifier,
63
- secret: new Secret(decodedSecret),
64
- };
65
- }
66
- /**
67
- * Creates a transient token that can be shared with the persistence
68
- * layer.
69
- *
70
- * @param userId - The user ID for whom the token is being created
71
- * @param size - The size of the random token seed
72
- * @param expiresIn - Token expiration time (string like '2h' or number in seconds)
73
- */
74
- static createTransientToken(userId, size, expiresIn) {
75
- const expiresAt = new Date();
76
- expiresAt.setSeconds(expiresAt.getSeconds() + string.seconds.parse(expiresIn));
77
- return {
78
- userId,
79
- expiresAt,
80
- ...this.seed(size),
81
- };
82
- }
83
- /**
84
- * Creates a secret opaque token and its hash.
85
- *
86
- * @param size - The length of the random token to generate
87
- */
88
- static seed(size) {
89
- const seed = string.random(size);
90
- const secret = new Secret(seed);
91
- const hash = createHash('sha256').update(secret.release()).digest('hex');
92
- return { secret, hash };
93
- }
94
- /**
95
- * Compute the value property using the given secret. You can
96
- * get secret via the static "createTransientToken" method.
97
- *
98
- * @param secret - The secret value to compute the public token value from
99
- */
100
- computeValue(secret) {
101
- this.value = new Secret(`${base64.urlEncode(String(this.identifier))}.${base64.urlEncode(secret.release())}`);
102
- }
103
- /**
104
- * Check if the token has been expired. Verifies
105
- * the "expiresAt" timestamp with the current
106
- * date.
107
- */
108
- isExpired() {
109
- return this.expiresAt < new Date();
110
- }
111
- /**
112
- * Verifies the value of a token against the pre-defined hash
113
- *
114
- * @param secret - The secret to verify against the stored hash
115
- */
116
- verify(secret) {
117
- const newHash = createHash('sha256').update(secret.release()).digest('hex');
118
- return safeEqual(this.hash, newHash);
119
- }
120
- }
1
+ import { t as VerificationToken } from "../../verification_token-DrdoU4RH.js";
2
+ export { VerificationToken };
@@ -1,77 +1,8 @@
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
- import { Socket } from 'node:net';
10
- import Macroable from '@poppinss/macroable';
11
- import { IncomingMessage, ServerResponse } from 'node:http';
12
- import { HttpServerUtils } from "./http.js";
13
- import { CookieClient } from "../../modules/http/main.js";
14
- /**
15
- * Test utils has a collection of helper methods to make testing
16
- * experience great for AdonisJS applications. It provides utilities
17
- * for HTTP testing, context creation, and cookie handling.
18
- *
19
- * @example
20
- * const testUtils = new TestUtils(app)
21
- * await testUtils.boot()
22
- *
23
- * const ctx = await testUtils.createHttpContext()
24
- * const httpUtils = testUtils.httpServer()
25
- */
26
- export class TestUtils extends Macroable {
27
- app;
28
- /**
29
- * Flag to track if test utils have been booted
30
- */
31
- #booted = false;
32
- /**
33
- * Check if utils have been booted
34
- */
35
- get isBooted() {
36
- return this.#booted;
37
- }
38
- /**
39
- * Creates a new TestUtils instance
40
- *
41
- * @param app - The application service instance
42
- */
43
- constructor(app) {
44
- super();
45
- this.app = app;
46
- }
47
- /**
48
- * Boot test utils. It requires the app to be booted
49
- * and container to have all the bindings
50
- */
51
- async boot() {
52
- if (!this.isBooted) {
53
- this.#booted = true;
54
- this.cookies = new CookieClient(await this.app.container.make('encryption'));
55
- }
56
- }
57
- /**
58
- * Returns an instance of the HTTP server testing
59
- * utils
60
- */
61
- httpServer() {
62
- return new HttpServerUtils(this);
63
- }
64
- /**
65
- * Create an instance of HTTP context for testing
66
- *
67
- * @param options - Options for creating HTTP context with custom req/res objects
68
- */
69
- async createHttpContext(options = {}) {
70
- const req = options.req || new IncomingMessage(new Socket());
71
- const res = options.res || new ServerResponse(req);
72
- const server = await this.app.container.make('server');
73
- const request = server.createRequest(req, res);
74
- const response = server.createResponse(req, res);
75
- return server.createHttpContext(request, response, this.app.container.createResolver());
76
- }
77
- }
1
+ import "../../chunk-B88MteZI.js";
2
+ import "../../config_provider-DWVFHOQX.js";
3
+ import "../../main-nojlltNo.js";
4
+ import "../../exceptions-DNMesP42.js";
5
+ import "../../define_config-CoWy5lbf.js";
6
+ import "../../main-Bfnr5tAw.js";
7
+ import { t as TestUtils } from "../../main-BU8NWUEG.js";
8
+ export { TestUtils };
@@ -8,9 +8,10 @@ import type { HttpServerEvents, LookupList, RoutesList, SignedURLOptions, UrlFor
8
8
  import type { Dumper } from '../modules/dumper/dumper.ts';
9
9
  import type { LoggerManager } from '../modules/logger.ts';
10
10
  import type { HashManager } from '../modules/hash/main.ts';
11
- import type { Encryption } from '../modules/encryption.ts';
12
11
  import type { ManagerDriverFactory } from '../types/hash.ts';
13
12
  import type { Router, Server } from '../modules/http/main.ts';
13
+ import { type EncryptionConfig } from '../types/encryption.ts';
14
+ import type { EncryptionManager } from '../modules/encryption/main.ts';
14
15
  import type { ContainerResolveEventData } from '../types/container.ts';
15
16
  import type { LoggerConfig, LoggerManagerConfig } from '../types/logger.ts';
16
17
  /**
@@ -119,6 +120,30 @@ export interface HashersList {
119
120
  export type InferHashers<T extends ConfigProvider<{
120
121
  list: Record<string, ManagerDriverFactory>;
121
122
  }>> = Awaited<ReturnType<T['resolver']>>['list'];
123
+ /**
124
+ * A list of known encryptors inferred from the user config.
125
+ * This interface should be extended in user code to register
126
+ * custom encryptors.
127
+ *
128
+ * @example
129
+ * // Extending EncryptorsList in user code
130
+ * declare module '@adonisjs/core' {
131
+ * interface EncryptorsList {
132
+ * default: EncryptionConfig
133
+ * secondary: EncryptionConfig
134
+ * }
135
+ * }
136
+ */
137
+ export interface EncryptorsList {
138
+ }
139
+ /**
140
+ * Utility type to infer encryptors configurations from a config provider.
141
+ *
142
+ * @template T - The config provider type that resolves to an object with a 'list' property
143
+ */
144
+ export type InferEncryptors<T extends ConfigProvider<{
145
+ list: Record<string, EncryptionConfig>;
146
+ }>> = Awaited<ReturnType<T['resolver']>>['list'];
122
147
  /**
123
148
  * ----------------------------------------------------------------
124
149
  * Container services
@@ -132,77 +157,32 @@ export type InferHashers<T extends ConfigProvider<{
132
157
  * Application service is a singleton resolved from
133
158
  * the container. It provides access to the core application
134
159
  * instance with all registered bindings.
135
- *
136
- * @example
137
- * // Accessing application service in a controller
138
- * export default class HomeController {
139
- * async index({ app }: { app: ApplicationService }) {
140
- * const version = app.version
141
- * const env = app.env.get('NODE_ENV')
142
- * }
143
- * }
144
160
  */
145
161
  export interface ApplicationService extends Application<ContainerBindings extends Record<any, any> ? ContainerBindings : never> {
146
162
  }
147
163
  /**
148
164
  * Logger service is a singleton logger instance registered
149
165
  * to the container. It provides access to configured loggers.
150
- *
151
- * @example
152
- * // Using logger service in a controller
153
- * export default class UserController {
154
- * async store({ logger }: { logger: LoggerService }) {
155
- * logger.info('Creating new user')
156
- * logger.use('file').error('Failed to create user')
157
- * }
158
- * }
159
166
  */
160
167
  export interface LoggerService extends LoggerManager<LoggersList extends Record<string, LoggerConfig> ? LoggersList : never> {
161
168
  }
162
169
  /**
163
170
  * Emitter service is a singleton emitter instance registered
164
171
  * to the container. It provides type-safe event emission and listening.
165
- *
166
- * @example
167
- * // Using emitter service to emit events
168
- * export default class UserController {
169
- * async store({ emitter }: { emitter: EmitterService }) {
170
- * const user = await User.create(data)
171
- * emitter.emit('user:created', { user })
172
- * }
173
- * }
174
172
  */
175
173
  export interface EmitterService extends Emitter<EventsList> {
176
174
  }
177
175
  /**
178
- * Encryption service is a singleton Encryption class instance
179
- * registered to the container. It provides encryption and decryption
180
- * functionality using the application's secret key.
181
- *
182
- * @example
183
- * // Using encryption service
184
- * export default class PaymentController {
185
- * async process({ encryption }: { encryption: EncryptionService }) {
186
- * const encrypted = encryption.encrypt('sensitive-data')
187
- * const decrypted = encryption.decrypt(encrypted)
188
- * }
189
- * }
176
+ * Encryption service is a singleton instance of the EncryptionManager
177
+ * registered in the container. It provides encryption and decryption
178
+ * functionality with support for multiple encryptors.
190
179
  */
191
- export interface EncryptionService extends Encryption {
180
+ export interface EncryptionService extends EncryptionManager<EncryptorsList extends Record<string, EncryptionConfig> ? EncryptorsList : never> {
192
181
  }
193
182
  /**
194
183
  * Http server service added to the container as a singleton.
195
184
  * It provides access to the HTTP server instance for handling
196
185
  * requests and responses.
197
- *
198
- * @example
199
- * // Accessing server service in middleware
200
- * export default class CustomMiddleware {
201
- * async handle({ server }: { server: HttpServerService }, next: NextFn) {
202
- * console.log('Server listening on:', server.getPort())
203
- * return next()
204
- * }
205
- * }
206
186
  */
207
187
  export interface HttpServerService extends Server {
208
188
  }
@@ -210,14 +190,6 @@ export interface HttpServerService extends Server {
210
190
  * Http router service added to the container as a singleton.
211
191
  * It provides access to the application's router for defining
212
192
  * and managing routes.
213
- *
214
- * @example
215
- * // Using router service to define routes programmatically
216
- * export default class RouteProvider {
217
- * boot({ router }: { router: HttpRouterService }) {
218
- * router.get('/api/health', () => ({ status: 'ok' }))
219
- * }
220
- * }
221
193
  */
222
194
  export interface HttpRouterService extends Router {
223
195
  }
@@ -225,49 +197,20 @@ export interface HttpRouterService extends Router {
225
197
  * Url builder service offers a type-safe API for creating URLs
226
198
  * for pre-registered routes. It ensures type safety when building
227
199
  * URLs with parameters.
228
- *
229
- * @example
230
- * // Using URL builder service
231
- * export default class PostController {
232
- * async show({ urlBuilder }: { urlBuilder: UrlBuilderService }) {
233
- * const postUrl = urlBuilder.make('posts.show', { id: 1 })
234
- * const userUrl = urlBuilder.make('users.profile', { username: 'john' })
235
- * }
236
- * }
237
200
  */
238
- export interface UrlBuilderService extends UrlFor<RoutesList extends LookupList ? RoutesList : never, URLOptions> {
201
+ export interface UrlBuilderUrlFor extends UrlFor<RoutesList extends LookupList ? RoutesList : never, URLOptions> {
239
202
  }
240
203
  /**
241
204
  * Url builder service offers a type-safe API for creating signed URLs
242
205
  * for pre-registered routes. Signed URLs include a signature that prevents
243
206
  * tampering and can have expiration times.
244
- *
245
- * @example
246
- * // Using signed URL builder service
247
- * export default class FileController {
248
- * async getDownloadUrl({ signedUrlBuilder }: { signedUrlBuilder: SignedUrlBuilderService }) {
249
- * const signedUrl = signedUrlBuilder.make('files.download',
250
- * { id: 1 },
251
- * { expiresIn: '1h' }
252
- * )
253
- * }
254
- * }
255
207
  */
256
- export interface SignedUrlBuilderService extends UrlFor<RoutesList extends LookupList ? RoutesList : never, SignedURLOptions> {
208
+ export interface UrlBuilderSignedUrlFor extends UrlFor<RoutesList extends LookupList ? RoutesList : never, SignedURLOptions> {
257
209
  }
258
210
  /**
259
211
  * Hash service is a singleton instance of the HashManager
260
212
  * registered in the container. It provides password hashing
261
213
  * and verification functionality.
262
- *
263
- * @example
264
- * // Using hash service for password management
265
- * export default class AuthController {
266
- * async register({ hash }: { hash: HashService }) {
267
- * const hashedPassword = await hash.make('user-password')
268
- * const isValid = await hash.verify(hashedPassword, 'user-password')
269
- * }
270
- * }
271
214
  */
272
215
  export interface HashService extends HashManager<HashersList extends Record<string, ManagerDriverFactory> ? HashersList : never> {
273
216
  }
@@ -275,16 +218,6 @@ export interface HashService extends HashManager<HashersList extends Record<stri
275
218
  * A list of known container bindings. This interface defines
276
219
  * all the services that are registered in the IoC container
277
220
  * and available for dependency injection.
278
- *
279
- * @example
280
- * // Accessing container bindings in a service
281
- * export default class UserService {
282
- * constructor(
283
- * private logger: LoggerService,
284
- * private hash: HashService,
285
- * private emitter: EmitterService
286
- * ) {}
287
- * }
288
221
  */
289
222
  export interface ContainerBindings {
290
223
  /** Ace command-line kernel */
@@ -349,6 +282,8 @@ export type IndexEntitiesConfig = {
349
282
  importAlias?: string;
350
283
  /** Glob patterns for matching controller files */
351
284
  glob?: string[];
285
+ /** Path segments to skip from generated keys. Defaults to ['controllers'] */
286
+ skipSegments?: string[];
352
287
  };
353
288
  /** Configuration for listeners indexing */
354
289
  listeners?: {
@@ -360,6 +295,8 @@ export type IndexEntitiesConfig = {
360
295
  importAlias?: string;
361
296
  /** Glob patterns for matching listener files */
362
297
  glob?: string[];
298
+ /** Path segments to skip from generated keys. Defaults to ['listeners'] */
299
+ skipSegments?: string[];
363
300
  };
364
301
  /** Configuration for events indexing */
365
302
  events?: {
@@ -371,11 +308,28 @@ export type IndexEntitiesConfig = {
371
308
  importAlias?: string;
372
309
  /** Glob patterns for matching event files */
373
310
  glob?: string[];
311
+ /** Path segments to skip from generated keys. Defaults to ['events'] */
312
+ skipSegments?: string[];
374
313
  };
314
+ /** Configuration for transformers indexing */
375
315
  transformers?: {
316
+ /** Whether to enable transformers indexing */
376
317
  enabled?: boolean;
318
+ /** Whether to include shared props in transformers */
319
+ withSharedProps?: boolean;
320
+ /** Source directory for transformers */
377
321
  source?: string;
322
+ /** Import alias for transformers */
378
323
  importAlias?: string;
324
+ /** Glob patterns for matching transformer files */
379
325
  glob?: string[];
326
+ /** Path segments to skip from generated keys. Defaults to ['transformers'] */
327
+ skipSegments?: string[];
328
+ };
329
+ /** Configuration for manifest generation */
330
+ manifest?: {
331
+ /** Whether to enable manifest generation */
332
+ enabled?: boolean;
333
+ exclude?: string[];
380
334
  };
381
335
  };