@adonisjs/core 7.0.0-next.2 → 7.0.0-next.21

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,9 +1 @@
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
1
  export {};
@@ -57,4 +57,4 @@ export declare function importTypeScript(app: ApplicationService): Promise<typeo
57
57
  * // }
58
58
  * // }
59
59
  */
60
- export declare function outputTransformerDataObjects(transformersList: RecursiveFileTree, buffer: Assembler.FileBuffer): Promise<void>;
60
+ export declare function outputTransformerDataObjects(transformersList: RecursiveFileTree, buffer: Assembler.FileBuffer, withSharedProps: boolean): Promise<void>;
package/build/src/vine.js CHANGED
@@ -1,97 +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 vine, { symbols, BaseLiteralType } from '@vinejs/vine';
10
- const MULTIPART_FILE = symbols.SUBTYPE ?? Symbol.for('subtype');
11
- /**
12
- * Checks if the value is an instance of multipart file
13
- * from bodyparser.
14
- */
15
- function isBodyParserFile(file) {
16
- return !!(file && typeof file === 'object' && 'isMultipartFile' in file);
17
- }
18
- /**
19
- * VineJS validation rule that validates the file to be an
20
- * instance of BodyParser MultipartFile class.
21
- */
22
- const isMultipartFile = vine.createRule((file, options, field) => {
23
- /**
24
- * Report error when value is not a field multipart
25
- * file object
26
- */
27
- if (!isBodyParserFile(file)) {
28
- field.report('The {{ field }} must be a file', 'file', field);
29
- return;
30
- }
31
- const validationOptions = typeof options === 'function' ? options(field) : options;
32
- /**
33
- * Set size when it's defined in the options and missing
34
- * on the file instance
35
- */
36
- if (file.sizeLimit === undefined && validationOptions.size) {
37
- file.sizeLimit = validationOptions.size;
38
- }
39
- /**
40
- * Set extensions when it's defined in the options and missing
41
- * on the file instance
42
- */
43
- if (file.allowedExtensions === undefined && validationOptions.extnames) {
44
- file.allowedExtensions = validationOptions.extnames;
45
- }
46
- /**
47
- * Validate file
48
- */
49
- file.validate();
50
- /**
51
- * Report errors
52
- */
53
- file.errors.forEach((error) => {
54
- field.report(error.message, `file.${error.type}`, field, validationOptions);
55
- });
56
- });
57
- /**
58
- * Represents a multipart file uploaded via multipart/form-data HTTP
59
- * request. This class extends VineJS's BaseLiteralType to provide
60
- * specialized validation for uploaded files.
61
- *
62
- * @example
63
- * const fileSchema = vine.object({
64
- * avatar: vine.file({
65
- * size: '2mb',
66
- * extnames: ['jpg', 'png']
67
- * })
68
- * })
69
- */
70
- export class VineMultipartFile extends BaseLiteralType {
71
- /**
72
- * Private validation options for file validation
73
- */
74
- #validationOptions;
75
- /**
76
- * Symbol identifier for multipart file subtype
77
- */
78
- [MULTIPART_FILE] = 'multipartFile';
79
- /**
80
- * Creates a new VineMultipartFile instance
81
- *
82
- * @param validationOptions - File validation options like size limits and allowed extensions
83
- * @param options - Field options from VineJS
84
- * @param validations - Array of validation functions to apply
85
- */
86
- constructor(validationOptions, options, validations) {
87
- super(options, validations || [isMultipartFile(validationOptions || {})]);
88
- this.#validationOptions = validationOptions;
89
- }
90
- /**
91
- * Creates a clone of the current VineMultipartFile instance
92
- * with the same validation options and configurations
93
- */
94
- clone() {
95
- return new VineMultipartFile(this.#validationOptions, this.cloneOptions(), this.cloneValidations());
96
- }
97
- }
1
+ import { t as VineMultipartFile } from "../vine-DGint2rk.js";
2
+ export { VineMultipartFile };
@@ -0,0 +1,28 @@
1
+ import prettyHrTime from "pretty-hrtime";
2
+ import string from "@poppinss/utils/string";
3
+ import he from "he";
4
+ import StringBuilder from "@poppinss/utils/string_builder";
5
+ var string_default = {
6
+ ...string,
7
+ toSentence: string.sentence,
8
+ ordinalize: string.ordinal,
9
+ generateRandom: string.random,
10
+ create(value) {
11
+ return new StringBuilder(value);
12
+ },
13
+ prettyHrTime(time, options) {
14
+ return prettyHrTime(time, options);
15
+ },
16
+ isEmpty(value) {
17
+ return value.trim().length === 0;
18
+ },
19
+ escapeHTML(value, options) {
20
+ value = he.escape(value);
21
+ if (options && options.encodeSymbols) value = this.encodeSymbols(value, { allowUnsafeSymbols: true });
22
+ return value;
23
+ },
24
+ encodeSymbols(value, options) {
25
+ return he.encode(value, options);
26
+ }
27
+ };
28
+ export { string_default as t };
@@ -0,0 +1,10 @@
1
+ import { t as Ignitor } from "./main-CZZ21eXm.js";
2
+ import { t as IgnitorFactory } from "./ignitor-BrmVPN5N.js";
3
+ import { t as TestUtils } from "./main-BU8NWUEG.js";
4
+ var TestUtilsFactory = class {
5
+ create(ignitorOrAppRoot, options) {
6
+ if (ignitorOrAppRoot instanceof Ignitor) return new TestUtils(ignitorOrAppRoot.createApp("test"));
7
+ return new TestUtils(new IgnitorFactory().withCoreConfig().withCoreProviders().create(ignitorOrAppRoot, options).createApp("console"));
8
+ }
9
+ };
10
+ export { TestUtilsFactory as t };
@@ -1,27 +1,25 @@
1
1
  #!/usr/bin/env node
2
- /*
3
- * @adonisjs/core
4
- *
5
- * (c) AdonisJS
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
- import { Kernel, ListLoader, HelpCommand } from '@adonisjs/ace';
11
- import IndexCommand from "./commands/index_commands.js";
2
+ import { t as __decorate } from "../decorate-CJcHOoD-.js";
3
+ import { BaseCommand, HelpCommand, IndexGenerator, Kernel, ListLoader, args } from "@adonisjs/ace";
4
+ import { join } from "node:path";
5
+ var IndexCommand = class extends BaseCommand {
6
+ static commandName = "index";
7
+ static description = "Create an index of commands along with a lazy loader";
8
+ async run() {
9
+ await new IndexGenerator(join(process.cwd(), this.commandsDir)).generate();
10
+ }
11
+ };
12
+ __decorate([args.string({ description: "Relative path from cwd to the commands directory" })], IndexCommand.prototype, "commandsDir", void 0);
12
13
  const kernel = Kernel.create();
13
14
  kernel.addLoader(new ListLoader([IndexCommand]));
14
- kernel.defineFlag('help', {
15
- type: 'boolean',
16
- description: HelpCommand.description,
15
+ kernel.defineFlag("help", {
16
+ type: "boolean",
17
+ description: HelpCommand.description
17
18
  });
18
- /**
19
- * Flag listener to display the help
20
- */
21
- kernel.on('help', async (command, $kernel, parsed) => {
22
- parsed.args.unshift(command.commandName);
23
- const help = new HelpCommand($kernel, parsed, kernel.ui, kernel.prompt);
24
- await help.exec();
25
- return $kernel.shortcircuit();
19
+ kernel.on("help", async (command, $kernel, parsed) => {
20
+ parsed.args.unshift(command.commandName);
21
+ await new HelpCommand($kernel, parsed, kernel.ui, kernel.prompt).exec();
22
+ return $kernel.shortcircuit();
26
23
  });
27
24
  await kernel.handle(process.argv.splice(2));
25
+ export {};
@@ -1,9 +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
- export * from '@adonisjs/ace/types';
1
+ export * from "@adonisjs/ace/types";
2
+ export {};
@@ -1,9 +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
- export * from '@adonisjs/application/types';
1
+ export * from "@adonisjs/application/types";
2
+ export {};
@@ -1,9 +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
- export * from '@adonisjs/bodyparser/types';
1
+ export * from "@adonisjs/bodyparser/types";
2
+ export {};
@@ -1,9 +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
- export * from '@poppinss/utils/types';
1
+ export * from "@poppinss/utils/types";
2
+ export {};
@@ -1,9 +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
- export * from '@adonisjs/fold/types';
1
+ export * from "@adonisjs/fold/types";
2
+ export {};
@@ -1 +1,39 @@
1
- export * from '@adonisjs/encryption/types';
1
+ /**
2
+ * Contract that all encryption drivers must implement.
3
+ *
4
+ * Defines the interface for encrypting and decrypting values, including
5
+ * support for optional purpose binding and child key derivation.
6
+ */
7
+ export type { EncryptionDriverContract, EncryptionConfig } from '@boringnode/encryption/types';
8
+ /**
9
+ * Factory function signature for creating encryption driver instances.
10
+ *
11
+ * The factory receives an encryption key and returns a configured
12
+ * driver instance. This pattern allows the manager to create drivers
13
+ * on-demand with different keys.
14
+ */
15
+ export type { ManagerDriverFactory } from '@boringnode/encryption/types';
16
+ /**
17
+ * Configuration options for the AES-256-CBC encryption driver.
18
+ *
19
+ * Includes the driver identifier and a list of encryption keys.
20
+ * The first key is used for encryption, while all keys are tried
21
+ * for decryption (allowing for key rotation).
22
+ */
23
+ export type { AES256CBCDriverConfig } from '@boringnode/encryption/drivers/aes_256_cbc';
24
+ /**
25
+ * Configuration options for the AES-256-GCM encryption driver.
26
+ *
27
+ * Includes the driver identifier and a list of encryption keys.
28
+ * The first key is used for encryption, while all keys are tried
29
+ * for decryption (allowing for key rotation).
30
+ */
31
+ export type { AES256GCMDriverConfig } from '@boringnode/encryption/drivers/aes_256_gcm';
32
+ /**
33
+ * Configuration options for the ChaCha20-Poly1305 encryption driver.
34
+ *
35
+ * Includes the driver identifier and a list of encryption keys.
36
+ * The first key is used for encryption, while all keys are tried
37
+ * for decryption (allowing for key rotation).
38
+ */
39
+ export type { ChaCha20Poly1305DriverConfig } from '@boringnode/encryption/drivers/chacha20_poly1305';
@@ -1,9 +1 @@
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/encryption/types';
1
+ export {};
@@ -1,9 +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
- export * from '@adonisjs/events/types';
1
+ export * from "@adonisjs/events/types";
2
+ export {};
@@ -1,9 +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
- export * from '@adonisjs/hash/types';
1
+ export * from "@adonisjs/hash/types";
2
+ export {};
@@ -1,9 +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
- export * from '@adonisjs/health/types';
1
+ export * from "@adonisjs/health/types";
2
+ export {};
@@ -1,2 +1,22 @@
1
+ /**
2
+ * Helper types and utilities for AdonisJS applications.
3
+ * Re-exports commonly used type utilities and file system operation types.
4
+ *
5
+ * @example
6
+ * // Use Opaque type for branded primitives
7
+ * import type { Opaque } from '@adonisjs/core/types/helpers'
8
+ *
9
+ * type UserId = Opaque<'UserId', number>
10
+ * const userId: UserId = 123 as UserId
11
+ *
12
+ * @example
13
+ * // Use file system option types
14
+ * import type { ImportAllFilesOptions } from '@adonisjs/core/types/helpers'
15
+ *
16
+ * const options: ImportAllFilesOptions = {
17
+ * ignoreMissingExports: true,
18
+ * transformKeys: (key) => key.toLowerCase()
19
+ * }
20
+ */
1
21
  export type { Opaque, NormalizeConstructor } from '@poppinss/utils/types';
2
22
  export type { ImportAllFilesOptions, ReadAllFilesOptions } from '@poppinss/utils/fs';
@@ -1,9 +1 @@
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
1
  export {};
@@ -1,9 +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
- export * from '@adonisjs/http-server/types';
1
+ export * from "@adonisjs/http-server/types";
2
+ export {};
@@ -1,9 +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
- export * from '@adonisjs/logger/types';
1
+ export * from "@adonisjs/logger/types";
2
+ export {};
@@ -1,9 +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
- export * from '@adonisjs/repl/types';
1
+ export * from "@adonisjs/repl/types";
2
+ export {};
@@ -1,9 +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
- export * from '@adonisjs/http-transformers/types';
1
+ export * from "@adonisjs/http-transformers/types";
2
+ export {};
@@ -0,0 +1,42 @@
1
+ async function importAssembler(app) {
2
+ try {
3
+ return await app.import("@adonisjs/assembler");
4
+ } catch {}
5
+ }
6
+ async function importTypeScript(app) {
7
+ try {
8
+ return await app.importDefault("typescript");
9
+ } catch {}
10
+ }
11
+ async function outputTransformerDataObjects(transformersList, buffer, withSharedProps) {
12
+ const importsBuffer = buffer.create();
13
+ importsBuffer.write(`/// <reference path="./manifest.d.ts" />`);
14
+ importsBuffer.write(`import type { InferData, InferVariants } from '@adonisjs/core/types/transformers'`);
15
+ if (withSharedProps) importsBuffer.write(`import type { InferSharedProps } from '@adonisjs/inertia/types'`);
16
+ buffer.writeLine(importsBuffer);
17
+ buffer.write("export namespace Data {").indent();
18
+ function generateNamespaceTree(input, parents) {
19
+ Object.keys(input).forEach((key) => {
20
+ const value = input[key];
21
+ if (typeof value === "string") {
22
+ const importName = `${parents.join("")}${key}Transformer`;
23
+ importsBuffer.write(`import type ${importName} from '${value}'`);
24
+ buffer.write(`export type ${key} = InferData<${importName}>`);
25
+ buffer.write(`export namespace ${key} {`).indent();
26
+ buffer.write(`export type Variants = InferVariants<${importName}>`);
27
+ buffer.dedent().write("}");
28
+ } else {
29
+ buffer.write(`export namespace ${key} {`).indent();
30
+ generateNamespaceTree(value, [...parents, key]);
31
+ buffer.dedent().write(`}`);
32
+ }
33
+ });
34
+ }
35
+ generateNamespaceTree(transformersList, []);
36
+ if (withSharedProps) {
37
+ importsBuffer.write(`import type InertiaMiddleware from '#middleware/inertia_middleware'`);
38
+ buffer.write("export type SharedProps = InferSharedProps<InertiaMiddleware>");
39
+ }
40
+ buffer.dedent().write("}");
41
+ }
42
+ export { importTypeScript as n, outputTransformerDataObjects as r, importAssembler as t };
@@ -0,0 +1,46 @@
1
+ import string from "@poppinss/utils/string";
2
+ import base64 from "@poppinss/utils/base64";
3
+ import { Secret, safeEqual } from "@poppinss/utils";
4
+ import { createHash } from "node:crypto";
5
+ var VerificationToken = class {
6
+ static decode(value) {
7
+ if (typeof value !== "string") return null;
8
+ if (!value) return null;
9
+ const [identifier, ...tokenValue] = value.split(".");
10
+ if (!identifier || tokenValue.length === 0) return null;
11
+ const decodedIdentifier = base64.urlDecode(identifier);
12
+ const decodedSecret = base64.urlDecode(tokenValue.join("."));
13
+ if (!decodedIdentifier || !decodedSecret) return null;
14
+ return {
15
+ identifier: decodedIdentifier,
16
+ secret: new Secret(decodedSecret)
17
+ };
18
+ }
19
+ static createTransientToken(userId, size, expiresIn) {
20
+ const expiresAt = /* @__PURE__ */ new Date();
21
+ expiresAt.setSeconds(expiresAt.getSeconds() + string.seconds.parse(expiresIn));
22
+ return {
23
+ userId,
24
+ expiresAt,
25
+ ...this.seed(size)
26
+ };
27
+ }
28
+ static seed(size) {
29
+ const secret = new Secret(string.random(size));
30
+ return {
31
+ secret,
32
+ hash: createHash("sha256").update(secret.release()).digest("hex")
33
+ };
34
+ }
35
+ computeValue(secret) {
36
+ this.value = new Secret(`${base64.urlEncode(String(this.identifier))}.${base64.urlEncode(secret.release())}`);
37
+ }
38
+ isExpired() {
39
+ return this.expiresAt < /* @__PURE__ */ new Date();
40
+ }
41
+ verify(secret) {
42
+ const newHash = createHash("sha256").update(secret.release()).digest("hex");
43
+ return safeEqual(this.hash, newHash);
44
+ }
45
+ };
46
+ export { VerificationToken as t };
@@ -0,0 +1,32 @@
1
+ import vine, { BaseLiteralType, symbols } from "@vinejs/vine";
2
+ const MULTIPART_FILE = symbols.SUBTYPE ?? Symbol.for("subtype");
3
+ function isBodyParserFile(file) {
4
+ return !!(file && typeof file === "object" && "isMultipartFile" in file);
5
+ }
6
+ const isMultipartFile = vine.createRule((file, options, field) => {
7
+ if (!isBodyParserFile(file)) {
8
+ field.report("The {{ field }} must be a file", "file", field);
9
+ return false;
10
+ }
11
+ const validationOptions = typeof options === "function" ? options(field) : options;
12
+ if (file.sizeLimit === void 0 && validationOptions.size) file.sizeLimit = validationOptions.size;
13
+ if (file.allowedExtensions === void 0 && validationOptions.extnames) file.allowedExtensions = validationOptions.extnames;
14
+ file.validate();
15
+ file.errors.forEach((error) => {
16
+ field.report(error.message, `file.${error.type}`, field, validationOptions);
17
+ });
18
+ return file.isValid;
19
+ });
20
+ var VineMultipartFile = class VineMultipartFile extends BaseLiteralType {
21
+ #validationOptions;
22
+ [MULTIPART_FILE] = "multipartFile";
23
+ constructor(validationOptions, options, validations) {
24
+ super(options, validations || []);
25
+ this.#validationOptions = validationOptions;
26
+ this.dataTypeValidator = isMultipartFile(validationOptions || {});
27
+ }
28
+ clone() {
29
+ return new VineMultipartFile(this.#validationOptions, this.cloneOptions(), this.cloneValidations());
30
+ }
31
+ };
32
+ export { VineMultipartFile as t };