@c9up/ream 0.2.29 → 0.2.30

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 (220) hide show
  1. package/README.md +5 -6
  2. package/dist/Codemods.d.ts +8 -0
  3. package/dist/Codemods.d.ts.map +1 -1
  4. package/dist/Codemods.js +29 -1
  5. package/dist/Codemods.js.map +1 -1
  6. package/dist/HttpKernel.d.ts.map +1 -1
  7. package/dist/HttpKernel.js +17 -5
  8. package/dist/HttpKernel.js.map +1 -1
  9. package/dist/Ignitor.d.ts +5 -0
  10. package/dist/Ignitor.d.ts.map +1 -1
  11. package/dist/Ignitor.js +12 -1
  12. package/dist/Ignitor.js.map +1 -1
  13. package/dist/bodyparser/BodyParserMiddleware.d.ts +4 -4
  14. package/dist/bodyparser/BodyParserMiddleware.d.ts.map +1 -1
  15. package/dist/bodyparser/BodyParserMiddleware.js +38 -11
  16. package/dist/bodyparser/BodyParserMiddleware.js.map +1 -1
  17. package/dist/bodyparser/MultipartFile.d.ts +21 -15
  18. package/dist/bodyparser/MultipartFile.d.ts.map +1 -1
  19. package/dist/bodyparser/MultipartFile.js +40 -58
  20. package/dist/bodyparser/MultipartFile.js.map +1 -1
  21. package/dist/bodyparser/parseSize.d.ts +7 -4
  22. package/dist/bodyparser/parseSize.d.ts.map +1 -1
  23. package/dist/bodyparser/parseSize.js +12 -17
  24. package/dist/bodyparser/parseSize.js.map +1 -1
  25. package/dist/bodyparser/qsParse.d.ts +10 -0
  26. package/dist/bodyparser/qsParse.d.ts.map +1 -1
  27. package/dist/bodyparser/qsParse.js +27 -12
  28. package/dist/bodyparser/qsParse.js.map +1 -1
  29. package/dist/console/prompts.d.ts.map +1 -1
  30. package/dist/console/prompts.js +3 -1
  31. package/dist/console/prompts.js.map +1 -1
  32. package/dist/container/Container.d.ts.map +1 -1
  33. package/dist/container/Container.js +61 -71
  34. package/dist/container/Container.js.map +1 -1
  35. package/dist/events/Emitter.d.ts +12 -0
  36. package/dist/events/Emitter.d.ts.map +1 -1
  37. package/dist/events/Emitter.js +36 -9
  38. package/dist/events/Emitter.js.map +1 -1
  39. package/dist/events/helix/helpers.d.ts.map +1 -1
  40. package/dist/events/helix/helpers.js +19 -9
  41. package/dist/events/helix/helpers.js.map +1 -1
  42. package/dist/graphql/GraphQLEngine.d.ts +8 -0
  43. package/dist/graphql/GraphQLEngine.d.ts.map +1 -1
  44. package/dist/graphql/GraphQLEngine.js +77 -11
  45. package/dist/graphql/GraphQLEngine.js.map +1 -1
  46. package/dist/helpers/MessageBuilder.d.ts +4 -2
  47. package/dist/helpers/MessageBuilder.d.ts.map +1 -1
  48. package/dist/helpers/MessageBuilder.js +4 -2
  49. package/dist/helpers/MessageBuilder.js.map +1 -1
  50. package/dist/helpers/errors.d.ts +11 -0
  51. package/dist/helpers/errors.d.ts.map +1 -0
  52. package/dist/helpers/errors.js +17 -0
  53. package/dist/helpers/errors.js.map +1 -0
  54. package/dist/helpers/napi-loader.d.ts.map +1 -1
  55. package/dist/helpers/napi-loader.js +3 -2
  56. package/dist/helpers/napi-loader.js.map +1 -1
  57. package/dist/http/HttpContext.d.ts +20 -2
  58. package/dist/http/HttpContext.d.ts.map +1 -1
  59. package/dist/http/HttpContext.js +10 -4
  60. package/dist/http/HttpContext.js.map +1 -1
  61. package/dist/http/RedirectBuilder.d.ts.map +1 -1
  62. package/dist/http/RedirectBuilder.js +4 -0
  63. package/dist/http/RedirectBuilder.js.map +1 -1
  64. package/dist/http/Request.d.ts.map +1 -1
  65. package/dist/http/Request.js +15 -29
  66. package/dist/http/Request.js.map +1 -1
  67. package/dist/http/Response.d.ts +7 -4
  68. package/dist/http/Response.d.ts.map +1 -1
  69. package/dist/http/Response.js +14 -6
  70. package/dist/http/Response.js.map +1 -1
  71. package/dist/http/permissions.d.ts +14 -8
  72. package/dist/http/permissions.d.ts.map +1 -1
  73. package/dist/http/permissions.js +26 -16
  74. package/dist/http/permissions.js.map +1 -1
  75. package/dist/index.d.ts +2 -2
  76. package/dist/index.d.ts.map +1 -1
  77. package/dist/index.js +1 -1
  78. package/dist/index.js.map +1 -1
  79. package/dist/middleware/Pipeline.js +1 -1
  80. package/dist/middleware/Pipeline.js.map +1 -1
  81. package/dist/native/generated.d.ts +16 -30
  82. package/dist/native/generated.d.ts.map +1 -1
  83. package/dist/profiler/Profiler.d.ts.map +1 -1
  84. package/dist/profiler/Profiler.js +4 -1
  85. package/dist/profiler/Profiler.js.map +1 -1
  86. package/dist/profiler/client.generated.d.ts +5 -0
  87. package/dist/profiler/client.generated.d.ts.map +1 -0
  88. package/dist/profiler/client.generated.js +6 -0
  89. package/dist/profiler/client.generated.js.map +1 -0
  90. package/dist/profiler/collectors.d.ts +92 -13
  91. package/dist/profiler/collectors.d.ts.map +1 -1
  92. package/dist/profiler/collectors.js +106 -19
  93. package/dist/profiler/collectors.js.map +1 -1
  94. package/dist/profiler/endpoint.d.ts +2 -1
  95. package/dist/profiler/endpoint.d.ts.map +1 -1
  96. package/dist/profiler/endpoint.js +25 -1
  97. package/dist/profiler/endpoint.js.map +1 -1
  98. package/dist/profiler/index.d.ts +8 -4
  99. package/dist/profiler/index.d.ts.map +1 -1
  100. package/dist/profiler/index.js +11 -4
  101. package/dist/profiler/index.js.map +1 -1
  102. package/dist/profiler/middleware.d.ts.map +1 -1
  103. package/dist/profiler/middleware.js +76 -10
  104. package/dist/profiler/middleware.js.map +1 -1
  105. package/dist/profiler/preview.d.ts +17 -0
  106. package/dist/profiler/preview.d.ts.map +1 -0
  107. package/dist/profiler/preview.js +100 -0
  108. package/dist/profiler/preview.js.map +1 -0
  109. package/dist/profiler/toolbar.d.ts +15 -23
  110. package/dist/profiler/toolbar.d.ts.map +1 -1
  111. package/dist/profiler/toolbar.js +25 -91
  112. package/dist/profiler/toolbar.js.map +1 -1
  113. package/dist/profiler/types.d.ts +6 -1
  114. package/dist/profiler/types.d.ts.map +1 -1
  115. package/dist/router/Router.d.ts +6 -0
  116. package/dist/router/Router.d.ts.map +1 -1
  117. package/dist/router/Router.js +115 -12
  118. package/dist/router/Router.js.map +1 -1
  119. package/dist/rpc/RpcRouter.js +3 -3
  120. package/dist/rpc/RpcRouter.js.map +1 -1
  121. package/dist/scheduler/Scheduler.js +1 -1
  122. package/dist/scheduler/Scheduler.js.map +1 -1
  123. package/dist/security/CookieSigner.d.ts.map +1 -1
  124. package/dist/security/CookieSigner.js +15 -5
  125. package/dist/security/CookieSigner.js.map +1 -1
  126. package/dist/security/SignedUrl.d.ts.map +1 -1
  127. package/dist/security/SignedUrl.js +10 -18
  128. package/dist/security/SignedUrl.js.map +1 -1
  129. package/dist/server/Server.d.ts +4 -1
  130. package/dist/server/Server.d.ts.map +1 -1
  131. package/dist/server/Server.js.map +1 -1
  132. package/dist/server/nativeLimits.d.ts +9 -1
  133. package/dist/server/nativeLimits.d.ts.map +1 -1
  134. package/dist/server/nativeLimits.js +8 -0
  135. package/dist/server/nativeLimits.js.map +1 -1
  136. package/dist/session/Session.d.ts.map +1 -1
  137. package/dist/session/Session.js +13 -4
  138. package/dist/session/Session.js.map +1 -1
  139. package/dist/session/drivers/MemoryDriver.d.ts.map +1 -1
  140. package/dist/session/drivers/MemoryDriver.js +14 -2
  141. package/dist/session/drivers/MemoryDriver.js.map +1 -1
  142. package/dist/storage/StaticMiddleware.d.ts.map +1 -1
  143. package/dist/storage/StaticMiddleware.js +20 -9
  144. package/dist/storage/StaticMiddleware.js.map +1 -1
  145. package/dist/testing/ApiResponse.d.ts.map +1 -1
  146. package/dist/testing/ApiResponse.js +7 -1
  147. package/dist/testing/ApiResponse.js.map +1 -1
  148. package/dist/testing/TestClient.d.ts.map +1 -1
  149. package/dist/testing/TestClient.js +16 -4
  150. package/dist/testing/TestClient.js.map +1 -1
  151. package/dist/utils/Macroable.d.ts +1 -1
  152. package/dist/utils/Macroable.js +2 -2
  153. package/dist/utils/Macroable.js.map +1 -1
  154. package/events.darwin-arm64.node +0 -0
  155. package/events.darwin-x64.node +0 -0
  156. package/events.linux-arm64-gnu.node +0 -0
  157. package/events.linux-x64-gnu.node +0 -0
  158. package/events.win32-x64-msvc.node +0 -0
  159. package/index.darwin-arm64.node +0 -0
  160. package/index.darwin-x64.node +0 -0
  161. package/index.linux-arm64-gnu.node +0 -0
  162. package/index.linux-x64-gnu.node +0 -0
  163. package/index.win32-x64-msvc.node +0 -0
  164. package/package.json +1 -2
  165. package/scheduler.darwin-arm64.node +0 -0
  166. package/scheduler.darwin-x64.node +0 -0
  167. package/scheduler.linux-arm64-gnu.node +0 -0
  168. package/scheduler.linux-x64-gnu.node +0 -0
  169. package/scheduler.win32-x64-msvc.node +0 -0
  170. package/src/Codemods.ts +49 -3
  171. package/src/HttpKernel.ts +18 -7
  172. package/src/Ignitor.ts +21 -4
  173. package/src/bodyparser/BodyParserMiddleware.ts +42 -16
  174. package/src/bodyparser/MultipartFile.ts +46 -67
  175. package/src/bodyparser/parseSize.ts +17 -17
  176. package/src/bodyparser/qsParse.ts +28 -13
  177. package/src/console/prompts.ts +3 -1
  178. package/src/container/Container.ts +97 -81
  179. package/src/events/Emitter.ts +37 -10
  180. package/src/events/helix/helpers.ts +24 -19
  181. package/src/graphql/GraphQLEngine.ts +89 -13
  182. package/src/helpers/MessageBuilder.ts +4 -2
  183. package/src/helpers/errors.ts +16 -0
  184. package/src/helpers/napi-loader.ts +3 -2
  185. package/src/http/HttpContext.ts +20 -4
  186. package/src/http/RedirectBuilder.ts +3 -0
  187. package/src/http/Request.ts +15 -29
  188. package/src/http/Response.ts +15 -7
  189. package/src/http/permissions.ts +31 -15
  190. package/src/index.ts +2 -1
  191. package/src/middleware/Pipeline.ts +1 -1
  192. package/src/native/generated.ts +18 -42
  193. package/src/profiler/Profiler.ts +4 -1
  194. package/src/profiler/client/toolbar.css +595 -0
  195. package/src/profiler/client/toolbar.js +1299 -0
  196. package/src/profiler/client.generated.ts +7 -0
  197. package/src/profiler/collectors.ts +156 -19
  198. package/src/profiler/endpoint.ts +27 -1
  199. package/src/profiler/index.ts +17 -3
  200. package/src/profiler/middleware.ts +74 -9
  201. package/src/profiler/preview.ts +104 -0
  202. package/src/profiler/toolbar.ts +28 -91
  203. package/src/profiler/types.ts +6 -1
  204. package/src/router/Router.ts +136 -13
  205. package/src/rpc/RpcRouter.ts +4 -4
  206. package/src/scheduler/Scheduler.ts +1 -1
  207. package/src/security/CookieSigner.ts +13 -5
  208. package/src/security/SignedUrl.ts +12 -16
  209. package/src/server/Server.ts +4 -1
  210. package/src/server/nativeLimits.ts +18 -1
  211. package/src/session/Session.ts +13 -4
  212. package/src/session/drivers/MemoryDriver.ts +15 -2
  213. package/src/storage/StaticMiddleware.ts +18 -9
  214. package/src/testing/ApiResponse.ts +7 -1
  215. package/src/testing/TestClient.ts +14 -5
  216. package/src/utils/Macroable.ts +2 -2
  217. package/scripts/build-napi-types.mjs +0 -69
  218. package/scripts/copy-napi.mjs +0 -121
  219. package/scripts/generate-mime.mjs +0 -119
  220. package/scripts/generate-napi-types.mjs +0 -187
@@ -142,7 +142,7 @@ export class TestClient {
142
142
  // Boots on the first request and no earlier. `#port` is read here rather
143
143
  // than captured, so it is the port this boot bound to.
144
144
  await this.boot();
145
- return sendRequest(this.#port, m, p, { ...this.#headers, ...init.headers }, init.body.toString('utf8'), init.timeoutMs);
145
+ return sendRequest(this.#port, m, p, { ...this.#headers, ...init.headers }, init.body, init.timeoutMs);
146
146
  };
147
147
  return new RequestBuilder(sender, method, path, this.#auth, this.#sessionSeeder);
148
148
  }
@@ -213,7 +213,10 @@ async function sendRequest(port, method, path, headers, body, timeoutMs) {
213
213
  const headerLines = Object.entries(headers)
214
214
  .map(([k, v]) => `${k}: ${v}`)
215
215
  .join('\r\n');
216
- const contentLength = Buffer.byteLength(body, 'utf8');
216
+ // The body stays a Buffer end to end: a multipart upload of a PNG or a
217
+ // PDF is not valid UTF-8, and a round trip through a string replaced
218
+ // every such byte with U+FFFD before the server ever saw it.
219
+ const contentLength = body.length;
217
220
  let request = `${method} ${path} HTTP/1.1\r\n`;
218
221
  request += `Host: localhost:${port}\r\n`;
219
222
  request += `Connection: close\r\n`;
@@ -224,8 +227,9 @@ async function sendRequest(port, method, path, headers, body, timeoutMs) {
224
227
  request += `${headerLines}\r\n`;
225
228
  }
226
229
  request += '\r\n';
227
- request += body;
228
230
  socket.write(request);
231
+ if (contentLength > 0)
232
+ socket.write(body);
229
233
  });
230
234
  const chunks = [];
231
235
  socket.on('data', (chunk) => chunks.push(chunk));
@@ -276,6 +280,10 @@ export function parseHttpResponse(raw) {
276
280
  const statusLine = lines[0] ?? '';
277
281
  const [, statusDigits] = statusLine.match(/HTTP\/\d+\.\d+ (\d+)/) ?? [];
278
282
  const status = statusDigits === undefined ? 0 : Number.parseInt(statusDigits, 10);
283
+ // A repeated header is never overwritten. Set-Cookie lines are joined with
284
+ // `\n`, the way `Response.getHeaders()` hands them to the serializer: a
285
+ // cookie's `Expires` holds a comma, so a comma cannot separate two of them
286
+ // (RFC 6265 §3). Any other field is combined with `, ` (RFC 9110 §5.3).
279
287
  const headers = {};
280
288
  for (const line of lines.slice(1)) {
281
289
  const colonIdx = line.indexOf(':');
@@ -283,7 +291,11 @@ export function parseHttpResponse(raw) {
283
291
  continue;
284
292
  const key = line.slice(0, colonIdx).trim().toLowerCase();
285
293
  const value = line.slice(colonIdx + 1).trim();
286
- headers[key] = value;
294
+ const existing = headers[key];
295
+ if (existing === undefined)
296
+ headers[key] = value;
297
+ else
298
+ headers[key] = `${existing}${key === 'set-cookie' ? '\n' : ', '}${value}`;
287
299
  }
288
300
  // RFC 7230 §4.1: when Transfer-Encoding includes `chunked`, the message body
289
301
  // is a sequence of `<size-hex>[;ext]\r\n<bytes>\r\n` chunks terminated by
@@ -1 +1 @@
1
- {"version":3,"file":"TestClient.js","sourceRoot":"","sources":["../../src/testing/TestClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAIL,cAAc,GAGf,MAAM,qBAAqB,CAAA;AAE5B,4EAA4E;AAC5E,6EAA6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G,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;QACnC,CAAC,IAAI,IAAI,GAAG,IAAI,CAAC,MAAM,CAAA,CAAC,wBAAwB;IAClD,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;AAC3B,CAAC"}
@@ -22,7 +22,7 @@ export declare class Macroable {
22
22
  /**
23
23
  * Attach a method to every instance of THIS class (AdonisJS `macro`).
24
24
  *
25
- * `this.prototype`, not `Macroable.prototype`: eight classes extend this one,
25
+ * `this.prototype`, not `Macroable.prototype`: nine classes extend this one,
26
26
  * and defining on the base put every macro on all of them — a
27
27
  * `Response.macro('json', …)` also landed on `Request`, `Router` and
28
28
  * `HttpContext`, and two subclasses declaring the same name clobbered each
@@ -3,12 +3,12 @@
3
3
  // is what scopes a macro to the subclass that declared it. Using
4
4
  // `Macroable.prototype` put every macro on all eight subclasses at once.
5
5
  // Removing the `this` reintroduces that bug.
6
- // biome-ignore lint/complexity/noStaticOnlyClass: eight classes extend this one to inherit macro()/getter(); it is a base class, not a namespace.
6
+ // biome-ignore lint/complexity/noStaticOnlyClass: nine classes extend this one to inherit macro()/getter(); it is a base class, not a namespace.
7
7
  export class Macroable {
8
8
  /**
9
9
  * Attach a method to every instance of THIS class (AdonisJS `macro`).
10
10
  *
11
- * `this.prototype`, not `Macroable.prototype`: eight classes extend this one,
11
+ * `this.prototype`, not `Macroable.prototype`: nine classes extend this one,
12
12
  * and defining on the base put every macro on all of them — a
13
13
  * `Response.macro('json', …)` also landed on `Request`, `Router` and
14
14
  * `HttpContext`, and two subclasses declaring the same name clobbered each
@@ -1 +1 @@
1
- {"version":3,"file":"Macroable.js","sourceRoot":"","sources":["../../src/utils/Macroable.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,gFAAgF;AAChF,iEAAiE;AACjE,yEAAyE;AACzE,6CAA6C;AAyB7C,kJAAkJ;AAClJ,MAAM,OAAO,SAAS;IACpB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SAAS;IACpB;;;;;;;;OAQG;IACH,oEAAoE;IACpE,8EAA8E;IAC9E,8EAA8E;IAC9E,+EAA+E;IAC/E,MAAM,CAAC,KAAK,CAA8B,IAAY,EAAE,EAAW;QACjE,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE;YAC1C,KAAK,EAAE,EAAE;YACT,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,IAAI;SACnB,CAAC,CAAA;IACJ,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,MAAM,CAA8B,IAAY,EAAE,EAAY,EAAE,SAAS,GAAG,KAAK;QACtF,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAA;YAC5E,OAAM;QACR,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;QAC7B,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE;YAC1C,YAAY,EAAE,IAAI;YAClB,GAAG;gBACD,IAAI,CAAC,CAAC,QAAQ,IAAI,IAAI,CAAC,EAAE,CAAC;oBACxB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAA;gBACrF,CAAC;gBACD,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAA;YACvB,CAAC;SACF,CAAC,CAAA;IACJ,CAAC;CACF"}
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c9up/ream",
3
- "version": "0.2.29",
3
+ "version": "0.2.30",
4
4
  "description": "Ream — Rust-powered Node.js application framework",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -228,7 +228,6 @@
228
228
  "index.*.node",
229
229
  "scheduler.*.node",
230
230
  "events.*.node",
231
- "scripts",
232
231
  "src",
233
232
  "swcrc.app.json",
234
233
  "tsconfig.app.json",
Binary file
Binary file
Binary file
Binary file
Binary file
package/src/Codemods.ts CHANGED
@@ -43,7 +43,10 @@ export interface Codemods {
43
43
  options?: { force?: boolean },
44
44
  ): Promise<GeneratedStub>
45
45
  registerCommand(importPath: string): Promise<void>
46
- registerMiddleware(importPath: string, options?: { tier?: 'server' | 'router' }): Promise<void>
46
+ registerMiddleware(
47
+ importPath: string,
48
+ options?: { tier?: 'server' | 'router'; position?: MiddlewarePosition },
49
+ ): Promise<void>
47
50
  defineEnvValidations(definition: EnvValidationNode): Promise<string[]>
48
51
  addPreloadFile(modulePath: string, environments?: PreloadEnvironment[]): Promise<void>
49
52
  }
@@ -131,6 +134,40 @@ function findTierBlock(
131
134
  return { start, end: start + closeMatch.index }
132
135
  }
133
136
 
137
+ /**
138
+ * Where a middleware entry goes in its tier's array: at the end (`after`, the
139
+ * default, as the upstream assembler does) or at the head (`before`). Order is
140
+ * execution order, so a middleware that needs another one's work — a CSRF
141
+ * guard reading the session — is appended after it.
142
+ */
143
+ export type MiddlewarePosition = 'before' | 'after'
144
+
145
+ /**
146
+ * Insert `text` after the last element of the array whose contents span
147
+ * `block`, adding the comma the previous element may lack. A trailing line
148
+ * comment is stepped over so the comma never lands inside it.
149
+ */
150
+ function appendToArray(
151
+ content: string,
152
+ block: { start: number; end: number },
153
+ text: string,
154
+ ): string {
155
+ const inner = content.slice(block.start, block.end)
156
+ const trimmed = inner.trimEnd()
157
+ const insertAt = block.start + trimmed.length
158
+ if (trimmed.trim() === '' || trimmed.endsWith(',')) {
159
+ return `${content.slice(0, insertAt)}${text}${content.slice(insertAt)}`
160
+ }
161
+ const lineStart = trimmed.lastIndexOf('\n') + 1
162
+ const commentAt = trimmed.indexOf('//', lineStart)
163
+ const code = (commentAt === -1 ? trimmed : trimmed.slice(0, commentAt)).trimEnd()
164
+ if (code.trim() === '' || code.endsWith(',')) {
165
+ return `${content.slice(0, insertAt)}${text}${content.slice(insertAt)}`
166
+ }
167
+ const commaAt = block.start + code.length
168
+ return `${content.slice(0, commaAt)},${content.slice(commaAt, insertAt)}${text}${content.slice(insertAt)}`
169
+ }
170
+
134
171
  /**
135
172
  * Detect line ending (CRLF on Windows checkouts, LF elsewhere) so codemods preserve the file's existing convention.
136
173
  * Majority-based: a stray CRLF in an otherwise-LF file must not flip the whole insertion to CRLF.
@@ -566,8 +603,14 @@ export function createCodemods(options?: { force?: boolean; cwd?: string }): Cod
566
603
  */
567
604
  async registerMiddleware(
568
605
  importPath: string,
569
- options?: { tier?: MiddlewareTier },
606
+ options?: { tier?: MiddlewareTier; position?: MiddlewarePosition },
570
607
  ): Promise<void> {
608
+ const position = options?.position ?? 'after'
609
+ if (position !== 'before' && position !== 'after') {
610
+ throw new Error(
611
+ `[configure] Invalid middleware position: '${String(position)}'. Expected 'before' or 'after'.`,
612
+ )
613
+ }
571
614
  const requestedTier = options?.tier ?? 'router'
572
615
  if (!isMiddlewareTier(requestedTier)) {
573
616
  throw new Error(
@@ -612,7 +655,10 @@ export function createCodemods(options?: { force?: boolean; cwd?: string }): Cod
612
655
 
613
656
  const eol = detectLineEnding(content)
614
657
  const entry = ` () => import('${importPath}'),`
615
- content = `${content.slice(0, targetBlock.start)}${eol}${entry}${content.slice(targetBlock.start)}`
658
+ content =
659
+ position === 'before'
660
+ ? `${content.slice(0, targetBlock.start)}${eol}${entry}${content.slice(targetBlock.start)}`
661
+ : appendToArray(content, targetBlock, `${eol}${entry}`)
616
662
  fs.writeFileSync(kernelPath, content)
617
663
  },
618
664
 
package/src/HttpKernel.ts CHANGED
@@ -200,7 +200,7 @@ export function createHttpKernel(
200
200
  // read decorator metadata via Reflect. Absent for inline-arrow
201
201
  // route handlers — that's intentional, decorators only apply
202
202
  // to controller methods.
203
- controller: match.route.controller?.target.prototype as object | undefined,
203
+ controller: controllerPrototype(match.route.controller?.target),
204
204
  action: match.route.controller?.method,
205
205
  }
206
206
  : { pattern: '', middleware: [] }
@@ -212,6 +212,7 @@ export function createHttpKernel(
212
212
  // value bound for this request cannot be seen by any other.
213
213
  const resolver = config.container?.createResolver()
214
214
  const ctx = new HttpContext(correlationId, reqData, match?.params ?? {}, routeInfo, resolver)
215
+ ctx.subdomains = match?.subdomains ?? {}
215
216
  // What Adonis binds on every request's resolver: the context itself, so a
216
217
  // controller or service can take `HttpContext` as a constructor dependency.
217
218
  resolver?.bindValue(HttpContext, ctx)
@@ -453,18 +454,25 @@ function createControllerHandler(
453
454
  // `HttpContext` as a dependency must get this request's, not a stale one.
454
455
  const resolve = ctx.containerResolver ?? container
455
456
  const instance = resolve ? await resolve.make(controller.target) : new controller.target()
456
- const method = (instance as Record<string, (ctx: HttpContext) => Promise<void> | void>)[
457
- controller.method
458
- ]
457
+ const method: unknown =
458
+ typeof instance === 'object' && instance !== null
459
+ ? Reflect.get(instance, controller.method)
460
+ : undefined
459
461
  if (typeof method !== 'function') {
460
462
  throw new Error(
461
463
  `Controller method '${controller.method}' not found on ${controller.target.name}`,
462
464
  )
463
465
  }
464
- await method.call(instance, ctx)
466
+ await Reflect.apply(method, instance, [ctx])
465
467
  }
466
468
  }
467
469
 
470
+ /** A controller class's prototype, where its decorators keep their metadata. */
471
+ function controllerPrototype(target: AnyConstructor | undefined): object | undefined {
472
+ const prototype: unknown = target?.prototype
473
+ return typeof prototype === 'object' && prototype !== null ? prototype : undefined
474
+ }
475
+
468
476
  /**
469
477
  * Read @Guard, @Role, @Permission metadata from a controller method.
470
478
  * Returns empty arrays if no decorators are present.
@@ -554,8 +562,10 @@ function reconcileRepresentation(
554
562
  /**
555
563
  * Append the development script to an HTML body.
556
564
  *
557
- * Only HTML, and never a stream: appending to an SSE or a download would
558
- * corrupt it, and a page is the only thing that can act on the script anyway.
565
+ * Only HTML, and never a stream or a base64-encoded body (`sendBuffer`, a
566
+ * buffered download): appending to any of them corrupts it — Rust fails to
567
+ * decode the base64 and the client receives the encoded text — and a page is
568
+ * the only thing that can act on the script anyway.
559
569
  * Before `</body>` when there is one, so the script is inside the document
560
570
  * rather than trailing after it.
561
571
  */
@@ -567,6 +577,7 @@ function withDevScript(
567
577
  ): string {
568
578
  if (script === undefined || streamId !== undefined || body === '') return body
569
579
  if (!(headers['content-type'] ?? '').includes('text/html')) return body
580
+ if (headers['x-ream-body-encoding'] === 'base64') return body
570
581
  const closing = body.lastIndexOf('</body>')
571
582
  return closing === -1 ? body + script : body.slice(0, closing) + script + body.slice(closing)
572
583
  }
package/src/Ignitor.ts CHANGED
@@ -301,6 +301,11 @@ export interface HyperServerLike {
301
301
  // a clean `STREAMING_UNSUPPORTED` error when called on such a host.
302
302
  registerStream?(streamId: string): Promise<boolean>
303
303
  writeStream?(streamId: string, chunk: string): Promise<boolean>
304
+ /**
305
+ * Byte-exact writes. Without it a download, `response.stream()` or a static
306
+ * file is buffered whole and shipped base64-encoded in one response.
307
+ */
308
+ writeStreamBytes?(streamId: string, chunk: Uint8Array): Promise<boolean>
304
309
  closeStream?(streamId: string): Promise<boolean>
305
310
  onStreamDisconnect?(streamId: string, callback: () => void): void
306
311
  }
@@ -874,6 +879,12 @@ export class Ignitor {
874
879
  return {
875
880
  registerStream: server.registerStream.bind(server),
876
881
  writeStream: server.writeStream.bind(server),
882
+ // The byte channel is what lets a download be streamed rather
883
+ // than read whole into memory; a host without it still gets SSE.
884
+ writeStreamBytes:
885
+ typeof server.writeStreamBytes === 'function'
886
+ ? server.writeStreamBytes.bind(server)
887
+ : undefined,
877
888
  closeStream: server.closeStream.bind(server),
878
889
  onStreamDisconnect: server.onStreamDisconnect.bind(server),
879
890
  }
@@ -1021,7 +1032,7 @@ export class Ignitor {
1021
1032
  'File change detected — a process restart is required to apply it (`ream dev` restarts automatically).',
1022
1033
  severity: 'info',
1023
1034
  timestamp: new Date().toISOString(),
1024
- } as ErrorEvent)
1035
+ })
1025
1036
  },
1026
1037
  logger: {
1027
1038
  info: (msg) =>
@@ -1031,7 +1042,7 @@ export class Ignitor {
1031
1042
  message: msg,
1032
1043
  severity: 'info',
1033
1044
  timestamp: new Date().toISOString(),
1034
- } as ErrorEvent),
1045
+ }),
1035
1046
  },
1036
1047
  })
1037
1048
  }
@@ -1414,7 +1425,13 @@ export class Ignitor {
1414
1425
  const events = this.#app.container.has('events')
1415
1426
  ? await this.#app.container.resolve<Emitter>('events')
1416
1427
  : { on: () => undefined }
1417
- this.#profiler = createProfiler(events)
1428
+ // Imported here, at start, rather than at the top: the barrel imports this
1429
+ // module, and its `VERSION` is what the release bump rewrites.
1430
+ const { VERSION } = await import('./index.js')
1431
+ this.#profiler = createProfiler(events, [], {
1432
+ version: VERSION,
1433
+ environment: process.env.REAM_ENV ?? process.env.NODE_ENV ?? 'development',
1434
+ })
1418
1435
  }
1419
1436
 
1420
1437
  #profiler?: Profiler
@@ -1468,7 +1485,7 @@ export class Ignitor {
1468
1485
  message,
1469
1486
  severity: kind === 'error' ? 'critical' : 'info',
1470
1487
  timestamp: new Date().toISOString(),
1471
- } as ErrorEvent)
1488
+ })
1472
1489
  }
1473
1490
  }
1474
1491
 
@@ -21,11 +21,11 @@ export interface BodyParserConfig {
21
21
  */
22
22
  allowedMethods?: string[]
23
23
  json?: {
24
- limit?: string // e.g. '1mb'
24
+ limit?: string | number // e.g. '1mb', '1.5 mb' or a number of bytes
25
25
  types?: string[]
26
26
  }
27
27
  form?: {
28
- limit?: string
28
+ limit?: string | number
29
29
  types?: string[]
30
30
  /**
31
31
  * Turn `''` into `null`. AdonisJS defaults this to `true`, so an empty
@@ -39,12 +39,12 @@ export interface BodyParserConfig {
39
39
  queryString?: QsParseOptions
40
40
  }
41
41
  raw?: {
42
- limit?: string
42
+ limit?: string | number
43
43
  types?: string[]
44
44
  }
45
45
  multipart?: {
46
46
  /** Total multipart body size cap (sum of all file sizes). Default: '20mb'. */
47
- limit?: string
47
+ limit?: string | number
48
48
  /**
49
49
  * Maximum number of files per request. AdonisJS has no such option — it
50
50
  * bounds a multipart body by total size and field count only, so ten
@@ -98,6 +98,8 @@ const DEFAULT_CONFIG: ResolvedBodyParserConfig = {
98
98
 
99
99
  export default class BodyParserMiddleware {
100
100
  #config: ResolvedBodyParserConfig
101
+ /** Each section's limit in bytes, read once so a bad size fails at boot. */
102
+ readonly #limits: { json: number; form: number; raw: number; multipart: number }
101
103
 
102
104
  constructor(explicitConfig: BodyParserConfig | undefined = undefined) {
103
105
  // The default value is load-bearing: an OPTIONAL parameter still counts
@@ -118,6 +120,12 @@ export default class BodyParserMiddleware {
118
120
  raw: { ...DEFAULT_CONFIG.raw, ...config?.raw },
119
121
  multipart: { ...DEFAULT_CONFIG.multipart, ...config?.multipart },
120
122
  }
123
+ this.#limits = {
124
+ json: parseSize(this.#config.json.limit),
125
+ form: parseSize(this.#config.form.limit),
126
+ raw: parseSize(this.#config.raw.limit),
127
+ multipart: parseSize(this.#config.multipart.limit),
128
+ }
121
129
  }
122
130
 
123
131
  async handle(ctx: HttpContext, next: () => Promise<void>) {
@@ -144,13 +152,14 @@ export default class BodyParserMiddleware {
144
152
  // Size check. Thrown rather than written: the app's exception handler
145
153
  // negotiates the response, so an HTML app gets an error page instead of a
146
154
  // JSON envelope it never asked for — and can override the rendering.
147
- if (Buffer.byteLength(rawBody, 'utf8') > parseSize(this.#getLimit(contentType))) {
155
+ if (Buffer.byteLength(rawBody, 'utf8') > this.#getLimit(contentType)) {
148
156
  throw entityTooLarge('request entity too large')
149
157
  }
150
158
 
151
- // JSON
159
+ // JSON — parsed here and only here, under one of `json.types`. A body
160
+ // with any other media type (or none) is never read as JSON.
152
161
  if (matchesType(contentType, this.#config.json.types)) {
153
- // `Request` lazy-parses JSON on first read; nothing to do here.
162
+ ctx.request.setParsedBody(parseJsonBody(rawBody))
154
163
  }
155
164
 
156
165
  // Form URL-encoded
@@ -191,11 +200,11 @@ export default class BodyParserMiddleware {
191
200
  await next()
192
201
  }
193
202
 
194
- #getLimit(contentType: string): string {
195
- if (matchesType(contentType, this.#config.json.types)) return this.#config.json.limit
196
- if (matchesType(contentType, this.#config.form.types)) return this.#config.form.limit
197
- if (matchesType(contentType, this.#config.multipart.types)) return this.#config.multipart.limit
198
- return this.#config.raw.limit
203
+ #getLimit(contentType: string): number {
204
+ if (matchesType(contentType, this.#config.json.types)) return this.#limits.json
205
+ if (matchesType(contentType, this.#config.form.types)) return this.#limits.form
206
+ if (matchesType(contentType, this.#config.multipart.types)) return this.#limits.multipart
207
+ return this.#limits.raw
199
208
  }
200
209
 
201
210
  /**
@@ -217,12 +226,30 @@ export default class BodyParserMiddleware {
217
226
  }
218
227
 
219
228
  const totalBytes = files.reduce((sum, f) => sum + f.size, 0)
220
- if (totalBytes > parseSize(cfg.limit)) {
229
+ if (totalBytes > this.#limits.multipart) {
221
230
  throw entityTooLarge('request entity too large')
222
231
  }
223
232
  }
224
233
  }
225
234
 
235
+ /**
236
+ * A JSON body as the request body: an object as is, any other JSON value under
237
+ * `_body` (the shape the raw-text parser uses), and `{}` for malformed JSON.
238
+ */
239
+ function parseJsonBody(raw: string): Record<string, unknown> {
240
+ if (raw.length === 0) return {}
241
+ let parsed: unknown
242
+ try {
243
+ parsed = JSON.parse(raw)
244
+ } catch {
245
+ return {}
246
+ }
247
+ if (parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed)) {
248
+ return { ...parsed }
249
+ }
250
+ return { _body: parsed }
251
+ }
252
+
226
253
  /** The one exception every body-size limit raises (AdonisJS parity). */
227
254
  function entityTooLarge(message: string): Exception {
228
255
  return new Exception(message, { status: 413, code: 'E_REQUEST_ENTITY_TOO_LARGE' })
@@ -250,8 +277,7 @@ function matchesType(contentType: string, types: string[]): boolean {
250
277
 
251
278
  /**
252
279
  * `enabled` was an atlas-era invention: AdonisJS has no such flag, and a parser
253
- * is turned off by giving it no `types`. It also never worked for JSON, which
254
- * `Request` lazy-parses on first read regardless.
280
+ * is turned off by giving it no `types`.
255
281
  *
256
282
  * Silently ignoring a config key that used to mean something would re-enable a
257
283
  * parser an app deliberately switched off, so it fails loudly with the
@@ -278,7 +304,7 @@ function assertNoEnabledFlag(config?: BodyParserConfig): void {
278
304
  throw new Error(
279
305
  '[E_BODYPARSER_CONFIG] `multipart.tmpDir` is not supported — uploaded files are held in ' +
280
306
  'memory and never written to a temporary directory. Choose the destination when you ' +
281
- 'store the file: `await file.moveToDisk(directory)`.',
307
+ 'store the file: `await file.move(directory)`.',
282
308
  )
283
309
  }
284
310
  }