bun-query-builder 0.2.25 → 0.2.27

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/README.md CHANGED
@@ -33,7 +33,7 @@ await QueryBuilder
33
33
 
34
34
  // Update
35
35
  await QueryBuilder
36
- .update('users')
36
+ .updateTable('users')
37
37
  .set({ active: false })
38
38
  .where('id', '=', 1)
39
39
  .execute()
@@ -45,6 +45,30 @@ await QueryBuilder
45
45
  .execute()
46
46
  ```
47
47
 
48
+ ## Configuration
49
+
50
+ Drop a `query-builder.config.ts` in your project root. Every field is optional at
51
+ every depth — supply only what you want to change, and the library defaults the rest:
52
+
53
+ ```typescript
54
+ import { defineConfig } from 'bun-query-builder'
55
+
56
+ export default defineConfig({
57
+ dialect: 'postgres',
58
+ database: { database: 'my_app' },
59
+ })
60
+ ```
61
+
62
+ ```typescript
63
+ // Load it once at app boot, or configure from code with setConfig().
64
+ import { getConfig } from 'bun-query-builder'
65
+
66
+ await getConfig()
67
+ ```
68
+
69
+ Type your own configuration against `QueryBuilderOptions` (what you write, everything
70
+ optional), not `QueryBuilderConfig` (what the library reads back, everything present).
71
+
48
72
  ## Features
49
73
 
50
74
  - **Typed from Models** - Infer tables, columns, and primary keys from your model files
@@ -1 +1 @@
1
- export declare function explain(sql: string): Promise<void>;
1
+ export declare function explain(sql: string): Promise<unknown>;
@@ -1,2 +1,2 @@
1
1
  import type { FileOptions } from '../types';
2
- export declare function file(path: string, opts?: FileOptions): Promise<void>;
2
+ export declare function file(path: string, opts?: FileOptions): Promise<unknown>;
@@ -10,7 +10,7 @@ export declare interface ColumnInfo {
10
10
  name: string
11
11
  type: string
12
12
  nullable: boolean
13
- default: any
13
+ default: unknown
14
14
  isPrimaryKey?: boolean
15
15
  isForeignKey?: boolean
16
16
  }
@@ -1,2 +1,5 @@
1
1
  import type { IntrospectOptions } from '../types';
2
- export declare function introspect(dir: string, _opts?: IntrospectOptions): Promise<void>;
2
+ export declare function introspect(dir: string, _opts?: IntrospectOptions): Promise<{
3
+ models: unknown;
4
+ schema: unknown
5
+ }>;
@@ -24,8 +24,6 @@ export declare function saveMigrationSnapshot(plan: MigrationPlan, options?: { d
24
24
  * Simply update your models and run migrations - the system automatically figures out what changed.
25
25
  */
26
26
  export declare function generateMigration(dir?: string, opts?: MigrateOptions): Promise<GenerateMigrationResult>;
27
- // `dir` is the models directory. This function runs the SQL corpus, which it
28
- // finds from the workspace root, so it has no use for it — the parameter stays
29
27
  // because it is public API and every caller passes it.
30
28
  // eslint-disable-next-line pickier/no-unused-vars
31
29
  export declare function executeMigration(dir?: string): Promise<boolean>;
@@ -1 +1 @@
1
- export declare function ping(): Promise<void>;
1
+ export declare function ping(): Promise<unknown>;
@@ -1,2 +1,6 @@
1
1
  import type { SqlOptions } from '../types';
2
- export declare function sql(dir: string, table: string, opts?: SqlOptions): void;
2
+ export declare function sql(dir: string, table: string, opts?: SqlOptions): {
3
+ sql: unknown;
4
+ qb: unknown;
5
+ schema: unknown
6
+ };
@@ -1,2 +1,2 @@
1
1
  import type { UnsafeOptions } from '../types';
2
- export declare function unsafe(sql: string, opts?: UnsafeOptions): Promise<void>;
2
+ export declare function unsafe(sql: string, opts?: UnsafeOptions): Promise<unknown>;
@@ -1,2 +1,2 @@
1
1
  import type { WaitReadyOptions } from '../types';
2
- export declare function waitReady(opts?: WaitReadyOptions): Promise<void>;
2
+ export declare function waitReady(opts?: WaitReadyOptions): Promise<boolean>;