Files
makelore/.project-docs/20-architecture/data-flow.md

30 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Data Flow
## Primary Flows
| Flow | Source | Destination | Notes |
|---|---|---|---|
| 登录续期 | Renderer 活动信号 | Main Works Session | 连续 7 天未使用才清除会话 |
| 项目创建 | 新建项目对话框 | Host API → Main 项目初始化 | 创建时固定 `ProjectType`;小游戏/小程序原子生成受控模板,自定义只生成项目空间 |
| 一键提交 | `ProjectPublishAction` | Renderer capability → Host API → Main packager → Works Square 版本上传 | 只对小游戏/小程序开放Main 打包、自动版本、幂等重试和脱敏Renderer 随后轮询云构建 |
| 提交绑定 | 云端成功上传响应 | Main → submission binding v2 | 只持久化成功的 app/version/review/hash落盘失败返回固定告警但不反转提交 |
| 运营发布 | Works Square 审核与交付 | 公共 `play_url` | 客户端只消费服务端发布结果;真实 Builder → OSS/CDN 生产链仍待整链验收 |
| 真机预览 | 项目空间 | Main → Owner preview / `play_url` | 核对 app、version、release 和同源 HTTPS`runtime_url` 仅一版本兼容回退 |
## State Ownership
- Main 持有刷新凭据、发布 Token、临时 ZIP、幂等键和 submission binding v2Renderer 不持有归档路径或自动部署状态。
- 项目内 `.niancode/project.json` 保存 `ProjectType`Main 在配置写入和目录复用时保持其不可变,并在打包时重新读取校验。
- Renderer 仅持有短效公开会话状态、提交展示状态和安全投影后的公共播放/短时预览 URL。
- 旧 schema v1 `submitted` 记录迁移并保留;旧 `armed``waiting_for_package``waiting_for_login``uploading``failed` 归一为 `legacy_retired`,不再启动 watcher 或上传任务。
## External Interfaces
- Works Square 项目创建、版本上传、构建状态、Owner 状态与 Release preview API。
- 本机 Host API 的发布与真机预览路由;发布路由要求 Renderer capability。
- 服务端安全投影后的公共 `play_url`;只接受同源 HTTPS、精确 App 路径和可信版本状态。
## Last Updated
2026-08-10