@read-frog/definitions 0.0.1

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.
@@ -0,0 +1,263 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/constants/app.d.ts
4
+ declare const APP_NAME = "Read Frog";
5
+ //#endregion
6
+ //#region src/constants/auth.d.ts
7
+ declare const AUTH_BASE_PATH = "/api/identity";
8
+ declare const AUTH_COOKIE_PATTERNS: readonly ["better-auth.session_token"];
9
+ //#endregion
10
+ //#region src/types/languages.d.ts
11
+ declare const LANG_CODE_ISO6393_OPTIONS: readonly ["eng", "cmn", "cmn-Hant", "yue", "spa", "rus", "arb", "ben", "hin", "por", "ind", "jpn", "fra", "deu", "jav", "kor", "tel", "vie", "mar", "ita", "tam", "tur", "urd", "guj", "pol", "ukr", "kan", "mai", "mal", "pes", "mya", "swh", "sun", "ron", "pan", "bho", "amh", "hau", "fuv", "bos", "hrv", "nld", "srp", "tha", "ckb", "yor", "uzn", "zlm", "ibo", "npi", "ceb", "skr", "tgl", "hun", "azj", "sin", "koi", "ell", "ces", "mag", "run", "bel", "plt", "qug", "mad", "nya", "zyb", "pbu", "kin", "zul", "bul", "swe", "lin", "som", "hms", "hnj", "ilo", "kaz"];
12
+ declare const langCodeISO6393Schema: z.ZodEnum<{
13
+ eng: "eng";
14
+ cmn: "cmn";
15
+ "cmn-Hant": "cmn-Hant";
16
+ yue: "yue";
17
+ spa: "spa";
18
+ rus: "rus";
19
+ arb: "arb";
20
+ ben: "ben";
21
+ hin: "hin";
22
+ por: "por";
23
+ ind: "ind";
24
+ jpn: "jpn";
25
+ fra: "fra";
26
+ deu: "deu";
27
+ jav: "jav";
28
+ kor: "kor";
29
+ tel: "tel";
30
+ vie: "vie";
31
+ mar: "mar";
32
+ ita: "ita";
33
+ tam: "tam";
34
+ tur: "tur";
35
+ urd: "urd";
36
+ guj: "guj";
37
+ pol: "pol";
38
+ ukr: "ukr";
39
+ kan: "kan";
40
+ mai: "mai";
41
+ mal: "mal";
42
+ pes: "pes";
43
+ mya: "mya";
44
+ swh: "swh";
45
+ sun: "sun";
46
+ ron: "ron";
47
+ pan: "pan";
48
+ bho: "bho";
49
+ amh: "amh";
50
+ hau: "hau";
51
+ fuv: "fuv";
52
+ bos: "bos";
53
+ hrv: "hrv";
54
+ nld: "nld";
55
+ srp: "srp";
56
+ tha: "tha";
57
+ ckb: "ckb";
58
+ yor: "yor";
59
+ uzn: "uzn";
60
+ zlm: "zlm";
61
+ ibo: "ibo";
62
+ npi: "npi";
63
+ ceb: "ceb";
64
+ skr: "skr";
65
+ tgl: "tgl";
66
+ hun: "hun";
67
+ azj: "azj";
68
+ sin: "sin";
69
+ koi: "koi";
70
+ ell: "ell";
71
+ ces: "ces";
72
+ mag: "mag";
73
+ run: "run";
74
+ bel: "bel";
75
+ plt: "plt";
76
+ qug: "qug";
77
+ mad: "mad";
78
+ nya: "nya";
79
+ zyb: "zyb";
80
+ pbu: "pbu";
81
+ kin: "kin";
82
+ zul: "zul";
83
+ bul: "bul";
84
+ swe: "swe";
85
+ lin: "lin";
86
+ som: "som";
87
+ hms: "hms";
88
+ hnj: "hnj";
89
+ ilo: "ilo";
90
+ kaz: "kaz";
91
+ }>;
92
+ declare const langCodeISO6391Schema: z.ZodEnum<{
93
+ en: "en";
94
+ zh: "zh";
95
+ "zh-TW": "zh-TW";
96
+ es: "es";
97
+ ru: "ru";
98
+ ar: "ar";
99
+ bn: "bn";
100
+ hi: "hi";
101
+ pt: "pt";
102
+ id: "id";
103
+ ja: "ja";
104
+ fr: "fr";
105
+ de: "de";
106
+ jv: "jv";
107
+ ko: "ko";
108
+ te: "te";
109
+ vi: "vi";
110
+ mr: "mr";
111
+ it: "it";
112
+ ta: "ta";
113
+ tr: "tr";
114
+ ur: "ur";
115
+ gu: "gu";
116
+ pl: "pl";
117
+ uk: "uk";
118
+ kn: "kn";
119
+ ml: "ml";
120
+ fa: "fa";
121
+ my: "my";
122
+ sw: "sw";
123
+ su: "su";
124
+ ro: "ro";
125
+ pa: "pa";
126
+ am: "am";
127
+ ha: "ha";
128
+ ff: "ff";
129
+ bs: "bs";
130
+ hr: "hr";
131
+ nl: "nl";
132
+ sr: "sr";
133
+ th: "th";
134
+ ku: "ku";
135
+ yo: "yo";
136
+ uz: "uz";
137
+ ms: "ms";
138
+ ig: "ig";
139
+ ne: "ne";
140
+ tl: "tl";
141
+ hu: "hu";
142
+ az: "az";
143
+ si: "si";
144
+ el: "el";
145
+ cs: "cs";
146
+ ny: "ny";
147
+ rw: "rw";
148
+ zu: "zu";
149
+ bg: "bg";
150
+ sv: "sv";
151
+ ln: "ln";
152
+ so: "so";
153
+ kk: "kk";
154
+ be: "be";
155
+ }>;
156
+ type LangCodeISO6391 = z.infer<typeof langCodeISO6391Schema>;
157
+ type LangCodeISO6393 = z.infer<typeof langCodeISO6393Schema>;
158
+ declare const LANG_CODE_TO_EN_NAME: Record<LangCodeISO6393, string>;
159
+ declare const LANG_CODE_TO_LOCALE_NAME: Record<LangCodeISO6393, string>;
160
+ declare const ISO6393_TO_6391: Record<LangCodeISO6393, LangCodeISO6391 | undefined>;
161
+ declare const LOCALE_TO_ISO6393: Partial<Record<LangCodeISO6391, LangCodeISO6393>>;
162
+ declare const langLevel: z.ZodEnum<{
163
+ beginner: "beginner";
164
+ intermediate: "intermediate";
165
+ advanced: "advanced";
166
+ }>;
167
+ type LangLevel = z.infer<typeof langLevel>;
168
+ declare const RTL_LANG_CODES: readonly LangCodeISO6393[];
169
+ //#endregion
170
+ //#region src/constants/dictionary.d.ts
171
+ /**
172
+ * This file is used to assemble a system prompt according to different languages.
173
+ */
174
+ interface DictionaryFieldLabels {
175
+ pronunciation: string;
176
+ partOfSpeech: string;
177
+ definition: string;
178
+ exampleSentence: string;
179
+ extendedVocabulary: string;
180
+ synonyms: string;
181
+ antonyms: string;
182
+ root: string;
183
+ grammarPoint: string;
184
+ explanation: string;
185
+ uniqueAttributes: string;
186
+ }
187
+ declare const LANG_DICTIONARY_LABELS: Record<LangCodeISO6393, DictionaryFieldLabels>;
188
+ //#endregion
189
+ //#region src/constants/url.d.ts
190
+ declare const CHROME_EXTENSION_ORIGIN = "chrome-extension://modkelfkcfjpgbfmnbnllalkiogfofhb";
191
+ declare const EDGE_EXTENSION_ORIGIN = "extension://cbcbomlgikfbdnoaohcjfledcoklcjbo";
192
+ declare const TRUSTED_ORIGINS: string[];
193
+ declare const WEBSITE_DEV_PORT = 8888;
194
+ declare const WEBSITE_DEV_URL = "http://localhost:8888";
195
+ declare const WEBSITE_PROD_URL = "https://www.readfrog.app";
196
+ declare const READFROG_DOMAIN = "readfrog.app";
197
+ declare const LOCALHOST_DOMAIN = "localhost";
198
+ declare const AUTH_DOMAINS: readonly ["readfrog.app", "localhost"];
199
+ //#endregion
200
+ //#region src/schemas/version.d.ts
201
+ /**
202
+ * Semantic version regex pattern
203
+ * Matches versions like: 1.0.0, 10.20.30
204
+ * Does NOT match: v1.0.0, 1.0.0-alpha, 1.0, 1.-1.0
205
+ */
206
+ declare const SEMANTIC_VERSION_REGEX: RegExp;
207
+ /**
208
+ * Zod schema for semantic version validation
209
+ * Validates semantic version strings according to SemVer conventions
210
+ * Requires exactly 3 parts: major.minor.patch
211
+ *
212
+ * @example
213
+ * semanticVersionSchema.parse('1.0.0') // ✓ valid
214
+ * semanticVersionSchema.parse('10.20.30') // ✓ valid
215
+ * semanticVersionSchema.parse('1.11') // ✗ throws error (must have 3 parts)
216
+ * semanticVersionSchema.parse('v1.0.0') // ✗ throws error
217
+ * semanticVersionSchema.parse('1.0.0-alpha') // ✗ throws error
218
+ */
219
+ declare const semanticVersionSchema: z.ZodString;
220
+ /**
221
+ * Type for semantic version string
222
+ */
223
+ type SemanticVersion = z.infer<typeof semanticVersionSchema>;
224
+ /**
225
+ * Version type classification
226
+ */
227
+ type VersionType = 'major' | 'minor' | 'patch';
228
+ /**
229
+ * Parse a semantic version string into its components
230
+ * Validates the input using semanticVersionSchema before parsing
231
+ *
232
+ * @param version - The version string to parse (must be in format major.minor.patch)
233
+ * @returns An object containing the major, minor, and patch numbers
234
+ * @throws {z.ZodError} If the version string is invalid
235
+ *
236
+ * @example
237
+ * parseSemanticVersion('1.2.3') // { major: 1, minor: 2, patch: 3 }
238
+ * parseSemanticVersion('10.20.30') // { major: 10, minor: 20, patch: 30 }
239
+ * parseSemanticVersion('1.0') // throws error - must have 3 parts
240
+ * parseSemanticVersion('v1.0.0') // throws error - invalid format
241
+ */
242
+ declare function parseSemanticVersion(version: string): {
243
+ major: number;
244
+ minor: number;
245
+ patch: number;
246
+ };
247
+ /**
248
+ * Determine the version type (major, minor, or patch) based on semantic versioning rules
249
+ * Validates the input using semanticVersionSchema before classification
250
+ *
251
+ * @param version - The version string to classify
252
+ * @returns The version type classification
253
+ * @throws {z.ZodError} If the version string is invalid
254
+ *
255
+ * @example
256
+ * getVersionType('1.0.0') // 'major'
257
+ * getVersionType('1.2.0') // 'minor'
258
+ * getVersionType('1.2.3') // 'patch'
259
+ * getVersionType('1.0') // throws error - must have 3 parts
260
+ */
261
+ declare function getVersionType(version: string): VersionType;
262
+ //#endregion
263
+ export { APP_NAME, AUTH_BASE_PATH, AUTH_COOKIE_PATTERNS, AUTH_DOMAINS, CHROME_EXTENSION_ORIGIN, DictionaryFieldLabels, EDGE_EXTENSION_ORIGIN, ISO6393_TO_6391, LANG_CODE_ISO6393_OPTIONS, LANG_CODE_TO_EN_NAME, LANG_CODE_TO_LOCALE_NAME, LANG_DICTIONARY_LABELS, LOCALE_TO_ISO6393, LOCALHOST_DOMAIN, LangCodeISO6391, LangCodeISO6393, LangLevel, READFROG_DOMAIN, RTL_LANG_CODES, SEMANTIC_VERSION_REGEX, SemanticVersion, TRUSTED_ORIGINS, VersionType, WEBSITE_DEV_PORT, WEBSITE_DEV_URL, WEBSITE_PROD_URL, getVersionType, langCodeISO6391Schema, langCodeISO6393Schema, langLevel, parseSemanticVersion, semanticVersionSchema };