feat(session): support admit-only synthetic messages (#35774)
This commit is contained in:
parent
cb18a42a47
commit
3e57b43a4a
7 changed files with 27 additions and 2 deletions
|
|
@ -154,6 +154,7 @@ export type Endpoint4_12Input = {
|
||||||
readonly text: Endpoint4_12Request["payload"]["text"]
|
readonly text: Endpoint4_12Request["payload"]["text"]
|
||||||
readonly description?: Endpoint4_12Request["payload"]["description"]
|
readonly description?: Endpoint4_12Request["payload"]["description"]
|
||||||
readonly metadata?: Endpoint4_12Request["payload"]["metadata"]
|
readonly metadata?: Endpoint4_12Request["payload"]["metadata"]
|
||||||
|
readonly resume?: Endpoint4_12Request["payload"]["resume"]
|
||||||
}
|
}
|
||||||
export type Endpoint4_12Output = EffectValue<ReturnType<RawClient["server.session"]["session.synthetic"]>>
|
export type Endpoint4_12Output = EffectValue<ReturnType<RawClient["server.session"]["session.synthetic"]>>
|
||||||
export type SessionSyntheticOperation<E = never> = (input: Endpoint4_12Input) => Effect.Effect<Endpoint4_12Output, E>
|
export type SessionSyntheticOperation<E = never> = (input: Endpoint4_12Input) => Effect.Effect<Endpoint4_12Output, E>
|
||||||
|
|
|
||||||
|
|
@ -209,11 +209,17 @@ type Endpoint4_12Input = {
|
||||||
readonly text: Endpoint4_12Request["payload"]["text"]
|
readonly text: Endpoint4_12Request["payload"]["text"]
|
||||||
readonly description?: Endpoint4_12Request["payload"]["description"]
|
readonly description?: Endpoint4_12Request["payload"]["description"]
|
||||||
readonly metadata?: Endpoint4_12Request["payload"]["metadata"]
|
readonly metadata?: Endpoint4_12Request["payload"]["metadata"]
|
||||||
|
readonly resume?: Endpoint4_12Request["payload"]["resume"]
|
||||||
}
|
}
|
||||||
const Endpoint4_12 = (raw: RawClient["server.session"]) => (input: Endpoint4_12Input) =>
|
const Endpoint4_12 = (raw: RawClient["server.session"]) => (input: Endpoint4_12Input) =>
|
||||||
raw["session.synthetic"]({
|
raw["session.synthetic"]({
|
||||||
params: { sessionID: input["sessionID"] },
|
params: { sessionID: input["sessionID"] },
|
||||||
payload: { text: input["text"], description: input["description"], metadata: input["metadata"] },
|
payload: {
|
||||||
|
text: input["text"],
|
||||||
|
description: input["description"],
|
||||||
|
metadata: input["metadata"],
|
||||||
|
resume: input["resume"],
|
||||||
|
},
|
||||||
}).pipe(Effect.mapError(mapClientError))
|
}).pipe(Effect.mapError(mapClientError))
|
||||||
|
|
||||||
type Endpoint4_13Request = Parameters<RawClient["server.session"]["session.shell"]>[0]
|
type Endpoint4_13Request = Parameters<RawClient["server.session"]["session.shell"]>[0]
|
||||||
|
|
|
||||||
|
|
@ -538,7 +538,12 @@ export function make(options: ClientOptions) {
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
path: `/api/session/${encodeURIComponent(input.sessionID)}/synthetic`,
|
path: `/api/session/${encodeURIComponent(input.sessionID)}/synthetic`,
|
||||||
body: { text: input["text"], description: input["description"], metadata: input["metadata"] },
|
body: {
|
||||||
|
text: input["text"],
|
||||||
|
description: input["description"],
|
||||||
|
metadata: input["metadata"],
|
||||||
|
resume: input["resume"],
|
||||||
|
},
|
||||||
successStatus: 204,
|
successStatus: 204,
|
||||||
declaredStatuses: [404, 400, 401],
|
declaredStatuses: [404, 400, 401],
|
||||||
empty: true,
|
empty: true,
|
||||||
|
|
|
||||||
|
|
@ -856,17 +856,26 @@ export type SessionSyntheticInput = {
|
||||||
readonly text: string
|
readonly text: string
|
||||||
readonly description?: string | null
|
readonly description?: string | null
|
||||||
readonly metadata?: { readonly [x: string]: JsonValue }
|
readonly metadata?: { readonly [x: string]: JsonValue }
|
||||||
|
readonly resume?: boolean | null
|
||||||
}["text"]
|
}["text"]
|
||||||
readonly description?: {
|
readonly description?: {
|
||||||
readonly text: string
|
readonly text: string
|
||||||
readonly description?: string | null
|
readonly description?: string | null
|
||||||
readonly metadata?: { readonly [x: string]: JsonValue }
|
readonly metadata?: { readonly [x: string]: JsonValue }
|
||||||
|
readonly resume?: boolean | null
|
||||||
}["description"]
|
}["description"]
|
||||||
readonly metadata?: {
|
readonly metadata?: {
|
||||||
readonly text: string
|
readonly text: string
|
||||||
readonly description?: string | null
|
readonly description?: string | null
|
||||||
readonly metadata?: { readonly [x: string]: JsonValue }
|
readonly metadata?: { readonly [x: string]: JsonValue }
|
||||||
|
readonly resume?: boolean | null
|
||||||
}["metadata"]
|
}["metadata"]
|
||||||
|
readonly resume?: {
|
||||||
|
readonly text: string
|
||||||
|
readonly description?: string | null
|
||||||
|
readonly metadata?: { readonly [x: string]: JsonValue }
|
||||||
|
readonly resume?: boolean | null
|
||||||
|
}["resume"]
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SessionSyntheticOutput = void
|
export type SessionSyntheticOutput = void
|
||||||
|
|
|
||||||
|
|
@ -243,6 +243,7 @@ export interface Interface {
|
||||||
text: string
|
text: string
|
||||||
description?: string
|
description?: string
|
||||||
metadata?: Record<string, unknown>
|
metadata?: Record<string, unknown>
|
||||||
|
resume?: boolean
|
||||||
}) => Effect.Effect<void, NotFoundError>
|
}) => Effect.Effect<void, NotFoundError>
|
||||||
readonly revert: {
|
readonly revert: {
|
||||||
readonly stage: (input: {
|
readonly stage: (input: {
|
||||||
|
|
@ -682,6 +683,7 @@ const layer = Layer.effect(
|
||||||
description: input.description,
|
description: input.description,
|
||||||
metadata: input.metadata,
|
metadata: input.metadata,
|
||||||
})
|
})
|
||||||
|
if (input.resume === false) return
|
||||||
yield* execution
|
yield* execution
|
||||||
.resume(input.sessionID)
|
.resume(input.sessionID)
|
||||||
.pipe(Effect.ignore, Effect.forkIn(scope, { startImmediately: true }), Effect.asVoid)
|
.pipe(Effect.ignore, Effect.forkIn(scope, { startImmediately: true }), Effect.asVoid)
|
||||||
|
|
|
||||||
|
|
@ -344,6 +344,7 @@ export const makeSessionGroup = <I extends HttpApiMiddleware.AnyId, S>(sessionLo
|
||||||
text: Schema.String,
|
text: Schema.String,
|
||||||
description: Schema.String.pipe(Schema.optional),
|
description: Schema.String.pipe(Schema.optional),
|
||||||
metadata: SessionMessage.Synthetic.fields.metadata,
|
metadata: SessionMessage.Synthetic.fields.metadata,
|
||||||
|
resume: Schema.Boolean.pipe(Schema.optional),
|
||||||
}),
|
}),
|
||||||
success: HttpApiSchema.NoContent,
|
success: HttpApiSchema.NoContent,
|
||||||
error: SessionNotFoundError,
|
error: SessionNotFoundError,
|
||||||
|
|
|
||||||
|
|
@ -329,6 +329,7 @@ export const SessionHandler = HttpApiBuilder.group(Api, "server.session", (handl
|
||||||
text: ctx.payload.text,
|
text: ctx.payload.text,
|
||||||
description: ctx.payload.description,
|
description: ctx.payload.description,
|
||||||
metadata: ctx.payload.metadata,
|
metadata: ctx.payload.metadata,
|
||||||
|
resume: ctx.payload.resume,
|
||||||
})
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
Effect.catchTag("Session.NotFoundError", (error) =>
|
Effect.catchTag("Session.NotFoundError", (error) =>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue