Skip to content

Commit 0f07d93

Browse files
VinciGit00claude
andcommitted
fix: biome schema version, formatting, and add nationality test
- Update biome.json schema to match installed CLI version - Exclude .claude dir from biome checks - Fix formatting in schemas.ts and client.test.ts - Add search nationality forwarding test Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3188144 commit 0f07d93

3 files changed

Lines changed: 22 additions & 9 deletions

File tree

biome.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.4.9/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.4.11/schema.json",
33
"assist": {
44
"actions": {
55
"source": {
@@ -31,6 +31,6 @@
3131
}
3232
],
3333
"files": {
34-
"includes": ["**", "!dist", "!node_modules", "!bun.lock"]
34+
"includes": ["**", "!dist", "!node_modules", "!bun.lock", "!.claude"]
3535
}
3636
}

src/schemas.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@ import { z } from "zod/v4";
22
import { MODEL_NAMES } from "./models.js";
33
import * as url from "./url.js";
44

5-
export const apiServiceEnumSchema = z.enum([
6-
"scrape",
7-
"extract",
8-
"search",
9-
"monitor",
10-
"crawl",
11-
]);
5+
export const apiServiceEnumSchema = z.enum(["scrape", "extract", "search", "monitor", "crawl"]);
126
export const apiStatusEnumSchema = z.enum(["completed", "failed"]);
137
export const apiHtmlModeSchema = z.enum(["normal", "reader", "prune"]);
148
export const apiFetchContentTypeSchema = z.enum([
@@ -188,6 +182,11 @@ export const apiSearchRequestSchema = z
188182
schema: z.record(z.string(), z.unknown()).optional(),
189183
llmConfig: apiLlmConfigSchema.optional(),
190184
locationGeoCode: z.string().max(10).optional(),
185+
nationality: z
186+
.string()
187+
.length(2)
188+
.transform((v) => v.toLowerCase())
189+
.optional(),
191190
timeRange: z
192191
.enum(["past_hour", "past_24_hours", "past_week", "past_month", "past_year"])
193192
.optional(),

tests/client.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,20 @@ describe("scrapegraphai", () => {
6363
api.stop();
6464
});
6565

66+
test("search forwards nationality", async () => {
67+
let body: any;
68+
const api = mockApi({
69+
"/api/v2/search": async (req) => {
70+
body = await req.json();
71+
return Response.json({ results: [] }, { headers: { "x-request-id": "req-nat" } });
72+
},
73+
});
74+
const sgai = scrapegraphai({ apiKey: "test", baseUrl: api.url });
75+
await sgai.search("test query", { nationality: "it" });
76+
expect(body.nationality).toBe("it");
77+
api.stop();
78+
});
79+
6680
test("credits returns balance", async () => {
6781
const api = mockApi({
6882
"/api/v2/credits": () =>

0 commit comments

Comments
 (0)