- 建立 pnpm workspace + Turborepo 单仓、ESLint 9/Prettier/commitlint/husky 门禁 - NestJS + Fastify API:统一错误体、trace_id、Zod 管道、/health 真实依赖探活、OpenAPI 3.1 契约 - Prisma 基线:outbox_events/idempotency_keys/system_configs 与首版迁移、幂等种子 - shared 契约包:错误码、权限点、ULID、游标分页、命名/时间工具 - ui 包与 Web 壳层:Semi + Remix 图标统一出口、Cloud Blue 视觉、登录/工作台/错误页 - worker 骨架、Playwright 冒烟、Gitea CI、OpenAPI 快照与 oasdiff 回退脚本 - 补充 A0 实施报告与本地开发说明
This commit is contained in:
1 parent
9c3ab9768a
commit
04f49690f4
155 files changed
+18402
-28
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
import { ULID_PATTERN } from '../ulid.js';
|
||||
|
||||
/** 26 位 ULID 主键 */
|
||||
export const ulidSchema = z.string().regex(ULID_PATTERN, '必须是 26 位大写 ULID');
|
||||
|
||||
export const idSchema = ulidSchema;
|
||||
|
||||
/** ISO 8601 时间(必须带时区,A0 统一用 UTC Z) */
|
||||
export const isoDateTimeSchema = z.string().datetime({ offset: true });
|
||||
|
||||
export const sortOrderSchema = z.enum(['asc', 'desc']);
|
||||
|
||||
/** 请求追踪 ID(与 Pino requestId 同源) */
|
||||
export const traceIdSchema = z.string().min(8).max(64);
|
||||
|
||||
/** 任务提交幂等键:8–128 位可见 ASCII */
|
||||
export const idempotencyKeySchema = z
|
||||
.string()
|
||||
.min(8)
|
||||
.max(128)
|
||||
.regex(/^[\x21-\x7e]+$/, '幂等键必须是可见 ASCII 字符');
|
||||
|
||||
/** 客户 ID:ULID */
|
||||
export const customerIdSchema = ulidSchema;
|
||||
Reference in new issue
Block a user