@everylanguage/shared-types 1.0.22 โ 1.0.23-dev.20251211.91235.160
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/package.json +7 -69
- package/types/README.md +3 -3
- package/types/database.d.ts +3799 -1445
- package/LICENSE +0 -21
- package/README.md +0 -350
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Every Language
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/README.md
DELETED
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
# EL Backend
|
|
2
|
-
|
|
3
|
-
[](https://github.com/your-username/el-backend/actions/workflows/ci.yml)
|
|
4
|
-
[](https://github.com/your-username/el-backend/actions/workflows/deploy.yml)
|
|
5
|
-
|
|
6
|
-
Supabase backend for the EL audio translation platform supporting 4 applications:
|
|
7
|
-
|
|
8
|
-
- **App 1**: Audio recording with live translation and speaker segmentation
|
|
9
|
-
- **App 2**: Audio listening app with offline-first playback
|
|
10
|
-
- **App 3**: Analytics dashboard with geographic insights
|
|
11
|
-
- **App 4**: User management and content dashboard
|
|
12
|
-
|
|
13
|
-
## ๐ Quick Start
|
|
14
|
-
|
|
15
|
-
### Prerequisites
|
|
16
|
-
|
|
17
|
-
- Node.js 18+
|
|
18
|
-
- Docker Desktop (for Supabase)
|
|
19
|
-
- Supabase CLI (`npm install -g supabase`)
|
|
20
|
-
|
|
21
|
-
### Setup
|
|
22
|
-
|
|
23
|
-
1. **Clone and install:**
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
git clone <repo-url>
|
|
27
|
-
cd el-backend
|
|
28
|
-
npm install
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
2. **Environment setup:**
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
cp env.example .env.local
|
|
35
|
-
# Fill in your local environment variables
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
3. **Start development:**
|
|
39
|
-
```bash
|
|
40
|
-
npm run dev # Start Supabase locally
|
|
41
|
-
npm run generate-types # Generate TypeScript types
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## ๐ Available Scripts
|
|
45
|
-
|
|
46
|
-
### Development
|
|
47
|
-
|
|
48
|
-
- `npm run dev` - Start local Supabase development
|
|
49
|
-
- `npm run stop` - Stop Supabase
|
|
50
|
-
- `npm run reset` - Reset local database
|
|
51
|
-
- `npm run migrate` - Push migrations to database
|
|
52
|
-
- `npm run generate-types` - Generate TypeScript types
|
|
53
|
-
|
|
54
|
-
### Functions
|
|
55
|
-
|
|
56
|
-
- `npm run functions:serve` - Serve Edge Functions locally
|
|
57
|
-
- `npm run functions:deploy` - Deploy Edge Functions
|
|
58
|
-
|
|
59
|
-
### Code Quality
|
|
60
|
-
|
|
61
|
-
- `npm run lint` - Run ESLint
|
|
62
|
-
- `npm run lint:fix` - Auto-fix linting issues
|
|
63
|
-
- `npm run format` - Format code with Prettier
|
|
64
|
-
- `npm run format:check` - Check formatting
|
|
65
|
-
- `npm run type-check` - Verify TypeScript types
|
|
66
|
-
|
|
67
|
-
### Testing
|
|
68
|
-
|
|
69
|
-
- `npm test` - Run all tests
|
|
70
|
-
- `npm run test:watch` - Run tests in watch mode
|
|
71
|
-
|
|
72
|
-
### Git Workflow
|
|
73
|
-
|
|
74
|
-
- `npm run commit` - Commit with conventional commits
|
|
75
|
-
|
|
76
|
-
## ๐๏ธ Project Structure
|
|
77
|
-
|
|
78
|
-
```
|
|
79
|
-
el-backend/
|
|
80
|
-
โโโ .github/
|
|
81
|
-
โ โโโ workflows/ # CI/CD pipelines
|
|
82
|
-
โ โโโ ISSUE_TEMPLATE/ # GitHub issue templates
|
|
83
|
-
โโโ supabase/
|
|
84
|
-
โ โโโ migrations/ # Database migrations
|
|
85
|
-
โ โโโ functions/ # Edge Functions
|
|
86
|
-
โ โโโ seed/ # Seed data
|
|
87
|
-
โ โโโ tests/ # Database tests
|
|
88
|
-
โโโ types/
|
|
89
|
-
โ โโโ database.ts # Generated TypeScript types
|
|
90
|
-
โโโ tests/
|
|
91
|
-
โ โโโ unit/ # Unit tests
|
|
92
|
-
โ โโโ integration/ # Integration tests
|
|
93
|
-
โ โโโ e2e/ # End-to-end tests
|
|
94
|
-
โโโ docs/ # Documentation
|
|
95
|
-
โโโ scripts/ # Utility scripts
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
## ๐ Development Workflow
|
|
99
|
-
|
|
100
|
-
### 1. Create Feature Branch
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
git checkout main
|
|
104
|
-
git pull origin main
|
|
105
|
-
git checkout -b feature/your-feature
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### 2. Make Changes
|
|
109
|
-
|
|
110
|
-
- Write your code
|
|
111
|
-
- Add tests
|
|
112
|
-
- Update documentation if needed
|
|
113
|
-
|
|
114
|
-
### 3. Test Locally
|
|
115
|
-
|
|
116
|
-
```bash
|
|
117
|
-
npm test # Run tests
|
|
118
|
-
npm run lint # Check linting
|
|
119
|
-
npm run format:check # Check formatting
|
|
120
|
-
npm run type-check # Check types
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
### 4. Commit and Push
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
git add .
|
|
127
|
-
npm run commit # Use conventional commits
|
|
128
|
-
git push origin feature/your-feature
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### 5. Create Pull Request
|
|
132
|
-
|
|
133
|
-
- CI automatically runs on PR
|
|
134
|
-
- Wait for green checkmarks โ
|
|
135
|
-
- Request review from team
|
|
136
|
-
- Merge after approval
|
|
137
|
-
|
|
138
|
-
### 6. Automatic Deployment
|
|
139
|
-
|
|
140
|
-
- Merge to `main` triggers deployment
|
|
141
|
-
- Database migrations applied
|
|
142
|
-
- Edge Functions deployed
|
|
143
|
-
|
|
144
|
-
## ๐งช CI/CD Pipeline
|
|
145
|
-
|
|
146
|
-
Our automated pipeline ensures code quality and safe deployments:
|
|
147
|
-
|
|
148
|
-
### Continuous Integration (CI)
|
|
149
|
-
|
|
150
|
-
Runs on every PR and push:
|
|
151
|
-
|
|
152
|
-
- โ
Linting with ESLint
|
|
153
|
-
- โ
Code formatting with Prettier
|
|
154
|
-
- โ
TypeScript type checking
|
|
155
|
-
- โ
Test suite execution
|
|
156
|
-
- โ
Database migration testing
|
|
157
|
-
- โ
Type generation verification
|
|
158
|
-
|
|
159
|
-
### Continuous Deployment (CD)
|
|
160
|
-
|
|
161
|
-
Runs on merge to `main`:
|
|
162
|
-
|
|
163
|
-
- ๐ Database migrations to production
|
|
164
|
-
- ๐ Edge Function deployments
|
|
165
|
-
- ๐ Production schema verification
|
|
166
|
-
|
|
167
|
-
**๐ Read More**: [CI/CD Pipeline Documentation](./docs/ci-cd-pipeline.md)
|
|
168
|
-
|
|
169
|
-
## ๐๏ธ Database Management
|
|
170
|
-
|
|
171
|
-
### Creating Migrations
|
|
172
|
-
|
|
173
|
-
```bash
|
|
174
|
-
# Create new migration
|
|
175
|
-
supabase migration new add_user_profiles
|
|
176
|
-
|
|
177
|
-
# Edit the migration file
|
|
178
|
-
# supabase/migrations/[timestamp]_add_user_profiles.sql
|
|
179
|
-
|
|
180
|
-
# Test migration locally
|
|
181
|
-
npm run migrate
|
|
182
|
-
|
|
183
|
-
# Generate updated types
|
|
184
|
-
npm run generate-types
|
|
185
|
-
|
|
186
|
-
# Commit both migration and types
|
|
187
|
-
git add supabase/migrations/ types/database.ts
|
|
188
|
-
npm run commit
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
### Best Practices
|
|
192
|
-
|
|
193
|
-
- Always test migrations locally first
|
|
194
|
-
- Include both up and down migrations
|
|
195
|
-
- Generate types after schema changes
|
|
196
|
-
- Use descriptive migration names
|
|
197
|
-
|
|
198
|
-
## ๐ง Architecture Overview
|
|
199
|
-
|
|
200
|
-
### Technology Stack
|
|
201
|
-
|
|
202
|
-
- **Database**: PostgreSQL (via Supabase)
|
|
203
|
-
- **Authentication**: Supabase Auth
|
|
204
|
-
- **Storage**: Backblaze B2
|
|
205
|
-
- **Functions**: Supabase Edge Functions (Deno)
|
|
206
|
-
- **Sync**: PowerSync for offline-first apps
|
|
207
|
-
- **Testing**: Jest with Supabase integration
|
|
208
|
-
- **CI/CD**: GitHub Actions
|
|
209
|
-
|
|
210
|
-
### Key Features
|
|
211
|
-
|
|
212
|
-
- **Offline-first**: PowerSync integration for mobile apps
|
|
213
|
-
- **Real-time**: Supabase realtime subscriptions
|
|
214
|
-
- **Scalable**: Edge Functions for compute
|
|
215
|
-
- **Secure**: Row Level Security (RLS) policies
|
|
216
|
-
- **Tested**: Comprehensive test suite
|
|
217
|
-
- **Typed**: Full TypeScript support
|
|
218
|
-
|
|
219
|
-
## ๐ฑ Application Support
|
|
220
|
-
|
|
221
|
-
### App 1: Recording App
|
|
222
|
-
|
|
223
|
-
- User authentication and project management
|
|
224
|
-
- Audio file upload and processing
|
|
225
|
-
- Speaker segmentation data storage
|
|
226
|
-
- Offline sync capabilities
|
|
227
|
-
|
|
228
|
-
### App 2: Listening App
|
|
229
|
-
|
|
230
|
-
- Public content discovery and delivery
|
|
231
|
-
- Anonymous usage analytics
|
|
232
|
-
- Geographic content filtering
|
|
233
|
-
- Progressive download optimization
|
|
234
|
-
|
|
235
|
-
### App 3: Analytics Dashboard
|
|
236
|
-
|
|
237
|
-
- Real-time usage statistics
|
|
238
|
-
- Geographic usage insights
|
|
239
|
-
- Performance metrics
|
|
240
|
-
- Export capabilities
|
|
241
|
-
|
|
242
|
-
### App 4: Management Dashboard
|
|
243
|
-
|
|
244
|
-
- Content management interface
|
|
245
|
-
- User administration
|
|
246
|
-
- Project oversight tools
|
|
247
|
-
- Advanced analytics
|
|
248
|
-
|
|
249
|
-
## ๐งช Testing
|
|
250
|
-
|
|
251
|
-
### Test Structure
|
|
252
|
-
|
|
253
|
-
```
|
|
254
|
-
tests/
|
|
255
|
-
โโโ unit/ # Pure function tests
|
|
256
|
-
โโโ integration/ # Database + API tests
|
|
257
|
-
โโโ e2e/ # Full workflow tests
|
|
258
|
-
โโโ fixtures/ # Test data
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
### Running Tests
|
|
262
|
-
|
|
263
|
-
```bash
|
|
264
|
-
npm test # All tests
|
|
265
|
-
npm test -- --watch # Watch mode
|
|
266
|
-
npm test -- tests/specific-test.test.ts # Specific test
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
**๐ Read More**: [Testing Documentation](./docs/testing-guide.md)
|
|
270
|
-
|
|
271
|
-
## ๐จ Troubleshooting
|
|
272
|
-
|
|
273
|
-
### Common Issues
|
|
274
|
-
|
|
275
|
-
**Supabase won't start:**
|
|
276
|
-
|
|
277
|
-
```bash
|
|
278
|
-
# Ensure Docker is running
|
|
279
|
-
docker --version
|
|
280
|
-
|
|
281
|
-
# Reset Supabase
|
|
282
|
-
npm run stop
|
|
283
|
-
npm run reset
|
|
284
|
-
npm run dev
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
**Type errors:**
|
|
288
|
-
|
|
289
|
-
```bash
|
|
290
|
-
# Regenerate types
|
|
291
|
-
npm run generate-types
|
|
292
|
-
npm run type-check
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
**CI failures:**
|
|
296
|
-
|
|
297
|
-
```bash
|
|
298
|
-
# Run CI checks locally
|
|
299
|
-
npm run lint && npm run format:check && npm run type-check && npm test
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
## Language Data Seeding
|
|
303
|
-
|
|
304
|
-
This project includes comprehensive language data from ISO 639-3 and ROLV (Registry of Language Varieties) sources.
|
|
305
|
-
|
|
306
|
-
### Quick Start
|
|
307
|
-
|
|
308
|
-
1. **Generate seed files**:
|
|
309
|
-
|
|
310
|
-
```bash
|
|
311
|
-
npm run generate:language-seeds
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
2. **Apply to database**:
|
|
315
|
-
```bash
|
|
316
|
-
supabase db reset # This will run all migrations including language seeds
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
### What Gets Seeded
|
|
320
|
-
|
|
321
|
-
- **~7,900 ISO 639-3 languages** (family and individual language levels)
|
|
322
|
-
- **~30,000+ ROLV varieties** (dialect level)
|
|
323
|
-
- **~50,000+ language aliases** from both sources
|
|
324
|
-
- **Complete source tracking** for data provenance
|
|
325
|
-
- **Hierarchical relationships** between macrolanguages and individual languages
|
|
326
|
-
|
|
327
|
-
### Data Sources
|
|
328
|
-
|
|
329
|
-
- **ISO 639-3**: SIL International language codes and names
|
|
330
|
-
- **ROLV**: Global Registry of Language Varieties dialect data
|
|
331
|
-
- **Mapping Plans**: See `assets/data/languages/*/mapping_plan_*.md`
|
|
332
|
-
|
|
333
|
-
### Manual Process
|
|
334
|
-
|
|
335
|
-
If you need to regenerate or customize the language data:
|
|
336
|
-
|
|
337
|
-
1. **Modify source data** in `assets/data/languages/`
|
|
338
|
-
2. **Update mapping plans** in the respective directories
|
|
339
|
-
3. **Regenerate seeds**: `npm run generate:language-seeds`
|
|
340
|
-
4. **Test with fresh database**: `supabase db reset`
|
|
341
|
-
|
|
342
|
-
### Database Schema
|
|
343
|
-
|
|
344
|
-
The language data is stored across these tables:
|
|
345
|
-
|
|
346
|
-
- `language_entities` - Core language/dialect entities
|
|
347
|
-
- `language_entity_sources` - External source tracking
|
|
348
|
-
- `language_aliases` - Alternative names for search
|
|
349
|
-
- `language_properties` - Metadata key-value pairs
|
|
350
|
-
- `language_entities_regions` - Geographic relationships
|