feat(api-water): 支持上传水印图片

This commit is contained in:
R524809
2026-09-04 14:27:59 +08:00
parent c2523fe349
commit 009082d0f4
15 changed files with 6484 additions and 6089 deletions
+1
View File
@@ -2,3 +2,4 @@ export * from './collection';
export * from './auth';
export * from './stores';
export * from './watermarks';
export * from './media';
+35
View File
@@ -0,0 +1,35 @@
import { z } from 'zod';
const checksum = z
.string()
.regex(/^[a-f0-9]{64}$/, '必须是 SHA-256 十六进制摘要');
export const createMediaUploadIntentRequestSchema = z
.object({
purpose: z.literal('watermark_image'),
filename: z.string().trim().min(1).max(255),
content_type: z.enum(['image/png', 'image/jpeg', 'image/webp']),
byte_size: z
.number()
.int()
.min(1)
.max(5 * 1024 * 1024),
checksum_sha256: checksum,
})
.strict();
export const completeMediaUploadIntentRequestSchema = z
.object({
checksum_sha256: checksum,
})
.strict();
export const createMediaAccessUrlRequestSchema = z
.object({
purpose: z.literal('preview'),
})
.strict();
export type CreateMediaUploadIntentRequest = z.infer<
typeof createMediaUploadIntentRequestSchema
>;
export type CompleteMediaUploadIntentRequest = z.infer<
typeof completeMediaUploadIntentRequestSchema
>;