@adonisjs/core 7.0.0-next.1 → 7.0.0-next.10

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 (41) hide show
  1. package/build/commands/serve.js +3 -9
  2. package/build/commands/test.js +2 -8
  3. package/build/modules/ace/codemods.d.ts +109 -14
  4. package/build/modules/ace/codemods.js +119 -16
  5. package/build/modules/ace/main.d.ts +30 -0
  6. package/build/modules/ace/main.js +30 -0
  7. package/build/modules/app.d.ts +17 -0
  8. package/build/modules/app.js +17 -0
  9. package/build/modules/config.d.ts +17 -0
  10. package/build/modules/config.js +17 -0
  11. package/build/modules/dumper/dumper.d.ts +5 -0
  12. package/build/modules/dumper/dumper.js +11 -1
  13. package/build/modules/dumper/main.d.ts +21 -0
  14. package/build/modules/dumper/main.js +21 -0
  15. package/build/modules/encryption.d.ts +17 -0
  16. package/build/modules/encryption.js +17 -0
  17. package/build/modules/env/main.d.ts +19 -0
  18. package/build/modules/env/main.js +19 -0
  19. package/build/modules/hash/drivers/bcrypt.d.ts +11 -0
  20. package/build/modules/hash/drivers/bcrypt.js +11 -0
  21. package/build/modules/hash/main.d.ts +18 -0
  22. package/build/modules/hash/main.js +18 -0
  23. package/build/modules/http/url_builder_client.d.ts +1 -0
  24. package/build/modules/http/url_builder_client.js +9 -0
  25. package/build/providers/app_provider.d.ts +9 -21
  26. package/build/providers/app_provider.js +40 -44
  27. package/build/providers/edge_provider.js +62 -1
  28. package/build/src/assembler_hooks/index_entities.js +8 -2
  29. package/build/src/cli_formatters/routes_list.js +23 -7
  30. package/build/src/helpers/http.d.ts +20 -0
  31. package/build/src/helpers/http.js +28 -0
  32. package/build/src/helpers/main.d.ts +1 -5
  33. package/build/src/helpers/main.js +1 -5
  34. package/build/src/helpers/string.js +18 -0
  35. package/build/src/ignitor/http.js +18 -5
  36. package/build/src/types.d.ts +1 -0
  37. package/build/src/utils.d.ts +1 -1
  38. package/build/src/utils.js +13 -3
  39. package/build/src/vine.js +14 -6
  40. package/build/types/helpers.d.ts +20 -0
  41. package/package.json +22 -21
@@ -32,7 +32,9 @@ export class HttpServerProcess {
32
32
  this.#ignitor = ignitor;
33
33
  }
34
34
  /**
35
- * Calling this method closes the underlying HTTP server
35
+ * Calling this method closes the underlying HTTP server gracefully.
36
+ *
37
+ * @param nodeHttpServer - The Node.js HTTP or HTTPS server instance to close
36
38
  */
37
39
  #close(nodeHttpServer) {
38
40
  return new Promise((resolve) => {
@@ -42,7 +44,11 @@ export class HttpServerProcess {
42
44
  }
43
45
  /**
44
46
  * Monitors the app and the server to close the HTTP server when
45
- * either one of them goes down
47
+ * either one of them goes down. Sets up event listeners for graceful shutdown.
48
+ *
49
+ * @param nodeHttpServer - The Node.js HTTP or HTTPS server instance to monitor
50
+ * @param app - The application service instance
51
+ * @param logger - The logger service for error reporting
46
52
  */
47
53
  #monitorAppAndServer(nodeHttpServer, app, logger) {
48
54
  /**
@@ -64,7 +70,9 @@ export class HttpServerProcess {
64
70
  });
65
71
  }
66
72
  /**
67
- * Starts the http server a given host and port
73
+ * Starts the HTTP server on a given host and port using environment variables.
74
+ *
75
+ * @param nodeHttpServer - The Node.js HTTP or HTTPS server instance to start listening
68
76
  */
69
77
  #listen(nodeHttpServer) {
70
78
  return new Promise((resolve, reject) => {
@@ -81,8 +89,13 @@ export class HttpServerProcess {
81
89
  });
82
90
  }
83
91
  /**
84
- * Notifies the app and the parent process that the
85
- * HTTP server is ready
92
+ * Notifies the app and the parent process that the HTTP server is ready.
93
+ * Sends notifications through multiple channels: parent process, logger, and event emitter.
94
+ *
95
+ * @param app - The application service instance for parent process notification
96
+ * @param logger - The logger service for console output
97
+ * @param emitter - The event emitter for app-level notifications
98
+ * @param payload - Server startup information including host, port, and duration
86
99
  */
87
100
  #notifyServerHasStarted(app, logger, emitter, payload) {
88
101
  /**
@@ -374,6 +374,7 @@ export type IndexEntitiesConfig = {
374
374
  };
375
375
  transformers?: {
376
376
  enabled?: boolean;
377
+ withSharedProps?: boolean;
377
378
  source?: string;
378
379
  importAlias?: string;
379
380
  glob?: string[];
@@ -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>;
@@ -71,9 +71,12 @@ export async function importTypeScript(app) {
71
71
  * // }
72
72
  * // }
73
73
  */
74
- export async function outputTransformerDataObjects(transformersList, buffer) {
74
+ export async function outputTransformerDataObjects(transformersList, buffer, withSharedProps) {
75
75
  const importsBuffer = buffer.create();
76
- importsBuffer.write(`import { InferData } from '@adonisjs/core/types/transformers'`);
76
+ importsBuffer.write(`import type { InferData, InferVariants } from '@adonisjs/core/types/transformers'`);
77
+ if (withSharedProps) {
78
+ importsBuffer.write(`import type { InferSharedProps } from '@adonisjs/inertia/types'`);
79
+ }
77
80
  buffer.writeLine(importsBuffer);
78
81
  buffer.write('export namespace Data {').indent();
79
82
  /**
@@ -89,8 +92,11 @@ export async function outputTransformerDataObjects(transformersList, buffer) {
89
92
  const value = input[key];
90
93
  if (typeof value === 'string') {
91
94
  const importName = `${parents.join()}${key}Transformer`;
92
- importsBuffer.write(`import ${importName} from '${value}'`);
95
+ importsBuffer.write(`import type ${importName} from '${value}'`);
93
96
  buffer.write(`export type ${key} = InferData<${importName}>`);
97
+ buffer.write(`export namespace ${key} {`).indent();
98
+ buffer.write(`export type Variants = InferVariants<${importName}>`);
99
+ buffer.dedent().write('}');
94
100
  }
95
101
  else {
96
102
  buffer.write(`export namespace ${key} {`).indent();
@@ -100,5 +106,9 @@ export async function outputTransformerDataObjects(transformersList, buffer) {
100
106
  });
101
107
  }
102
108
  generateNamespaceTree(transformersList, []);
109
+ if (withSharedProps) {
110
+ importsBuffer.write(`import type InertiaMiddleware from '#middleware/inertia_middleware'`);
111
+ buffer.write('export type SharedProps = InferSharedProps<InertiaMiddleware>');
112
+ }
103
113
  buffer.dedent().write('}');
104
114
  }
package/build/src/vine.js CHANGED
@@ -9,15 +9,21 @@
9
9
  import vine, { symbols, BaseLiteralType } from '@vinejs/vine';
10
10
  const MULTIPART_FILE = symbols.SUBTYPE ?? Symbol.for('subtype');
11
11
  /**
12
- * Checks if the value is an instance of multipart file
13
- * from bodyparser.
12
+ * Checks if the value is an instance of multipart file from bodyparser.
13
+ * Used internally for type guarding in file validation.
14
+ *
15
+ * @param file - The value to check for MultipartFile instance
14
16
  */
15
17
  function isBodyParserFile(file) {
16
18
  return !!(file && typeof file === 'object' && 'isMultipartFile' in file);
17
19
  }
18
20
  /**
19
- * VineJS validation rule that validates the file to be an
20
- * instance of BodyParser MultipartFile class.
21
+ * VineJS validation rule that validates the file to be an instance of BodyParser
22
+ * MultipartFile class and applies size/extension validation if configured.
23
+ *
24
+ * @param file - The file value to validate
25
+ * @param options - Validation options for file size and extensions
26
+ * @param field - The field context from VineJS validation
21
27
  */
22
28
  const isMultipartFile = vine.createRule((file, options, field) => {
23
29
  /**
@@ -26,7 +32,7 @@ const isMultipartFile = vine.createRule((file, options, field) => {
26
32
  */
27
33
  if (!isBodyParserFile(file)) {
28
34
  field.report('The {{ field }} must be a file', 'file', field);
29
- return;
35
+ return false;
30
36
  }
31
37
  const validationOptions = typeof options === 'function' ? options(field) : options;
32
38
  /**
@@ -53,6 +59,7 @@ const isMultipartFile = vine.createRule((file, options, field) => {
53
59
  file.errors.forEach((error) => {
54
60
  field.report(error.message, `file.${error.type}`, field, validationOptions);
55
61
  });
62
+ return file.isValid;
56
63
  });
57
64
  /**
58
65
  * Represents a multipart file uploaded via multipart/form-data HTTP
@@ -84,8 +91,9 @@ export class VineMultipartFile extends BaseLiteralType {
84
91
  * @param validations - Array of validation functions to apply
85
92
  */
86
93
  constructor(validationOptions, options, validations) {
87
- super(options, validations || [isMultipartFile(validationOptions || {})]);
94
+ super(options, validations || []);
88
95
  this.#validationOptions = validationOptions;
96
+ this.dataTypeValidator = isMultipartFile(validationOptions || {});
89
97
  }
90
98
  /**
91
99
  * Creates a clone of the current VineMultipartFile instance
@@ -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';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adonisjs/core",
3
3
  "description": "Core of AdonisJS",
4
- "version": "7.0.0-next.1",
4
+ "version": "7.0.0-next.10",
5
5
  "engines": {
6
6
  "node": ">=24.0.0"
7
7
  },
@@ -54,6 +54,7 @@
54
54
  "./env/editor": "./build/modules/env/editor.js",
55
55
  "./events": "./build/modules/events.js",
56
56
  "./http": "./build/modules/http/main.js",
57
+ "./http/url_builder_client": "./build/modules/http/url_builder_client.js",
57
58
  "./logger": "./build/modules/logger.js",
58
59
  "./repl": "./build/modules/repl.js",
59
60
  "./transformers": "./build/modules/transformers/main.js",
@@ -84,10 +85,10 @@
84
85
  "index:commands": "node --import=@poppinss/ts-exec toolkit/main.js index build/commands"
85
86
  },
86
87
  "devDependencies": {
87
- "@adonisjs/assembler": "^8.0.0-next.9",
88
- "@adonisjs/eslint-config": "^3.0.0-next.1",
88
+ "@adonisjs/assembler": "^8.0.0-next.16",
89
+ "@adonisjs/eslint-config": "^3.0.0-next.4",
89
90
  "@adonisjs/prettier-config": "^1.4.5",
90
- "@adonisjs/tsconfig": "^2.0.0-next.0",
91
+ "@adonisjs/tsconfig": "^2.0.0-next.2",
91
92
  "@japa/assert": "^4.1.1",
92
93
  "@japa/expect-type": "^2.0.3",
93
94
  "@japa/file-system": "^2.3.2",
@@ -95,20 +96,20 @@
95
96
  "@japa/snapshot": "^2.0.9",
96
97
  "@poppinss/ts-exec": "^1.4.1",
97
98
  "@release-it/conventional-changelog": "^10.0.1",
98
- "@types/node": "^24.5.2",
99
+ "@types/node": "^24.10.0",
99
100
  "@types/pretty-hrtime": "^1.0.3",
100
101
  "@types/sinon": "^17.0.4",
101
102
  "@types/supertest": "^6.0.3",
102
103
  "@types/test-console": "^2.0.3",
103
- "@vinejs/vine": "^3.0.1",
104
+ "@vinejs/vine": "^4.1.0",
104
105
  "argon2": "^0.44.0",
105
106
  "bcrypt": "^6.0.0",
106
107
  "c8": "^10.1.3",
107
108
  "copyfiles": "^2.4.1",
108
- "cross-env": "^10.0.0",
109
+ "cross-env": "^10.1.0",
109
110
  "del-cli": "^7.0.0",
110
111
  "edge.js": "^6.3.0",
111
- "eslint": "^9.35.0",
112
+ "eslint": "^9.39.1",
112
113
  "execa": "^9.6.0",
113
114
  "get-port": "^7.1.0",
114
115
  "prettier": "^3.6.2",
@@ -117,30 +118,30 @@
117
118
  "supertest": "^7.1.4",
118
119
  "test-console": "^2.0.0",
119
120
  "timekeeper": "^2.3.1",
120
- "typedoc": "^0.28.13",
121
- "typescript": "^5.9.2",
121
+ "typedoc": "^0.28.14",
122
+ "typescript": "^5.9.3",
122
123
  "youch": "^4.1.0-beta.11"
123
124
  },
124
125
  "dependencies": {
125
- "@adonisjs/ace": "^14.0.1-next.1",
126
- "@adonisjs/application": "^9.0.0-next.8",
127
- "@adonisjs/bodyparser": "^11.0.0-next.1",
126
+ "@adonisjs/ace": "^14.0.1-next.2",
127
+ "@adonisjs/application": "^9.0.0-next.10",
128
+ "@adonisjs/bodyparser": "^11.0.0-next.2",
128
129
  "@adonisjs/config": "^6.0.0-next.1",
129
130
  "@adonisjs/encryption": "^7.0.0-next.1",
130
131
  "@adonisjs/env": "^7.0.0-next.1",
131
132
  "@adonisjs/events": "^10.1.0-next.2",
132
- "@adonisjs/fold": "^11.0.0-next.2",
133
+ "@adonisjs/fold": "^11.0.0-next.3",
133
134
  "@adonisjs/hash": "^10.0.0-next.1",
134
135
  "@adonisjs/health": "^3.0.0-next.0",
135
- "@adonisjs/http-server": "^8.0.0-next.7",
136
- "@adonisjs/http-transformers": "^1.4.0",
137
- "@adonisjs/logger": "^7.1.0-next.0",
136
+ "@adonisjs/http-server": "^8.0.0-next.12",
137
+ "@adonisjs/http-transformers": "^1.5.0",
138
+ "@adonisjs/logger": "^7.1.0-next.2",
138
139
  "@adonisjs/repl": "^5.0.0-next.0",
139
140
  "@poppinss/colors": "^4.1.5",
140
- "@poppinss/dumper": "^0.6.4",
141
+ "@poppinss/dumper": "^0.6.5",
141
142
  "@poppinss/macroable": "^1.1.0",
142
143
  "@poppinss/utils": "^7.0.0-next.3",
143
- "@sindresorhus/is": "^7.1.0",
144
+ "@sindresorhus/is": "^7.1.1",
144
145
  "@types/he": "^1.2.3",
145
146
  "error-stack-parser-es": "^1.0.5",
146
147
  "he": "^1.2.0",
@@ -148,8 +149,8 @@
148
149
  "string-width": "^8.1.0"
149
150
  },
150
151
  "peerDependencies": {
151
- "@adonisjs/assembler": "^8.0.0-next.6",
152
- "@vinejs/vine": "^3.0.0",
152
+ "@adonisjs/assembler": "^8.0.0-next.10",
153
+ "@vinejs/vine": "^4.0.0-next.0",
153
154
  "argon2": "^0.43.0",
154
155
  "bcrypt": "^6.0.0",
155
156
  "edge.js": "^6.2.0",