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 +25 -1
- package/dist/actions/explain.d.ts +1 -1
- package/dist/actions/file.d.ts +1 -1
- package/dist/actions/inspect.d.ts +1 -1
- package/dist/actions/introspect.d.ts +4 -1
- package/dist/actions/migrate.d.ts +0 -2
- package/dist/actions/ping.d.ts +1 -1
- package/dist/actions/sql.d.ts +5 -1
- package/dist/actions/unsafe.d.ts +1 -1
- package/dist/actions/wait-ready.d.ts +1 -1
- package/dist/bin/cli.js +546 -362
- package/dist/browser.d.ts +14 -8
- package/dist/client.d.ts +147 -101
- package/dist/config.d.ts +102 -2
- package/dist/db.d.ts +5 -0
- package/dist/model.d.ts +1 -1
- package/dist/orm.d.ts +4 -3
- package/dist/schema.d.ts +1 -1
- package/dist/src/index.js +394 -244
- package/dist/type-inference.d.ts +11 -3
- package/dist/types.d.ts +92 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ await QueryBuilder
|
|
|
33
33
|
|
|
34
34
|
// Update
|
|
35
35
|
await QueryBuilder
|
|
36
|
-
.
|
|
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<
|
|
1
|
+
export declare function explain(sql: string): Promise<unknown>;
|
package/dist/actions/file.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { FileOptions } from '../types';
|
|
2
|
-
export declare function file(path: string, opts?: FileOptions): Promise<
|
|
2
|
+
export declare function file(path: string, opts?: FileOptions): Promise<unknown>;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import type { IntrospectOptions } from '../types';
|
|
2
|
-
export declare function introspect(dir: string, _opts?: IntrospectOptions): Promise<
|
|
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>;
|
package/dist/actions/ping.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function ping(): Promise<
|
|
1
|
+
export declare function ping(): Promise<unknown>;
|
package/dist/actions/sql.d.ts
CHANGED
package/dist/actions/unsafe.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { UnsafeOptions } from '../types';
|
|
2
|
-
export declare function unsafe(sql: string, opts?: UnsafeOptions): Promise<
|
|
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<
|
|
2
|
+
export declare function waitReady(opts?: WaitReadyOptions): Promise<boolean>;
|