@aria-framework/kit 0.6.0 → 0.6.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 (2) hide show
  1. package/asyncHandler.js +11 -1
  2. package/package.json +1 -1
package/asyncHandler.js CHANGED
@@ -13,12 +13,22 @@
13
13
  *
14
14
  * Express 5 handles this natively. Kept anyway: it is a no-op there, and removing it would mean
15
15
  * editing every route the day an app upgrades.
16
+ *
17
+ * IT RETURNS THE PROMISE, and that `return` is load-bearing even though Express ignores it.
18
+ * TEST HARNESSES AWAIT THE HANDLER. Both consuming apps drive real route handlers directly —
19
+ * `await callback(req, res, next)` — to exercise a flow without standing up a server. Drop the
20
+ * return and `await undefined` resolves immediately, so every assertion runs BEFORE the handler
21
+ * has finished and a suite that was proving something starts proving nothing.
22
+ *
23
+ * This was found the hard way: 0.6.0 shipped without it, because the original was a one-line
24
+ * arrow whose implicit return was invisible when it was rewritten as a named function. Eight
25
+ * checks in one app's Entra suite failed, all of them looking like authorisation bugs.
16
26
  */
17
27
 
18
28
  'use strict';
19
29
 
20
30
  module.exports = function asyncHandler(fn) {
21
31
  return function (req, res, next) {
22
- Promise.resolve(fn(req, res, next)).catch(next);
32
+ return Promise.resolve(fn(req, res, next)).catch(next);
23
33
  };
24
34
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aria-framework/kit",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Aria App Framework — kit module. Small dependency-free server utilities: open-redirect guard (safeReturnTo), SQL LIKE escaping, magic-byte upload validation (fileSniff), Crockford base32 tracking IDs, and person-name compose/split helpers.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,