feat: upgrade investigation and presentation runtime
This commit is contained in:
@@ -1,34 +1,7 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { safeChartInput } from "../frontendAction/registry.js";
|
||||
|
||||
export const supplyLayerSchema = z.enum(["junctions", "pipes", "valves", "pumps", "tanks", "reservoirs", "scada"]);
|
||||
const identifier = z.string().trim().min(1).max(128);
|
||||
|
||||
export const taskPresentationCommandSchema = z.discriminatedUnion("action", [
|
||||
z.object({
|
||||
action: z.literal("highlight_features"),
|
||||
layer: supplyLayerSchema,
|
||||
feature_ids: z.array(identifier).min(1).max(100),
|
||||
effect: z.enum(["steady", "pulse"]).default("steady"),
|
||||
}).strict(),
|
||||
z.object({ action: z.literal("clear_highlights") }).strict(),
|
||||
z.object({
|
||||
action: z.literal("open_chart"),
|
||||
chart_id: identifier,
|
||||
chart: safeChartInput,
|
||||
evidence_refs: z.array(z.string().trim().min(1)).min(1).max(100),
|
||||
}).strict(),
|
||||
z.object({ action: z.literal("close_chart"), chart_id: identifier }).strict(),
|
||||
z.object({
|
||||
action: z.literal("set_overlay"),
|
||||
overlay_id: identifier,
|
||||
title: z.string().trim().min(1).max(200),
|
||||
mode: z.enum(["geometry", "heatmap"]),
|
||||
evidence_id: z.string().trim().min(1),
|
||||
}).strict(),
|
||||
z.object({ action: z.literal("clear_overlay"), overlay_id: identifier }).strict(),
|
||||
]);
|
||||
import { createViewCommandSchema } from "../frontendAction/command.js";
|
||||
export { supplyLayerSchema } from "../frontendAction/command.js";
|
||||
export const taskPresentationCommandSchema = createViewCommandSchema({ publication: true });
|
||||
|
||||
export type TaskPresentationCommand = z.infer<typeof taskPresentationCommandSchema>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user