@oxyhq/core 3.4.2 → 3.4.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/package.json CHANGED
@@ -1,10 +1,17 @@
1
1
  {
2
2
  "name": "@oxyhq/core",
3
- "version": "3.4.2",
3
+ "version": "3.4.4",
4
4
  "description": "OxyHQ SDK Foundation — API client, authentication, cryptographic identity, and shared utilities",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/types/index.d.ts",
8
+ "typesVersions": {
9
+ "*": {
10
+ "server": [
11
+ "dist/types/server/index.d.ts"
12
+ ]
13
+ }
14
+ },
8
15
  "source": "src/index.ts",
9
16
  "sideEffects": false,
10
17
  "publishConfig": {
@@ -127,7 +134,7 @@
127
134
  "@biomejs/biome": "^1.9.4",
128
135
  "@react-native-async-storage/async-storage": "^2.2.0",
129
136
  "@types/elliptic": "^6.4.18",
130
- "@types/express": "^5.0.0",
137
+ "@types/express": "^4.17.21",
131
138
  "@types/invariant": "^2.2.34",
132
139
  "@types/node": "^20.19.9",
133
140
  "expo-crypto": "~56.0.3",
@@ -10,10 +10,10 @@
10
10
  * import { oxyClient } from '@oxyhq/core';
11
11
  *
12
12
  * const oxy = oxyClient({ apiUrl: 'https://api.oxy.so' });
13
- *
13
+ *
14
14
  * app.use(createOxyRateLimit(oxy, { store: redisStore }));
15
15
  * ```
16
16
  */
17
17
 
18
18
  export { createOxyRateLimit } from './rateLimit';
19
- export type { OxyRateLimitOptions } from './rateLimit';
19
+ export type { OxyRateLimitOptions } from './rateLimit';
@@ -107,7 +107,7 @@ function resolveKey(req: OxyAuthedRequest): string {
107
107
  if (userId) {
108
108
  return `user:${userId}`;
109
109
  }
110
- const ip = req.ip || (req.socket as any)?.remoteAddress || 'unknown';
110
+ const ip = req.ip || req.socket.remoteAddress || 'unknown';
111
111
  return ipKeyGenerator(ip);
112
112
  }
113
113
 
@@ -138,19 +138,19 @@ export function createOxyRateLimit(
138
138
  const limiter = rateLimit({
139
139
  windowMs,
140
140
  ...(store ? { store } : {}),
141
- max: ((req: Request): number => {
141
+ max: (req: Request): number => {
142
142
  const authed = req as OxyAuthedRequest;
143
143
  const userId = authed.userId ?? authed.user?.id ?? authed.user?._id;
144
144
  return userId ? authenticatedMax : anonymousMax;
145
- }) as any,
146
- keyGenerator: ((req: Request): string => resolveKey(req as OxyAuthedRequest)) as any,
145
+ },
146
+ keyGenerator: (req: Request): string => resolveKey(req as OxyAuthedRequest),
147
147
  message,
148
148
  standardHeaders: true,
149
149
  legacyHeaders: false,
150
- skip: skip as any,
151
- } as any);
150
+ skip,
151
+ });
152
152
 
153
- return ((req: any, res: any, next: any) => {
153
+ return (req, res, next) => {
154
154
  // Skipped paths bypass BOTH session resolution and limiting — cheap and
155
155
  // safe for static/streaming/health traffic.
156
156
  if (skip(req)) {
@@ -166,5 +166,5 @@ export function createOxyRateLimit(
166
166
  }
167
167
  limiter(req, res, next);
168
168
  });
169
- }) as RequestHandler;
169
+ };
170
170
  }