From 100a86e3ced57ab88507f7cceca755ff6aed7438 Mon Sep 17 00:00:00 2001 From: Bas van den Aakster Date: Sun, 14 Dec 2025 17:02:11 +0100 Subject: [PATCH] Fix storage.getServicesByName() calls - use correct storage methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace non-existent getServicesByName() with: - discoverServices() for paginated mode - getRandomService() for random mode Fixes "storage.getServicesByName is not a function" error. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- src/rpc.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/rpc.ts b/src/rpc.ts index ce45d4b..78f9cf1 100644 --- a/src/rpc.ts +++ b/src/rpc.ts @@ -215,7 +215,7 @@ const handlers: Record = { const pageLimit = Math.min(Math.max(1, limit), MAX_PAGE_SIZE); const pageOffset = Math.max(0, offset || 0); - const allServices = await storage.getServicesByName(parsed.service, parsed.version); + const allServices = await storage.discoverServices(parsed.service, parsed.version, 1000, 0); const compatibleServices = filterCompatibleServices(allServices); // Get unique services per username with available offers @@ -260,14 +260,12 @@ const handlers: Record = { } // Mode 3: Random discovery without username - const allServices = await storage.getServicesByName(parsed.service, parsed.version); - const compatibleServices = filterCompatibleServices(allServices); + const randomService = await storage.getRandomService(parsed.service, parsed.version); - if (compatibleServices.length === 0) { + if (!randomService) { throw new Error('No services found'); } - const randomService = compatibleServices[Math.floor(Math.random() * compatibleServices.length)]; const availableOffer = await findAvailableOffer(randomService); if (!availableOffer) {