bun-query-builder 0.1.13 → 0.1.15

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.
Files changed (63) hide show
  1. package/README.md +45 -468
  2. package/dist/__tests__/type-narrowing-compile.d.ts +1 -0
  3. package/dist/__tests__/type-narrowing.test.d.ts +1 -0
  4. package/dist/actions/benchmark.d.ts +1 -1
  5. package/dist/actions/cache.d.ts +1 -1
  6. package/dist/actions/console.d.ts +1 -1
  7. package/dist/actions/data.d.ts +2 -1
  8. package/dist/actions/db-info.d.ts +1 -1
  9. package/dist/actions/db-optimize.d.ts +1 -1
  10. package/dist/actions/db-wipe.d.ts +1 -1
  11. package/dist/actions/explain.d.ts +1 -1
  12. package/dist/actions/file.d.ts +1 -1
  13. package/dist/actions/index.d.ts +1 -1
  14. package/dist/actions/inspect.d.ts +1 -1
  15. package/dist/actions/introspect.d.ts +1 -1
  16. package/dist/actions/make-model.d.ts +1 -1
  17. package/dist/actions/migrate-generate.d.ts +1 -1
  18. package/dist/actions/migrate-rollback.d.ts +1 -1
  19. package/dist/actions/migrate-status.d.ts +1 -1
  20. package/dist/actions/migrate.d.ts +1 -1
  21. package/dist/actions/model-show.d.ts +1 -1
  22. package/dist/actions/ping.d.ts +1 -1
  23. package/dist/actions/query-explain-all.d.ts +1 -1
  24. package/dist/actions/relation-diagram.d.ts +1 -1
  25. package/dist/actions/seed.d.ts +1 -1
  26. package/dist/actions/sql.d.ts +1 -1
  27. package/dist/actions/unsafe.d.ts +1 -1
  28. package/dist/actions/validate.d.ts +1 -1
  29. package/dist/actions/wait-ready.d.ts +1 -1
  30. package/dist/bin/cli.js +25785 -0
  31. package/dist/browser.d.ts +118 -44
  32. package/dist/client.d.ts +22 -56
  33. package/dist/config.d.ts +16 -3
  34. package/dist/db.d.ts +5 -4
  35. package/dist/drivers/dynamodb.d.ts +3 -13
  36. package/dist/drivers/index.d.ts +2 -1
  37. package/dist/drivers/mysql.d.ts +3 -9
  38. package/dist/drivers/postgres.d.ts +3 -9
  39. package/dist/drivers/sqlite.d.ts +3 -9
  40. package/dist/dynamodb/client.d.ts +1 -5
  41. package/dist/dynamodb/index.d.ts +7 -28
  42. package/dist/dynamodb/migration-driver.d.ts +2 -23
  43. package/dist/dynamodb/migration-tracker.d.ts +4 -6
  44. package/dist/dynamodb/migrations.d.ts +4 -1
  45. package/dist/dynamodb/model.d.ts +5 -13
  46. package/dist/dynamodb-client.d.ts +3 -23
  47. package/dist/dynamodb-single-table.d.ts +22 -26
  48. package/dist/dynamodb-tooling-adapter.d.ts +2 -33
  49. package/dist/factory.d.ts +3 -3
  50. package/dist/index.d.ts +24 -1
  51. package/dist/loader.d.ts +1 -1
  52. package/dist/meta.d.ts +1 -1
  53. package/dist/migrations.d.ts +4 -4
  54. package/dist/model.d.ts +61 -3
  55. package/dist/orm.d.ts +130 -82
  56. package/dist/schema.d.ts +32 -25
  57. package/dist/seeder.d.ts +3 -1
  58. package/dist/{browser.js → src/browser.js} +32 -5
  59. package/dist/{dynamodb → src/dynamodb}/index.js +29 -2
  60. package/dist/{index.js → src/index.js} +8253 -7498
  61. package/dist/type-inference.d.ts +326 -0
  62. package/dist/types.d.ts +1 -5
  63. package/package.json +3 -3
package/README.md CHANGED
@@ -1,489 +1,66 @@
1
- <p align="center"><img src=".github/art/cover.jpg" alt="Social Card of this repo"></p>
2
-
3
- [![npm version][npm-version-src]][npm-version-href]
4
- [![GitHub Actions][github-actions-src]][github-actions-href]
5
- [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
6
- <!-- [![npm downloads][npm-downloads-src]][npm-downloads-href] -->
7
- <!-- [![Codecov][codecov-src]][codecov-href] -->
8
-
9
1
  # bun-query-builder
10
2
 
11
- Fully-typed, model-driven Query Builder for Bun’s native `sql`.
12
-
13
- Define your data model once and get a type-safe query experience _(a la Kysely/Laravel)_, powered by Bun’s tagged templates for safety and performance.
14
-
15
- ## Features
16
-
17
- ### Core Query Building
18
-
19
- - **Typed from Models**: Infer tables/columns/PKs from your model files; `selectFrom('users')` and `where({ active: true })` are typed.
20
- - **Fluent Builder**: `select/insert/update/delete`, `where/andWhere/orWhere`, `join/leftJoin/rightJoin/crossJoin`, `groupBy/having`, `union/unionAll`.
21
- - **Aggregations**: `count()`, `avg()`, `sum()`, `max()`, `min()` with full type safety.
22
- - **Batch Operations**: `insertMany()`, `updateMany()`, `deleteMany()` for efficient bulk operations.
23
-
24
- ### Advanced Features
25
-
26
- - **Relations**: `with(...)`, `withCount(...)`, `whereHas(...)`, `has()`, `doesntHave()`, `selectAllRelations()` with configurable aliasing and constraint callbacks.
27
- - **Query Scopes**: Define reusable query constraints on models for cleaner, more maintainable code.
28
- - **Query Caching**: Built-in LRU cache with TTL support via `cache(ttlMs)`, `clearQueryCache()`, `setQueryCacheMaxSize()`.
29
- - **Model Hooks**: Lifecycle events - `beforeCreate`, `afterCreate`, `beforeUpdate`, `afterUpdate`, `beforeDelete`, `afterDelete`.
3
+ A simple yet performant query builder for TypeScript. Built with Bun.
30
4
 
31
- ### Utilities & Helpers
32
-
33
- - **Utilities**: `distinct/distinctOn`, `orderByDesc/latest/oldest/inRandomOrder`, `whereColumn/whereRaw/groupByRaw/havingRaw`, JSON/date helpers.
34
- - **Pagination**: `paginate`, `simplePaginate`, `cursorPaginate`, plus `chunk/chunkById/eachById`.
35
- - **Soft Deletes**: `withTrashed()`, `onlyTrashed()` for logical deletion support.
36
-
37
- ### Database Operations
38
-
39
- - **Transactions**: `transaction` with retries/backoff/isolation/onRetry/afterCommit; `savepoint`; distributed tx helpers.
40
- - **Migrations**: Generate and execute migrations from models with full diff support.
41
- - **Seeders**: Database seeding with fake data generation via `ts-mocker` (faker alternative).
42
- - **Raw Queries**: Tagged templates and parameterized queries with `raw()` and `unsafe()`.
43
-
44
- ### Configuration & Integration
45
-
46
- - **Configurable**: Dialect hints, timestamps, alias strategies, relation FK formats, JSON mode, random function, shared lock syntax.
47
- - **Bun API passthroughs**: `unsafe`, `file`, `simple`, pool `reserve/release`, `close`, `ping/waitForReady`.
48
- - **CLI**: Introspection, query printing, connectivity checks, file/unsafe execution, explain.
49
-
50
- > Note: LISTEN/NOTIFY and COPY helpers are scaffolded and will be wired as Bun exposes native APIs.
51
-
52
- ## Get Started
53
-
54
- ### Installation
5
+ ## Installation
55
6
 
56
7
  ```bash
57
8
  bun add bun-query-builder
58
9
  ```
59
10
 
60
- ### Usage
61
-
62
- ```ts
63
- import { buildDatabaseSchema, buildSchemaMeta, createQueryBuilder } from 'bun-query-builder'
64
-
65
- // Load or define your model files (see docs for model shape)
66
- const models = {
67
- User: { name: 'User', table: 'users', primaryKey: 'id', attributes: { id: { validation: { rule: {} } }, name: { validation: { rule: {} } }, active: { validation: { rule: {} } } } },
68
- } as const
69
-
70
- const schema = buildDatabaseSchema(models as any)
71
- const meta = buildSchemaMeta(models as any)
72
- const db = createQueryBuilder<typeof schema>({ schema, meta })
73
-
74
- // Fully-typed query
75
- const q = db
76
- .selectFrom('users')
77
- .where({ active: true })
78
- .orderBy('created_at', 'desc')
79
- .limit(10)
80
-
81
- const rows = await q.execute()
82
- ```
83
-
84
- ### Aggregations
85
-
86
- ```ts
87
- // Get average age of active users
88
- const avgAge = await db.selectFrom('users')
89
- .where({ active: true })
90
- .avg('age')
91
-
92
- // Count total posts
93
- const totalPosts = await db.selectFrom('posts').count()
94
-
95
- // Get max and min scores
96
- const maxScore = await db.selectFrom('users').max('score')
97
- const minScore = await db.selectFrom('users').min('score')
98
- ```
99
-
100
- ### Batch Operations
101
-
102
- ```ts
103
- // Insert multiple records at once
104
- await db.insertMany('users', [
105
- { name: 'Alice', email: 'alice@example.com' },
106
- { name: 'Bob', email: 'bob@example.com' },
107
- { name: 'Charlie', email: 'charlie@example.com' },
108
- ])
109
-
110
- // Update multiple records matching conditions
111
- await db.updateMany('users', { verified: false }, { status: 'pending' })
112
-
113
- // Delete multiple records by IDs
114
- await db.deleteMany('users', [1, 2, 3, 4, 5])
11
+ ```bash
12
+ npm install bun-query-builder
115
13
  ```
116
14
 
117
- ### Query Caching
15
+ ## Usage
118
16
 
119
- ```ts
120
- // Cache query results for 60 seconds (default)
121
- const users = await db.selectFrom('users')
122
- .where({ active: true })
123
- .cache()
124
- .get()
17
+ ```typescript
18
+ import { QueryBuilder } from 'bun-query-builder'
125
19
 
126
- // Custom cache TTL (5 seconds)
127
- const posts = await db.selectFrom('posts')
128
- .orderBy('created_at', 'desc')
20
+ // Select query
21
+ const users = await QueryBuilder
22
+ .selectFrom('users')
23
+ .where('active', '=', true)
24
+ .orderByDesc('created_at')
129
25
  .limit(10)
130
- .cache(5000)
131
- .get()
132
-
133
- // Clear all cached queries
134
- clearQueryCache()
135
-
136
- // Configure cache size
137
- setQueryCacheMaxSize(500)
138
- ```
139
-
140
- ### Model Hooks
141
-
142
- ```ts
143
- const db = createQueryBuilder<typeof schema>({
144
- schema,
145
- meta,
146
- hooks: {
147
- beforeCreate: async ({ table, data }) => {
148
- console.log(`Creating ${table}:`, data)
149
- // Modify data, validate, or throw to prevent creation
150
- },
151
- afterCreate: async ({ table, data, result }) => {
152
- console.log(`Created ${table}:`, result)
153
- // Trigger notifications, update caches, etc.
154
- },
155
- beforeUpdate: async ({ table, data, where }) => {
156
- // Audit logging, validation, etc.
157
- },
158
- afterUpdate: async ({ table, data, where, result }) => {
159
- // Clear related caches, send webhooks, etc.
160
- },
161
- beforeDelete: async ({ table, where }) => {
162
- // Prevent deletion, check constraints, etc.
163
- },
164
- afterDelete: async ({ table, where, result }) => {
165
- // Clean up related data, update aggregates, etc.
166
- },
167
- }
168
- })
169
- ```
170
-
171
- ### Query Scopes
172
-
173
- ```ts
174
- // Define scopes on your models
175
- const User = {
176
- name: 'User',
177
- table: 'users',
178
- scopes: {
179
- active: (qb) => qb.where({ status: 'active' }),
180
- verified: (qb) => qb.where({ email_verified_at: ['IS NOT', null] }),
181
- premium: (qb) => qb.where({ subscription: 'premium' }),
182
- },
183
- // ... other model properties
184
- }
185
-
186
- // Use scopes in queries
187
- const activeUsers = await db.selectFrom('users')
188
- .scope('active')
189
- .scope('verified')
190
26
  .get()
191
- ```
192
-
193
- ### Relations with Constraints
194
-
195
- ```ts
196
- // Eager load with constraints
197
- const users = await db.selectFrom('users')
198
- .with({
199
- posts: (qb) => qb.where('published', '=', true).orderBy('created_at', 'desc')
200
- })
201
- .get()
202
-
203
- // Check for related records
204
- const usersWithPosts = await db.selectFrom('users')
205
- .has('posts')
206
- .get()
207
-
208
- // Query by relationship existence
209
- const activeAuthors = await db.selectFrom('users')
210
- .whereHas('posts', (qb) => qb.where('published', '=', true))
211
- .get()
212
- ```
213
-
214
- ## Migrations
215
-
216
- Generate and execute migrations from your models:
217
-
218
- ```ts
219
- import { generateMigration, executeMigration } from 'bun-query-builder'
220
-
221
- // Generate migration from models directory
222
- const migration = await generateMigration('./models', {
223
- dialect: 'postgres',
224
- apply: true,
225
- full: true
226
- })
227
-
228
- // Execute the migration
229
- await executeMigration(migration)
230
- ```
231
-
232
- ## Database Seeding
233
-
234
- Populate your database with test data using seeders powered by [ts-mocker](https://github.com/stacksjs/ts-mocker):
235
-
236
- ### Creating a Seeder
237
-
238
- ```bash
239
- # Generate a new seeder
240
- bun qb make:seeder User
241
-
242
- # This creates database/seeders/UserSeeder.ts
243
- ```
244
-
245
- ### Writing a Seeder
246
-
247
- ```ts
248
- import { Seeder } from 'bun-query-builder'
249
- import { faker } from 'ts-mocker'
250
27
 
251
- export default class UserSeeder extends Seeder {
252
- async run(qb: any): Promise<void> {
253
- // Generate 50 users with realistic fake data
254
- const users = Array.from({ length: 50 }, () => ({
255
- name: faker.person.fullName(),
256
- email: faker.internet.email(),
257
- age: faker.number.int(18, 80),
258
- role: faker.helpers.arrayElement(['admin', 'user', 'moderator']),
259
- created_at: new Date(),
260
- updated_at: new Date(),
261
- }))
262
-
263
- await qb.table('users').insert(users).execute()
264
- }
265
-
266
- // Control execution order (lower runs first)
267
- get order(): number {
268
- return 10 // Default is 100
269
- }
270
- }
271
- ```
272
-
273
- ### Running Seeders
274
-
275
- ```bash
276
- # Run all seeders
277
- bun qb seed
278
- bun qb db:seed
279
-
280
- # Run a specific seeder
281
- bun qb seed --class UserSeeder
282
-
283
- # Drop all tables, re-run migrations and seed
284
- bun qb db:fresh
285
- ```
286
-
287
- ### Programmatic Usage
288
-
289
- ```ts
290
- import { runSeeders, runSeeder } from 'bun-query-builder'
291
-
292
- // Run all seeders
293
- await runSeeders({
294
- seedersDir: './database/seeders',
295
- verbose: true
296
- })
297
-
298
- // Run specific seeder
299
- await runSeeder('UserSeeder', { verbose: true })
300
- ```
301
-
302
- ### CLI
303
-
304
- ```bash
305
- # Model Generation
306
- query-builder make:model User
307
- query-builder make:model Post --table=blog_posts
308
- query-builder model:show User # Show detailed model info
309
-
310
- # Schema Introspection
311
- query-builder introspect ./app/Models --verbose
312
- query-builder sql ./app/Models users --limit 5
313
-
314
- # Migrations
315
- query-builder migrate ./app/Models --dialect postgres
316
- query-builder migrate:generate # Generate migration from drift
317
- query-builder migrate:status # Show migration status
318
- query-builder migrate:list # List all migrations
319
- query-builder migrate:rollback --steps 2 # Rollback migrations
320
- query-builder migrate:fresh ./app/Models
321
- query-builder reset ./app/Models
322
-
323
- # Database Info
324
- query-builder db:info # Show database statistics
325
- query-builder db:stats # Alias for db:info
326
- query-builder inspect users # Inspect table structure
327
- query-builder table:info users # Alias for inspect
328
- query-builder db:wipe --force # Drop all tables
329
- query-builder db:optimize # Optimize database (VACUUM, ANALYZE)
330
- query-builder db:optimize --aggressive # Aggressive optimization
331
-
332
- # Interactive Console
333
- query-builder console # Start REPL
334
- query-builder tinker # Alias for console
335
-
336
- # Seeders
337
- query-builder make:seeder User
338
- query-builder seed
339
- query-builder db:seed --class UserSeeder
340
- query-builder db:fresh
341
-
342
- # Data Management
343
- query-builder export users --format json
344
- query-builder export users --format csv --output users.csv
345
- query-builder import users users.json --truncate
346
- query-builder dump --tables users,posts
347
-
348
- # Cache Management
349
- query-builder cache:clear
350
- query-builder cache:stats
351
- query-builder cache:config --size 500
352
-
353
- # Performance
354
- query-builder benchmark --iterations 1000
355
- query-builder benchmark --operations select,insert
356
- query-builder query:explain-all ./queries # Batch EXPLAIN analysis
357
-
358
- # Schema Validation
359
- query-builder validate:schema ./app/Models
360
- query-builder check # Alias for validate:schema
361
-
362
- # Connectivity
363
- query-builder ping
364
- query-builder wait-ready --attempts 30 --delay 250
365
-
366
- # Execute SQL
367
- query-builder file ./migrations/seed.sql
368
- query-builder unsafe "SELECT * FROM users WHERE id = $1" --params "[1]"
369
- query-builder explain "SELECT * FROM users WHERE active = true"
370
-
371
- # Diagrams & Visualization
372
- query-builder relation:diagram # Generate Mermaid ER diagram
373
- query-builder relation:diagram --format dot # Generate Graphviz DOT
374
- query-builder relation:diagram --output schema.mmd
28
+ // Insert
29
+ await QueryBuilder
30
+ .insertInto('users')
31
+ .values({ name: 'John', email: 'john@example.com' })
32
+ .execute()
33
+
34
+ // Update
35
+ await QueryBuilder
36
+ .update('users')
37
+ .set({ active: false })
38
+ .where('id', '=', 1)
39
+ .execute()
40
+
41
+ // Delete
42
+ await QueryBuilder
43
+ .deleteFrom('users')
44
+ .where('id', '=', 1)
45
+ .execute()
375
46
  ```
376
47
 
377
- ## Performance
378
-
379
- **🏆 bun-query-builder wins 13 out of 16 benchmarks (81.25%)**
380
-
381
- ### Summary
382
-
383
- | Category | Win Rate | Performance vs Best |
384
- |----------|----------|-------------------|
385
- | Basic Queries | 7/7 (100%) 🎯 | 1.36x-29.29x faster |
386
- | Advanced Queries | 4/5 (80%) | 1.01x-3.96x faster |
387
- | Batch Operations | 2/4 (50%) | 1.45x-4.83x faster |
388
-
389
- ### Key Performance Wins
390
-
391
- 🚀 **Dominant in Basic Queries:**
392
-
393
- - **29.29x faster** than Prisma in DELETE operations
394
- - **16.45x faster** than Prisma in SELECT with LIMIT
395
- - **14.86x faster** than Prisma in SELECT active users
396
- - **13.8x faster** than Prisma in SELECT by ID
397
- - **12.65x faster** than Prisma in COUNT queries
398
-
399
- ⚡ **Strong in Advanced Queries:**
400
-
401
- - **3.96x faster** than Drizzle in AGGREGATE queries
402
- - **2.99x faster** than Prisma in GROUP BY + HAVING
403
- - **1.28x faster** than Prisma in JOIN operations
404
- - **1.03x faster** than Kysely in JOIN operations
405
- - **1.02x faster** than Kysely in AGGREGATE queries
406
-
407
- 💪 **Competitive in Batch Operations:**
408
-
409
- - **4.83x faster** than Prisma in DELETE MANY
410
- - **1.45x faster** than Kysely in DELETE MANY
411
- - Within 14% of Kysely on INSERT MANY
412
-
413
- ### Perfect Category
414
-
415
- - **100% wins** in basic CRUD operations (7/7) 🎯 - Beating Kysely, Drizzle, and Prisma in every single basic query
416
-
417
- ### The Trade-offs (3 out of 16)
418
-
419
- - **WHERE: Complex conditions** - Kysely 1.05x faster
420
- - **ORDER BY + LIMIT** - Kysely 1.07x faster
421
- - **SELECT: Large result set (1000 rows)**
422
-
423
- **Note:** Two additional benchmarks where we're competitive but not winning:
424
-
425
- - **INSERT MANY: 100 users** - Kysely 1.14x faster
426
- - **UPDATE MANY** - Prisma 1.10x faster
427
-
428
- ### Why Fast?
429
-
430
- bun-query-builder leverages Bun's native SQLite driver with:
431
-
432
- - **Direct BunDatabase access** - No abstraction layers
433
- - **Statement caching** - Prepared statements reused across queries
434
- - **Ultra-fast path** - Optimized execution for queries without hooks/soft-deletes
435
- - **Smart optimizations** - For-loop template processing, minimal allocations
436
-
437
- **[View Full Benchmark Results →](./packages/benchmark/README.md)**
438
-
439
- ## Testing
440
-
441
- ```bash
442
- bun test
443
- ```
444
-
445
- ## Changelog
446
-
447
- Please see our [releases](https://github.com/stackjs/bun-query-builder/releases) page for more information on what has changed recently.
448
-
449
- ## Contributing
450
-
451
- Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
452
-
453
- ## Community
454
-
455
- For help, discussion about best practices, or any other conversation that would benefit from being searchable:
456
-
457
- [Discussions on GitHub](https://github.com/stacksjs/ts-starter/discussions)
458
-
459
- For casual chit-chat with others using this package:
460
-
461
- [Join the Stacks Discord Server](https://discord.gg/stacksjs)
462
-
463
- ## Postcardware
464
-
465
- “Software that is free, but hopes for a postcard.” We love receiving postcards from around the world showing where Stacks is being used! We showcase them on our website too.
466
-
467
- Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States 🌎
468
-
469
- ## Sponsors
470
-
471
- We would like to extend our thanks to the following sponsors for funding Stacks development. If you are interested in becoming a sponsor, please reach out to us.
48
+ ## Features
472
49
 
473
- - [JetBrains](https://www.jetbrains.com/)
474
- - [The Solana Foundation](https://solana.com/)
50
+ - **Typed from Models** - Infer tables, columns, and primary keys from your model files
51
+ - **Fluent Builder** - `select`, `insert`, `update`, `delete`, `where`, `join`, `groupBy`, `having`, `union`
52
+ - **Aggregations** - `count()`, `avg()`, `sum()`, `max()`, `min()` with full type safety
53
+ - **Batch Operations** - `insertMany()`, `updateMany()`, `deleteMany()` for efficient bulk operations
54
+ - **Relations** - `with(...)`, `withCount(...)`, `whereHas(...)`, `has()`, `doesntHave()`
55
+ - **Query Caching** - Built-in LRU cache with TTL support
56
+ - **Model Hooks** - Lifecycle events for `beforeCreate`, `afterCreate`, `beforeUpdate`, `afterUpdate`, `beforeDelete`, `afterDelete`
57
+ - **Transactions** - Full transaction support with retries, backoff, and isolation levels
58
+ - **Migrations** - Generate and execute migrations from models with diff support
59
+ - **Seeders** - Database seeding with fake data generation
60
+ - **Soft Deletes** - `withTrashed()`, `onlyTrashed()` for logical deletion
61
+ - **Pagination** - `paginate`, `simplePaginate`, `cursorPaginate`, `chunk`, `chunkById`
62
+ - **CLI** - Introspection, query printing, connectivity checks, and more
475
63
 
476
64
  ## License
477
65
 
478
- The MIT License (MIT). Please see [LICENSE](LICENSE.md) for more information.
479
-
480
- Made with 💙
481
-
482
- <!-- Badges -->
483
- [npm-version-src]: https://img.shields.io/npm/v/bun-query-builder?style=flat-square
484
- [npm-version-href]: https://npmjs.com/package/bun-query-builder
485
- [github-actions-src]: https://img.shields.io/github/actions/workflow/status/stacksjs/ts-starter/ci.yml?style=flat-square&branch=main
486
- [github-actions-href]: https://github.com/stacksjs/ts-starter/actions?query=workflow%3Aci
487
-
488
- <!-- [codecov-src]: https://img.shields.io/codecov/c/gh/stacksjs/ts-starter/main?style=flat-square
489
- [codecov-href]: https://codecov.io/gh/stacksjs/ts-starter -->
66
+ MIT
@@ -5,4 +5,4 @@ export declare function runBenchmark(options?: BenchmarkOptions): Promise<void>;
5
5
  export declare interface BenchmarkOptions {
6
6
  operations?: string
7
7
  iterations?: number
8
- }
8
+ }
@@ -15,4 +15,4 @@ export declare function cacheStats(): Promise<void>;
15
15
  export declare function cacheConfig(options?: CacheConfigOptions): Promise<void>;
16
16
  export declare interface CacheConfigOptions {
17
17
  size?: number
18
- }
18
+ }
@@ -5,4 +5,4 @@ export declare function startConsole(): Promise<void>;
5
5
  /**
6
6
  * Tinker - alias for startConsole
7
7
  */
8
- export declare function tinker(): Promise<void>;
8
+ export declare function tinker(): Promise<void>;
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Export data from a table
3
3
  */
4
+ // eslint-disable-next-line pickier/no-unused-vars
4
5
  export declare function exportData(tableName: string, options?: ExportOptions): Promise<void>;
5
6
  /**
6
7
  * Import data into a table
@@ -22,4 +23,4 @@ export declare interface ImportOptions {
22
23
  export declare interface DumpOptions {
23
24
  tables?: string
24
25
  output?: string
25
- }
26
+ }
@@ -19,4 +19,4 @@ export declare interface DatabaseInfo {
19
19
  tables: TableInfo[]
20
20
  totalTables: number
21
21
  totalRows: number
22
- }
22
+ }
@@ -9,4 +9,4 @@ export declare interface OptimizeOptions {
9
9
  tables?: string[]
10
10
  verbose?: boolean
11
11
  }
12
- export { dbOptimize as optimizeDatabase };
12
+ export { dbOptimize as optimizeDatabase };
@@ -8,4 +8,4 @@ export declare interface WipeOptions {
8
8
  force?: boolean
9
9
  verbose?: boolean
10
10
  }
11
- export { dbWipe as wipeDatabase };
11
+ export { dbWipe as wipeDatabase };
@@ -1 +1 @@
1
- export declare function explain(sql: string): void;
1
+ export declare function explain(sql: string): Promise<void>;
@@ -1,2 +1,2 @@
1
1
  import type { FileOptions } from '../types';
2
- export declare function file(path: string, opts?: FileOptions): void;
2
+ export declare function file(path: string, opts?: FileOptions): Promise<void>;
@@ -22,4 +22,4 @@ export { freshDatabase, makeSeeder, runSeeder, runSeeders } from './seed';
22
22
  export { sql } from './sql';
23
23
  export { unsafe } from './unsafe';
24
24
  export { checkSchema, validateSchema } from './validate';
25
- export { waitReady } from './wait-ready';
25
+ export { waitReady } from './wait-ready';
@@ -27,4 +27,4 @@ export declare interface TableInspection {
27
27
  }
28
28
  export declare interface InspectOptions {
29
29
  verbose?: boolean
30
- }
30
+ }
@@ -1,2 +1,2 @@
1
1
  import type { IntrospectOptions } from '../types';
2
- export declare function introspect(dir: string, _opts?: IntrospectOptions): void;
2
+ export declare function introspect(dir: string, _opts?: IntrospectOptions): Promise<void>;
@@ -6,4 +6,4 @@ export declare interface MakeModelOptions {
6
6
  table?: string
7
7
  dir?: string
8
8
  timestamps?: boolean
9
- }
9
+ }
@@ -3,4 +3,4 @@ import type { GenerateMigrationResult, MigrateOptions } from '@/types';
3
3
  * Generate migration files from model changes (alias for generateMigration)
4
4
  */
5
5
  export declare function migrateGenerate(dir?: string, opts?: MigrateOptions): Promise<GenerateMigrationResult>;
6
- export { migrateGenerate as generateMigration };
6
+ export { migrateGenerate as generateMigration };
@@ -10,4 +10,4 @@
10
10
  export declare function migrateRollback(options?: RollbackOptions): Promise<void>;
11
11
  export declare interface RollbackOptions {
12
12
  steps?: number
13
- }
13
+ }
@@ -10,4 +10,4 @@ export declare interface MigrationStatus {
10
10
  file: string
11
11
  status: 'executed' | 'pending' | 'transient'
12
12
  executedAt?: string
13
- }
13
+ }
@@ -28,4 +28,4 @@ export declare function copyModelsToGenerated(_dir?: string, _workspaceRoot?: st
28
28
  * Clear the generated directory to force fresh migration generation
29
29
  * This is called during migrate:fresh to ensure all models are treated as new
30
30
  */
31
- export declare function clearGeneratedDirectory(workspaceRoot?: string): Promise<void>;
31
+ export declare function clearGeneratedDirectory(workspaceRoot?: string): Promise<void>;
@@ -19,4 +19,4 @@ export declare interface ModelDetails {
19
19
  timestamps?: boolean
20
20
  softDeletes?: boolean
21
21
  }
22
- export { modelShow as showModel };
22
+ export { modelShow as showModel };
@@ -1 +1 @@
1
- export declare function ping(): void;
1
+ export declare function ping(): Promise<void>;
@@ -13,4 +13,4 @@ export declare interface ExplainResult {
13
13
  plan: any[]
14
14
  error?: string
15
15
  }
16
- export { queryExplainAll as explainAllQueries };
16
+ export { queryExplainAll as explainAllQueries };