Review a presigned upload policy

src/upload-policy-types.tsTypeScript
@@ -0,0 +1,33 @@
1+export interface UploadIntent {
2+ id: string;
3+ tenantId: string;
4+ key: string;
5+ mime: "image/jpeg" | "image/png";
6+ bytes: number;
7+ sha256: string;
8+ completed: boolean;
9+}
10+
11+export interface UploadPolicyDependencies {
12+ clock: { nowMs(): number };
13+ ids: { randomId(): string };
14+ signer: {
15+ createPost(input: {
16+ key: string;
17+ expiresAtSeconds: number;
18+ conditions: readonly unknown[];
19+ }): Promise<{ url: string; fields: Readonly<Record<string, string>> }>;
20+ };
21+ intents: {
22+ create(intent: UploadIntent): Promise<void>;
23+ get(id: string): Promise<UploadIntent | undefined>;
24+ markComplete(id: string): Promise<void>;
25+ };
26+ storage: {
27+ head(key: string): Promise<{
28+ bytes: number;
29+ mime: string;
30+ sha256: string;
31+ } | undefined>;
32+ };
33+}