Skip to content

Commit 4e5c91b

Browse files
hyperpolymathclaude
andcommitted
fix(api): repair pre-existing typecheck and lint failures in the TS carve-out
- config.ts: std@0.220 dotenv exports load, not config; drop removed allowEmptyValues option - repository.ts: type the Promise.all destructure (profiles as ProfileRecord[]); make uniqueBy generic instead of any - verisimClient.ts: await the wrapped requests (require-await) deno task check now passes end-to-end; these errors predate engine v2 (the check task died at the first one, so lint had never run). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 1d9eaae commit 4e5c91b

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

apps/api/src/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// Copyright (c) Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
33
// Environment configuration for the flat-mate API. Reads from .env and provides typed defaults.
44

5-
import { config as loadDotenv } from "https://deno.land/std@0.220.0/dotenv/mod.ts";
5+
import { load as loadDotenv } from "https://deno.land/std@0.220.0/dotenv/mod.ts";
66

7-
await loadDotenv({ export: true, allowEmptyValues: true });
7+
await loadDotenv({ export: true });
88

99
const DEFAULT_PORT = 4000;
1010
const DEFAULT_VERISIMDB_BASE = "http://127.0.0.1:8080";

apps/api/src/repository.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export class FlatMateRepository {
200200
}
201201

202202
async listMatches(userId: string) {
203-
const [outgoing, incoming, profiles] = await Promise.all([
203+
const [outgoing, incoming, profilesRaw] = await Promise.all([
204204
this.client.textSearch(
205205
`flatmate_swipe from_${this.safe(userId)} like_1`,
206206
400,
@@ -212,6 +212,7 @@ export class FlatMateRepository {
212212
this.listProfiles({ limit: 400 }),
213213
]);
214214

215+
const profiles = profilesRaw as ProfileRecord[];
215216
const outgoingSwipes = this.decodeEntities(outgoing, ENTITY_KINDS.SWIPE)
216217
.filter(
217218
(item) => item.fromUserId === userId && item.liked,
@@ -291,9 +292,9 @@ export class FlatMateRepository {
291292
return String(value).toLowerCase().replace(/[^a-z0-9]+/g, "_");
292293
}
293294

294-
private uniqueBy(list: unknown[], keyFn: (item: any) => unknown) {
295-
const seen = new Set();
296-
const output = [];
295+
private uniqueBy<T>(list: T[], keyFn: (item: T) => unknown) {
296+
const seen = new Set<unknown>();
297+
const output: T[] = [];
297298

298299
for (const item of list) {
299300
const key = keyFn(item);

apps/api/src/verisimClient.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ export class VerisimClient {
1010
}
1111

1212
async createHexad(payload: unknown) {
13-
return this.request("POST", "/api/v1/hexads", payload);
13+
return await this.request("POST", "/api/v1/hexads", payload);
1414
}
1515

1616
async updateHexad(id: string, payload: unknown) {
17-
return this.request("PUT", `/api/v1/hexads/${id}`, payload);
17+
return await this.request("PUT", `/api/v1/hexads/${id}`, payload);
1818
}
1919

2020
async textSearch(query: string, limit = 100) {
2121
const q = encodeURIComponent(query);
2222
const path = `/api/v1/search/text?q=${q}&limit=${limit}`;
23-
return this.request("GET", path);
23+
return await this.request("GET", path);
2424
}
2525

2626
async vectorSearch(vector: number[], k = 15) {
27-
return this.request("POST", "/api/v1/search/vector", { vector, k });
27+
return await this.request("POST", "/api/v1/search/vector", { vector, k });
2828
}
2929

3030
private async request(method: string, path: string, payload?: unknown) {

0 commit comments

Comments
 (0)