@better-i18n/schemas 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/github.ts ADDED
@@ -0,0 +1,130 @@
1
+
2
+ import { z } from 'zod';
3
+
4
+ /**
5
+ * Schema for listing GitHub repositories from an installation.
6
+ */
7
+ export const listRepositoriesSchema = z.object({
8
+ installationId: z.number(),
9
+ page: z.number().min(1).default(1),
10
+ limit: z.number().min(1).max(100).default(30),
11
+ type: z.enum(["all", "public", "private"]).default("all"),
12
+ sort: z
13
+ .enum(["created", "updated", "pushed", "full_name"])
14
+ .default("updated"),
15
+ direction: z.enum(["asc", "desc"]).default("desc"),
16
+ });
17
+
18
+ /**
19
+ * Schema for getting a specific GitHub repository.
20
+ */
21
+ export const getRepositorySchema = z.object({
22
+ installationId: z.number(),
23
+ owner: z.string().min(1),
24
+ repo: z.string().min(1),
25
+ });
26
+
27
+ /**
28
+ * Schema for adding a GitHub repository to a project.
29
+ */
30
+ export const addRepositorySchema = z.object({
31
+ projectId: z.string().uuid(),
32
+ installationId: z.number(),
33
+ owner: z.string().min(1),
34
+ repo: z.string().min(1),
35
+ path: z.string().default(""),
36
+ pattern: z.string().default(""),
37
+ format: z.enum(["JSON_FLAT", "JSON_NAMESPACED"]).default("JSON_FLAT"),
38
+ branch: z.string().optional(),
39
+ targetBranch: z.string().default("i18n-sync"),
40
+ autoPushToSourceBranch: z.boolean().default(false),
41
+ });
42
+
43
+ /**
44
+ * Schema for updating a GitHub repository.
45
+ */
46
+ export const updateRepositorySchema = z.object({
47
+ repositoryId: z.string().uuid(),
48
+ path: z.string().optional(),
49
+ pattern: z.string().optional(),
50
+ format: z.enum(["JSON_FLAT", "JSON_NAMESPACED"]).optional(),
51
+ branch: z.string().optional(),
52
+ targetBranch: z.string().optional(),
53
+ enabled: z.boolean().optional(),
54
+ autoPushToSourceBranch: z.boolean().optional(),
55
+ });
56
+
57
+ /**
58
+ * Schema for removing a GitHub repository from a project.
59
+ */
60
+ export const removeRepositorySchema = z.object({
61
+ repositoryId: z.string().uuid(),
62
+ });
63
+
64
+ /**
65
+ * Schema for syncing a GitHub repository.
66
+ */
67
+ export const syncRepositorySchema = z.object({
68
+ repositoryId: z.string().uuid(),
69
+ });
70
+
71
+ /**
72
+ * Schema for GitHub OAuth callback.
73
+ */
74
+ export const oauthCallbackSchema = z.object({
75
+ code: z.string().min(1),
76
+ state: z.string().optional(),
77
+ installation_id: z.string().optional(), // GitHub App installation ID (as string)
78
+ });
79
+
80
+ /**
81
+ * Schema for listing GitHub repository branches.
82
+ */
83
+ export const listBranchesSchema = z.object({
84
+ installationId: z.number(),
85
+ owner: z.string().min(1),
86
+ repo: z.string().min(1),
87
+ });
88
+
89
+ /**
90
+ * Schema for getting GitHub repository tree.
91
+ */
92
+ export const getTreeSchema = z.object({
93
+ installationId: z.number(),
94
+ owner: z.string().min(1),
95
+ repo: z.string().min(1),
96
+ branch: z.string().min(1),
97
+ path: z.string().default(""),
98
+ });
99
+
100
+ /**
101
+ * Schema for getting source files from a repository.
102
+ */
103
+ export const getSourceFilesSchema = z.object({
104
+ repositoryId: z.string().uuid(),
105
+ });
106
+
107
+ /**
108
+ * Schema for connecting a GitHub repository for Doctor CI only (no sync).
109
+ */
110
+ export const connectForDoctorSchema = z.object({
111
+ projectId: z.string().uuid(),
112
+ installationId: z.number(),
113
+ owner: z.string().min(1),
114
+ repo: z.string().min(1),
115
+ });
116
+
117
+ /**
118
+ * Types for GitHub repository operations.
119
+ */
120
+ export type ListRepositoriesInput = z.infer<typeof listRepositoriesSchema>;
121
+ export type GetRepositoryInput = z.infer<typeof getRepositorySchema>;
122
+ export type AddRepositoryInput = z.infer<typeof addRepositorySchema>;
123
+ export type UpdateRepositoryInput = z.infer<typeof updateRepositorySchema>;
124
+ export type RemoveRepositoryInput = z.infer<typeof removeRepositorySchema>;
125
+ export type SyncRepositoryInput = z.infer<typeof syncRepositorySchema>;
126
+ export type OAuthCallbackInput = z.infer<typeof oauthCallbackSchema>;
127
+ export type ListBranchesInput = z.infer<typeof listBranchesSchema>;
128
+ export type GetTreeInput = z.infer<typeof getTreeSchema>;
129
+ export type GetSourceFilesInput = z.infer<typeof getSourceFilesSchema>;
130
+ export type ConnectForDoctorInput = z.infer<typeof connectForDoctorSchema>;
package/src/index.ts ADDED
@@ -0,0 +1,10 @@
1
+
2
+ export * from "./ai-models";
3
+ export * from "./github";
4
+ export * from "./languages/index";
5
+ export * from "./organizations/index";
6
+ export * from "./projects/index";
7
+ export * from "./subscription";
8
+ export * from "./sync";
9
+ export * from "./translations";
10
+ export * from "./content";
@@ -0,0 +1,265 @@
1
+ /**
2
+ * Language utilities and mappings
3
+ *
4
+ * Shared across the monorepo for consistent language handling.
5
+ */
6
+
7
+ // Map common language codes to display names (ISO 639-1 and BCP 47 variants)
8
+ export const LANGUAGE_NAMES: Record<string, string> = {
9
+ // BCP 47 locale variants
10
+ "zh-hans": "Chinese (Simplified)",
11
+ "zh-hant": "Chinese (Traditional)",
12
+ "pt-br": "Portuguese (Brazil)",
13
+ "pt-pt": "Portuguese (Portugal)",
14
+ "en-us": "English (US)",
15
+ "en-gb": "English (UK)",
16
+ "fr-ca": "French (Canada)",
17
+ "es-mx": "Spanish (Mexico)",
18
+ "es-419": "Spanish (Latin America)",
19
+ "sr-latn": "Serbian (Latin)",
20
+ "sr-cyrl": "Serbian (Cyrillic)",
21
+ "nb-no": "Norwegian Bokmål",
22
+ "nn-no": "Norwegian Nynorsk",
23
+ // ISO 639-1 base codes
24
+ en: "English",
25
+ tr: "Turkish",
26
+ de: "German",
27
+ fr: "French",
28
+ es: "Spanish",
29
+ it: "Italian",
30
+ pt: "Portuguese",
31
+ ru: "Russian",
32
+ zh: "Chinese",
33
+ ja: "Japanese",
34
+ ko: "Korean",
35
+ ar: "Arabic",
36
+ pl: "Polish",
37
+ nl: "Dutch",
38
+ sv: "Swedish",
39
+ no: "Norwegian",
40
+ da: "Danish",
41
+ fi: "Finnish",
42
+ cs: "Czech",
43
+ hu: "Hungarian",
44
+ ro: "Romanian",
45
+ uk: "Ukrainian",
46
+ vi: "Vietnamese",
47
+ th: "Thai",
48
+ id: "Indonesian",
49
+ ms: "Malay",
50
+ hi: "Hindi",
51
+ bn: "Bengali",
52
+ he: "Hebrew",
53
+ el: "Greek",
54
+ bg: "Bulgarian",
55
+ sk: "Slovak",
56
+ sl: "Slovenian",
57
+ hr: "Croatian",
58
+ sr: "Serbian",
59
+ lt: "Lithuanian",
60
+ lv: "Latvian",
61
+ et: "Estonian",
62
+ ca: "Catalan",
63
+ eu: "Basque",
64
+ gl: "Galician",
65
+ sq: "Albanian",
66
+ af: "Afrikaans",
67
+ ak: "Akan",
68
+ aa: "Afar",
69
+ ab: "Abkhazian",
70
+ am: "Amharic",
71
+ sw: "Swahili",
72
+ ta: "Tamil",
73
+ te: "Telugu",
74
+ ur: "Urdu",
75
+ fa: "Persian",
76
+ ml: "Malayalam",
77
+ mr: "Marathi",
78
+ gu: "Gujarati",
79
+ kn: "Kannada",
80
+ ne: "Nepali",
81
+ si: "Sinhala",
82
+ km: "Khmer",
83
+ lo: "Lao",
84
+ my: "Burmese",
85
+ ka: "Georgian",
86
+ hy: "Armenian",
87
+ az: "Azerbaijani",
88
+ uz: "Uzbek",
89
+ kk: "Kazakh",
90
+ mn: "Mongolian",
91
+ tl: "Filipino",
92
+ zu: "Zulu",
93
+ xh: "Xhosa",
94
+ ig: "Igbo",
95
+ yo: "Yoruba",
96
+ ha: "Hausa",
97
+ so: "Somali",
98
+ };
99
+
100
+ // Map common language codes to country codes for flags (ISO 639-1 and BCP 47 variants)
101
+ export const LANGUAGE_TO_COUNTRY: Record<string, string> = {
102
+ // BCP 47 locale variants → country code
103
+ "zh-hans": "cn",
104
+ "zh-hant": "tw",
105
+ "pt-br": "br",
106
+ "pt-pt": "pt",
107
+ "en-us": "us",
108
+ "en-gb": "gb",
109
+ "fr-ca": "ca",
110
+ "es-mx": "mx",
111
+ "es-419": "mx",
112
+ "sr-latn": "rs",
113
+ "sr-cyrl": "rs",
114
+ "nb-no": "no",
115
+ "nn-no": "no",
116
+ // ISO 639-1 base codes
117
+ en: "gb",
118
+ tr: "tr",
119
+ de: "de",
120
+ fr: "fr",
121
+ es: "es",
122
+ it: "it",
123
+ pt: "pt",
124
+ ru: "ru",
125
+ zh: "cn",
126
+ ja: "jp",
127
+ ko: "kr",
128
+ ar: "sa",
129
+ pl: "pl",
130
+ nl: "nl",
131
+ sv: "se",
132
+ no: "no",
133
+ da: "dk",
134
+ fi: "fi",
135
+ cs: "cz",
136
+ hu: "hu",
137
+ ro: "ro",
138
+ uk: "ua",
139
+ vi: "vn",
140
+ th: "th",
141
+ id: "id",
142
+ ms: "my",
143
+ hi: "in",
144
+ bn: "bd",
145
+ he: "il",
146
+ el: "gr",
147
+ bg: "bg",
148
+ sk: "sk",
149
+ sl: "si",
150
+ hr: "hr",
151
+ sr: "rs",
152
+ lt: "lt",
153
+ lv: "lv",
154
+ et: "ee",
155
+ ca: "es-ct",
156
+ eu: "es-pv",
157
+ gl: "es-ga",
158
+ sq: "al",
159
+ af: "za",
160
+ ak: "gh",
161
+ aa: "et",
162
+ ab: "ge",
163
+ am: "et",
164
+ sw: "tz",
165
+ ta: "in",
166
+ te: "in",
167
+ ur: "pk",
168
+ fa: "ir",
169
+ ml: "in",
170
+ mr: "in",
171
+ gu: "in",
172
+ kn: "in",
173
+ ne: "np",
174
+ si: "lk",
175
+ km: "kh",
176
+ lo: "la",
177
+ my: "mm",
178
+ ka: "ge",
179
+ hy: "am",
180
+ az: "az",
181
+ uz: "uz",
182
+ kk: "kz",
183
+ mn: "mn",
184
+ tl: "ph",
185
+ zu: "za",
186
+ xh: "za",
187
+ ig: "ng",
188
+ yo: "ng",
189
+ ha: "ng",
190
+ so: "so",
191
+ };
192
+
193
+ /**
194
+ * Get country code from language code for flag mapping.
195
+ * Handles ISO 639-1 (e.g. "en") and BCP 47 (e.g. "zh-Hans", "pt-BR", "es-419").
196
+ * Returns undefined when we do not have a trustworthy mapping instead of
197
+ * guessing from the language code and accidentally showing the wrong flag.
198
+ */
199
+ export function getCountryCode(langCode: string | undefined | null): string | undefined {
200
+ if (!langCode) return undefined;
201
+ const code = langCode.toLowerCase();
202
+ // 1. Exact match in table (zh-hans, pt-br, es-419, etc.)
203
+ if (LANGUAGE_TO_COUNTRY[code]) return LANGUAGE_TO_COUNTRY[code];
204
+ // 2. BCP 47 — parse subtag
205
+ if (code.includes("-")) {
206
+ const [base, subtag] = code.split("-");
207
+ // Region subtag (2 letters, e.g. "br" in pt-BR, "us" in en-US)
208
+ if (subtag.length === 2) return subtag;
209
+ // Script subtag (4 letters, e.g. "hans" in zh-Hans) or numeric region (e.g. "419")
210
+ // Fall back to base language country code
211
+ return LANGUAGE_TO_COUNTRY[base];
212
+ }
213
+ // 3. Base ISO 639-1
214
+ return LANGUAGE_TO_COUNTRY[code];
215
+ }
216
+
217
+ /**
218
+ * Get language name from code, with fallback to uppercase code.
219
+ * Supports ISO 639-1 and BCP 47 locale codes.
220
+ */
221
+ export function getLanguageName(code: string): string {
222
+ const lower = code.toLowerCase();
223
+ if (LANGUAGE_NAMES[lower]) return LANGUAGE_NAMES[lower];
224
+ // BCP 47 fallback: if zh-Hans not found, try zh
225
+ if (lower.includes("-")) {
226
+ const base = lower.split("-")[0];
227
+ if (LANGUAGE_NAMES[base]) return LANGUAGE_NAMES[base];
228
+ }
229
+ return code.toUpperCase();
230
+ }
231
+
232
+ /**
233
+ * Format a language code for display following BCP 47 conventions.
234
+ * - Base codes: "en" → "EN"
235
+ * - Region subtag: "pt-br" → "pt-BR"
236
+ * - Script subtag: "zh-hans" → "zh-Hans"
237
+ * - Numeric region: "es-419" → "es-419"
238
+ */
239
+ export function formatLanguageCode(code: string): string {
240
+ if (!code.includes("-")) return code.toUpperCase();
241
+ const [lang, subtag] = code.split("-");
242
+ // Region subtag (2 letters): pt-BR, en-US
243
+ if (subtag.length === 2)
244
+ return `${lang.toLowerCase()}-${subtag.toUpperCase()}`;
245
+ // Script subtag (4 letters): zh-Hans, sr-Latn
246
+ if (subtag.length === 4) {
247
+ return `${lang.toLowerCase()}-${subtag.charAt(0).toUpperCase()}${subtag.slice(1).toLowerCase()}`;
248
+ }
249
+ // Numeric or other: es-419
250
+ return `${lang.toLowerCase()}-${subtag}`;
251
+ }
252
+
253
+ /**
254
+ * Get language code from name (reverse lookup)
255
+ * Returns undefined if not found
256
+ */
257
+ export function getLanguageCode(name: string): string | undefined {
258
+ const lowerName = name.toLowerCase();
259
+ for (const [code, langName] of Object.entries(LANGUAGE_NAMES)) {
260
+ if (langName.toLowerCase() === lowerName) {
261
+ return code;
262
+ }
263
+ }
264
+ return undefined;
265
+ }
@@ -0,0 +1,4 @@
1
+
2
+ export * from "./organization.input";
3
+
4
+
@@ -0,0 +1,23 @@
1
+
2
+ import { z } from 'zod';
3
+
4
+ /**
5
+ * Schema for creating a new organization.
6
+ */
7
+ export const createOrganizationSchema = z.object({
8
+ name: z
9
+ .string()
10
+ .min(1, "Organization name is required")
11
+ .max(100, "Organization name must be less than 100 characters"),
12
+ slug: z
13
+ .string()
14
+ .regex(/^[a-z0-9-]+$/, "Slug can only contain lowercase letters, numbers, and hyphens")
15
+ .min(1, "Slug is required")
16
+ .max(50, "Slug must be less than 50 characters"),
17
+ logo: z.string().url("Invalid logo URL").optional(),
18
+ });
19
+
20
+ // Type exports
21
+ export type CreateOrganizationInput = z.infer<typeof createOrganizationSchema>;
22
+
23
+
@@ -0,0 +1,4 @@
1
+
2
+ export * from "./project.input";
3
+
4
+
@@ -0,0 +1,221 @@
1
+
2
+ import { z } from 'zod';
3
+
4
+ /**
5
+ * Schema for creating a new project.
6
+ */
7
+ export const createProjectSchema = z.object({
8
+ name: z.string().min(1, "Project name is required").max(100, "Project name must be less than 100 characters"),
9
+ slug: z
10
+ .string()
11
+ .regex(/^[a-z0-9-]+$/, "Slug can only contain lowercase letters, numbers, and hyphens")
12
+ .min(1, "Slug is required")
13
+ .max(50, "Slug must be less than 50 characters"),
14
+ sourceLanguage: z.string().min(2).max(10).describe("ISO 639-1 or BCP 47 language code"),
15
+ organizationId: z.string().uuid("Invalid organization ID"),
16
+ });
17
+
18
+ /**
19
+ * Schema for updating a project.
20
+ */
21
+ export const updateProjectSchema = z.object({
22
+ projectId: z.string().uuid("Invalid project ID"),
23
+ name: z.string().min(1).max(100).optional(),
24
+ slug: z.string().regex(/^[a-z0-9-]+$/).optional(),
25
+ sourceLanguage: z.string().min(2).max(10).optional(),
26
+ autoTranslate: z.boolean().optional(),
27
+ autoPullRequest: z.boolean().optional(),
28
+ cdnFallbackEnabled: z.boolean().optional(),
29
+ cdnFallbackLanguageCode: z.string().min(2).max(10).optional().nullable(),
30
+ aiSystemPrompt: z.string().max(2000, "System prompt must be less than 2000 characters").optional().nullable(),
31
+ contentEnabled: z.boolean().optional(),
32
+ doctorReportRecipientId: z.string().uuid().optional().nullable(),
33
+ });
34
+
35
+ /**
36
+ * Schema for project list query.
37
+ */
38
+ export const listProjectsSchema = z.object({
39
+ organizationId: z.string().uuid("Invalid organization ID"),
40
+ page: z.number().int().positive().default(1),
41
+ limit: z.number().int().positive().max(100).default(20),
42
+ search: z.string().optional(),
43
+ });
44
+
45
+ /**
46
+ * Schema for getting a project by ID.
47
+ */
48
+ export const getProjectSchema = z.object({
49
+ projectId: z.string().uuid("Invalid project ID"),
50
+ });
51
+
52
+ /**
53
+ * Schema for getting a project by slug.
54
+ */
55
+ export const getProjectBySlugSchema = z.object({
56
+ organizationId: z.string().uuid("Invalid organization ID"),
57
+ slug: z.string().regex(/^[a-z0-9-]+$/, "Invalid project slug"),
58
+ });
59
+
60
+ /**
61
+ * Schema for deleting a project.
62
+ */
63
+ export const deleteProjectSchema = z.object({
64
+ projectId: z.string().uuid("Invalid project ID"),
65
+ });
66
+
67
+ /**
68
+ * Schema for adding a target language to a project.
69
+ * Status defaults to "active" for manual adds, but AI adds can specify "draft".
70
+ */
71
+ export const addTargetLanguageSchema = z.object({
72
+ projectId: z.string().uuid("Invalid project ID"),
73
+ languageCode: z.string().min(2).max(10),
74
+ status: z.enum(["active", "draft"]).default("active").optional(),
75
+ });
76
+
77
+ /**
78
+ * Schema for batch adding multiple target languages to a project.
79
+ * Replaces sequential addTargetLanguage calls for better performance.
80
+ */
81
+ export const batchAddTargetLanguagesSchema = z.object({
82
+ projectId: z.string().uuid("Invalid project ID"),
83
+ languageCodes: z
84
+ .array(z.string().min(2).max(10))
85
+ .min(1, "At least one language code required")
86
+ .max(50, "Maximum 50 languages at once"),
87
+ status: z.enum(["active", "draft"]).default("active").optional(),
88
+ });
89
+
90
+ /**
91
+ * Schema for batch updating target language statuses.
92
+ * Replaces sequential updateTargetLanguageStatus calls.
93
+ */
94
+ export const batchUpdateTargetLanguageStatusSchema = z.object({
95
+ projectId: z.string().uuid("Invalid project ID"),
96
+ updates: z
97
+ .array(
98
+ z.object({
99
+ languageCode: z.string().min(2).max(10),
100
+ status: z.enum(["active", "draft", "archived"]),
101
+ }),
102
+ )
103
+ .min(1, "At least one update required")
104
+ .max(50, "Maximum 50 updates at once"),
105
+ });
106
+
107
+ /**
108
+ * Schema for removing a target language from a project.
109
+ */
110
+ export const removeTargetLanguageSchema = z.object({
111
+ projectId: z.string().uuid("Invalid project ID"),
112
+ languageCode: z.string().min(2).max(10),
113
+ });
114
+
115
+ /**
116
+ * Language status for publish workflow:
117
+ * - "active": Visible in editor AND published to CDN
118
+ * - "draft": Visible in editor BUT excluded from CDN publish
119
+ * - "archived": Hidden from editor AND excluded from publish
120
+ */
121
+ export const languageStatusEnum = z.enum(["active", "draft", "archived"]);
122
+
123
+ /**
124
+ * Schema for updating a target language's status.
125
+ * Replaces the old boolean disabled field with a three-state enum.
126
+ */
127
+ export const updateTargetLanguageStatusSchema = z.object({
128
+ projectId: z.string().uuid("Invalid project ID"),
129
+ languageCode: z.string().min(2).max(10),
130
+ status: languageStatusEnum,
131
+ });
132
+
133
+ /**
134
+ * Schema for reordering target languages within a project.
135
+ * Accepts an ordered array of language codes to set custom display order.
136
+ */
137
+ export const reorderTargetLanguagesSchema = z.object({
138
+ projectId: z.string().uuid("Invalid project ID"),
139
+ languageCodes: z
140
+ .array(z.string().min(2).max(10))
141
+ .min(1, "At least one language code required"),
142
+ /** 0-based index of source language in the combined (source + target) list */
143
+ sourceLanguagePosition: z.number().int().min(0).optional(),
144
+ });
145
+
146
+ export type ReorderTargetLanguagesInput = z.infer<
147
+ typeof reorderTargetLanguagesSchema
148
+ >;
149
+
150
+ export const resetLanguageOrderSchema = z.object({
151
+ projectId: z.string().uuid("Invalid project ID"),
152
+ });
153
+
154
+ export type ResetLanguageOrderInput = z.infer<
155
+ typeof resetLanguageOrderSchema
156
+ >;
157
+
158
+ /**
159
+ * @deprecated Use updateTargetLanguageStatusSchema instead
160
+ * Kept for backward compatibility during migration
161
+ */
162
+ export const toggleTargetLanguageSchema = z.object({
163
+ projectId: z.string().uuid("Invalid project ID"),
164
+ languageCode: z.string().min(2).max(10),
165
+ disabled: z.boolean(),
166
+ });
167
+
168
+ /**
169
+ * Schema for checking project slug availability within an organization.
170
+ */
171
+ export const checkProjectSlugAvailabilitySchema = z.object({
172
+ organizationId: z.string().uuid("Invalid organization ID"),
173
+ slug: z.string().min(1).max(50).regex(/^[a-z0-9-]+$/, {
174
+ message: "Slug can only contain lowercase letters, numbers, and hyphens",
175
+ }),
176
+ });
177
+
178
+ /**
179
+ * Schema for getting project target languages.
180
+ */
181
+ export const getTargetLanguagesSchema = z.object({
182
+ projectId: z.string().uuid("Invalid project ID"),
183
+ });
184
+
185
+ /**
186
+ * Schema for managing languages in a single operation.
187
+ * Combines batch add + batch status updates into one mutation
188
+ * so that a single activity record is created.
189
+ */
190
+ export const manageLanguagesSchema = z.object({
191
+ projectId: z.string().uuid("Invalid project ID"),
192
+ add: z.array(z.string().min(2).max(10)).default([]),
193
+ statusUpdates: z
194
+ .array(
195
+ z.object({
196
+ languageCode: z.string().min(2).max(10),
197
+ status: z.enum(["active", "draft"]),
198
+ }),
199
+ )
200
+ .default([]),
201
+ });
202
+
203
+ export type ManageLanguagesInput = z.infer<typeof manageLanguagesSchema>;
204
+
205
+ // Type exports
206
+ export type CreateProjectInput = z.infer<typeof createProjectSchema>;
207
+ export type UpdateProjectInput = z.infer<typeof updateProjectSchema>;
208
+ export type ListProjectsInput = z.infer<typeof listProjectsSchema>;
209
+ export type GetProjectInput = z.infer<typeof getProjectSchema>;
210
+ export type GetProjectBySlugInput = z.infer<typeof getProjectBySlugSchema>;
211
+ export type DeleteProjectInput = z.infer<typeof deleteProjectSchema>;
212
+ export type AddTargetLanguageInput = z.infer<typeof addTargetLanguageSchema>;
213
+ export type RemoveTargetLanguageInput = z.infer<typeof removeTargetLanguageSchema>;
214
+ export type ToggleTargetLanguageInput = z.infer<typeof toggleTargetLanguageSchema>;
215
+ export type UpdateTargetLanguageStatusInput = z.infer<typeof updateTargetLanguageStatusSchema>;
216
+ export type LanguageStatus = z.infer<typeof languageStatusEnum>;
217
+ export type GetTargetLanguagesInput = z.infer<typeof getTargetLanguagesSchema>;
218
+ export type BatchAddTargetLanguagesInput = z.infer<typeof batchAddTargetLanguagesSchema>;
219
+ export type BatchUpdateTargetLanguageStatusInput = z.infer<typeof batchUpdateTargetLanguageStatusSchema>;
220
+
221
+
@@ -0,0 +1,12 @@
1
+ import { z } from "zod";
2
+
3
+ export const invoiceSchema = z.object({
4
+ id: z.string(),
5
+ date: z.number(),
6
+ amount: z.number(),
7
+ status: z.enum(["draft", "open", "paid", "uncollectible", "void"]),
8
+ pdfUrl: z.string().nullable(),
9
+ hostedUrl: z.string().nullable(),
10
+ });
11
+
12
+ export type Invoice = z.infer<typeof invoiceSchema>;