-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
71 lines (64 loc) · 1.95 KB
/
types.ts
File metadata and controls
71 lines (64 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
export type AuthStatus = 'loading' | 'no_key' | 'locked' | 'unlocked';
export type Secret = {
id: 'github' | 'cloudflare' | 'netlify' | 'vercel';
encryptedToken: ArrayBuffer;
iv: Uint8Array;
// Store non-secret metadata for display
metadata?: Record<string, any>;
};
export type Settings = {
id: 'global';
repoUrl: string; // 'owner/repo'
defaultSection: string; // 'posts'
assetPath: string; // 'static/images/posts'
defaultBranch: string; // 'main'
defaultCommitMessage: string;
websiteBaseUrl?: string;
frontMatterSchema: FrontMatterField[];
};
export type FrontMatterField = {
name: string;
type: 'string' | 'list' | 'boolean' | 'date' | 'textarea' | 'image';
label: string;
description?: string; // Optional description for better UX
};
export type Post = {
id: string; // nanoid()
slug: string;
frontMatter: Record<string, any>;
markdown: string;
createdAt: string;
updatedAt: string;
section: string;
status: 'draft' | 'published';
syncState: 'local' | 'synced' | 'conflict';
remoteSha?: string; // GitHub blob SHA for conflict detection
conflictData?: {
remoteFrontMatter: Record<string, any>;
remoteMarkdown: string;
remoteSha: string;
};
};
export type Asset = {
id: string;
path: string;
name: string;
size: number;
remoteSha?: string;
downloadUrl: string;
contentType?: string;
syncState: 'local' | 'synced' | 'deleting';
updatedAt: string;
// NEW: Store base64 content for local assets before they're synced to GitHub
localContent?: string; // Base64 encoded file content (only present when syncState is 'local')
};
export type DeployProvider = 'github' | 'cloudflare' | 'netlify' | 'vercel';
export type Deployment = {
id: string; // provider-project_id
provider: DeployProvider;
name: string;
projectId: string; // Vercel projectId, Netlify site_id, Cloudflare projectName
accountId?: string; // Cloudflare accountId
encryptedToken: ArrayBuffer;
iv: Uint8Array;
};