feat(api): add command authentication attempts
This commit is contained in:
parent
a772767e9b
commit
b5177adb5b
18 changed files with 1138 additions and 16 deletions
|
|
@ -466,6 +466,40 @@ export type IntegrationOauthCancelOperation<E = never> = (
|
|||
input: Endpoint10_6Input,
|
||||
) => Effect.Effect<Endpoint10_6Output, E>
|
||||
|
||||
type Endpoint10_7Request = Parameters<RawClient["server.integration"]["integration.command.connect"]>[0]
|
||||
export type Endpoint10_7Input = {
|
||||
readonly integrationID: Endpoint10_7Request["params"]["integrationID"]
|
||||
readonly location?: Endpoint10_7Request["query"]["location"]
|
||||
readonly methodID: Endpoint10_7Request["payload"]["methodID"]
|
||||
readonly label?: Endpoint10_7Request["payload"]["label"]
|
||||
}
|
||||
export type Endpoint10_7Output = EffectValue<ReturnType<RawClient["server.integration"]["integration.command.connect"]>>
|
||||
export type IntegrationCommandConnectOperation<E = never> = (
|
||||
input: Endpoint10_7Input,
|
||||
) => Effect.Effect<Endpoint10_7Output, E>
|
||||
|
||||
type Endpoint10_8Request = Parameters<RawClient["server.integration"]["integration.command.status"]>[0]
|
||||
export type Endpoint10_8Input = {
|
||||
readonly integrationID: Endpoint10_8Request["params"]["integrationID"]
|
||||
readonly attemptID: Endpoint10_8Request["params"]["attemptID"]
|
||||
readonly location?: Endpoint10_8Request["query"]["location"]
|
||||
}
|
||||
export type Endpoint10_8Output = EffectValue<ReturnType<RawClient["server.integration"]["integration.command.status"]>>
|
||||
export type IntegrationCommandStatusOperation<E = never> = (
|
||||
input: Endpoint10_8Input,
|
||||
) => Effect.Effect<Endpoint10_8Output, E>
|
||||
|
||||
type Endpoint10_9Request = Parameters<RawClient["server.integration"]["integration.command.cancel"]>[0]
|
||||
export type Endpoint10_9Input = {
|
||||
readonly integrationID: Endpoint10_9Request["params"]["integrationID"]
|
||||
readonly attemptID: Endpoint10_9Request["params"]["attemptID"]
|
||||
readonly location?: Endpoint10_9Request["query"]["location"]
|
||||
}
|
||||
export type Endpoint10_9Output = EffectValue<ReturnType<RawClient["server.integration"]["integration.command.cancel"]>>
|
||||
export type IntegrationCommandCancelOperation<E = never> = (
|
||||
input: Endpoint10_9Input,
|
||||
) => Effect.Effect<Endpoint10_9Output, E>
|
||||
|
||||
export interface IntegrationApi<E = never> {
|
||||
readonly list: IntegrationListOperation<E>
|
||||
readonly get: IntegrationGetOperation<E>
|
||||
|
|
@ -476,6 +510,11 @@ export interface IntegrationApi<E = never> {
|
|||
readonly complete: IntegrationOauthCompleteOperation<E>
|
||||
readonly cancel: IntegrationOauthCancelOperation<E>
|
||||
}
|
||||
readonly command: {
|
||||
readonly connect: IntegrationCommandConnectOperation<E>
|
||||
readonly status: IntegrationCommandStatusOperation<E>
|
||||
readonly cancel: IntegrationCommandCancelOperation<E>
|
||||
}
|
||||
}
|
||||
|
||||
type Endpoint11_0Request = Parameters<RawClient["server.mcp"]["mcp.list"]>[0]
|
||||
|
|
|
|||
|
|
@ -571,6 +571,44 @@ const Endpoint10_6 = (raw: RawClient["server.integration"]) => (input: Endpoint1
|
|||
query: { location: input["location"] },
|
||||
}).pipe(Effect.mapError(mapClientError))
|
||||
|
||||
type Endpoint10_7Request = Parameters<RawClient["server.integration"]["integration.command.connect"]>[0]
|
||||
type Endpoint10_7Input = {
|
||||
readonly integrationID: Endpoint10_7Request["params"]["integrationID"]
|
||||
readonly location?: Endpoint10_7Request["query"]["location"]
|
||||
readonly methodID: Endpoint10_7Request["payload"]["methodID"]
|
||||
readonly label?: Endpoint10_7Request["payload"]["label"]
|
||||
}
|
||||
const Endpoint10_7 = (raw: RawClient["server.integration"]) => (input: Endpoint10_7Input) =>
|
||||
raw["integration.command.connect"]({
|
||||
params: { integrationID: input["integrationID"] },
|
||||
query: { location: input["location"] },
|
||||
payload: { methodID: input["methodID"], label: input["label"] },
|
||||
}).pipe(Effect.mapError(mapClientError))
|
||||
|
||||
type Endpoint10_8Request = Parameters<RawClient["server.integration"]["integration.command.status"]>[0]
|
||||
type Endpoint10_8Input = {
|
||||
readonly integrationID: Endpoint10_8Request["params"]["integrationID"]
|
||||
readonly attemptID: Endpoint10_8Request["params"]["attemptID"]
|
||||
readonly location?: Endpoint10_8Request["query"]["location"]
|
||||
}
|
||||
const Endpoint10_8 = (raw: RawClient["server.integration"]) => (input: Endpoint10_8Input) =>
|
||||
raw["integration.command.status"]({
|
||||
params: { integrationID: input["integrationID"], attemptID: input["attemptID"] },
|
||||
query: { location: input["location"] },
|
||||
}).pipe(Effect.mapError(mapClientError))
|
||||
|
||||
type Endpoint10_9Request = Parameters<RawClient["server.integration"]["integration.command.cancel"]>[0]
|
||||
type Endpoint10_9Input = {
|
||||
readonly integrationID: Endpoint10_9Request["params"]["integrationID"]
|
||||
readonly attemptID: Endpoint10_9Request["params"]["attemptID"]
|
||||
readonly location?: Endpoint10_9Request["query"]["location"]
|
||||
}
|
||||
const Endpoint10_9 = (raw: RawClient["server.integration"]) => (input: Endpoint10_9Input) =>
|
||||
raw["integration.command.cancel"]({
|
||||
params: { integrationID: input["integrationID"], attemptID: input["attemptID"] },
|
||||
query: { location: input["location"] },
|
||||
}).pipe(Effect.mapError(mapClientError))
|
||||
|
||||
const adaptGroup10 = (raw: RawClient["server.integration"]) => ({
|
||||
list: Endpoint10_0(raw),
|
||||
get: Endpoint10_1(raw),
|
||||
|
|
@ -581,6 +619,7 @@ const adaptGroup10 = (raw: RawClient["server.integration"]) => ({
|
|||
complete: Endpoint10_5(raw),
|
||||
cancel: Endpoint10_6(raw),
|
||||
},
|
||||
command: { connect: Endpoint10_7(raw), status: Endpoint10_8(raw), cancel: Endpoint10_9(raw) },
|
||||
})
|
||||
|
||||
type Endpoint11_0Request = Parameters<RawClient["server.mcp"]["mcp.list"]>[0]
|
||||
|
|
|
|||
|
|
@ -92,6 +92,12 @@ import type {
|
|||
IntegrationOauthCompleteOutput,
|
||||
IntegrationOauthCancelInput,
|
||||
IntegrationOauthCancelOutput,
|
||||
IntegrationCommandConnectInput,
|
||||
IntegrationCommandConnectOutput,
|
||||
IntegrationCommandStatusInput,
|
||||
IntegrationCommandStatusOutput,
|
||||
IntegrationCommandCancelInput,
|
||||
IntegrationCommandCancelOutput,
|
||||
McpListInput,
|
||||
McpListOutput,
|
||||
McpResourceCatalogInput,
|
||||
|
|
@ -954,6 +960,45 @@ export function make(options: ClientOptions) {
|
|||
requestOptions,
|
||||
),
|
||||
},
|
||||
command: {
|
||||
connect: (input: IntegrationCommandConnectInput, requestOptions?: RequestOptions) =>
|
||||
request<IntegrationCommandConnectOutput>(
|
||||
{
|
||||
method: "POST",
|
||||
path: `/api/integration/${encodeURIComponent(input.integrationID)}/connect/command`,
|
||||
query: { location: input["location"] },
|
||||
body: { methodID: input["methodID"], label: input["label"] },
|
||||
successStatus: 200,
|
||||
declaredStatuses: [400, 401],
|
||||
empty: false,
|
||||
},
|
||||
requestOptions,
|
||||
),
|
||||
status: (input: IntegrationCommandStatusInput, requestOptions?: RequestOptions) =>
|
||||
request<IntegrationCommandStatusOutput>(
|
||||
{
|
||||
method: "GET",
|
||||
path: `/api/integration/${encodeURIComponent(input.integrationID)}/connect/command/${encodeURIComponent(input.attemptID)}`,
|
||||
query: { location: input["location"] },
|
||||
successStatus: 200,
|
||||
declaredStatuses: [401, 400],
|
||||
empty: false,
|
||||
},
|
||||
requestOptions,
|
||||
),
|
||||
cancel: (input: IntegrationCommandCancelInput, requestOptions?: RequestOptions) =>
|
||||
request<IntegrationCommandCancelOutput>(
|
||||
{
|
||||
method: "DELETE",
|
||||
path: `/api/integration/${encodeURIComponent(input.integrationID)}/connect/command/${encodeURIComponent(input.attemptID)}`,
|
||||
query: { location: input["location"] },
|
||||
successStatus: 204,
|
||||
declaredStatuses: [401, 400],
|
||||
empty: true,
|
||||
},
|
||||
requestOptions,
|
||||
),
|
||||
},
|
||||
},
|
||||
mcp: {
|
||||
list: (input?: McpListInput, requestOptions?: RequestOptions) =>
|
||||
|
|
|
|||
|
|
@ -187,6 +187,8 @@ export type ProviderV2Info = {
|
|||
|
||||
export type IntegrationWhen = { key: string; op: "eq" | "neq"; value: string }
|
||||
|
||||
export type IntegrationCommandMethod = { id: string; type: "command"; label: string; command: Array<string> }
|
||||
|
||||
export type IntegrationKeyMethod = { type: "key"; label?: string }
|
||||
|
||||
export type IntegrationEnvMethod = { type: "env"; names: Array<string> }
|
||||
|
|
@ -214,6 +216,31 @@ export type IntegrationAttemptStatus =
|
|||
time: { created: number | "Infinity" | "-Infinity" | "NaN"; expires: number | "Infinity" | "-Infinity" | "NaN" }
|
||||
}
|
||||
|
||||
export type IntegrationCommandAttempt = {
|
||||
attemptID: string
|
||||
time: { created: number | "Infinity" | "-Infinity" | "NaN"; expires: number | "Infinity" | "-Infinity" | "NaN" }
|
||||
}
|
||||
|
||||
export type IntegrationCommandAttemptStatus =
|
||||
| {
|
||||
status: "pending"
|
||||
message?: string
|
||||
time: { created: number | "Infinity" | "-Infinity" | "NaN"; expires: number | "Infinity" | "-Infinity" | "NaN" }
|
||||
}
|
||||
| {
|
||||
status: "complete"
|
||||
time: { created: number | "Infinity" | "-Infinity" | "NaN"; expires: number | "Infinity" | "-Infinity" | "NaN" }
|
||||
}
|
||||
| {
|
||||
status: "failed"
|
||||
message: string
|
||||
time: { created: number | "Infinity" | "-Infinity" | "NaN"; expires: number | "Infinity" | "-Infinity" | "NaN" }
|
||||
}
|
||||
| {
|
||||
status: "expired"
|
||||
time: { created: number | "Infinity" | "-Infinity" | "NaN"; expires: number | "Infinity" | "-Infinity" | "NaN" }
|
||||
}
|
||||
|
||||
export type McpStatusConnected = { status: "connected" }
|
||||
|
||||
export type McpStatusPending = { status: "pending" }
|
||||
|
|
@ -1992,7 +2019,11 @@ export type SessionMessageAssistantTool = {
|
|||
time: { created: number; ran?: number; completed?: number }
|
||||
}
|
||||
|
||||
export type IntegrationMethod = IntegrationOAuthMethod | IntegrationKeyMethod | IntegrationEnvMethod
|
||||
export type IntegrationMethod =
|
||||
| IntegrationOAuthMethod
|
||||
| IntegrationCommandMethod
|
||||
| IntegrationKeyMethod
|
||||
| IntegrationEnvMethod
|
||||
|
||||
export type FormFields = [FormField, ...Array<FormField>]
|
||||
|
||||
|
|
@ -3351,6 +3382,43 @@ export type IntegrationOauthCancelInput = {
|
|||
|
||||
export type IntegrationOauthCancelOutput = void
|
||||
|
||||
export type IntegrationCommandConnectInput = {
|
||||
readonly integrationID: { readonly integrationID: string }["integrationID"]
|
||||
readonly location?: {
|
||||
readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined
|
||||
}["location"]
|
||||
readonly methodID: { readonly methodID: string; readonly label?: string | undefined }["methodID"]
|
||||
readonly label?: { readonly methodID: string; readonly label?: string | undefined }["label"]
|
||||
}
|
||||
|
||||
export type IntegrationCommandConnectOutput = {
|
||||
location: { directory: string; workspaceID?: string; project: { id: string; directory: string } }
|
||||
data: IntegrationCommandAttempt
|
||||
}
|
||||
|
||||
export type IntegrationCommandStatusInput = {
|
||||
readonly integrationID: { readonly integrationID: string; readonly attemptID: string }["integrationID"]
|
||||
readonly attemptID: { readonly integrationID: string; readonly attemptID: string }["attemptID"]
|
||||
readonly location?: {
|
||||
readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined
|
||||
}["location"]
|
||||
}
|
||||
|
||||
export type IntegrationCommandStatusOutput = {
|
||||
location: { directory: string; workspaceID?: string; project: { id: string; directory: string } }
|
||||
data: IntegrationCommandAttemptStatus
|
||||
}
|
||||
|
||||
export type IntegrationCommandCancelInput = {
|
||||
readonly integrationID: { readonly integrationID: string; readonly attemptID: string }["integrationID"]
|
||||
readonly attemptID: { readonly integrationID: string; readonly attemptID: string }["attemptID"]
|
||||
readonly location?: {
|
||||
readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined
|
||||
}["location"]
|
||||
}
|
||||
|
||||
export type IntegrationCommandCancelOutput = void
|
||||
|
||||
export type McpListInput = {
|
||||
readonly location?: {
|
||||
readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue