Files
cms-website/apps/api/src/modules/publish/publish.module.ts
T
浅念 c35f10835a feat(publish): 显式发布命令(dry-run/confirm/审计/站点配置首版/锚点helper)
- publishSiteContent 零装饰器服务:dry-run 只读清单(current 非空且 published≠current)
  + 随机 confirm token;confirm 单事务批量 UPDATE published←current + audit_logs
  (action=content.publish,全仓第一个审计写入方)+ site_config_revisions v1 首版
  ({name,origin,locale,brand:{}},UNIQUE(site_id,version) 幂等)
- 空清单 no-op 零写入;SITE_NOT_FOUND/CONFIRM_TOKEN_REQUIRED 均先于任何写入
- P0 门禁不做(ADR-018 记偏离,服务 JSDoc 注明);导入永不发布(ADR-010)
- sf CLI + content:publish(--dry-run/--confirm/--actor,缺省 dry-run 安全优先,
  actor 缺省 super_admin@cli)
- anchors.ts:五列内容身份查询从 content/term/route 三写入器抽单源共享(零行为
  变更,既有 333 测试守护)
- 集成测试 7 例(临时库 mini 全链):dry-run 零写入/confirm/幂等/config 首版与
  既有跳过/actor/空清单/SITE_NOT_FOUND/缺 token

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-10-22 07:06:23 +08:00

29 lines
1.1 KiB
TypeScript
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.
// publish 域 Nest 模块(Plan 4 Task 1):注册 PublishService 供 standalone context
// 使用(NestFactory.createApplicationContext(PublishModule)——本切片 API 不监听端口,ADR-002)。
// 与 source.module.ts / import.module.ts 同构薄壳:逻辑全在 publish.service.ts 的
// 零装饰器独立函数里,本类只提供 DI 语境下的调用面;'reflect-metadata' 置顶
// (CLI/测试直接 import publish.service.ts 纯函数文件,不经本模块,故无需提前加载
// reflect-metadata)。
import 'reflect-metadata'
import { Injectable, Module } from '@nestjs/common'
import {
publishSiteContent,
type PublishDb,
type PublishSiteContentInput,
type PublishSiteContentResult,
} from './publish.service.js'
/** publishSiteContent 的 Nest 注入壳(standalone context / 后续 REST 通道复用同一实现) */
@Injectable()
export class PublishService {
publish(db: PublishDb, input: PublishSiteContentInput): Promise<PublishSiteContentResult> {
return publishSiteContent(db, input)
}
}
@Module({
providers: [PublishService],
exports: [PublishService],
})
export class PublishModule {}