SuperAPI AI 工具集

atscript-ui-wf

前端与建站

查看项目

更新于 10-16 01:19

技能介绍

用途:构建基于 HTTP 往返的多步骤工作流表单,客户端用 @atscript/vue-wf,服务端用 @atscript/moost-wf,主要面向 <AsWfForm> 等场景。

安装:npx skills add moostjs/atscript-ui;客户端 pnpm add @atscript/core @atscript/typescript @atscript/ui @atscript/vue-form @atscript/vue-wf vue;服务端 pnpm add @atscript/moost-wf moost @moostjs/event-http @moostjs/event-wf @prostojs/wf。持久化时才需 @atscript/db 与 @atscript/db-sqlite。

主要能力:@Workflow/@Step/@WorkflowSchema 定义线性或分支流程;@WfInput() 校验入站数据,缺失或非法时抛 StepRetriableError 并暂停该步骤;finishWf/abortWf 生成 WfFinished 信封;<AsWfForm> 提供 @finished/@error 等事件与 useWfForm 组合式接口;支持 body/cookie/query 令牌传输与邮箱魔链恢复。

使用方式:在 Vue 中挂载 <AsWfForm path="/wf/trigger" name="hello" :types="types" @finished="onFinished" />,服务端通过 handleAsOutletRequest 与 createAsHttpOutlet 包装响应。:types 与 :components 会透传给底层 <AsForm>,完成页可用 wf.finish.* 插槽定制。

适用场景:登录+MFA、注册内联 OTP、邮箱邀请魔法链接、结账保存草稿等多步骤流程。

限制:@atscript/moost-wf/store 仅支持 ESM,CJS 消费者需改用内存存储;令牌用 body 传输时刷新会丢失;AsWfStore 恢复需用 getAndDelete 保证竞态安全;影子列仅支持 string|number|boolean。更多细节见 https://ui.atscript.dev/workflows/ 与 https://github.com/moostjs/atscript-ui。