refactor(core): derive catalog availability from integrations (#32272)
This commit is contained in:
parent
4810df0a71
commit
0cf3ee4406
29 changed files with 622 additions and 509 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { Credential } from "@opencode-ai/core/credential"
|
||||
import { Integration } from "@opencode-ai/core/integration"
|
||||
import { Effect } from "effect"
|
||||
import { HttpApiBuilder, HttpApiSchema } from "effect/unstable/httpapi"
|
||||
import { Api } from "../api"
|
||||
|
|
@ -8,14 +8,14 @@ export const CredentialHandler = HttpApiBuilder.group(Api, "server.credential",
|
|||
.handle(
|
||||
"credential.update",
|
||||
Effect.fn(function* (ctx) {
|
||||
yield* (yield* Credential.Service).update(ctx.params.credentialID, { label: ctx.payload.label })
|
||||
yield* (yield* Integration.Service).connection.update(ctx.params.credentialID, { label: ctx.payload.label })
|
||||
return HttpApiSchema.NoContent.make()
|
||||
}),
|
||||
)
|
||||
.handle(
|
||||
"credential.remove",
|
||||
Effect.fn(function* (ctx) {
|
||||
yield* (yield* Credential.Service).remove(ctx.params.credentialID)
|
||||
yield* (yield* Integration.Service).connection.remove(ctx.params.credentialID)
|
||||
return HttpApiSchema.NoContent.make()
|
||||
}),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ export const IntegrationHandler = HttpApiBuilder.group(Api, "server.integration"
|
|||
Effect.fn(function* (ctx) {
|
||||
const service = yield* Integration.Service
|
||||
yield* authorize(
|
||||
service.connect.key({
|
||||
service.connection.key({
|
||||
integrationID: ctx.params.integrationID,
|
||||
key: ctx.payload.key,
|
||||
label: ctx.payload.label,
|
||||
|
|
@ -53,7 +53,7 @@ export const IntegrationHandler = HttpApiBuilder.group(Api, "server.integration"
|
|||
const service = yield* Integration.Service
|
||||
return yield* response(
|
||||
authorize(
|
||||
service.connect.oauth({
|
||||
service.connection.oauth({
|
||||
integrationID: ctx.params.integrationID,
|
||||
methodID: ctx.payload.methodID,
|
||||
inputs: ctx.payload.inputs,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue