@thexjs/core 1.7.0 → 1.7.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.
package/dist/index.d.ts CHANGED
@@ -681,6 +681,13 @@ declare function Link({ href, children, clientNav, prefetch, ...rest }: LinkProp
681
681
 
682
682
  declare function DefaultNotFound(_props: RouteProps): react.JSX.Element;
683
683
 
684
+ /**
685
+ * Returns the client IP from a request, checking `X-Forwarded-For` first
686
+ * (for proxied/edge deployments), falling back to `X-Real-IP`, and finally
687
+ * to `null` if neither is present.
688
+ */
689
+ declare function clientIpFromRequest(req: Request): string | null;
690
+
684
691
  /**
685
692
  * Structured, append-only audit logging for security-relevant events.
686
693
  *
@@ -720,8 +727,7 @@ declare const noopAuditSink: AuditSink;
720
727
  declare function createConsoleAuditSink(): AuditSink;
721
728
  declare function setAuditSink(sink: AuditSink): void;
722
729
  declare function getAuditSink(): AuditSink;
723
- /** Best-effort client IP from proxy headers; null when the request has none. */
724
- declare function clientIpFromRequest(req: Request): string | null;
730
+
725
731
  /** Correlation id already assigned to the request by `withRequestLogging`, if any. */
726
732
  declare function requestIdFromRequest(req: Request): string | undefined;
727
733
  /**
package/dist/index.js CHANGED
@@ -2859,6 +2859,13 @@ function Link({ href, children, clientNav = true, prefetch = true, ...rest }) {
2859
2859
  );
2860
2860
  }
2861
2861
 
2862
+ // src/security/ip.ts
2863
+ function clientIpFromRequest(req) {
2864
+ const forwarded = req.headers.get("x-forwarded-for");
2865
+ if (forwarded) return forwarded.split(",")[0]?.trim() || null;
2866
+ return req.headers.get("x-real-ip");
2867
+ }
2868
+
2862
2869
  // src/observability/audit.ts
2863
2870
  var noopAuditSink = {
2864
2871
  write: () => {
@@ -2878,11 +2885,6 @@ function setAuditSink(sink) {
2878
2885
  function getAuditSink() {
2879
2886
  return activeSink;
2880
2887
  }
2881
- function clientIpFromRequest(req) {
2882
- const forwarded = req.headers.get("x-forwarded-for");
2883
- if (forwarded) return forwarded.split(",")[0]?.trim() || null;
2884
- return req.headers.get("x-real-ip");
2885
- }
2886
2888
  function requestIdFromRequest(req) {
2887
2889
  return req.headers.get("x-request-id") ?? void 0;
2888
2890
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thexjs/core",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "Full-stack React framework core (router, SSR/SSG renderer, islands, server functions) for the x framework, built on Bun.",
5
5
  "keywords": [
6
6
  "react",