Skip to content

Commit 8624388

Browse files
fix(backend): resolve ESLint errors from #1278
- Remove duplicate MemoryCache class fragment in redis.ts and use unknown instead of any - Drop unused rateLimit import in stream-rate-limiter middleware - Remove dup cancel route registration left by merge and drop as any - Fix broken ternary leftover in soroban-event-worker - Pin prisma's mysql2 dep via override and sync package-lock Generated with Codebuff 🤖 Co-Authored-By: Codebuff <noreply@codebuff.com>
1 parent f0838b1 commit 8624388

6 files changed

Lines changed: 14 additions & 128 deletions

File tree

backend/src/lib/redis.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ interface CacheItem<T> {
2424
createdAt: number;
2525
}
2626

27-
class MemoryCache {
28-
private cache = new Map<string, CacheItem<unknown>>();
2927
interface MemoryCacheOptions {
3028
/**
3129
* Hard cap on the number of entries kept in memory. When exceeded, the
@@ -43,7 +41,7 @@ const DEFAULT_MEMORY_CACHE_MAX_ITEMS = 10_000;
4341
* memory usage stays bounded regardless of key churn or sweep interval.
4442
*/
4543
export class MemoryCache {
46-
private cache = new Map<string, CacheItem<any>>();
44+
private cache = new Map<string, CacheItem<unknown>>();
4745
private hits = 0;
4846
private misses = 0;
4947
private readonly maxItems: number;
@@ -72,12 +70,11 @@ export class MemoryCache {
7270
return null;
7371
}
7472
this.hits++;
75-
return item.value as T;
7673
// Refresh LRU recency: re-insert at the end of the Map so this entry is
7774
// the last candidate for eviction when the max-size cap is hit.
7875
this.cache.delete(key);
7976
this.cache.set(key, item);
80-
return item.value;
77+
return item.value as T;
8178
}
8279

8380
set<T>(key: string, value: T, ttlSeconds: number): void {

backend/src/middleware/stream-rate-limiter.middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { rateLimit, type Options } from 'express-rate-limit';
1+
import { type Options } from 'express-rate-limit';
22
import { createRateLimiter } from './rate-limiter.middleware.js';
33
import { type Request, type Response, type NextFunction } from 'express';
44
import type { AuthenticatedRequest } from '../types/auth.types.js';

backend/src/routes/v1/stream.routes.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,6 @@ router.post('/:streamId/withdraw', requireAuth, withdrawHandler);
656656
* $ref: '#/components/schemas/Error'
657657
*/
658658
router.post('/:streamId/top-up', requireAuth, topUpStreamHandler);
659-
router.post('/:streamId/cancel', requireAuth, cancelStreamHandler);
660659

661660
/**
662661
* @openapi
@@ -719,6 +718,6 @@ router.post('/:streamId/cancel', requireAuth, cancelStreamHandler);
719718
* schema:
720719
* $ref: '#/components/schemas/Error'
721720
*/
722-
router.post('/:streamId/cancel', requireAuth, cancelStreamHandler as any);
721+
router.post('/:streamId/cancel', requireAuth, cancelStreamHandler);
723722

724723
export default router;

backend/src/workers/soroban-event-worker.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,6 @@ export class SorobanEventWorker {
396396
const finalCursor = hasError
397397
? lastCursor
398398
: ((response as { latestCursor?: string }).latestCursor || lastCursor);
399-
: (response as any).latestCursor || lastCursor;
400399

401400
await prisma.indexerState.upsert({
402401
where: { id: INDEXER_STATE_ID },

package-lock.json

Lines changed: 6 additions & 118 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
"sharp": "^0.35.0",
4343
"deepmerge-ts": "^8.0.0",
4444
"react": "19.2.7",
45-
"react-dom": "19.2.7"
45+
"react-dom": "19.2.7",
46+
"prisma": {
47+
"mysql2": "^3.22.0"
48+
}
4649
}
4750
}

0 commit comments

Comments
 (0)