mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-01 15:32:11 +08:00
Merge pull request #13487 from Kilo-Org/dependabot-hey-api-openapi-ts
fix(security): @hey-api/openapi-ts updated due dependabot warnings
This commit is contained in:
@@ -45,7 +45,7 @@ const original = {
|
||||
|
||||
type ServerPath = "default" | "raw"
|
||||
type Sdk = ReturnType<typeof createKiloClient>
|
||||
type SdkResult = { response: Response; data?: unknown; error?: unknown }
|
||||
type SdkResult = { response?: Response; data?: unknown; error?: unknown }
|
||||
type Captured = { status: number; data?: unknown; error?: unknown }
|
||||
type ProjectFixture = { sdk: Sdk; directory: string }
|
||||
type LlmProjectFixture = ProjectFixture & { llm: TestLLMServer["Service"] }
|
||||
@@ -115,7 +115,7 @@ function call<T>(request: () => Promise<T>) {
|
||||
function capture(request: () => Promise<SdkResult>) {
|
||||
return call(request).pipe(
|
||||
Effect.map((result) => ({
|
||||
status: result.response.status,
|
||||
status: result.response!.status,
|
||||
data: result.data,
|
||||
error: result.error,
|
||||
})),
|
||||
@@ -132,9 +132,9 @@ function captureThrown(request: () => Promise<unknown>) {
|
||||
})
|
||||
}
|
||||
|
||||
function expectStatus(request: () => Promise<{ response: Response }>, status: number) {
|
||||
function expectStatus(request: () => Promise<{ response?: Response }>, status: number) {
|
||||
return call(request).pipe(
|
||||
Effect.tap((result) => Effect.sync(() => expect(result.response.status).toBe(status))),
|
||||
Effect.tap((result) => Effect.sync(() => expect(result.response!.status).toBe(status))),
|
||||
Effect.asVoid,
|
||||
)
|
||||
}
|
||||
@@ -351,12 +351,12 @@ describe("HttpApi SDK", () => {
|
||||
const health = yield* call(() => sdk.global.health())
|
||||
const log = yield* call(() => sdk.app.log({ service: "httpapi-sdk-test", level: "info", message: "hello" }))
|
||||
|
||||
expect(health.response.status).toBe(200)
|
||||
expect(health.response!.status).toBe(200)
|
||||
expect(health.data).toMatchObject({ healthy: true })
|
||||
expect(yield* firstEvent((signal) => sdk.global.event({ signal }))).toMatchObject({
|
||||
payload: { type: "server.connected" },
|
||||
})
|
||||
expect(log.response.status).toBe(200)
|
||||
expect(log.response!.status).toBe(200)
|
||||
expect(log.data).toBe(true)
|
||||
yield* expectStatus(() => sdk.auth.set({ providerID: "test" }), 400)
|
||||
}),
|
||||
@@ -373,21 +373,21 @@ describe("HttpApi SDK", () => {
|
||||
const v2session = yield* call(() => sdk.v2.session.create({ agent: "build" })) // kilocode_change
|
||||
const listed = yield* call(() => sdk.session.list({ roots: true, limit: 10 }))
|
||||
|
||||
expect(file.response.status).toBe(200)
|
||||
expect(file.response!.status).toBe(200)
|
||||
expect(file.data).toMatchObject({ content: "hello" })
|
||||
// kilocode_change start
|
||||
expect(raw.response.status).toBe(200)
|
||||
expect(raw.response!.status).toBe(200)
|
||||
const body = raw.data
|
||||
if (!body) throw new Error("missing V2 file body")
|
||||
const content =
|
||||
body instanceof Blob ? yield* Effect.promise(() => body.text()) : Buffer.from(body as unknown as Uint8Array).toString()
|
||||
expect(content).toBe("hello")
|
||||
// kilocode_change end
|
||||
expect(session.response.status).toBe(200)
|
||||
expect(session.response!.status).toBe(200)
|
||||
expect(session.data).toMatchObject({ title: "sdk" })
|
||||
expect({ status: v2session.response.status, error: v2session.error }).toEqual({ status: 200, error: undefined }) // kilocode_change
|
||||
expect({ status: v2session.response!.status, error: v2session.error }).toEqual({ status: 200, error: undefined }) // kilocode_change
|
||||
expect(v2session.data).toMatchObject({ data: { location: { directory } } }) // kilocode_change
|
||||
expect(listed.response.status).toBe(200)
|
||||
expect(listed.response!.status).toBe(200)
|
||||
expect(listed.data?.map((item) => item.id)).toContain(session.data?.id)
|
||||
|
||||
yield* Effect.all([
|
||||
@@ -417,7 +417,7 @@ describe("HttpApi SDK", () => {
|
||||
)
|
||||
const url = new URL(request!.url)
|
||||
|
||||
expect(found.response.status).toBe(200)
|
||||
expect(found.response!.status).toBe(200)
|
||||
expect(found.data).toMatchObject({ data: [{ path: "hello.txt", type: "file" }] })
|
||||
expect(url.searchParams.get("directory")).toBe(directory)
|
||||
expect(url.searchParams.get("workspace")).toBe(workspaceID)
|
||||
@@ -431,7 +431,7 @@ describe("HttpApi SDK", () => {
|
||||
headers: { "x-kilo-directory": encodeURIComponent(directory) },
|
||||
})
|
||||
const legacySession = yield* call(() => legacy.v2.session.create({ agent: "build" }))
|
||||
expect(legacySession.response.status).toBe(200)
|
||||
expect(legacySession.response!.status).toBe(200)
|
||||
expect(legacySession.data).toMatchObject({ data: { location: { directory } } })
|
||||
// kilocode_change end
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user