mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 02:18:25 +00:00
refactor(gateway): dedupe wizard status schema
This commit is contained in:
@@ -1,6 +1,13 @@
|
|||||||
import { Type } from "@sinclair/typebox";
|
import { Type } from "@sinclair/typebox";
|
||||||
import { NonEmptyString } from "./primitives.js";
|
import { NonEmptyString } from "./primitives.js";
|
||||||
|
|
||||||
|
const WizardRunStatusSchema = Type.Union([
|
||||||
|
Type.Literal("running"),
|
||||||
|
Type.Literal("done"),
|
||||||
|
Type.Literal("cancelled"),
|
||||||
|
Type.Literal("error"),
|
||||||
|
]);
|
||||||
|
|
||||||
export const WizardStartParamsSchema = Type.Object(
|
export const WizardStartParamsSchema = Type.Object(
|
||||||
{
|
{
|
||||||
mode: Type.Optional(Type.Union([Type.Literal("local"), Type.Literal("remote")])),
|
mode: Type.Optional(Type.Union([Type.Literal("local"), Type.Literal("remote")])),
|
||||||
@@ -75,14 +82,7 @@ export const WizardNextResultSchema = Type.Object(
|
|||||||
{
|
{
|
||||||
done: Type.Boolean(),
|
done: Type.Boolean(),
|
||||||
step: Type.Optional(WizardStepSchema),
|
step: Type.Optional(WizardStepSchema),
|
||||||
status: Type.Optional(
|
status: Type.Optional(WizardRunStatusSchema),
|
||||||
Type.Union([
|
|
||||||
Type.Literal("running"),
|
|
||||||
Type.Literal("done"),
|
|
||||||
Type.Literal("cancelled"),
|
|
||||||
Type.Literal("error"),
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
error: Type.Optional(Type.String()),
|
error: Type.Optional(Type.String()),
|
||||||
},
|
},
|
||||||
{ additionalProperties: false },
|
{ additionalProperties: false },
|
||||||
@@ -93,14 +93,7 @@ export const WizardStartResultSchema = Type.Object(
|
|||||||
sessionId: NonEmptyString,
|
sessionId: NonEmptyString,
|
||||||
done: Type.Boolean(),
|
done: Type.Boolean(),
|
||||||
step: Type.Optional(WizardStepSchema),
|
step: Type.Optional(WizardStepSchema),
|
||||||
status: Type.Optional(
|
status: Type.Optional(WizardRunStatusSchema),
|
||||||
Type.Union([
|
|
||||||
Type.Literal("running"),
|
|
||||||
Type.Literal("done"),
|
|
||||||
Type.Literal("cancelled"),
|
|
||||||
Type.Literal("error"),
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
error: Type.Optional(Type.String()),
|
error: Type.Optional(Type.String()),
|
||||||
},
|
},
|
||||||
{ additionalProperties: false },
|
{ additionalProperties: false },
|
||||||
|
|||||||
Reference in New Issue
Block a user