mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 10:40:43 +00:00
refactor: share config delivery context schema
This commit is contained in:
@@ -7,6 +7,16 @@ const ConfigSchemaLookupPathString = Type.String({
|
||||
pattern: "^[A-Za-z0-9_./\\[\\]\\-*]+$",
|
||||
});
|
||||
|
||||
const ConfigDeliveryContextSchema = Type.Object(
|
||||
{
|
||||
channel: Type.Optional(Type.String()),
|
||||
to: Type.Optional(Type.String()),
|
||||
accountId: Type.Optional(Type.String()),
|
||||
threadId: Type.Optional(Type.Union([Type.String(), Type.Number()])),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
export const ConfigGetParamsSchema = Type.Object({}, { additionalProperties: false });
|
||||
|
||||
export const ConfigSetParamsSchema = Type.Object(
|
||||
@@ -22,17 +32,7 @@ const ConfigApplyLikeParamsSchema = Type.Object(
|
||||
raw: NonEmptyString,
|
||||
baseHash: Type.Optional(NonEmptyString),
|
||||
sessionKey: Type.Optional(Type.String()),
|
||||
deliveryContext: Type.Optional(
|
||||
Type.Object(
|
||||
{
|
||||
channel: Type.Optional(Type.String()),
|
||||
to: Type.Optional(Type.String()),
|
||||
accountId: Type.Optional(Type.String()),
|
||||
threadId: Type.Optional(Type.Union([Type.String(), Type.Number()])),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
),
|
||||
),
|
||||
deliveryContext: Type.Optional(ConfigDeliveryContextSchema),
|
||||
note: Type.Optional(Type.String()),
|
||||
restartDelayMs: Type.Optional(Type.Integer({ minimum: 0 })),
|
||||
},
|
||||
@@ -54,17 +54,7 @@ export const ConfigSchemaLookupParamsSchema = Type.Object(
|
||||
export const UpdateRunParamsSchema = Type.Object(
|
||||
{
|
||||
sessionKey: Type.Optional(Type.String()),
|
||||
deliveryContext: Type.Optional(
|
||||
Type.Object(
|
||||
{
|
||||
channel: Type.Optional(Type.String()),
|
||||
to: Type.Optional(Type.String()),
|
||||
accountId: Type.Optional(Type.String()),
|
||||
threadId: Type.Optional(Type.Union([Type.String(), Type.Number()])),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
),
|
||||
),
|
||||
deliveryContext: Type.Optional(ConfigDeliveryContextSchema),
|
||||
note: Type.Optional(Type.String()),
|
||||
restartDelayMs: Type.Optional(Type.Integer({ minimum: 0 })),
|
||||
timeoutMs: Type.Optional(Type.Integer({ minimum: 1 })),
|
||||
|
||||
Reference in New Issue
Block a user