@jaypie/express 1.2.22 → 1.2.24

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/README.md CHANGED
@@ -1,18 +1,9 @@
1
- # Jaypie Express 🐦‍⬛🧋
1
+ # Jaypie Express 🐦‍⬛
2
2
 
3
- Express Jaypie handler for AWS Lambda
3
+ Express.js handler utilities for Jaypie applications.
4
4
 
5
- See [Jaypie](https://github.com/finlaysonstudio/jaypie) for usage.
6
-
7
- ## 📝 Changelog
8
-
9
- | Date | Version | Summary |
10
- | ---------- | ------- | -------------- |
11
- | 1/23/2026 | 1.2.5 | Fix array query params with bracket notation in API Gateway v1 |
12
- | 5/21/2024 | 1.0.0 | Initial release |
13
- | 5/19/2024 | 0.1.0 | Initial deploy |
14
- | 5/12/2024 | 0.0.1 | Initial commit |
5
+ See [jaypie.net](https://jaypie.net) for documentation.
15
6
 
16
7
  ## 📜 License
17
8
 
18
- [MIT License](./LICENSE.txt). Published by Finlayson Studio
9
+ [MIT License](./LICENSE.txt). Published by Finlayson Studio.
@@ -1865,6 +1865,10 @@ function expressHandler(handlerOrOptions, optionsOrHandler) {
1865
1865
  //
1866
1866
  // Build a request-local setup list to avoid mutating the shared array
1867
1867
  const requestSetup = [];
1868
+ // Load the Datadog LLM Observability API key into the environment when enabled
1869
+ requestSetup.push(async () => {
1870
+ await datadog.loadDatadogApiKey();
1871
+ });
1868
1872
  // Load secrets into process.env if configured
1869
1873
  if (secrets && secrets.length > 0) {
1870
1874
  const secretsToLoad = secrets;
@@ -2024,19 +2028,37 @@ function expressHandler(handlerOrOptions, optionsOrHandler) {
2024
2028
  res: summarizeResponse(res, extras),
2025
2029
  });
2026
2030
  // Construct normalized path for reporting and metrics
2027
- let path = (req.baseUrl || "") + (req.url || "");
2028
- if (!path.startsWith("/")) {
2029
- path = "/" + path;
2031
+ let pathWithQuery = (req.baseUrl || "") + (req.url || "");
2032
+ if (!pathWithQuery.startsWith("/")) {
2033
+ pathWithQuery = "/" + pathWithQuery;
2030
2034
  }
2035
+ const queryIndex = pathWithQuery.indexOf("?");
2036
+ let path = queryIndex >= 0 ? pathWithQuery.slice(0, queryIndex) : pathWithQuery;
2037
+ const rawQuery = queryIndex >= 0 ? pathWithQuery.slice(queryIndex + 1) : "";
2031
2038
  if (path.length > 1 && path.endsWith("/")) {
2032
2039
  path = path.slice(0, -1);
2033
2040
  }
2034
2041
  // Replace UUIDs with :id for better aggregation
2035
2042
  path = path.replace(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi, ":id");
2043
+ // Normalize query params (sort alphabetically for stable aggregation)
2044
+ let query = "";
2045
+ if (rawQuery) {
2046
+ const params = new URLSearchParams(rawQuery);
2047
+ params.sort();
2048
+ query = params.toString();
2049
+ }
2050
+ // Capture request content metadata
2051
+ const headers = req.headers || {};
2052
+ const contentType = String(headers["content-type"] || "");
2053
+ const contentLengthHeader = headers["content-length"];
2054
+ const contentLength = contentLengthHeader ? Number(contentLengthHeader) : 0;
2036
2055
  // Add request data to session report
2037
2056
  logger$1.report({
2038
2057
  method: req.method,
2039
2058
  path,
2059
+ query,
2060
+ contentType,
2061
+ contentLength,
2040
2062
  status: String(res.statusCode),
2041
2063
  });
2042
2064
  // Submit metric if Datadog is configured