/** * module: minute —— 对外类型(编码规范 §10.1;语义出处 OS 2.1 / 3.1)。 * * 纪要是工作台五要素里**唯一的主动动作**:团队主动维护上传的沉淀(会议纪要等)。 * 它本身不产生责任;责任的产生只有一条路——**决议经登记触发转为工作流的启动**, * 「登记人即来源」。所以本模块的写面很薄,重头在「决议 → 登记起单」这一跳。 */ import type { StaffId } from '@contracts'; import type { Minute, MinuteResolution, ResolutionState } from './internal/domain/minute.ts'; export type { Minute, MinuteResolution, ResolutionState }; export class MinuteNotFoundError extends Error { constructor(readonly minuteId: string) { super(`纪要不存在:${minuteId}`); this.name = 'MinuteNotFoundError'; } } export class ResolutionAlreadyRegisteredError extends Error { constructor( readonly resolutionId: string, readonly workflowId: string, ) { super(`决议 ${resolutionId} 已登记起单(工作流 ${workflowId})—— 同一决议不重复起单`); this.name = 'ResolutionAlreadyRegisteredError'; } } export type CreateMinuteInput = { readonly title: string; readonly body: string; readonly authorId: StaffId; /** 与会/相关人 —— 仅作沉淀标注,不产生责任 */ readonly participants?: readonly StaffId[]; readonly occurredOn: string; readonly resolutions?: ReadonlyArray<{ text: string; ownerId?: StaffId | undefined }>; }; export type RegisterInput = { readonly resolutionId: string; /** 登记人 —— 凡单必有来源,登记触发的来源就是他 */ readonly byId: StaffId; readonly processPackageId: string; /** 按调用接口 schema 填写的输入(表单由 schema 自动渲染) */ readonly data: Record; }; export type MinuteService = { list(limit?: number): Promise; get(minuteId: string): Promise; create(input: CreateMinuteInput): Promise; /** 只增不改的编辑:正文可续,决议只增 —— 纪要是沉淀,不是可覆写的文档 */ appendResolution(minuteId: string, text: string, ownerId?: StaffId): Promise; /** 决议 → 登记起单:登记人即来源;同一决议只起一次单 */ register(input: RegisterInput): Promise<{ workflowId: string; resolutionId: string }>; };