mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 13:40:44 +00:00
refactor: trim cron helper exports
This commit is contained in:
@@ -6,7 +6,7 @@ const trimStringPreprocess = (value: unknown) => (typeof value === "string" ? va
|
||||
const trimLowercaseStringPreprocess = (value: unknown) =>
|
||||
normalizeOptionalLowercaseString(value) ?? value;
|
||||
|
||||
export const DeliveryModeFieldSchema = z
|
||||
const DeliveryModeFieldSchema = z
|
||||
.preprocess(trimLowercaseStringPreprocess, z.enum(["deliver", "announce", "none", "webhook"]))
|
||||
.transform((value) => (value === "deliver" ? "announce" : value));
|
||||
|
||||
@@ -30,7 +30,7 @@ export const TimeoutSecondsFieldSchema = z
|
||||
.finite()
|
||||
.transform((value) => Math.max(0, value));
|
||||
|
||||
export type ParsedDeliveryInput = {
|
||||
type ParsedDeliveryInput = {
|
||||
mode?: "announce" | "none" | "webhook";
|
||||
channel?: string;
|
||||
to?: string;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
|
||||
import { stripHeartbeatToken } from "../auto-reply/heartbeat.js";
|
||||
|
||||
export type HeartbeatDeliveryPayload = {
|
||||
type HeartbeatDeliveryPayload = {
|
||||
text?: string;
|
||||
mediaUrl?: string;
|
||||
mediaUrls?: string[];
|
||||
|
||||
@@ -61,9 +61,7 @@ function resolveSchedulePayload(
|
||||
return schedulePayloadFromRecord(job);
|
||||
}
|
||||
|
||||
export function cronScheduleIdentity(
|
||||
job: Pick<CronJob, "schedule"> & { enabled?: boolean },
|
||||
): string {
|
||||
function cronScheduleIdentity(job: Pick<CronJob, "schedule"> & { enabled?: boolean }): string {
|
||||
const schedule = resolveSchedulePayload(job as unknown as Record<string, unknown>);
|
||||
if (!schedule) {
|
||||
throw new Error("Unsupported cron schedule kind");
|
||||
|
||||
@@ -13,9 +13,7 @@ import type {
|
||||
} from "./service/state.js";
|
||||
import type { CronJob } from "./types.js";
|
||||
|
||||
export type { CronListPageOptions, CronListPageResult } from "./service/list-page-types.js";
|
||||
|
||||
export type CronWakeResult = { ok: true } | { ok: false };
|
||||
type CronWakeResult = { ok: true } | { ok: false };
|
||||
|
||||
export type CronServiceRunResult = CronRunResult | { ok: true; ran: false; reason: "invalid-spec" };
|
||||
|
||||
|
||||
@@ -1,20 +1,10 @@
|
||||
import type {
|
||||
CronListPageOptions,
|
||||
CronServiceContract,
|
||||
CronServiceRunResult,
|
||||
} from "./service-contract.js";
|
||||
import type { CronServiceContract, CronServiceRunResult } from "./service-contract.js";
|
||||
import type { CronListPageOptions } from "./service/list-page-types.js";
|
||||
import * as ops from "./service/ops.js";
|
||||
import { type CronServiceDeps, createCronServiceState } from "./service/state.js";
|
||||
import type { CronJob, CronJobCreate, CronJobPatch } from "./types.js";
|
||||
|
||||
export type { CronEvent, CronServiceDeps } from "./service/state.js";
|
||||
export type {
|
||||
CronListPageOptions,
|
||||
CronListPageResult,
|
||||
CronServiceContract,
|
||||
CronServiceRunResult,
|
||||
CronWakeResult,
|
||||
} from "./service-contract.js";
|
||||
|
||||
export class CronService implements CronServiceContract {
|
||||
private readonly state;
|
||||
|
||||
Reference in New Issue
Block a user