bun-query-builder 0.1.2 → 0.1.6
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/dist/actions/benchmark.d.ts +12 -0
- package/dist/actions/cache.d.ts +6 -0
- package/dist/actions/console.d.ts +2 -0
- package/dist/actions/data.d.ts +15 -0
- package/dist/actions/db-info.d.ts +17 -0
- package/dist/actions/db-optimize.d.ts +11 -0
- package/dist/actions/db-wipe.d.ts +10 -0
- package/dist/actions/file.d.ts +2 -1
- package/dist/actions/index.d.ts +25 -8
- package/dist/actions/inspect.d.ts +24 -0
- package/dist/actions/introspect.d.ts +2 -1
- package/dist/actions/make-model.d.ts +7 -0
- package/dist/actions/migrate-generate.d.ts +5 -0
- package/dist/actions/migrate-rollback.d.ts +6 -0
- package/dist/actions/migrate-status.d.ts +9 -0
- package/dist/actions/migrate.d.ts +13 -3
- package/dist/actions/model-show.d.ts +20 -0
- package/dist/actions/query-explain-all.d.ts +14 -0
- package/dist/actions/relation-diagram.d.ts +11 -0
- package/dist/actions/seed.d.ts +8 -0
- package/dist/actions/sql.d.ts +2 -1
- package/dist/actions/unsafe.d.ts +2 -1
- package/dist/actions/validate.d.ts +16 -0
- package/dist/actions/wait-ready.d.ts +2 -1
- package/dist/client.d.ts +230 -158
- package/dist/config.d.ts +2 -1
- package/dist/db.d.ts +10 -0
- package/dist/drivers/index.d.ts +12 -0
- package/dist/drivers/mysql.d.ts +187 -0
- package/dist/drivers/postgres.d.ts +173 -0
- package/dist/drivers/sqlite.d.ts +175 -0
- package/dist/factory.d.ts +3 -6
- package/dist/index.d.ts +11 -9
- package/dist/index.js +5444 -869
- package/dist/loader.d.ts +3 -2
- package/dist/meta.d.ts +10 -2
- package/dist/migrations.d.ts +43 -43
- package/dist/schema.d.ts +36 -177
- package/dist/seeder.d.ts +21 -0
- package/dist/types.d.ts +60 -143
- package/package.json +18 -27
- package/LICENSE.md +0 -21
- package/README.md +0 -150
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare interface BenchmarkOptions {
|
|
2
|
+
operations?: string
|
|
3
|
+
iterations?: number
|
|
4
|
+
}
|
|
5
|
+
declare interface BenchmarkResult {
|
|
6
|
+
operation: string
|
|
7
|
+
avgTime: number
|
|
8
|
+
minTime: number
|
|
9
|
+
maxTime: number
|
|
10
|
+
iterations: number
|
|
11
|
+
}
|
|
12
|
+
export declare function runBenchmark(options: BenchmarkOptions = {}): Promise<void>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare interface ExportOptions {
|
|
2
|
+
format?: 'json' | 'csv' | 'sql'
|
|
3
|
+
output?: string
|
|
4
|
+
limit?: number
|
|
5
|
+
}
|
|
6
|
+
export declare interface ImportOptions {
|
|
7
|
+
format?: 'json' | 'csv'
|
|
8
|
+
truncate?: boolean
|
|
9
|
+
}
|
|
10
|
+
export declare interface DumpOptions {
|
|
11
|
+
tables?: string
|
|
12
|
+
output?: string
|
|
13
|
+
}
|
|
14
|
+
export declare function exportData(tableName: string, options: ExportOptions = {}): Promise<void>;
|
|
15
|
+
export declare function importData(tableName: string, filePath: string, options: ImportOptions = {}): Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SupportedDialect } from '@/types';
|
|
2
|
+
|
|
3
|
+
export declare interface TableInfo {
|
|
4
|
+
name: string
|
|
5
|
+
rowCount: number
|
|
6
|
+
columns?: number
|
|
7
|
+
indexes?: number
|
|
8
|
+
}
|
|
9
|
+
export declare interface DatabaseInfo {
|
|
10
|
+
dialect: SupportedDialect
|
|
11
|
+
database: string
|
|
12
|
+
tables: TableInfo[]
|
|
13
|
+
totalTables: number
|
|
14
|
+
totalRows: number
|
|
15
|
+
}
|
|
16
|
+
export declare function dbInfo(): Promise<DatabaseInfo>;
|
|
17
|
+
export declare function dbStats(): Promise<DatabaseInfo>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SupportedDialect } from '@/types';
|
|
2
|
+
|
|
3
|
+
export declare interface OptimizeOptions {
|
|
4
|
+
dialect?: SupportedDialect
|
|
5
|
+
aggressive?: boolean
|
|
6
|
+
tables?: string[]
|
|
7
|
+
verbose?: boolean
|
|
8
|
+
}
|
|
9
|
+
export declare function dbOptimize(options: OptimizeOptions = {}): Promise<void>;
|
|
10
|
+
|
|
11
|
+
export { dbOptimize as optimizeDatabase }
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SupportedDialect } from '@/types';
|
|
2
|
+
|
|
3
|
+
export declare interface WipeOptions {
|
|
4
|
+
dialect?: SupportedDialect
|
|
5
|
+
force?: boolean
|
|
6
|
+
verbose?: boolean
|
|
7
|
+
}
|
|
8
|
+
export declare function dbWipe(options: WipeOptions = {}): Promise<void>;
|
|
9
|
+
|
|
10
|
+
export { dbWipe as wipeDatabase }
|
package/dist/actions/file.d.ts
CHANGED
package/dist/actions/index.d.ts
CHANGED
|
@@ -1,8 +1,25 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
1
|
+
export { runBenchmark } from './benchmark'
|
|
2
|
+
export { cacheClear, cacheConfig, cacheStats } from './cache'
|
|
3
|
+
export { startConsole, tinker } from './console'
|
|
4
|
+
export { dumpDatabase, exportData, importData } from './data'
|
|
5
|
+
export { dbInfo, dbStats } from './db-info'
|
|
6
|
+
export { dbOptimize, optimizeDatabase } from './db-optimize'
|
|
7
|
+
export { dbWipe, wipeDatabase } from './db-wipe'
|
|
8
|
+
export { explain } from './explain'
|
|
9
|
+
export { file } from './file'
|
|
10
|
+
export { inspectTable, tableInfo } from './inspect'
|
|
11
|
+
export { introspect } from './introspect'
|
|
12
|
+
export { makeModel } from './make-model'
|
|
13
|
+
export { executeMigration, generateMigration, resetDatabase } from './migrate'
|
|
14
|
+
export { migrateGenerate } from './migrate-generate'
|
|
15
|
+
export { migrateRollback } from './migrate-rollback'
|
|
16
|
+
export { migrateList, migrateStatus } from './migrate-status'
|
|
17
|
+
export { modelShow, showModel } from './model-show'
|
|
18
|
+
export { ping } from './ping'
|
|
19
|
+
export { explainAllQueries, queryExplainAll } from './query-explain-all'
|
|
20
|
+
export { generateDiagram, relationDiagram } from './relation-diagram'
|
|
21
|
+
export { freshDatabase, makeSeeder, runSeeder, runSeeders } from './seed'
|
|
22
|
+
export { sql } from './sql'
|
|
23
|
+
export { unsafe } from './unsafe'
|
|
24
|
+
export { checkSchema, validateSchema } from './validate'
|
|
25
|
+
export { waitReady } from './wait-ready'
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare interface ColumnInfo {
|
|
2
|
+
name: string
|
|
3
|
+
type: string
|
|
4
|
+
nullable: boolean
|
|
5
|
+
default: any
|
|
6
|
+
isPrimaryKey?: boolean
|
|
7
|
+
isForeignKey?: boolean
|
|
8
|
+
}
|
|
9
|
+
export declare interface IndexInfo {
|
|
10
|
+
name: string
|
|
11
|
+
columns: string[]
|
|
12
|
+
unique: boolean
|
|
13
|
+
}
|
|
14
|
+
export declare interface TableInspection {
|
|
15
|
+
tableName: string
|
|
16
|
+
rowCount: number
|
|
17
|
+
columns: ColumnInfo[]
|
|
18
|
+
indexes: IndexInfo[]
|
|
19
|
+
}
|
|
20
|
+
export declare interface InspectOptions {
|
|
21
|
+
verbose?: boolean
|
|
22
|
+
}
|
|
23
|
+
export declare function inspectTable(tableName: string, options: InspectOptions = {}): Promise<TableInspection>;
|
|
24
|
+
export declare function tableInfo(tableName: string, options: InspectOptions = {}): Promise<TableInspection>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare function findWorkspaceRoot(startPath: string): string;
|
|
2
|
+
declare function getSqlDirectory(workspaceRoot?: string): string;
|
|
3
|
+
export declare interface RollbackOptions {
|
|
4
|
+
steps?: number
|
|
5
|
+
}
|
|
6
|
+
export declare function migrateRollback(options: RollbackOptions = {}): Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare function findWorkspaceRoot(startPath: string): string;
|
|
2
|
+
declare function getSqlDirectory(workspaceRoot?: string): string;
|
|
3
|
+
export declare interface MigrationStatus {
|
|
4
|
+
file: string
|
|
5
|
+
status: 'executed' | 'pending' | 'transient'
|
|
6
|
+
executedAt?: string
|
|
7
|
+
}
|
|
8
|
+
export declare function migrateStatus(): Promise<MigrationStatus[]>;
|
|
9
|
+
export declare function migrateList(): Promise<MigrationStatus[]>;
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
import type { GenerateMigrationResult, MigrateOptions } from '
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { GenerateMigrationResult, MigrateOptions, SupportedDialect } from '@/types';
|
|
2
|
+
|
|
3
|
+
declare function getWorkspaceRoot(): string;
|
|
4
|
+
declare function ensureSqlDirectory(workspaceRoot?: string): string;
|
|
5
|
+
export declare function generateMigration(dir?: string, opts: MigrateOptions = {}): Promise<GenerateMigrationResult>;
|
|
6
|
+
export declare function executeMigration(dir?: string): Promise<boolean>;
|
|
7
|
+
export declare function resetDatabase(dir?: string, opts: MigrateOptions = {}): Promise<boolean>;
|
|
8
|
+
export declare function deleteMigrationFiles(dir?: string, workspaceRoot?: string, opts: MigrateOptions = {}): Promise<void>;
|
|
9
|
+
export declare function copyModelsToGenerated(dir?: string, workspaceRoot?: string): Promise<void>;
|
|
10
|
+
declare function getSqlDirectory(workspaceRoot?: string): string;
|
|
11
|
+
declare function createMigrationsTable(qb: any, dialect: SupportedDialect): Promise<void>;
|
|
12
|
+
declare function getExecutedMigrations(qb: any, dialect: SupportedDialect): Promise<string[]>;
|
|
13
|
+
declare function recordMigration(qb: any, migrationFile: string, dialect: SupportedDialect): Promise<void>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare interface ModelShowOptions {
|
|
2
|
+
dir?: string
|
|
3
|
+
verbose?: boolean
|
|
4
|
+
json?: boolean
|
|
5
|
+
}
|
|
6
|
+
export declare interface ModelDetails {
|
|
7
|
+
name: string
|
|
8
|
+
table: string
|
|
9
|
+
primaryKey: string
|
|
10
|
+
attributes: Record<string, any>
|
|
11
|
+
relations?: Record<string, any>
|
|
12
|
+
scopes?: Record<string, any>
|
|
13
|
+
hooks?: string[]
|
|
14
|
+
indexes?: any[]
|
|
15
|
+
timestamps?: boolean
|
|
16
|
+
softDeletes?: boolean
|
|
17
|
+
}
|
|
18
|
+
export declare function modelShow(modelName: string, options: ModelShowOptions = {}): Promise<ModelDetails | void>;
|
|
19
|
+
|
|
20
|
+
export { modelShow as showModel }
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare interface ExplainAllOptions {
|
|
2
|
+
verbose?: boolean
|
|
3
|
+
json?: boolean
|
|
4
|
+
format?: 'text' | 'json'
|
|
5
|
+
}
|
|
6
|
+
export declare interface ExplainResult {
|
|
7
|
+
file: string
|
|
8
|
+
query: string
|
|
9
|
+
plan: any[]
|
|
10
|
+
error?: string
|
|
11
|
+
}
|
|
12
|
+
export declare function queryExplainAll(path: string, options: ExplainAllOptions = {}): Promise<ExplainResult[]>;
|
|
13
|
+
|
|
14
|
+
export { queryExplainAll as explainAllQueries }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare interface DiagramOptions {
|
|
2
|
+
dir?: string
|
|
3
|
+
format?: 'mermaid' | 'dot'
|
|
4
|
+
output?: string
|
|
5
|
+
verbose?: boolean
|
|
6
|
+
}
|
|
7
|
+
export declare function relationDiagram(options: DiagramOptions = {}): Promise<string>;
|
|
8
|
+
declare function generateMermaidDiagram(models: Record<string, any>): string;
|
|
9
|
+
declare function generateDotDiagram(models: Record<string, any>): string;
|
|
10
|
+
|
|
11
|
+
export { relationDiagram as generateDiagram }
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RunSeederOptions, Seeder, SeederConfig } from '@/seeder';
|
|
2
|
+
|
|
3
|
+
declare function findWorkspaceRoot(startPath: string): string;
|
|
4
|
+
declare function loadSeeders(seedersDir: string): Promise<Array<{ name: string, instance: Seeder }>>;
|
|
5
|
+
export declare function runSeeders(config: SeederConfig = {}): Promise<void>;
|
|
6
|
+
export declare function runSeeder(className: string, options: RunSeederOptions = {}): Promise<void>;
|
|
7
|
+
export declare function makeSeeder(name: string): Promise<void>;
|
|
8
|
+
export declare function freshDatabase(options: { seedersDir?: string, modelsDir?: string, verbose?: boolean } = {}): Promise<void>;
|
package/dist/actions/sql.d.ts
CHANGED
package/dist/actions/unsafe.d.ts
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare function findWorkspaceRoot(startPath: string): string;
|
|
2
|
+
export declare interface ValidationIssue {
|
|
3
|
+
type: 'missing_table' | 'extra_table' | 'missing_column' | 'extra_column' | 'type_mismatch'
|
|
4
|
+
severity: 'error' | 'warning'
|
|
5
|
+
table?: string
|
|
6
|
+
column?: string
|
|
7
|
+
expected?: string
|
|
8
|
+
actual?: string
|
|
9
|
+
message: string
|
|
10
|
+
}
|
|
11
|
+
export declare interface ValidationResult {
|
|
12
|
+
valid: boolean
|
|
13
|
+
issues: ValidationIssue[]
|
|
14
|
+
}
|
|
15
|
+
export declare function validateSchema(dir?: string): Promise<ValidationResult>;
|
|
16
|
+
export declare function checkSchema(dir?: string): Promise<ValidationResult>;
|