@adonisjs/core 6.1.5-2 → 6.1.5-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 (197) hide show
  1. package/build/commands/build.d.ts +10 -0
  2. package/build/commands/build.js +65 -22
  3. package/build/commands/commands.json +1 -1
  4. package/build/commands/configure.d.ts +30 -3
  5. package/build/commands/configure.js +103 -25
  6. package/build/commands/eject.d.ts +4 -0
  7. package/build/commands/eject.js +16 -8
  8. package/build/commands/generate_key.d.ts +4 -0
  9. package/build/commands/generate_key.js +15 -8
  10. package/build/commands/inspect_rcfile.d.ts +9 -0
  11. package/build/commands/inspect_rcfile.js +36 -0
  12. package/build/commands/list/routes.d.ts +23 -0
  13. package/build/commands/list/routes.js +29 -13
  14. package/build/commands/main.d.ts +4 -0
  15. package/build/commands/make/command.d.ts +7 -1
  16. package/build/commands/make/command.js +20 -7
  17. package/build/commands/make/controller.d.ts +10 -1
  18. package/build/commands/make/controller.js +35 -14
  19. package/build/commands/make/event.d.ts +7 -1
  20. package/build/commands/make/event.js +20 -8
  21. package/build/commands/make/exception.d.ts +14 -0
  22. package/build/commands/make/exception.js +37 -0
  23. package/build/commands/make/listener.d.ts +8 -1
  24. package/build/commands/make/listener.js +28 -12
  25. package/build/commands/make/middleware.d.ts +8 -1
  26. package/build/commands/make/middleware.js +21 -8
  27. package/build/commands/make/preload.d.ts +22 -0
  28. package/build/commands/make/preload.js +99 -0
  29. package/build/commands/make/provider.d.ts +7 -1
  30. package/build/commands/make/provider.js +28 -8
  31. package/build/commands/make/service.d.ts +14 -0
  32. package/build/commands/make/service.js +37 -0
  33. package/build/commands/make/test.d.ts +10 -1
  34. package/build/commands/make/test.js +46 -10
  35. package/build/commands/make/validator.d.ts +14 -0
  36. package/build/commands/make/validator.js +37 -0
  37. package/build/commands/make/view.d.ts +14 -0
  38. package/build/commands/make/view.js +37 -0
  39. package/build/commands/repl.d.ts +14 -0
  40. package/build/commands/repl.js +30 -0
  41. package/build/commands/serve.d.ts +12 -0
  42. package/build/commands/serve.js +78 -27
  43. package/build/commands/test.d.ts +32 -0
  44. package/build/commands/test.js +203 -0
  45. package/build/factories/app.js +8 -0
  46. package/build/factories/bodyparser.js +8 -0
  47. package/build/factories/core/ace.d.ts +4 -1
  48. package/build/factories/core/ace.js +11 -0
  49. package/build/factories/core/ignitor.d.ts +20 -1
  50. package/build/factories/core/ignitor.js +35 -1
  51. package/build/factories/core/main.js +8 -0
  52. package/build/factories/core/test_utils.d.ts +4 -1
  53. package/build/factories/core/test_utils.js +11 -0
  54. package/build/factories/encryption.js +8 -0
  55. package/build/factories/events.js +8 -0
  56. package/build/factories/hash.js +8 -0
  57. package/build/factories/http.js +8 -0
  58. package/build/factories/logger.js +8 -0
  59. package/build/factories/stubs.d.ts +10 -0
  60. package/build/factories/stubs.js +23 -1
  61. package/build/index.d.ts +6 -2
  62. package/build/index.js +14 -1
  63. package/build/modules/ace/codemods.d.ts +54 -0
  64. package/build/modules/ace/codemods.js +133 -0
  65. package/build/modules/ace/commands.d.ts +48 -0
  66. package/build/modules/ace/commands.js +54 -0
  67. package/build/modules/ace/create_kernel.d.ts +9 -0
  68. package/build/modules/ace/create_kernel.js +32 -1
  69. package/build/modules/ace/kernel.d.ts +4 -0
  70. package/build/modules/ace/kernel.js +12 -0
  71. package/build/modules/ace/main.js +8 -0
  72. package/build/modules/ace/shell.d.ts +9 -1
  73. package/build/modules/ace/shell.js +21 -0
  74. package/build/modules/app.js +8 -0
  75. package/build/modules/bodyparser/bodyparser_middleware.d.ts +4 -0
  76. package/build/modules/bodyparser/bodyparser_middleware.js +12 -0
  77. package/build/modules/bodyparser/main.js +8 -0
  78. package/build/modules/config.js +8 -0
  79. package/build/modules/container.js +8 -0
  80. package/build/modules/encryption.js +8 -0
  81. package/build/modules/env.js +8 -0
  82. package/build/modules/events.js +8 -0
  83. package/build/modules/hash/define_config.d.ts +4 -0
  84. package/build/modules/hash/define_config.js +23 -0
  85. package/build/modules/hash/drivers/argon.d.ts +1 -0
  86. package/build/modules/hash/drivers/argon.js +9 -0
  87. package/build/modules/hash/drivers/bcrypt.d.ts +1 -0
  88. package/build/modules/hash/drivers/bcrypt.js +9 -0
  89. package/build/modules/hash/drivers/scrypt.d.ts +1 -0
  90. package/build/modules/hash/drivers/scrypt.js +9 -0
  91. package/build/modules/hash/drivers_collection.d.ts +16 -4
  92. package/build/modules/hash/drivers_collection.js +31 -8
  93. package/build/modules/hash/main.d.ts +1 -0
  94. package/build/modules/hash/main.js +9 -0
  95. package/build/modules/http/main.js +9 -0
  96. package/build/modules/http/request_validator.d.ts +44 -0
  97. package/build/modules/http/request_validator.js +74 -0
  98. package/build/modules/logger.js +8 -0
  99. package/build/modules/repl.d.ts +1 -0
  100. package/build/modules/repl.js +9 -0
  101. package/build/providers/app_provider.d.ts +31 -2
  102. package/build/providers/app_provider.js +44 -15
  103. package/build/providers/edge_provider.d.ts +10 -0
  104. package/build/providers/edge_provider.js +22 -0
  105. package/build/providers/hash_provider.d.ts +22 -2
  106. package/build/providers/hash_provider.js +49 -7
  107. package/build/providers/http_provider.d.ts +17 -0
  108. package/build/providers/http_provider.js +26 -1
  109. package/build/providers/repl_provider.d.ts +13 -0
  110. package/build/providers/repl_provider.js +35 -0
  111. package/build/providers/vinejs_provider.d.ts +5 -0
  112. package/build/providers/vinejs_provider.js +13 -0
  113. package/build/services/ace.js +15 -0
  114. package/build/services/app.d.ts +8 -0
  115. package/build/services/app.js +16 -0
  116. package/build/services/config.js +11 -0
  117. package/build/services/emitter.js +13 -2
  118. package/build/services/encryption.js +13 -2
  119. package/build/services/hash.js +13 -2
  120. package/build/services/logger.js +13 -2
  121. package/build/services/repl.d.ts +3 -0
  122. package/build/services/repl.js +18 -0
  123. package/build/services/router.js +13 -2
  124. package/build/services/server.js +13 -2
  125. package/build/services/test_utils.js +15 -0
  126. package/build/src/bindings/edge/main.d.ts +7 -0
  127. package/build/src/bindings/edge/main.js +58 -0
  128. package/build/src/bindings/edge/types.d.ts +18 -0
  129. package/build/src/bindings/edge/types.js +9 -0
  130. package/build/src/bindings/repl.d.ts +6 -0
  131. package/build/src/bindings/repl.js +78 -0
  132. package/build/src/bindings/vinejs/main.d.ts +13 -0
  133. package/build/src/bindings/vinejs/main.js +76 -0
  134. package/build/src/bindings/vinejs/types.d.ts +12 -0
  135. package/build/src/bindings/vinejs/types.js +9 -0
  136. package/build/src/cli_formatters/routes_list.d.ts +24 -1
  137. package/build/src/cli_formatters/routes_list.js +118 -0
  138. package/build/src/debug.d.ts +1 -1
  139. package/build/src/debug.js +8 -0
  140. package/build/src/exceptions.d.ts +1 -0
  141. package/build/src/exceptions.js +9 -0
  142. package/build/src/helpers/is.js +8 -0
  143. package/build/src/helpers/main.d.ts +1 -1
  144. package/build/src/helpers/main.js +9 -1
  145. package/build/src/helpers/parse_binding_reference.d.ts +40 -0
  146. package/build/src/helpers/parse_binding_reference.js +60 -0
  147. package/build/src/helpers/string.d.ts +26 -0
  148. package/build/src/helpers/string.js +15 -0
  149. package/build/src/helpers/types.d.ts +114 -16
  150. package/build/src/helpers/types.js +13 -0
  151. package/build/src/ignitor/ace.d.ts +12 -0
  152. package/build/src/ignitor/ace.js +50 -1
  153. package/build/src/ignitor/http.d.ts +9 -2
  154. package/build/src/ignitor/http.js +67 -0
  155. package/build/src/ignitor/main.d.ts +29 -1
  156. package/build/src/ignitor/main.js +56 -0
  157. package/build/src/ignitor/test.d.ts +10 -0
  158. package/build/src/ignitor/test.js +25 -0
  159. package/build/src/internal_helpers.d.ts +12 -5
  160. package/build/src/internal_helpers.js +35 -7
  161. package/build/src/test_utils/http.d.ts +10 -2
  162. package/build/src/test_utils/http.js +19 -0
  163. package/build/src/test_utils/main.d.ts +21 -3
  164. package/build/src/test_utils/main.js +27 -1
  165. package/build/src/types.d.ts +65 -4
  166. package/build/src/types.js +8 -0
  167. package/build/stubs/main.js +10 -0
  168. package/build/stubs/make/exception/main.stub +10 -0
  169. package/build/stubs/make/preload_file/main.stub +4 -0
  170. package/build/stubs/make/service/main.stub +4 -0
  171. package/build/stubs/make/validator/main.stub +5 -0
  172. package/build/stubs/make/view/main.stub +4 -0
  173. package/build/toolkit/commands/index_commands.d.ts +4 -0
  174. package/build/toolkit/commands/index_commands.js +13 -5
  175. package/build/toolkit/main.js +11 -0
  176. package/build/types/ace.js +8 -0
  177. package/build/types/app.js +8 -0
  178. package/build/types/bodyparser.js +8 -0
  179. package/build/types/container.js +8 -0
  180. package/build/types/encryption.js +8 -0
  181. package/build/types/events.js +8 -0
  182. package/build/types/hash.js +8 -0
  183. package/build/types/http.js +8 -0
  184. package/build/types/logger.js +8 -0
  185. package/build/types/repl.d.ts +1 -0
  186. package/build/types/repl.js +9 -0
  187. package/package.json +83 -121
  188. package/build/commands/make/_base.d.ts +0 -6
  189. package/build/commands/make/_base.js +0 -19
  190. package/build/legacy/validator.d.ts +0 -1
  191. package/build/legacy/validator.js +0 -1
  192. package/build/modules/http.js +0 -1
  193. package/build/src/helpers/string_builder.d.ts +0 -23
  194. package/build/src/helpers/string_builder.js +0 -86
  195. package/build/stubs/index.js +0 -2
  196. /package/build/modules/{http.d.ts → http/main.d.ts} +0 -0
  197. /package/build/stubs/{index.d.ts → main.d.ts} +0 -0
@@ -1 +1,9 @@
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
+ */
1
9
  export * from '@adonisjs/config';
@@ -1 +1,9 @@
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
+ */
1
9
  export * from '@adonisjs/fold';
@@ -1 +1,9 @@
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
+ */
1
9
  export * from '@adonisjs/encryption';
@@ -1 +1,9 @@
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
+ */
1
9
  export * from '@adonisjs/env';
@@ -1 +1,9 @@
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
+ */
1
9
  export * from '@adonisjs/events';
@@ -1,5 +1,8 @@
1
1
  import type { HashDriversList } from '../../src/types.js';
2
2
  import type { ManagerDriverFactory } from '../../types/hash.js';
3
+ /**
4
+ * Define config for the hash service.
5
+ */
3
6
  export declare function defineConfig<KnownHashers extends Record<string, {
4
7
  [K in keyof HashDriversList]: {
5
8
  driver: K;
@@ -9,6 +12,7 @@ export declare function defineConfig<KnownHashers extends Record<string, {
9
12
  list: KnownHashers;
10
13
  }): {
11
14
  default?: keyof KnownHashers;
15
+ driversInUse: Set<keyof HashDriversList>;
12
16
  list: {
13
17
  [K in keyof KnownHashers]: ManagerDriverFactory;
14
18
  };
@@ -1,18 +1,41 @@
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
+ */
1
9
  import { InvalidArgumentsException } from '@poppinss/utils';
2
10
  import driversCollection from './drivers_collection.js';
11
+ /**
12
+ * Define config for the hash service.
13
+ */
3
14
  export function defineConfig(config) {
15
+ /**
16
+ * Hashers list should always be provided
17
+ */
4
18
  if (!config.list) {
5
19
  throw new InvalidArgumentsException('Missing "list" property in hash config');
6
20
  }
21
+ /**
22
+ * The default hasher should be mentioned in the list
23
+ */
7
24
  if (config.default && !config.list[config.default]) {
8
25
  throw new InvalidArgumentsException(`Missing "list.${String(config.default)}" in hash config. It is referenced by the "default" property`);
9
26
  }
27
+ /**
28
+ * Converting list config to a collection that hash manager can use
29
+ */
30
+ const driversInUse = new Set();
10
31
  const managerHashers = Object.keys(config.list).reduce((result, disk) => {
11
32
  const hasherConfig = config.list[disk];
33
+ driversInUse.add(hasherConfig.driver);
12
34
  result[disk] = () => driversCollection.create(hasherConfig.driver, hasherConfig);
13
35
  return result;
14
36
  }, {});
15
37
  return {
38
+ driversInUse,
16
39
  default: config.default,
17
40
  list: managerHashers,
18
41
  };
@@ -0,0 +1 @@
1
+ export * from '@adonisjs/hash/drivers/argon';
@@ -0,0 +1,9 @@
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
+ export * from '@adonisjs/hash/drivers/argon';
@@ -0,0 +1 @@
1
+ export * from '@adonisjs/hash/drivers/bcrypt';
@@ -0,0 +1,9 @@
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
+ export * from '@adonisjs/hash/drivers/bcrypt';
@@ -0,0 +1 @@
1
+ export * from '@adonisjs/hash/drivers/scrypt';
@@ -0,0 +1,9 @@
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
+ export * from '@adonisjs/hash/drivers/scrypt';
@@ -1,9 +1,21 @@
1
- import { Argon, Bcrypt, Scrypt } from './main.js';
2
1
  import type { HashDriversList } from '../../src/types.js';
2
+ /**
3
+ * A global collection of Hash drivers
4
+ */
3
5
  declare class HashDriversCollection {
6
+ /**
7
+ * List of registered drivers
8
+ */
4
9
  list: Partial<HashDriversList>;
10
+ /**
11
+ * Extend drivers collection and add a custom
12
+ * driver to it.
13
+ */
5
14
  extend<Name extends keyof HashDriversList>(driverName: Name, factoryCallback: HashDriversList[Name]): this;
6
- create<Name extends keyof HashDriversList>(name: Name, config: Parameters<HashDriversList[Name]>[0]): Bcrypt | Argon | Scrypt;
15
+ /**
16
+ * Creates the driver instance with config
17
+ */
18
+ create<Name extends keyof HashDriversList>(name: Name, config: Parameters<HashDriversList[Name]>[0]): import("@adonisjs/hash/drivers/bcrypt").Bcrypt | import("@adonisjs/hash/drivers/argon").Argon | import("@adonisjs/hash/drivers/scrypt").Scrypt;
7
19
  }
8
- declare const hashDriversCollection: HashDriversCollection;
9
- export default hashDriversCollection;
20
+ declare const _default: HashDriversCollection;
21
+ export default _default;
@@ -1,15 +1,39 @@
1
- import { Argon, Bcrypt, Scrypt } from './main.js';
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
+ /**
10
+ * This class exists in the core, because it maintains a list of
11
+ * globally available drivers applicable to the hash manager
12
+ * instance registered with the container.
13
+ *
14
+ * In other words, these drivers are not needed by the hash module
15
+ * regular usage and specific to AdonisJS container flow.
16
+ */
2
17
  import { RuntimeException } from '@poppinss/utils';
18
+ /**
19
+ * A global collection of Hash drivers
20
+ */
3
21
  class HashDriversCollection {
4
- list = {
5
- bcrypt: (config) => new Bcrypt(config),
6
- argon2: (config) => new Argon(config),
7
- scrypt: (config) => new Scrypt(config),
8
- };
22
+ /**
23
+ * List of registered drivers
24
+ */
25
+ list = {};
26
+ /**
27
+ * Extend drivers collection and add a custom
28
+ * driver to it.
29
+ */
9
30
  extend(driverName, factoryCallback) {
10
31
  this.list[driverName] = factoryCallback;
11
32
  return this;
12
33
  }
34
+ /**
35
+ * Creates the driver instance with config
36
+ */
13
37
  create(name, config) {
14
38
  const driverFactory = this.list[name];
15
39
  if (!driverFactory) {
@@ -18,5 +42,4 @@ class HashDriversCollection {
18
42
  return driverFactory(config);
19
43
  }
20
44
  }
21
- const hashDriversCollection = new HashDriversCollection();
22
- export default hashDriversCollection;
45
+ export default new HashDriversCollection();
@@ -1,2 +1,3 @@
1
1
  export * from '@adonisjs/hash';
2
2
  export { defineConfig } from './define_config.js';
3
+ export { default as driversList } from './drivers_collection.js';
@@ -1,2 +1,11 @@
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
+ */
1
9
  export * from '@adonisjs/hash';
2
10
  export { defineConfig } from './define_config.js';
11
+ export { default as driversList } from './drivers_collection.js';
@@ -0,0 +1,9 @@
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
+ export * from '@adonisjs/http-server';
@@ -0,0 +1,44 @@
1
+ import { type VineValidator } from '@vinejs/vine';
2
+ import type { Infer, SchemaTypes, ValidationOptions, ErrorReporterContract, MessagesProviderContact } from '@vinejs/vine/types';
3
+ import { type HttpContext } from '@adonisjs/http-server';
4
+ declare module '@adonisjs/http-server' {
5
+ interface Request extends RequestValidator {
6
+ }
7
+ }
8
+ /**
9
+ * Request validation options with custom data as well
10
+ */
11
+ type RequestValidationOptions<MetaData extends undefined | Record<string, any>> = ValidationOptions<MetaData> & {
12
+ data?: any;
13
+ };
14
+ /**
15
+ * Request validator is used validate HTTP request data using
16
+ * VineJS validators. You may validate the request body,
17
+ * files, cookies, and headers.
18
+ */
19
+ export declare class RequestValidator {
20
+ #private;
21
+ constructor(ctx: HttpContext);
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?: (_: HttpContext) => ErrorReporterContract;
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?: (_: HttpContext) => MessagesProviderContact;
38
+ /**
39
+ * The validate method can be used to validate the request
40
+ * data for the current request using VineJS validators
41
+ */
42
+ 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>>;
43
+ }
44
+ export {};
@@ -0,0 +1,74 @@
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 { Request } from '@adonisjs/http-server';
10
+ /**
11
+ * Request validator is used validate HTTP request data using
12
+ * VineJS validators. You may validate the request body,
13
+ * files, cookies, and headers.
14
+ */
15
+ export class RequestValidator {
16
+ #ctx;
17
+ constructor(ctx) {
18
+ this.#ctx = ctx;
19
+ }
20
+ /**
21
+ * The error reporter method returns the error reporter
22
+ * to use for reporting errors.
23
+ *
24
+ * You can use this function to pick a different error reporter
25
+ * for each HTTP request
26
+ */
27
+ static errorReporter;
28
+ /**
29
+ * The messages provider method returns the messages provider to use
30
+ * finding custom error messages
31
+ *
32
+ * You can use this function to pick a different messages provider for
33
+ * each HTTP request
34
+ */
35
+ static messagesProvider;
36
+ /**
37
+ * The validate method can be used to validate the request
38
+ * data for the current request using VineJS validators
39
+ */
40
+ validateUsing(validator, ...[options]) {
41
+ const validatorOptions = options || {};
42
+ /**
43
+ * Assign request specific error reporter
44
+ */
45
+ if (RequestValidator.errorReporter) {
46
+ const errorReporter = RequestValidator.errorReporter(this.#ctx);
47
+ validatorOptions.errorReporter = () => errorReporter;
48
+ }
49
+ /**
50
+ * Assign request specific messages provider
51
+ */
52
+ if (RequestValidator.messagesProvider) {
53
+ validatorOptions.messagesProvider = RequestValidator.messagesProvider(this.#ctx);
54
+ }
55
+ /**
56
+ * Data to validate
57
+ */
58
+ const data = validatorOptions.data || {
59
+ ...this.#ctx.request.all(),
60
+ ...this.#ctx.request.allFiles(),
61
+ params: this.#ctx.request.params(),
62
+ headers: this.#ctx.request.headers(),
63
+ cookies: this.#ctx.request.cookiesList(),
64
+ };
65
+ return validator.validate(data, validatorOptions);
66
+ }
67
+ }
68
+ /**
69
+ * The validate method can be used to validate the request
70
+ * data for the current request using VineJS validators
71
+ */
72
+ Request.macro('validateUsing', function (...args) {
73
+ return new RequestValidator(this.ctx).validateUsing(...args);
74
+ });
@@ -1 +1,9 @@
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
+ */
1
9
  export * from '@adonisjs/logger';
@@ -0,0 +1 @@
1
+ export * from '@adonisjs/repl';
@@ -0,0 +1,9 @@
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
+ export * from '@adonisjs/repl';
@@ -1,16 +1,45 @@
1
1
  import type { ApplicationService } from '../src/types.js';
2
+ /**
3
+ * The Application Service provider registers all the baseline
4
+ * features required to run the framework.
5
+ */
2
6
  export default class AppServiceProvider {
3
7
  protected app: ApplicationService;
4
8
  constructor(app: ApplicationService);
9
+ /**
10
+ * Registers test utils with the container
11
+ */
5
12
  protected registerTestUtils(): void;
13
+ /**
14
+ * Registers ace with the container
15
+ */
6
16
  protected registerAce(): void;
17
+ /**
18
+ * Registers the application to the container
19
+ */
7
20
  protected registerApp(): void;
21
+ /**
22
+ * Registers the logger class to resolve the default logger
23
+ */
8
24
  protected registerLogger(): void;
25
+ /**
26
+ * Registers the logger manager to the container
27
+ */
9
28
  protected registerLoggerManager(): void;
29
+ /**
30
+ * Registers the config to the container
31
+ */
10
32
  protected registerConfig(): void;
33
+ /**
34
+ * Registers emitter service to the container
35
+ */
11
36
  protected registerEmitter(): void;
37
+ /**
38
+ * Register the encryption service to the container
39
+ */
12
40
  protected registerEncryption(): void;
13
- protected configureValidator(): Promise<void>;
41
+ /**
42
+ * Registers bindings
43
+ */
14
44
  register(): void;
15
- boot(): Promise<void>;
16
45
  }
@@ -1,52 +1,85 @@
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
+ */
1
9
  import { Config } from '../modules/config.js';
2
- import { Emitter } from '../modules/events.js';
3
- import { validator } from '../legacy/validator.js';
10
+ import { Logger } from '../modules/logger.js';
4
11
  import { Encryption } from '../modules/encryption.js';
5
- import { Logger, LoggerManager } from '../modules/logger.js';
12
+ /**
13
+ * The Application Service provider registers all the baseline
14
+ * features required to run the framework.
15
+ */
6
16
  export default class AppServiceProvider {
7
17
  app;
8
18
  constructor(app) {
9
19
  this.app = app;
10
20
  }
21
+ /**
22
+ * Registers test utils with the container
23
+ */
11
24
  registerTestUtils() {
12
25
  this.app.container.singleton('testUtils', async () => {
13
26
  const { TestUtils } = await import('../src/test_utils/main.js');
14
27
  return new TestUtils(this.app);
15
28
  });
16
29
  }
30
+ /**
31
+ * Registers ace with the container
32
+ */
17
33
  registerAce() {
18
34
  this.app.container.singleton('ace', async () => {
19
35
  const { createAceKernel } = await import('../modules/ace/create_kernel.js');
20
36
  return createAceKernel(this.app);
21
37
  });
22
38
  }
39
+ /**
40
+ * Registers the application to the container
41
+ */
23
42
  registerApp() {
24
43
  this.app.container.singleton('app', () => this.app);
25
44
  }
45
+ /**
46
+ * Registers the logger class to resolve the default logger
47
+ */
26
48
  registerLogger() {
27
49
  this.app.container.singleton(Logger, async (resolver) => {
28
50
  const loggerManager = await resolver.make('logger');
29
51
  return loggerManager.use();
30
52
  });
31
53
  }
54
+ /**
55
+ * Registers the logger manager to the container
56
+ */
32
57
  registerLoggerManager() {
33
- const LoggerServiceManager = LoggerManager;
34
- this.app.container.singleton(LoggerServiceManager, () => {
58
+ this.app.container.singleton('logger', async () => {
59
+ const { LoggerManager } = await import('../modules/logger.js');
35
60
  const config = this.app.config.get('logger');
36
61
  return new LoggerManager(config);
37
62
  });
38
- this.app.container.alias('logger', LoggerServiceManager);
39
63
  }
64
+ /**
65
+ * Registers the config to the container
66
+ */
40
67
  registerConfig() {
41
68
  this.app.container.singleton(Config, () => this.app.config);
42
69
  this.app.container.alias('config', Config);
43
70
  }
71
+ /**
72
+ * Registers emitter service to the container
73
+ */
44
74
  registerEmitter() {
45
- this.app.container.singleton(Emitter, () => {
75
+ this.app.container.singleton('emitter', async () => {
76
+ const { Emitter } = await import('../modules/events.js');
46
77
  return new Emitter(this.app);
47
78
  });
48
- this.app.container.alias('emitter', Emitter);
49
79
  }
80
+ /**
81
+ * Register the encryption service to the container
82
+ */
50
83
  registerEncryption() {
51
84
  this.app.container.singleton(Encryption, () => {
52
85
  const appKey = this.app.config.get('app.appKey');
@@ -54,10 +87,9 @@ export default class AppServiceProvider {
54
87
  });
55
88
  this.app.container.alias('encryption', Encryption);
56
89
  }
57
- async configureValidator() {
58
- const config = await this.app.container.make('config');
59
- validator.configure(config.get('validator', {}));
60
- }
90
+ /**
91
+ * Registers bindings
92
+ */
61
93
  register() {
62
94
  this.registerApp();
63
95
  this.registerAce();
@@ -68,7 +100,4 @@ export default class AppServiceProvider {
68
100
  this.registerEncryption();
69
101
  this.registerTestUtils();
70
102
  }
71
- async boot() {
72
- await this.configureValidator();
73
- }
74
103
  }
@@ -0,0 +1,10 @@
1
+ import '../src/bindings/edge/types.js';
2
+ import type { ApplicationService } from '../src/types.js';
3
+ export default class EdgeServiceProvider {
4
+ protected app: ApplicationService;
5
+ constructor(app: ApplicationService);
6
+ /**
7
+ * Bridge AdonisJS and Edge
8
+ */
9
+ boot(): Promise<void>;
10
+ }
@@ -0,0 +1,22 @@
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 '../src/bindings/edge/types.js';
10
+ import { bridgeEdgeAdonisJS } from '../src/bindings/edge/main.js';
11
+ export default class EdgeServiceProvider {
12
+ app;
13
+ constructor(app) {
14
+ this.app = app;
15
+ }
16
+ /**
17
+ * Bridge AdonisJS and Edge
18
+ */
19
+ async boot() {
20
+ bridgeEdgeAdonisJS(this.app, await this.app.container.make('router'));
21
+ }
22
+ }
@@ -1,9 +1,29 @@
1
- import type { ApplicationService } from '../src/types.js';
1
+ import type { ApplicationService, HashDriversList } from '../src/types.js';
2
+ /**
3
+ * Registers the passwords hasher with the container
4
+ */
2
5
  export default class HashServiceProvider {
3
6
  protected app: ApplicationService;
4
7
  constructor(app: ApplicationService);
5
- protected registerHashDrivers(): void;
8
+ /**
9
+ * Lazily registers a hash driver with the driversList collection
10
+ */
11
+ protected registerHashDrivers(driversInUse: Set<keyof HashDriversList>): Promise<void>;
12
+ /**
13
+ * Registering the hash class to resolve an instance with the
14
+ * default hasher.
15
+ */
6
16
  protected registerHash(): void;
17
+ /**
18
+ * Registers the hash manager with the container
19
+ */
7
20
  protected registerHashManager(): void;
21
+ /**
22
+ * Registers bindings
23
+ */
8
24
  register(): void;
25
+ /**
26
+ * Register drivers based upon hash config
27
+ */
28
+ boot(): void;
9
29
  }