flint-orm 0.6.0 → 0.7.0

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.
@@ -6,7 +6,9 @@ export declare class BetterSqlite3Executor implements Executor {
6
6
  constructor(client: Database.Database);
7
7
  all(sql: string, params: unknown[]): Promise<unknown[]>;
8
8
  get(sql: string, params: unknown[]): Promise<unknown>;
9
- run(sql: string, params: unknown[]): Promise<void>;
9
+ run(sql: string, params: unknown[]): Promise<{
10
+ rowsAffected: number;
11
+ }>;
10
12
  transaction(fn: () => void | Promise<void>): Promise<void>;
11
13
  close(): void;
12
14
  }
@@ -33,6 +35,8 @@ export declare function flint(options: {
33
35
  avg: <T extends import("..").AnyTable, C extends import("..").ColumnDef<any, any>>(table: T, column: C, condition?: import("..").Condition) => Promise<number | null>;
34
36
  min: <T extends import("..").AnyTable, C extends import("..").ColumnDef<any, any>>(table: T, column: C, condition?: import("..").Condition) => Promise<number | null>;
35
37
  max: <T extends import("..").AnyTable, C extends import("..").ColumnDef<any, any>>(table: T, column: C, condition?: import("..").Condition) => Promise<number | null>;
36
- $run(query: string, ...params: unknown[]): Promise<void>;
38
+ $run(query: string, ...params: unknown[]): Promise<{
39
+ rowsAffected: number;
40
+ }>;
37
41
  $executor: Executor;
38
42
  };
@@ -7,7 +7,9 @@ export declare class BunSqliteExecutor implements Executor {
7
7
  constructor(client: Database);
8
8
  all(sql: string, params: unknown[]): Promise<unknown[]>;
9
9
  get(sql: string, params: unknown[]): Promise<unknown>;
10
- run(sql: string, params: unknown[]): Promise<void>;
10
+ run(sql: string, params: unknown[]): Promise<{
11
+ rowsAffected: number;
12
+ }>;
11
13
  transaction(fn: () => void | Promise<void>): Promise<void>;
12
14
  close(): void;
13
15
  }
@@ -34,6 +36,8 @@ export declare function flint(options: {
34
36
  avg: <T extends import("..").AnyTable, C extends import("..").ColumnDef<any, any>>(table: T, column: C, condition?: import("..").Condition) => Promise<number | null>;
35
37
  min: <T extends import("..").AnyTable, C extends import("..").ColumnDef<any, any>>(table: T, column: C, condition?: import("..").Condition) => Promise<number | null>;
36
38
  max: <T extends import("..").AnyTable, C extends import("..").ColumnDef<any, any>>(table: T, column: C, condition?: import("..").Condition) => Promise<number | null>;
37
- $run(query: string, ...params: unknown[]): Promise<void>;
39
+ $run(query: string, ...params: unknown[]): Promise<{
40
+ rowsAffected: number;
41
+ }>;
38
42
  $executor: Executor;
39
43
  };
@@ -8,7 +8,9 @@ export declare class LazyExecutor implements Executor {
8
8
  constructor(factory: () => Promise<Executor>);
9
9
  all(sql: string, params: unknown[]): Promise<unknown[]>;
10
10
  get(sql: string, params: unknown[]): Promise<unknown>;
11
- run(sql: string, params: unknown[]): Promise<void>;
11
+ run(sql: string, params: unknown[]): Promise<{
12
+ rowsAffected: number;
13
+ }>;
12
14
  transaction(fn: () => void | Promise<void>): Promise<void>;
13
15
  close(): void;
14
16
  }
@@ -6,7 +6,9 @@ export declare class LibsqlWebExecutor implements Executor {
6
6
  constructor(client: Client);
7
7
  all(sql: string, params: unknown[]): Promise<unknown[]>;
8
8
  get(sql: string, params: unknown[]): Promise<unknown>;
9
- run(sql: string, params: unknown[]): Promise<void>;
9
+ run(sql: string, params: unknown[]): Promise<{
10
+ rowsAffected: number;
11
+ }>;
10
12
  transaction(fn: () => void | Promise<void>): Promise<void>;
11
13
  close(): void;
12
14
  }
@@ -34,6 +36,8 @@ export declare function flint(options: Config): {
34
36
  avg: <T extends import("..").AnyTable, C extends import("..").ColumnDef<any, any>>(table: T, column: C, condition?: import("..").Condition) => Promise<number | null>;
35
37
  min: <T extends import("..").AnyTable, C extends import("..").ColumnDef<any, any>>(table: T, column: C, condition?: import("..").Condition) => Promise<number | null>;
36
38
  max: <T extends import("..").AnyTable, C extends import("..").ColumnDef<any, any>>(table: T, column: C, condition?: import("..").Condition) => Promise<number | null>;
37
- $run(query: string, ...params: unknown[]): Promise<void>;
39
+ $run(query: string, ...params: unknown[]): Promise<{
40
+ rowsAffected: number;
41
+ }>;
38
42
  $executor: Executor;
39
43
  };
@@ -6,7 +6,9 @@ export declare class LibsqlExecutor implements Executor {
6
6
  constructor(client: Client);
7
7
  all(sql: string, params: unknown[]): Promise<unknown[]>;
8
8
  get(sql: string, params: unknown[]): Promise<unknown>;
9
- run(sql: string, params: unknown[]): Promise<void>;
9
+ run(sql: string, params: unknown[]): Promise<{
10
+ rowsAffected: number;
11
+ }>;
10
12
  transaction(fn: () => void | Promise<void>): Promise<void>;
11
13
  close(): void;
12
14
  }
@@ -31,6 +33,8 @@ export declare function flint(options: Config): {
31
33
  avg: <T extends import("..").AnyTable, C extends import("..").ColumnDef<any, any>>(table: T, column: C, condition?: import("..").Condition) => Promise<number | null>;
32
34
  min: <T extends import("..").AnyTable, C extends import("..").ColumnDef<any, any>>(table: T, column: C, condition?: import("..").Condition) => Promise<number | null>;
33
35
  max: <T extends import("..").AnyTable, C extends import("..").ColumnDef<any, any>>(table: T, column: C, condition?: import("..").Condition) => Promise<number | null>;
34
- $run(query: string, ...params: unknown[]): Promise<void>;
36
+ $run(query: string, ...params: unknown[]): Promise<{
37
+ rowsAffected: number;
38
+ }>;
35
39
  $executor: Executor;
36
40
  };
@@ -6,7 +6,9 @@ export declare class TursoSyncExecutor implements Executor {
6
6
  constructor(db: Database);
7
7
  all(sql: string, params: unknown[]): Promise<unknown[]>;
8
8
  get(sql: string, params: unknown[]): Promise<unknown>;
9
- run(sql: string, params: unknown[]): Promise<void>;
9
+ run(sql: string, params: unknown[]): Promise<{
10
+ rowsAffected: number;
11
+ }>;
10
12
  transaction(fn: () => void | Promise<void>): Promise<void>;
11
13
  close(): void;
12
14
  }
@@ -41,6 +43,8 @@ export declare function flint(options: TursoSyncOptions): {
41
43
  avg: <T extends import("..").AnyTable, C extends import("..").ColumnDef<any, any>>(table: T, column: C, condition?: import("..").Condition) => Promise<number | null>;
42
44
  min: <T extends import("..").AnyTable, C extends import("..").ColumnDef<any, any>>(table: T, column: C, condition?: import("..").Condition) => Promise<number | null>;
43
45
  max: <T extends import("..").AnyTable, C extends import("..").ColumnDef<any, any>>(table: T, column: C, condition?: import("..").Condition) => Promise<number | null>;
44
- $run(query: string, ...params: unknown[]): Promise<void>;
46
+ $run(query: string, ...params: unknown[]): Promise<{
47
+ rowsAffected: number;
48
+ }>;
45
49
  $executor: Executor;
46
50
  };
@@ -7,7 +7,9 @@ export declare class TursoExecutor implements Executor {
7
7
  constructor(db: Database);
8
8
  all(sql: string, params: unknown[]): Promise<unknown[]>;
9
9
  get(sql: string, params: unknown[]): Promise<unknown>;
10
- run(sql: string, params: unknown[]): Promise<void>;
10
+ run(sql: string, params: unknown[]): Promise<{
11
+ rowsAffected: number;
12
+ }>;
11
13
  transaction(fn: () => void | Promise<void>): Promise<void>;
12
14
  close(): void;
13
15
  }
@@ -36,6 +38,8 @@ export declare function flint(options: {
36
38
  avg: <T extends import("..").AnyTable, C extends import("..").ColumnDef<any, any>>(table: T, column: C, condition?: import("..").Condition) => Promise<number | null>;
37
39
  min: <T extends import("..").AnyTable, C extends import("..").ColumnDef<any, any>>(table: T, column: C, condition?: import("..").Condition) => Promise<number | null>;
38
40
  max: <T extends import("..").AnyTable, C extends import("..").ColumnDef<any, any>>(table: T, column: C, condition?: import("..").Condition) => Promise<number | null>;
39
- $run(query: string, ...params: unknown[]): Promise<void>;
41
+ $run(query: string, ...params: unknown[]): Promise<{
42
+ rowsAffected: number;
43
+ }>;
40
44
  $executor: Executor;
41
45
  };
@@ -7,8 +7,10 @@ export interface Executor {
7
7
  all(sql: string, params: unknown[]): Promise<unknown[]>;
8
8
  /** Execute a query and return a single row or null. */
9
9
  get(sql: string, params: unknown[]): Promise<unknown>;
10
- /** Execute a statement (INSERT, UPDATE, DELETE, DDL). */
11
- run(sql: string, params: unknown[]): Promise<void>;
10
+ /** Execute a statement (INSERT, UPDATE, DELETE, DDL) and return affected row count. */
11
+ run(sql: string, params: unknown[]): Promise<{
12
+ rowsAffected: number;
13
+ }>;
12
14
  /** Run a callback inside a transaction. */
13
15
  transaction(fn: () => void | Promise<void>): Promise<void>;
14
16
  /** Close the underlying database connection. No-op if already closed. */
package/dist/flint.d.ts CHANGED
@@ -107,7 +107,9 @@ export declare function createClient(executor: Executor): {
107
107
  /**
108
108
  * Execute raw SQL directly against the database.
109
109
  */
110
- $run(query: string, ...params: unknown[]): Promise<void>;
110
+ $run(query: string, ...params: unknown[]): Promise<{
111
+ rowsAffected: number;
112
+ }>;
111
113
  /** Direct access to the underlying executor. */
112
114
  $executor: Executor;
113
115
  };
@@ -202,7 +202,9 @@ export declare class InsertBuilder<T extends AnyTable, R extends boolean = false
202
202
  sql: string;
203
203
  params: unknown[];
204
204
  };
205
- execute(): Promise<R extends true ? Prettify<NarrowRow<InferRow<T>, K>>[] : void>;
205
+ execute(): Promise<R extends true ? Prettify<NarrowRow<InferRow<T>, K>>[] : {
206
+ rowsAffected: number;
207
+ }>;
206
208
  }
207
209
  /** Phase 1 of an UPDATE — only `.set()` is available. */
208
210
  export interface UpdateStage1<T extends AnyTable> {
@@ -228,7 +230,9 @@ export declare class UpdateBuilder<T extends AnyTable, R extends boolean = false
228
230
  sql: string;
229
231
  params: unknown[];
230
232
  };
231
- execute(): Promise<R extends true ? Prettify<NarrowRow<InferRow<T>, K>>[] : void>;
233
+ execute(): Promise<R extends true ? Prettify<NarrowRow<InferRow<T>, K>>[] : {
234
+ rowsAffected: number;
235
+ }>;
232
236
  }
233
237
  /** Full DELETE builder — chain `.where()` calls then `.execute()`. */
234
238
  export declare class DeleteBuilder<T extends AnyTable, R extends boolean = false, K extends keyof InferRow<T> = keyof InferRow<T>> implements Executable {
@@ -249,6 +253,8 @@ export declare class DeleteBuilder<T extends AnyTable, R extends boolean = false
249
253
  sql: string;
250
254
  params: unknown[];
251
255
  };
252
- execute(): Promise<R extends true ? Prettify<NarrowRow<InferRow<T>, K>>[] : void>;
256
+ execute(): Promise<R extends true ? Prettify<NarrowRow<InferRow<T>, K>>[] : {
257
+ rowsAffected: number;
258
+ }>;
253
259
  }
254
260
  export {};
package/dist/src/cli.js CHANGED
@@ -2054,8 +2054,7 @@ class InsertBuilder {
2054
2054
  }
2055
2055
  return records.map((r2) => decodeRow(r2, this.#table));
2056
2056
  }
2057
- await this.#executor.run(sql, params);
2058
- return;
2057
+ return await this.#executor.run(sql, params);
2059
2058
  } catch (e) {
2060
2059
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
2061
2060
  }
@@ -2139,8 +2138,7 @@ class UpdateBuilder {
2139
2138
  }
2140
2139
  return records.map((r2) => decodeRow(r2, this.#table));
2141
2140
  }
2142
- await this.#executor.run(sql, params);
2143
- return;
2141
+ return await this.#executor.run(sql, params);
2144
2142
  } catch (e) {
2145
2143
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
2146
2144
  }
@@ -2194,8 +2192,7 @@ class DeleteBuilder {
2194
2192
  }
2195
2193
  return records.map((r2) => decodeRow(r2, this.#table));
2196
2194
  }
2197
- await this.#executor.run(sql, params);
2198
- return;
2195
+ return await this.#executor.run(sql, params);
2199
2196
  } catch (e) {
2200
2197
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
2201
2198
  }
@@ -2335,8 +2332,8 @@ class BunSqliteExecutor {
2335
2332
  return Promise.resolve(this.#client.prepare(sql2).get(...params));
2336
2333
  }
2337
2334
  run(sql2, params) {
2338
- this.#client.prepare(sql2).run(...params);
2339
- return Promise.resolve();
2335
+ const result = this.#client.prepare(sql2).run(...params);
2336
+ return Promise.resolve({ rowsAffected: result.changes });
2340
2337
  }
2341
2338
  transaction(fn) {
2342
2339
  this.#client.run("BEGIN");
@@ -3154,8 +3151,8 @@ class BetterSqlite3Executor {
3154
3151
  return Promise.resolve(this.#client.prepare(sql2).get(...params));
3155
3152
  }
3156
3153
  run(sql2, params) {
3157
- this.#client.prepare(sql2).run(...params);
3158
- return Promise.resolve();
3154
+ const result = this.#client.prepare(sql2).run(...params);
3155
+ return Promise.resolve({ rowsAffected: result.changes });
3159
3156
  }
3160
3157
  transaction(fn) {
3161
3158
  this.#client.exec("BEGIN");
@@ -9141,7 +9138,8 @@ class LibsqlExecutor {
9141
9138
  return result.rows[0] ?? null;
9142
9139
  }
9143
9140
  async run(sql2, params) {
9144
- await this.#client.execute({ sql: sql2, args: sanitize(params) });
9141
+ const result = await this.#client.execute({ sql: sql2, args: sanitize(params) });
9142
+ return { rowsAffected: result.rowsAffected };
9145
9143
  }
9146
9144
  async transaction(fn) {
9147
9145
  await this.#client.execute("BEGIN");
@@ -9219,7 +9217,8 @@ class LibsqlWebExecutor {
9219
9217
  return result.rows[0] ?? null;
9220
9218
  }
9221
9219
  async run(sql2, params) {
9222
- await this.#client.execute({ sql: sql2, args: sanitize2(params) });
9220
+ const result = await this.#client.execute({ sql: sql2, args: sanitize2(params) });
9221
+ return { rowsAffected: result.rowsAffected };
9223
9222
  }
9224
9223
  async transaction(fn) {
9225
9224
  await this.#client.execute("BEGIN");
@@ -11528,7 +11527,8 @@ class TursoSyncExecutor {
11528
11527
  return this.#db.get(sql2, ...sanitize3(params)) ?? null;
11529
11528
  }
11530
11529
  async run(sql2, params) {
11531
- await this.#db.run(sql2, ...sanitize3(params));
11530
+ const result = await this.#db.run(sql2, ...sanitize3(params));
11531
+ return { rowsAffected: result.changes };
11532
11532
  }
11533
11533
  async transaction(fn) {
11534
11534
  await this.#db.exec("BEGIN");
@@ -12118,7 +12118,8 @@ class TursoExecutor {
12118
12118
  return this.#db.get(sql2, ...sanitize4(params)) ?? null;
12119
12119
  }
12120
12120
  async run(sql2, params) {
12121
- await this.#db.run(sql2, ...sanitize4(params));
12121
+ const result = await this.#db.run(sql2, ...sanitize4(params));
12122
+ return { rowsAffected: result.changes };
12122
12123
  }
12123
12124
  async transaction(fn) {
12124
12125
  await this.#db.exec("BEGIN");
@@ -1715,8 +1715,7 @@ class InsertBuilder {
1715
1715
  }
1716
1716
  return records.map((r) => decodeRow(r, this.#table));
1717
1717
  }
1718
- await this.#executor.run(sql, params);
1719
- return;
1718
+ return await this.#executor.run(sql, params);
1720
1719
  } catch (e) {
1721
1720
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
1722
1721
  }
@@ -1800,8 +1799,7 @@ class UpdateBuilder {
1800
1799
  }
1801
1800
  return records.map((r) => decodeRow(r, this.#table));
1802
1801
  }
1803
- await this.#executor.run(sql, params);
1804
- return;
1802
+ return await this.#executor.run(sql, params);
1805
1803
  } catch (e) {
1806
1804
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
1807
1805
  }
@@ -1855,8 +1853,7 @@ class DeleteBuilder {
1855
1853
  }
1856
1854
  return records.map((r) => decodeRow(r, this.#table));
1857
1855
  }
1858
- await this.#executor.run(sql, params);
1859
- return;
1856
+ return await this.#executor.run(sql, params);
1860
1857
  } catch (e) {
1861
1858
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
1862
1859
  }
@@ -1995,8 +1992,8 @@ class BetterSqlite3Executor {
1995
1992
  return Promise.resolve(this.#client.prepare(sql2).get(...params));
1996
1993
  }
1997
1994
  run(sql2, params) {
1998
- this.#client.prepare(sql2).run(...params);
1999
- return Promise.resolve();
1995
+ const result = this.#client.prepare(sql2).run(...params);
1996
+ return Promise.resolve({ rowsAffected: result.changes });
2000
1997
  }
2001
1998
  transaction(fn) {
2002
1999
  this.#client.exec("BEGIN");
@@ -950,8 +950,7 @@ class InsertBuilder {
950
950
  }
951
951
  return records.map((r) => decodeRow(r, this.#table));
952
952
  }
953
- await this.#executor.run(sql, params);
954
- return;
953
+ return await this.#executor.run(sql, params);
955
954
  } catch (e) {
956
955
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
957
956
  }
@@ -1035,8 +1034,7 @@ class UpdateBuilder {
1035
1034
  }
1036
1035
  return records.map((r) => decodeRow(r, this.#table));
1037
1036
  }
1038
- await this.#executor.run(sql, params);
1039
- return;
1037
+ return await this.#executor.run(sql, params);
1040
1038
  } catch (e) {
1041
1039
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
1042
1040
  }
@@ -1090,8 +1088,7 @@ class DeleteBuilder {
1090
1088
  }
1091
1089
  return records.map((r) => decodeRow(r, this.#table));
1092
1090
  }
1093
- await this.#executor.run(sql, params);
1094
- return;
1091
+ return await this.#executor.run(sql, params);
1095
1092
  } catch (e) {
1096
1093
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
1097
1094
  }
@@ -1231,8 +1228,8 @@ class BunSqliteExecutor {
1231
1228
  return Promise.resolve(this.#client.prepare(sql2).get(...params));
1232
1229
  }
1233
1230
  run(sql2, params) {
1234
- this.#client.prepare(sql2).run(...params);
1235
- return Promise.resolve();
1231
+ const result = this.#client.prepare(sql2).run(...params);
1232
+ return Promise.resolve({ rowsAffected: result.changes });
1236
1233
  }
1237
1234
  transaction(fn) {
1238
1235
  this.#client.run("BEGIN");
@@ -950,8 +950,7 @@ class InsertBuilder {
950
950
  }
951
951
  return records.map((r) => decodeRow(r, this.#table));
952
952
  }
953
- await this.#executor.run(sql, params);
954
- return;
953
+ return await this.#executor.run(sql, params);
955
954
  } catch (e) {
956
955
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
957
956
  }
@@ -1035,8 +1034,7 @@ class UpdateBuilder {
1035
1034
  }
1036
1035
  return records.map((r) => decodeRow(r, this.#table));
1037
1036
  }
1038
- await this.#executor.run(sql, params);
1039
- return;
1037
+ return await this.#executor.run(sql, params);
1040
1038
  } catch (e) {
1041
1039
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
1042
1040
  }
@@ -1090,8 +1088,7 @@ class DeleteBuilder {
1090
1088
  }
1091
1089
  return records.map((r) => decodeRow(r, this.#table));
1092
1090
  }
1093
- await this.#executor.run(sql, params);
1094
- return;
1091
+ return await this.#executor.run(sql, params);
1095
1092
  } catch (e) {
1096
1093
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
1097
1094
  }
@@ -5736,8 +5736,7 @@ class InsertBuilder {
5736
5736
  }
5737
5737
  return records.map((r) => decodeRow(r, this.#table));
5738
5738
  }
5739
- await this.#executor.run(sql, params);
5740
- return;
5739
+ return await this.#executor.run(sql, params);
5741
5740
  } catch (e) {
5742
5741
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
5743
5742
  }
@@ -5821,8 +5820,7 @@ class UpdateBuilder {
5821
5820
  }
5822
5821
  return records.map((r) => decodeRow(r, this.#table));
5823
5822
  }
5824
- await this.#executor.run(sql, params);
5825
- return;
5823
+ return await this.#executor.run(sql, params);
5826
5824
  } catch (e) {
5827
5825
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
5828
5826
  }
@@ -5876,8 +5874,7 @@ class DeleteBuilder {
5876
5874
  }
5877
5875
  return records.map((r) => decodeRow(r, this.#table));
5878
5876
  }
5879
- await this.#executor.run(sql, params);
5880
- return;
5877
+ return await this.#executor.run(sql, params);
5881
5878
  } catch (e) {
5882
5879
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
5883
5880
  }
@@ -6021,7 +6018,8 @@ class LibsqlWebExecutor {
6021
6018
  return result.rows[0] ?? null;
6022
6019
  }
6023
6020
  async run(sql2, params) {
6024
- await this.#client.execute({ sql: sql2, args: sanitize(params) });
6021
+ const result = await this.#client.execute({ sql: sql2, args: sanitize(params) });
6022
+ return { rowsAffected: result.rowsAffected };
6025
6023
  }
6026
6024
  async transaction(fn) {
6027
6025
  await this.#client.execute("BEGIN");
@@ -6870,8 +6870,7 @@ class InsertBuilder {
6870
6870
  }
6871
6871
  return records.map((r) => decodeRow(r, this.#table));
6872
6872
  }
6873
- await this.#executor.run(sql, params);
6874
- return;
6873
+ return await this.#executor.run(sql, params);
6875
6874
  } catch (e) {
6876
6875
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
6877
6876
  }
@@ -6955,8 +6954,7 @@ class UpdateBuilder {
6955
6954
  }
6956
6955
  return records.map((r) => decodeRow(r, this.#table));
6957
6956
  }
6958
- await this.#executor.run(sql, params);
6959
- return;
6957
+ return await this.#executor.run(sql, params);
6960
6958
  } catch (e) {
6961
6959
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
6962
6960
  }
@@ -7010,8 +7008,7 @@ class DeleteBuilder {
7010
7008
  }
7011
7009
  return records.map((r) => decodeRow(r, this.#table));
7012
7010
  }
7013
- await this.#executor.run(sql, params);
7014
- return;
7011
+ return await this.#executor.run(sql, params);
7015
7012
  } catch (e) {
7016
7013
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
7017
7014
  }
@@ -7161,7 +7158,8 @@ class LibsqlExecutor {
7161
7158
  return result.rows[0] ?? null;
7162
7159
  }
7163
7160
  async run(sql2, params) {
7164
- await this.#client.execute({ sql: sql2, args: sanitize(params) });
7161
+ const result = await this.#client.execute({ sql: sql2, args: sanitize(params) });
7162
+ return { rowsAffected: result.rowsAffected };
7165
7163
  }
7166
7164
  async transaction(fn) {
7167
7165
  await this.#client.execute("BEGIN");
@@ -3171,8 +3171,7 @@ class InsertBuilder {
3171
3171
  }
3172
3172
  return records.map((r) => decodeRow(r, this.#table));
3173
3173
  }
3174
- await this.#executor.run(sql, params);
3175
- return;
3174
+ return await this.#executor.run(sql, params);
3176
3175
  } catch (e) {
3177
3176
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
3178
3177
  }
@@ -3256,8 +3255,7 @@ class UpdateBuilder {
3256
3255
  }
3257
3256
  return records.map((r) => decodeRow(r, this.#table));
3258
3257
  }
3259
- await this.#executor.run(sql, params);
3260
- return;
3258
+ return await this.#executor.run(sql, params);
3261
3259
  } catch (e) {
3262
3260
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
3263
3261
  }
@@ -3311,8 +3309,7 @@ class DeleteBuilder {
3311
3309
  }
3312
3310
  return records.map((r) => decodeRow(r, this.#table));
3313
3311
  }
3314
- await this.#executor.run(sql, params);
3315
- return;
3312
+ return await this.#executor.run(sql, params);
3316
3313
  } catch (e) {
3317
3314
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
3318
3315
  }
@@ -3495,7 +3492,8 @@ class TursoSyncExecutor {
3495
3492
  return this.#db.get(sql2, ...sanitize(params)) ?? null;
3496
3493
  }
3497
3494
  async run(sql2, params) {
3498
- await this.#db.run(sql2, ...sanitize(params));
3495
+ const result = await this.#db.run(sql2, ...sanitize(params));
3496
+ return { rowsAffected: result.changes };
3499
3497
  }
3500
3498
  async transaction(fn) {
3501
3499
  await this.#db.exec("BEGIN");
@@ -2052,8 +2052,7 @@ class InsertBuilder {
2052
2052
  }
2053
2053
  return records.map((r) => decodeRow(r, this.#table));
2054
2054
  }
2055
- await this.#executor.run(sql, params);
2056
- return;
2055
+ return await this.#executor.run(sql, params);
2057
2056
  } catch (e) {
2058
2057
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
2059
2058
  }
@@ -2137,8 +2136,7 @@ class UpdateBuilder {
2137
2136
  }
2138
2137
  return records.map((r) => decodeRow(r, this.#table));
2139
2138
  }
2140
- await this.#executor.run(sql, params);
2141
- return;
2139
+ return await this.#executor.run(sql, params);
2142
2140
  } catch (e) {
2143
2141
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
2144
2142
  }
@@ -2192,8 +2190,7 @@ class DeleteBuilder {
2192
2190
  }
2193
2191
  return records.map((r) => decodeRow(r, this.#table));
2194
2192
  }
2195
- await this.#executor.run(sql, params);
2196
- return;
2193
+ return await this.#executor.run(sql, params);
2197
2194
  } catch (e) {
2198
2195
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
2199
2196
  }
@@ -2375,7 +2372,8 @@ class TursoExecutor {
2375
2372
  return this.#db.get(sql2, ...sanitize(params)) ?? null;
2376
2373
  }
2377
2374
  async run(sql2, params) {
2378
- await this.#db.run(sql2, ...sanitize(params));
2375
+ const result = await this.#db.run(sql2, ...sanitize(params));
2376
+ return { rowsAffected: result.changes };
2379
2377
  }
2380
2378
  async transaction(fn) {
2381
2379
  await this.#db.exec("BEGIN");
package/dist/src/index.js CHANGED
@@ -950,8 +950,7 @@ class InsertBuilder {
950
950
  }
951
951
  return records.map((r) => decodeRow(r, this.#table));
952
952
  }
953
- await this.#executor.run(sql, params);
954
- return;
953
+ return await this.#executor.run(sql, params);
955
954
  } catch (e) {
956
955
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
957
956
  }
@@ -1035,8 +1034,7 @@ class UpdateBuilder {
1035
1034
  }
1036
1035
  return records.map((r) => decodeRow(r, this.#table));
1037
1036
  }
1038
- await this.#executor.run(sql, params);
1039
- return;
1037
+ return await this.#executor.run(sql, params);
1040
1038
  } catch (e) {
1041
1039
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
1042
1040
  }
@@ -1090,8 +1088,7 @@ class DeleteBuilder {
1090
1088
  }
1091
1089
  return records.map((r) => decodeRow(r, this.#table));
1092
1090
  }
1093
- await this.#executor.run(sql, params);
1094
- return;
1091
+ return await this.#executor.run(sql, params);
1095
1092
  } catch (e) {
1096
1093
  throw new FlintQueryError(`Failed to execute query: ${sql}`, e);
1097
1094
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flint-orm",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "bin": {
5
5
  "flint": "./dist/src/cli.js"
6
6
  },