@getstrata/bootstrap 1.1.9 → 2.0.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @getstrata/bootstrap changelog
2
2
 
3
+ ## 2.0.0
4
+
5
+ - Strata 2.0: compose business transactions and tenant scopes
6
+
3
7
  ## 1.1.9
4
8
 
5
9
  - Defer model events until the surrounding transaction commits
@@ -10,11 +10,12 @@ function socketAddress(server, request) {
10
10
  async function missingHtmlResponse() {
11
11
  return notFoundHtmlResponse();
12
12
  }
13
- function wrapRouteHandler(handler) {
13
+ function wrapRouteHandler(handler, path) {
14
14
  return async (request, server) => {
15
15
  return await runWithRequestMeta({
16
16
  ...currentRequestMeta(),
17
17
  request,
18
+ routeTemplate: path,
18
19
  ipAddress: socketAddress(server, request),
19
20
  userAgent: request.headers.get("user-agent")
20
21
  }, async () => {
@@ -27,7 +28,7 @@ function convertAppRoutesToBunRoutes(routes) {
27
28
  const bunRoutes = {};
28
29
  for (const [path, handler] of Object.entries(routes)) {
29
30
  if (typeof handler === "function") {
30
- bunRoutes[path] = { GET: wrapRouteHandler(handler) };
31
+ bunRoutes[path] = { GET: wrapRouteHandler(handler, path) };
31
32
  continue;
32
33
  }
33
34
  if (handler && typeof handler === "object" && !Array.isArray(handler)) {
@@ -36,7 +37,7 @@ function convertAppRoutesToBunRoutes(routes) {
36
37
  if (typeof methodHandler !== "function") {
37
38
  continue;
38
39
  }
39
- methods[method.toUpperCase()] = wrapRouteHandler(methodHandler);
40
+ methods[method.toUpperCase()] = wrapRouteHandler(methodHandler, path);
40
41
  }
41
42
  if (Object.keys(methods).length > 0) {
42
43
  bunRoutes[path] = methods;
package/dist/index.js CHANGED
@@ -1509,11 +1509,12 @@ function socketAddress(server, request) {
1509
1509
  async function missingHtmlResponse() {
1510
1510
  return notFoundHtmlResponse2();
1511
1511
  }
1512
- function wrapRouteHandler(handler) {
1512
+ function wrapRouteHandler(handler, path) {
1513
1513
  return async (request, server) => {
1514
1514
  return await runWithRequestMeta({
1515
1515
  ...currentRequestMeta2(),
1516
1516
  request,
1517
+ routeTemplate: path,
1517
1518
  ipAddress: socketAddress(server, request),
1518
1519
  userAgent: request.headers.get("user-agent")
1519
1520
  }, async () => {
@@ -1526,7 +1527,7 @@ function convertAppRoutesToBunRoutes(routes) {
1526
1527
  const bunRoutes = {};
1527
1528
  for (const [path, handler] of Object.entries(routes)) {
1528
1529
  if (typeof handler === "function") {
1529
- bunRoutes[path] = { GET: wrapRouteHandler(handler) };
1530
+ bunRoutes[path] = { GET: wrapRouteHandler(handler, path) };
1530
1531
  continue;
1531
1532
  }
1532
1533
  if (handler && typeof handler === "object" && !Array.isArray(handler)) {
@@ -1535,7 +1536,7 @@ function convertAppRoutesToBunRoutes(routes) {
1535
1536
  if (typeof methodHandler !== "function") {
1536
1537
  continue;
1537
1538
  }
1538
- methods[method.toUpperCase()] = wrapRouteHandler(methodHandler);
1539
+ methods[method.toUpperCase()] = wrapRouteHandler(methodHandler, path);
1539
1540
  }
1540
1541
  if (Object.keys(methods).length > 0) {
1541
1542
  bunRoutes[path] = methods;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getstrata/bootstrap",
3
- "version": "1.1.9",
3
+ "version": "2.0.0",
4
4
  "description": "Strata application bootstrap: HttpKernel, DI, web session helpers",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -185,7 +185,7 @@
185
185
  "access": "public"
186
186
  },
187
187
  "peerDependencies": {
188
- "@getstrata/core": "^1.1.9",
188
+ "@getstrata/core": "^2.0.0",
189
189
  "typescript": "^5.9.0"
190
190
  },
191
191
  "engines": {