@pylonsync/functions 0.22.2 → 0.22.4

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/types.d.ts CHANGED
@@ -1380,6 +1380,15 @@ export interface RequestInfo {
1380
1380
  url: string;
1381
1381
  headers: Record<string, string>;
1382
1382
  rawBody: string;
1383
+ /**
1384
+ * The client IP Pylon uses for rate limits and the audit log. It comes
1385
+ * from `PYLON_CLIENT_IP_HEADER` (`CF-Connecting-IP` counts only when the
1386
+ * connecting address is a Cloudflare edge), then `X-Forwarded-For` with
1387
+ * `PYLON_TRUST_PROXY_HOPS` trusted proxies, then the socket address. A
1388
+ * caller cannot set it with a header. `null` when the platform exposes no
1389
+ * client address.
1390
+ */
1391
+ clientIp: string | null;
1383
1392
  }
1384
1393
  export type FnType = "query" | "mutation" | "action";
1385
1394
  export interface FnDefinition<TArgs = unknown, TReturn = unknown> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pylonsync/functions",
3
- "version": "0.22.2",
3
+ "version": "0.22.4",
4
4
  "description": "TypeScript function runtime for pylon — defines server-side queries, mutations, and actions.",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/runtime.ts CHANGED
@@ -1269,6 +1269,10 @@ function buildActionCtx(
1269
1269
  url: String(r.url ?? ""),
1270
1270
  headers: (r.headers as Record<string, string>) ?? {},
1271
1271
  rawBody: String(r.raw_body ?? r.rawBody ?? ""),
1272
+ clientIp:
1273
+ typeof (r.client_ip ?? r.clientIp) === "string"
1274
+ ? String(r.client_ip ?? r.clientIp)
1275
+ : null,
1272
1276
  };
1273
1277
  }
1274
1278
  return {
package/src/types.ts CHANGED
@@ -1511,6 +1511,15 @@ export interface RequestInfo {
1511
1511
  url: string;
1512
1512
  headers: Record<string, string>;
1513
1513
  rawBody: string;
1514
+ /**
1515
+ * The client IP Pylon uses for rate limits and the audit log. It comes
1516
+ * from `PYLON_CLIENT_IP_HEADER` (`CF-Connecting-IP` counts only when the
1517
+ * connecting address is a Cloudflare edge), then `X-Forwarded-For` with
1518
+ * `PYLON_TRUST_PROXY_HOPS` trusted proxies, then the socket address. A
1519
+ * caller cannot set it with a header. `null` when the platform exposes no
1520
+ * client address.
1521
+ */
1522
+ clientIp: string | null;
1514
1523
  }
1515
1524
 
1516
1525
  // ---------------------------------------------------------------------------