@adonisjs/core 7.0.0-next.9 → 7.0.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 (210) hide show
  1. package/README.md +62 -1
  2. package/build/chunk-iKc69rpz.js +26 -0
  3. package/build/commands/add.d.ts +4 -3
  4. package/build/commands/add.js +73 -110
  5. package/build/commands/build.js +51 -107
  6. package/build/commands/commands.json +1 -1
  7. package/build/commands/configure.js +81 -177
  8. package/build/commands/eject.js +17 -60
  9. package/build/commands/env/add.js +55 -134
  10. package/build/commands/generate_key.js +22 -66
  11. package/build/commands/inspect_rcfile.js +27 -55
  12. package/build/commands/list/routes.js +246 -116
  13. package/build/commands/make/command.d.ts +5 -0
  14. package/build/commands/make/command.js +16 -57
  15. package/build/commands/make/controller.d.ts +5 -0
  16. package/build/commands/make/controller.js +44 -120
  17. package/build/commands/make/event.d.ts +5 -0
  18. package/build/commands/make/event.js +17 -62
  19. package/build/commands/make/exception.d.ts +5 -0
  20. package/build/commands/make/exception.js +17 -62
  21. package/build/commands/make/listener.d.ts +5 -0
  22. package/build/commands/make/listener.js +37 -93
  23. package/build/commands/make/middleware.d.ts +5 -0
  24. package/build/commands/make/middleware.js +42 -101
  25. package/build/commands/make/preload.d.ts +5 -0
  26. package/build/commands/make/preload.js +48 -113
  27. package/build/commands/make/provider.d.ts +5 -0
  28. package/build/commands/make/provider.js +48 -112
  29. package/build/commands/make/service.d.ts +5 -0
  30. package/build/commands/make/service.js +17 -55
  31. package/build/commands/make/test.d.ts +5 -0
  32. package/build/commands/make/test.js +48 -132
  33. package/build/commands/make/transformer.d.ts +5 -0
  34. package/build/commands/make/transformer.js +18 -64
  35. package/build/commands/make/validator.d.ts +5 -0
  36. package/build/commands/make/validator.js +21 -80
  37. package/build/commands/make/view.d.ts +5 -0
  38. package/build/commands/make/view.js +16 -56
  39. package/build/commands/repl.js +17 -50
  40. package/build/commands/serve.js +80 -150
  41. package/build/commands/test.js +92 -202
  42. package/build/config_provider-FIAUgvae.js +13 -0
  43. package/build/core-IpCOCkUL.js +146 -0
  44. package/build/create_kernel-B7ILNhuP.js +38 -0
  45. package/build/create_kernel-BD0Iqi8e.js +3 -0
  46. package/build/debug-CGQmxzGt.js +3 -0
  47. package/build/decorate-DmrZA614.js +7 -0
  48. package/build/define_config-0oHaj43l.js +86 -0
  49. package/build/dumper-BBgqFX5a.js +147 -0
  50. package/build/errors-CrCO-k44.js +8 -0
  51. package/build/factories/app.js +2 -9
  52. package/build/factories/bodyparser.js +2 -9
  53. package/build/factories/core/ace.js +22 -45
  54. package/build/factories/core/ignitor.js +74 -180
  55. package/build/factories/core/main.js +18 -11
  56. package/build/factories/core/test_utils.js +19 -42
  57. package/build/factories/encryption.d.ts +1 -1
  58. package/build/factories/encryption.js +2 -9
  59. package/build/factories/events.js +2 -9
  60. package/build/factories/hash.js +2 -9
  61. package/build/factories/http.js +2 -9
  62. package/build/factories/logger.js +2 -9
  63. package/build/factories/stubs.d.ts +1 -6
  64. package/build/factories/stubs.js +24 -91
  65. package/build/index.d.ts +1 -1
  66. package/build/index.js +10 -46
  67. package/build/main--nXd7T-C.js +73 -0
  68. package/build/main-Cxz0TyIw.js +173 -0
  69. package/build/main-DN2qEEg5.js +41 -0
  70. package/build/main-DkNgvceD.js +52 -0
  71. package/build/main-MBAMnmJb.js +81 -0
  72. package/build/main-kn40V-hF.js +2 -0
  73. package/build/{stubs/make → make}/health/controller.stub +5 -2
  74. package/build/modules/ace/codemods.d.ts +75 -23
  75. package/build/modules/ace/codemods.js +291 -476
  76. package/build/modules/ace/main.js +2 -41
  77. package/build/modules/app.js +6 -26
  78. package/build/modules/bodyparser/bodyparser_middleware.js +3 -14
  79. package/build/modules/bodyparser/main.js +6 -9
  80. package/build/modules/config.js +6 -26
  81. package/build/modules/container.js +6 -9
  82. package/build/modules/dumper/main.js +6 -32
  83. package/build/modules/dumper/plugins/edge.js +46 -61
  84. package/build/modules/encryption/define_config.d.ts +161 -0
  85. package/build/modules/encryption/drivers/aes_256_cbc.d.ts +20 -0
  86. package/build/modules/encryption/drivers/aes_256_cbc.js +2 -0
  87. package/build/modules/encryption/drivers/aes_256_gcm.d.ts +21 -0
  88. package/build/modules/encryption/drivers/aes_256_gcm.js +2 -0
  89. package/build/modules/encryption/drivers/aes_siv.d.ts +19 -0
  90. package/build/modules/encryption/drivers/aes_siv.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/drivers/legacy.d.ts +84 -0
  94. package/build/modules/encryption/drivers/legacy.js +57 -0
  95. package/build/modules/encryption/errors.d.ts +16 -0
  96. package/build/modules/encryption/main.d.ts +89 -0
  97. package/build/modules/encryption/main.js +6 -0
  98. package/build/modules/env/editor.js +2 -9
  99. package/build/modules/env/main.js +2 -28
  100. package/build/modules/events.js +6 -9
  101. package/build/modules/hash/drivers/argon.js +2 -9
  102. package/build/modules/hash/drivers/bcrypt.js +2 -20
  103. package/build/modules/hash/drivers/scrypt.js +2 -9
  104. package/build/modules/hash/main.js +6 -28
  105. package/build/modules/hash/phc_formatter.js +2 -9
  106. package/build/modules/health.js +2 -9
  107. package/build/modules/http/helpers.d.ts +1 -0
  108. package/build/modules/http/helpers.js +2 -0
  109. package/build/modules/http/main.js +4 -15
  110. package/build/modules/http/request_validator.d.ts +3 -4
  111. package/build/modules/http/url_builder_client.js +2 -9
  112. package/build/modules/logger.d.ts +30 -0
  113. package/build/modules/logger.js +14 -9
  114. package/build/modules/repl.js +6 -9
  115. package/build/modules/transformers/main.js +2 -9
  116. package/build/providers/app_provider.d.ts +5 -13
  117. package/build/providers/app_provider.js +153 -359
  118. package/build/providers/edge_provider.js +98 -164
  119. package/build/providers/hash_provider.js +29 -91
  120. package/build/providers/repl_provider.js +66 -152
  121. package/build/providers/vinejs_provider.d.ts +1 -1
  122. package/build/providers/vinejs_provider.js +21 -65
  123. package/build/services/ace.js +1 -16
  124. package/build/services/app.js +3 -19
  125. package/build/services/config.js +1 -12
  126. package/build/services/dumper.js +4 -20
  127. package/build/services/emitter.js +1 -13
  128. package/build/services/encryption.js +1 -13
  129. package/build/services/hash.js +1 -13
  130. package/build/services/logger.js +1 -13
  131. package/build/services/repl.js +1 -13
  132. package/build/services/router.js +1 -13
  133. package/build/services/server.js +1 -13
  134. package/build/services/test_utils.js +1 -16
  135. package/build/services/url_builder.d.ts +3 -3
  136. package/build/services/url_builder.js +4 -16
  137. package/build/src/assembler_hooks/index_entities.d.ts +34 -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.js +2 -28
  142. package/build/src/helpers/is.js +3 -31
  143. package/build/src/helpers/main.js +5 -52
  144. package/build/src/helpers/string.js +26 -76
  145. package/build/src/helpers/types.js +25 -134
  146. package/build/src/helpers/verification_token.js +46 -120
  147. package/build/src/test_utils/main.js +8 -77
  148. package/build/src/types.d.ts +53 -99
  149. package/build/src/types.js +0 -8
  150. package/build/src/utils.d.ts +1 -1
  151. package/build/src/vine.js +29 -101
  152. package/build/toolkit/main.js +19 -21
  153. package/build/types/ace.js +2 -9
  154. package/build/types/app.js +2 -9
  155. package/build/types/bodyparser.js +2 -9
  156. package/build/types/common.js +2 -9
  157. package/build/types/container.js +2 -9
  158. package/build/types/encryption.d.ts +53 -1
  159. package/build/types/encryption.js +1 -9
  160. package/build/types/events.js +2 -9
  161. package/build/types/hash.js +2 -9
  162. package/build/types/health.js +2 -9
  163. package/build/types/helpers.js +0 -8
  164. package/build/types/http.js +2 -9
  165. package/build/types/logger.js +2 -9
  166. package/build/types/repl.js +2 -9
  167. package/build/types/transformers.js +2 -9
  168. package/build/utils-rRkbAPnP.js +42 -0
  169. package/package.json +117 -62
  170. package/build/modules/ace/commands.js +0 -157
  171. package/build/modules/ace/create_kernel.js +0 -91
  172. package/build/modules/ace/kernel.js +0 -40
  173. package/build/modules/dumper/define_config.js +0 -36
  174. package/build/modules/dumper/dumper.js +0 -266
  175. package/build/modules/dumper/errors.js +0 -119
  176. package/build/modules/encryption.d.ts +0 -18
  177. package/build/modules/encryption.js +0 -26
  178. package/build/modules/hash/define_config.js +0 -125
  179. package/build/modules/http/request_validator.js +0 -100
  180. package/build/src/assembler_hooks/index_entities.js +0 -112
  181. package/build/src/cli_formatters/routes_list.js +0 -397
  182. package/build/src/config_provider.js +0 -71
  183. package/build/src/debug.js +0 -25
  184. package/build/src/ignitor/ace.js +0 -102
  185. package/build/src/ignitor/http.js +0 -159
  186. package/build/src/ignitor/main.js +0 -124
  187. package/build/src/ignitor/test.js +0 -66
  188. package/build/src/test_utils/http.js +0 -82
  189. package/build/src/utils.js +0 -114
  190. package/build/stubs/main.js +0 -9
  191. package/build/toolkit/commands/index_commands.js +0 -30
  192. /package/build/{stubs/make → make}/command/main.stub +0 -0
  193. /package/build/{stubs/make → make}/controller/actions.stub +0 -0
  194. /package/build/{stubs/make → make}/controller/api.stub +0 -0
  195. /package/build/{stubs/make → make}/controller/main.stub +0 -0
  196. /package/build/{stubs/make → make}/controller/resource.stub +0 -0
  197. /package/build/{stubs/make → make}/event/main.stub +0 -0
  198. /package/build/{stubs/make → make}/exception/main.stub +0 -0
  199. /package/build/{stubs/make → make}/health/main.stub +0 -0
  200. /package/build/{stubs/make → make}/listener/for_event.stub +0 -0
  201. /package/build/{stubs/make → make}/listener/main.stub +0 -0
  202. /package/build/{stubs/make → make}/middleware/main.stub +0 -0
  203. /package/build/{stubs/make → make}/preload/main.stub +0 -0
  204. /package/build/{stubs/make → make}/provider/main.stub +0 -0
  205. /package/build/{stubs/make → make}/service/main.stub +0 -0
  206. /package/build/{stubs/make → make}/test/main.stub +0 -0
  207. /package/build/{stubs/make → make}/transformer/main.stub +0 -0
  208. /package/build/{stubs/make → make}/validator/main.stub +0 -0
  209. /package/build/{stubs/make → make}/validator/resource.stub +0 -0
  210. /package/build/{stubs/make → make}/view/main.stub +0 -0
@@ -1,41 +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
- /**
10
- * Ace command line interface module for AdonisJS applications.
11
- * Provides the kernel, base commands, and utilities for building CLI applications.
12
- *
13
- * @example
14
- * // Create and use the Ace kernel
15
- * import { Kernel, BaseCommand } from '@adonisjs/core/ace'
16
- *
17
- * const kernel = new Kernel(app)
18
- * await kernel.handle(['make:controller', 'UserController'])
19
- *
20
- * @example
21
- * // Create a custom command
22
- * import { BaseCommand, args, flags } from '@adonisjs/core/ace'
23
- *
24
- * export default class MakeUser extends BaseCommand {
25
- * static commandName = 'make:user'
26
- * static description = 'Create a new user'
27
- *
28
- * @args.string({ description: 'Name of the user' })
29
- * declare name: string
30
- *
31
- * @flags.boolean({ description: 'Create admin user' })
32
- * declare admin: boolean
33
- *
34
- * async run() {
35
- * this.logger.info(`Creating user: ${this.name}`)
36
- * }
37
- * }
38
- */
39
- export { Kernel } from "./kernel.js";
40
- export { BaseCommand, ListCommand } from "./commands.js";
41
- export { args, flags, errors, Parser, FsLoader, ListLoader, cliHelpers, HelpCommand, IndexGenerator, tracingChannels, } from '@adonisjs/ace';
1
+ import { a as Parser, c as errors, d as Kernel, f as BaseCommand, i as ListLoader, l as flags, n as HelpCommand, o as args, p as ListCommand, r as IndexGenerator, s as cliHelpers, t as FsLoader, u as tracingChannels } from "../../main-MBAMnmJb.js";
2
+ export { BaseCommand, FsLoader, HelpCommand, IndexGenerator, Kernel, ListCommand, ListLoader, Parser, args, cliHelpers, errors, flags, tracingChannels };
@@ -1,26 +1,6 @@
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
- * Application module re-exports all functionality from @adonisjs/application.
11
- * This includes the main Application class and related types for managing
12
- * the AdonisJS application lifecycle, container bindings, and service providers.
13
- *
14
- * @example
15
- * // Import the Application class
16
- * import { Application } from '@adonisjs/core/app'
17
- *
18
- * const app = new Application(new URL('../', import.meta.url))
19
- * await app.init()
20
- * await app.boot()
21
- *
22
- * @example
23
- * // Import application types
24
- * import type { ApplicationService, ContainerBindings } from '@adonisjs/core/app'
25
- */
26
- export * from '@adonisjs/application';
1
+ import { n as __reExport, t as __exportAll } from "../chunk-iKc69rpz.js";
2
+ export * from "@adonisjs/application";
3
+ var app_exports = /* @__PURE__ */ __exportAll({});
4
+ import * as import__adonisjs_application from "@adonisjs/application";
5
+ __reExport(app_exports, import__adonisjs_application);
6
+ export { app_exports as t };
@@ -1,14 +1,3 @@
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 { BodyParserMiddleware } from '@adonisjs/bodyparser/bodyparser_middleware';
10
- /**
11
- * Default export allows lazy importing middleware with
12
- * destructuring the named exports
13
- */
14
- export default BodyParserMiddleware;
1
+ import { BodyParserMiddleware } from "@adonisjs/bodyparser/bodyparser_middleware";
2
+ var bodyparser_middleware_default = BodyParserMiddleware;
3
+ export { bodyparser_middleware_default as default };
@@ -1,9 +1,6 @@
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/bodyparser';
1
+ import { n as __reExport, t as __exportAll } from "../../chunk-iKc69rpz.js";
2
+ export * from "@adonisjs/bodyparser";
3
+ var main_exports = /* @__PURE__ */ __exportAll({});
4
+ import * as import__adonisjs_bodyparser from "@adonisjs/bodyparser";
5
+ __reExport(main_exports, import__adonisjs_bodyparser);
6
+ export { main_exports as t };
@@ -1,26 +1,6 @@
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
- * Configuration module re-exports all functionality from @adonisjs/config.
11
- * This includes the Config class and related types for managing application
12
- * configuration files and environment-specific settings.
13
- *
14
- * @example
15
- * // Import the Config class
16
- * import { Config } from '@adonisjs/core/config'
17
- *
18
- * const config = new Config()
19
- * config.set('database.connection', 'mysql')
20
- * const dbConnection = config.get('database.connection')
21
- *
22
- * @example
23
- * // Import configuration types
24
- * import type { ConfigProvider } from '@adonisjs/core/config'
25
- */
26
- export * from '@adonisjs/config';
1
+ import { n as __reExport, t as __exportAll } from "../chunk-iKc69rpz.js";
2
+ export * from "@adonisjs/config";
3
+ var config_exports = /* @__PURE__ */ __exportAll({});
4
+ import * as import__adonisjs_config from "@adonisjs/config";
5
+ __reExport(config_exports, import__adonisjs_config);
6
+ export { config_exports as t };
@@ -1,9 +1,6 @@
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/fold';
1
+ import { n as __reExport, t as __exportAll } from "../chunk-iKc69rpz.js";
2
+ export * from "@adonisjs/fold";
3
+ var container_exports = /* @__PURE__ */ __exportAll({});
4
+ import * as import__adonisjs_fold from "@adonisjs/fold";
5
+ __reExport(container_exports, import__adonisjs_fold);
6
+ export { container_exports as t };
@@ -1,32 +1,6 @@
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
- * Dumper module provides debugging and inspection utilities for AdonisJS applications.
11
- * Includes the Dumper class for formatting output, error classes, and configuration helpers.
12
- *
13
- * @example
14
- * // Use the dumper service
15
- * import { Dumper } from '@adonisjs/core/dumper'
16
- *
17
- * const dumper = new Dumper(app)
18
- * const htmlOutput = dumper.dumpToHtml(user, { title: 'User Data' })
19
- * const ansiOutput = dumper.dumpToAnsi(user, { title: 'Debug User' })
20
- *
21
- * @example
22
- * // Configure dumper output
23
- * import { defineConfig } from '@adonisjs/core/dumper'
24
- *
25
- * export default defineConfig({
26
- * html: { showHidden: true, depth: 5 },
27
- * console: { collapse: ['Date', 'DateTime'] }
28
- * })
29
- */
30
- export * as errors from "./errors.js";
31
- export { Dumper } from "./dumper.js";
32
- export { defineConfig } from "./define_config.js";
1
+ import "../../chunk-iKc69rpz.js";
2
+ import { n as errors_exports, t as Dumper } from "../../dumper-BBgqFX5a.js";
3
+ function defineConfig(dumperConfig) {
4
+ return dumperConfig;
5
+ }
6
+ export { Dumper, defineConfig, errors_exports as errors };
@@ -1,62 +1,47 @@
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 { Template } from 'edge.js';
10
- /**
11
- * Returns an edge plugin that integrates with a given
12
- * dumper instance
13
- */
14
- export function pluginEdgeDumper(dumper) {
15
- Template.macro('dumper', dumper);
16
- return (edge) => {
17
- edge.registerTag({
18
- tagName: 'dump',
19
- block: false,
20
- seekable: true,
21
- noNewLine: true,
22
- compile(parser, buffer, token) {
23
- const parsed = parser.utils.transformAst(parser.utils.generateAST(token.properties.jsArg, token.loc, token.filename), token.filename, parser);
24
- buffer.writeExpression(`template.stacks.pushOnceTo('dumper', 'dumper_globals', template.dumper.getHeadElements(state.cspNonce))`, token.filename, token.loc.start.line);
25
- buffer.outputExpression(`template.dumper.dumpToHtml(${parser.utils.stringify(parsed)}, { cspNonce: state.cspNonce, source: { location: $filename, line: $lineNumber } })`, token.filename, token.loc.start.line, true);
26
- },
27
- });
28
- edge.registerTag({
29
- tagName: 'dd',
30
- block: false,
31
- seekable: true,
32
- noNewLine: true,
33
- compile(parser, buffer, token) {
34
- const parsed = parser.utils.transformAst(parser.utils.generateAST(token.properties.jsArg, token.loc, token.filename), token.filename, parser);
35
- /**
36
- * Dump/Die statement to catch error and convert it into
37
- * an Edge error
38
- */
39
- const ddStatement = [
40
- 'try {',
41
- ` template.dumper.dd(${parser.utils.stringify(parsed)})`,
42
- '} catch (error) {',
43
- ` if (error.code === 'E_DUMP_DIE_EXCEPTION') {`,
44
- ' const edgeError = template.createError(error.message, $filename, $lineNumber)',
45
- ' error.fileName = $filename',
46
- ' error.lineNumber = $lineNumber',
47
- ' edgeError.handle = function (_, ctx) {',
48
- ' return error.handle(error, ctx)',
49
- ' }',
50
- ' edgeError.report = function () {',
51
- ' return error.report(error)',
52
- ' }',
53
- ' throw edgeError',
54
- ' }',
55
- ' throw error',
56
- '}',
57
- ].join('\n');
58
- buffer.writeStatement(ddStatement, token.filename, token.loc.start.line);
59
- },
60
- });
61
- };
1
+ import { Template } from "edge.js";
2
+ function pluginEdgeDumper(dumper) {
3
+ Template.macro("dumper", dumper);
4
+ return (edge) => {
5
+ edge.registerTag({
6
+ tagName: "dump",
7
+ block: false,
8
+ seekable: true,
9
+ noNewLine: true,
10
+ compile(parser, buffer, token) {
11
+ const parsed = parser.utils.transformAst(parser.utils.generateAST(token.properties.jsArg, token.loc, token.filename), token.filename, parser);
12
+ buffer.writeExpression(`template.stacks.pushOnceTo('dumper', 'dumper_globals', template.dumper.getHeadElements(state.cspNonce))`, token.filename, token.loc.start.line);
13
+ buffer.outputExpression(`template.dumper.dumpToHtml(${parser.utils.stringify(parsed)}, { cspNonce: state.cspNonce, source: { location: $filename, line: $lineNumber } })`, token.filename, token.loc.start.line, true);
14
+ }
15
+ });
16
+ edge.registerTag({
17
+ tagName: "dd",
18
+ block: false,
19
+ seekable: true,
20
+ noNewLine: true,
21
+ compile(parser, buffer, token) {
22
+ const parsed = parser.utils.transformAst(parser.utils.generateAST(token.properties.jsArg, token.loc, token.filename), token.filename, parser);
23
+ const ddStatement = [
24
+ "try {",
25
+ ` template.dumper.dd(${parser.utils.stringify(parsed)})`,
26
+ "} catch (error) {",
27
+ ` if (error.code === 'E_DUMP_DIE_EXCEPTION') {`,
28
+ " const edgeError = template.createError(error.message, $filename, $lineNumber)",
29
+ " error.fileName = $filename",
30
+ " error.lineNumber = $lineNumber",
31
+ " edgeError.handle = function (_, ctx) {",
32
+ " return error.handle(error, ctx)",
33
+ " }",
34
+ " edgeError.report = function () {",
35
+ " return error.report(error)",
36
+ " }",
37
+ " throw edgeError",
38
+ " }",
39
+ " throw error",
40
+ "}"
41
+ ].join("\n");
42
+ buffer.writeStatement(ddStatement, token.filename, token.loc.start.line);
43
+ }
44
+ });
45
+ };
62
46
  }
47
+ export { pluginEdgeDumper };
@@ -0,0 +1,161 @@
1
+ import { type ConfigProvider } from '../../src/types.ts';
2
+ import { type AESSIVDriverConfig, type AES256CBCDriverConfig, type AES256GCMDriverConfig, type ChaCha20Poly1305DriverConfig, type LegacyDriverConfig } from '../../types/encryption.ts';
3
+ import { type EncryptionConfig } from '../../types/encryption.ts';
4
+ /**
5
+ * Resolved configuration from the config provider that will be
6
+ * accepted by the encryption manager.
7
+ *
8
+ * This type unwraps ConfigProvider types to their resolved values,
9
+ * ensuring all encryptors in the list are concrete EncryptionConfig
10
+ * objects rather than providers.
11
+ *
12
+ * @template KnownEncryptors - Record of encryptor names to their configurations
13
+ */
14
+ type ResolvedConfig<KnownEncryptors extends Record<string, EncryptionConfig | ConfigProvider<EncryptionConfig>>> = {
15
+ /**
16
+ * The default encryptor name to use when no specific
17
+ * encryptor is requested
18
+ */
19
+ default?: keyof KnownEncryptors;
20
+ /**
21
+ * Map of encryptor names to their resolved configurations.
22
+ * ConfigProvider types are unwrapped to their underlying
23
+ * EncryptionConfig values.
24
+ */
25
+ list: {
26
+ [K in keyof KnownEncryptors]: KnownEncryptors[K] extends ConfigProvider<infer A> ? A : KnownEncryptors[K];
27
+ };
28
+ };
29
+ /**
30
+ * Defines the encryption configuration for the application.
31
+ *
32
+ * This function creates a configuration provider that lazily resolves
33
+ * encryption drivers. It validates that the default encryptor (if specified)
34
+ * exists in the list and resolves any ConfigProvider instances to their
35
+ * concrete values.
36
+ *
37
+ * @template KnownEncryptors - Record of encryptor names to their configurations
38
+ *
39
+ * @param config - The encryption configuration object
40
+ * @param config.default - Optional default encryptor name
41
+ * @param config.list - Map of encryptor names to their configurations or providers
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * const encryptionConfig = defineConfig({
46
+ * default: 'app',
47
+ * list: {
48
+ * app: drivers.aes256gcm({
49
+ * id: 'app',
50
+ * keys: [env.get('APP_KEY')]
51
+ * }),
52
+ * backup: drivers.chacha20({
53
+ * id: 'backup',
54
+ * keys: [env.get('BACKUP_KEY')]
55
+ * })
56
+ * }
57
+ * })
58
+ * ```
59
+ */
60
+ export declare function defineConfig<KnownEncryptors extends Record<string, EncryptionConfig | ConfigProvider<EncryptionConfig>>>(config: {
61
+ default?: keyof KnownEncryptors;
62
+ list: KnownEncryptors;
63
+ }): ConfigProvider<ResolvedConfig<KnownEncryptors>>;
64
+ /**
65
+ * Collection of encryption driver factory functions.
66
+ *
67
+ * Each driver factory creates a ConfigProvider that lazily imports
68
+ * and configures the corresponding encryption driver. This allows
69
+ * for efficient code splitting and on-demand loading of encryption
70
+ * algorithms.
71
+ */
72
+ export declare const drivers: {
73
+ /**
74
+ * Creates a ChaCha20-Poly1305 encryption driver configuration.
75
+ *
76
+ * ChaCha20-Poly1305 is a modern authenticated encryption algorithm
77
+ * that provides excellent performance on systems without AES hardware
78
+ * acceleration.
79
+ *
80
+ * @param config - The ChaCha20-Poly1305 driver configuration
81
+ *
82
+ * @example
83
+ * ```ts
84
+ * drivers.chacha20({
85
+ * id: 'app',
86
+ * keys: [env.get('APP_KEY')]
87
+ * })
88
+ * ```
89
+ */
90
+ chacha20: (config: ChaCha20Poly1305DriverConfig) => ConfigProvider<EncryptionConfig>;
91
+ /**
92
+ * Creates an AES-256-CBC encryption driver configuration.
93
+ *
94
+ * AES-256-CBC is a widely-supported block cipher mode. However,
95
+ * consider using AES-256-GCM for new applications as it provides
96
+ * authenticated encryption.
97
+ *
98
+ * @param config - The AES-256-CBC driver configuration
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * drivers.aes256cbc({
103
+ * id: 'legacy',
104
+ * keys: [env.get('LEGACY_KEY')]
105
+ * })
106
+ * ```
107
+ */
108
+ aes256cbc: (config: AES256CBCDriverConfig) => ConfigProvider<EncryptionConfig>;
109
+ /**
110
+ * Creates an AES-256-GCM encryption driver configuration.
111
+ *
112
+ * AES-256-GCM is an authenticated encryption algorithm that provides
113
+ * both confidentiality and integrity. It offers excellent performance
114
+ * on systems with AES hardware acceleration.
115
+ *
116
+ * @param config - The AES-256-GCM driver configuration
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * drivers.aes256gcm({
121
+ * id: 'app',
122
+ * keys: [env.get('APP_KEY')]
123
+ * })
124
+ * ```
125
+ */
126
+ aes256gcm: (config: AES256GCMDriverConfig) => ConfigProvider<EncryptionConfig>;
127
+ /**
128
+ * Creates an AES-SIV encryption driver configuration.
129
+ *
130
+ * @param config - The AES-SIV driver configuration
131
+ *
132
+ * @example
133
+ * ```ts
134
+ * drivers.aessiv({
135
+ * id: 'app',
136
+ * key: env.get('APP_KEY')
137
+ * })
138
+ * ```
139
+ */
140
+ aessiv: (config: AESSIVDriverConfig) => ConfigProvider<EncryptionConfig>;
141
+ /**
142
+ * Creates a Legacy encryption driver configuration.
143
+ *
144
+ * The Legacy driver maintains compatibility with the old AdonisJS v6
145
+ * encryption format. It uses AES-256-CBC with HMAC SHA-256.
146
+ *
147
+ * Use this driver to decrypt values encrypted with older versions
148
+ * of AdonisJS or when migrating to newer encryption drivers.
149
+ *
150
+ * @param config - The Legacy driver configuration
151
+ *
152
+ * @example
153
+ * ```ts
154
+ * drivers.legacy({
155
+ * keys: [env.get('APP_KEY')]
156
+ * })
157
+ * ```
158
+ */
159
+ legacy: (config: LegacyDriverConfig) => ConfigProvider<EncryptionConfig>;
160
+ };
161
+ export {};
@@ -0,0 +1,20 @@
1
+ /**
2
+ * AES-256-CBC encryption driver implementation.
3
+ *
4
+ * This driver provides encryption and decryption using the AES-256-CBC
5
+ * (Advanced Encryption Standard with 256-bit key in Cipher Block Chaining mode)
6
+ * algorithm. While widely supported, AES-256-CBC does not provide authenticated
7
+ * encryption. Consider using AES-256-GCM for new applications.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * const driver = new AES256CBC({
12
+ * id: 'app',
13
+ * key: 'your-256-bit-key-here'
14
+ * })
15
+ *
16
+ * const encrypted = driver.encrypt('sensitive data')
17
+ * const decrypted = driver.decrypt(encrypted)
18
+ * ```
19
+ */
20
+ export { AES256CBC } from '@boringnode/encryption/drivers/aes_256_cbc';
@@ -0,0 +1,2 @@
1
+ import { AES256CBC } from "@boringnode/encryption/drivers/aes_256_cbc";
2
+ export { AES256CBC };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * AES-256-GCM encryption driver implementation.
3
+ *
4
+ * This driver provides authenticated encryption and decryption using the
5
+ * AES-256-GCM (Advanced Encryption Standard with 256-bit key in Galois/Counter Mode)
6
+ * algorithm. GCM mode provides both confidentiality and authenticity, making it
7
+ * the recommended choice for modern applications. It offers excellent performance
8
+ * on systems with AES hardware acceleration.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const driver = new AES256GCM({
13
+ * id: 'app',
14
+ * key: 'your-256-bit-key-here'
15
+ * })
16
+ *
17
+ * const encrypted = driver.encrypt('sensitive data')
18
+ * const decrypted = driver.decrypt(encrypted)
19
+ * ```
20
+ */
21
+ export { AES256GCM } from '@boringnode/encryption/drivers/aes_256_gcm';
@@ -0,0 +1,2 @@
1
+ import { AES256GCM } from "@boringnode/encryption/drivers/aes_256_gcm";
2
+ export { AES256GCM };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * AES-SIV encryption driver implementation.
3
+ *
4
+ * This driver provides deterministic authenticated encryption using AES-SIV
5
+ * (Synthetic Initialization Vector). It is useful when you need equality
6
+ * queries over encrypted values while preserving authenticity guarantees.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const driver = new AESSIV({
11
+ * id: 'app',
12
+ * key: 'your-256-bit-key-here'
13
+ * })
14
+ *
15
+ * const encrypted = driver.encrypt('sensitive data')
16
+ * const decrypted = driver.decrypt(encrypted)
17
+ * ```
18
+ */
19
+ export { AESSIV } from '@boringnode/encryption/drivers/aes_siv';
@@ -0,0 +1,2 @@
1
+ import { AESSIV } from "@boringnode/encryption/drivers/aes_siv";
2
+ export { AESSIV };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * ChaCha20-Poly1305 encryption driver implementation.
3
+ *
4
+ * This driver provides authenticated encryption and decryption using the
5
+ * ChaCha20-Poly1305 algorithm. ChaCha20 is a modern stream cipher that
6
+ * provides excellent performance on systems without AES hardware acceleration.
7
+ * Combined with Poly1305 for authentication, it offers both confidentiality
8
+ * and authenticity.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const driver = new ChaCha20Poly1305({
13
+ * id: 'app',
14
+ * key: 'your-256-bit-key-here'
15
+ * })
16
+ *
17
+ * const encrypted = driver.encrypt('sensitive data')
18
+ * const decrypted = driver.decrypt(encrypted)
19
+ * ```
20
+ */
21
+ export { ChaCha20Poly1305 } from '@boringnode/encryption/drivers/chacha20_poly1305';
@@ -0,0 +1,2 @@
1
+ import { ChaCha20Poly1305 } from "@boringnode/encryption/drivers/chacha20_poly1305";
2
+ export { ChaCha20Poly1305 };
@@ -0,0 +1,84 @@
1
+ import { type Secret } from '@poppinss/utils';
2
+ import { BaseDriver } from '@boringnode/encryption';
3
+ import type { CypherText, EncryptOptions, EncryptionDriverContract } from '@boringnode/encryption/types';
4
+ /**
5
+ * Configuration for the Legacy encryption driver.
6
+ *
7
+ * The Legacy driver maintains compatibility with the old AdonisJS v6
8
+ * encryption format using AES-256-CBC with HMAC SHA-256.
9
+ */
10
+ export interface LegacyConfig {
11
+ key: string | Secret<string>;
12
+ }
13
+ /**
14
+ * Configuration for the Legacy encryption driver factory.
15
+ *
16
+ * Used when configuring the driver through the defineConfig function.
17
+ */
18
+ export interface LegacyDriverConfig {
19
+ keys: (string | Secret<string>)[];
20
+ }
21
+ /**
22
+ * Factory function to create a Legacy encryption configuration.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * drivers.legacy({
27
+ * keys: [env.get('APP_KEY')]
28
+ * })
29
+ * ```
30
+ */
31
+ export declare function legacy(config: LegacyDriverConfig): {
32
+ driver: (key: string | Secret<string>) => Legacy;
33
+ keys: (string | Secret<string>)[];
34
+ };
35
+ /**
36
+ * Legacy encryption driver for AdonisJS.
37
+ *
38
+ * This driver maintains compatibility with the old AdonisJS v6 encryption
39
+ * format. It uses:
40
+ * - AES-256-CBC for encryption
41
+ * - HMAC SHA-256 for integrity verification
42
+ * - MessageBuilder from @poppinss/utils for encoding values
43
+ *
44
+ * Encrypted format: `[encrypted_base64url].[iv_base64url].[hmac]`
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * const driver = new Legacy({ key: 'your-32-character-secret-key!!' })
49
+ *
50
+ * const encrypted = driver.encrypt('sensitive data')
51
+ * const decrypted = driver.decrypt(encrypted)
52
+ * ```
53
+ */
54
+ export declare class Legacy extends BaseDriver implements EncryptionDriverContract {
55
+ constructor(config: LegacyConfig);
56
+ /**
57
+ * Encrypt a given piece of value using the app secret. A wide range of
58
+ * data types are supported.
59
+ *
60
+ * - String
61
+ * - Arrays
62
+ * - Objects
63
+ * - Booleans
64
+ * - Numbers
65
+ * - Dates
66
+ *
67
+ * You can optionally define a purpose for which the value was encrypted and
68
+ * mentioning a different purpose/no purpose during decrypt will fail.
69
+ */
70
+ encrypt(payload: any, options?: EncryptOptions): CypherText;
71
+ encrypt(payload: any, expiresIn?: string | number, purpose?: string): CypherText;
72
+ /**
73
+ * Decrypt value and verify it against a purpose
74
+ */
75
+ decrypt<T extends any>(value: string, purpose?: string): T | null;
76
+ /**
77
+ * Legacy driver does not support blind indexes.
78
+ */
79
+ blindIndex(_payload: any, _purpose: string): string;
80
+ /**
81
+ * Legacy driver does not support blind indexes.
82
+ */
83
+ blindIndexes(_payload: any, _purpose: string): string[];
84
+ }