kysely 0.23.4 → 0.23.5

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 (60) hide show
  1. package/README.md +3 -1
  2. package/dist/cjs/dialect/database-introspector.d.ts +4 -2
  3. package/dist/cjs/dialect/mysql/mysql-introspector.d.ts +1 -1
  4. package/dist/cjs/dialect/mysql/mysql-introspector.js +19 -13
  5. package/dist/cjs/dialect/postgres/postgres-introspector.d.ts +1 -1
  6. package/dist/cjs/dialect/postgres/postgres-introspector.js +3 -1
  7. package/dist/cjs/dialect/sqlite/sqlite-introspector.d.ts +1 -1
  8. package/dist/cjs/dialect/sqlite/sqlite-introspector.js +6 -5
  9. package/dist/cjs/operation-node/aggregate-function-node.d.ts +3 -2
  10. package/dist/cjs/operation-node/aggregate-function-node.js +2 -2
  11. package/dist/cjs/operation-node/delete-query-node.d.ts +1 -1
  12. package/dist/cjs/operation-node/delete-query-node.js +2 -2
  13. package/dist/cjs/operation-node/operation-node-transformer.js +2 -2
  14. package/dist/cjs/parser/expression-parser.js +1 -1
  15. package/dist/cjs/parser/table-parser.d.ts +1 -0
  16. package/dist/cjs/plugin/camel-case/camel-case-plugin.d.ts +7 -0
  17. package/dist/cjs/plugin/camel-case/camel-case-plugin.js +10 -4
  18. package/dist/cjs/query-builder/delete-query-builder.d.ts +5 -5
  19. package/dist/cjs/query-builder/delete-query-builder.js +1 -1
  20. package/dist/cjs/query-builder/function-module.d.ts +273 -39
  21. package/dist/cjs/query-builder/function-module.js +156 -34
  22. package/dist/cjs/query-builder/insert-query-builder.d.ts +4 -5
  23. package/dist/cjs/query-builder/insert-query-builder.js +0 -1
  24. package/dist/cjs/query-builder/select-query-builder.d.ts +8 -7
  25. package/dist/cjs/query-builder/update-query-builder.d.ts +5 -5
  26. package/dist/cjs/query-builder/update-query-builder.js +1 -1
  27. package/dist/cjs/query-compiler/default-query-compiler.js +1 -1
  28. package/dist/cjs/query-creator.d.ts +29 -0
  29. package/dist/cjs/query-creator.js +2 -21
  30. package/dist/cjs/util/type-utils.d.ts +5 -4
  31. package/dist/esm/dialect/database-introspector.d.ts +4 -2
  32. package/dist/esm/dialect/mysql/mysql-introspector.d.ts +1 -1
  33. package/dist/esm/dialect/mysql/mysql-introspector.js +19 -13
  34. package/dist/esm/dialect/postgres/postgres-introspector.d.ts +1 -1
  35. package/dist/esm/dialect/postgres/postgres-introspector.js +3 -1
  36. package/dist/esm/dialect/sqlite/sqlite-introspector.d.ts +1 -1
  37. package/dist/esm/dialect/sqlite/sqlite-introspector.js +6 -5
  38. package/dist/esm/operation-node/aggregate-function-node.d.ts +3 -2
  39. package/dist/esm/operation-node/aggregate-function-node.js +2 -2
  40. package/dist/esm/operation-node/delete-query-node.d.ts +1 -1
  41. package/dist/esm/operation-node/delete-query-node.js +2 -2
  42. package/dist/esm/operation-node/operation-node-transformer.js +2 -2
  43. package/dist/esm/parser/expression-parser.js +2 -2
  44. package/dist/esm/parser/table-parser.d.ts +1 -0
  45. package/dist/esm/plugin/camel-case/camel-case-plugin.d.ts +7 -0
  46. package/dist/esm/plugin/camel-case/camel-case-plugin.js +10 -4
  47. package/dist/esm/query-builder/delete-query-builder.d.ts +5 -5
  48. package/dist/esm/query-builder/delete-query-builder.js +1 -1
  49. package/dist/esm/query-builder/function-module.d.ts +273 -39
  50. package/dist/esm/query-builder/function-module.js +156 -34
  51. package/dist/esm/query-builder/insert-query-builder.d.ts +4 -5
  52. package/dist/esm/query-builder/insert-query-builder.js +0 -1
  53. package/dist/esm/query-builder/select-query-builder.d.ts +8 -7
  54. package/dist/esm/query-builder/update-query-builder.d.ts +5 -5
  55. package/dist/esm/query-builder/update-query-builder.js +1 -1
  56. package/dist/esm/query-compiler/default-query-compiler.js +1 -1
  57. package/dist/esm/query-creator.d.ts +29 -0
  58. package/dist/esm/query-creator.js +2 -21
  59. package/dist/esm/util/type-utils.d.ts +5 -4
  60. package/package.json +1 -1
package/README.md CHANGED
@@ -78,6 +78,8 @@ for [3rd party dialects](https://koskimas.github.io/kysely/interfaces/Dialect.ht
78
78
  - [SingleStore Data API](https://github.com/igalklebanov/kysely-singlestore)
79
79
  - [D1](https://github.com/aidenwallis/kysely-d1)
80
80
  - [SurrealDB](https://github.com/igalklebanov/kysely-surrealdb)
81
+ - [sqld](https://github.com/libsql/kysely-libsql)
82
+ - [Neon](https://github.com/seveibar/kysely-neon)
81
83
 
82
84
  # Minimal example
83
85
 
@@ -183,7 +185,7 @@ type UpdateablePerson = Updateable<PersonTable>
183
185
 
184
186
  # Playground
185
187
 
186
- [@wirekang](https://github.com/wirekang) has created a [playground for Kysely](https://wirekang.github.io/kysely-playground/#eyJkaWFsZWN0IjoibXlzcWwiLCJ0cyI6ImludGVyZmFjZSBEQiB7XG4gIHVzZXI6IFVzZXJUYWJsZVxufVxuXG5pbnRlcmZhY2UgVXNlclRhYmxlIHtcbiAgaWQ6IEdlbmVyYXRlZDxzdHJpbmc+XG4gIGZpcnN0X25hbWU6IHN0cmluZyB8IG51bGxcbiAgbGFzdF9uYW1lOiBzdHJpbmcgfCBudWxsXG4gIGNyZWF0ZWRfYXQ6IEdlbmVyYXRlZDxEYXRlPlxufVxuXG5yZXN1bHQgPSBreXNlbHlcbiAgLnNlbGVjdEZyb20oXCJ1c2VyXCIpXG4gIC5zZWxlY3RBbGwoKVxuICAub3JkZXJCeShcImNyZWF0ZWRfYXRcIikifQ==). You can use to quickly test stuff out and for creating code examples for your issues, PRs and discord messages.
188
+ [@wirekang](https://github.com/wirekang) has created a [playground for Kysely](https://wirekang.github.io/kysely-playground/?p=f&i=-NLp3n_P5fyeQKMQda8n). You can use to quickly test stuff out and for creating code examples for your issues, PRs and discord messages.
187
189
 
188
190
  # Generating types
189
191
 
@@ -7,7 +7,7 @@ export interface DatabaseIntrospector {
7
7
  */
8
8
  getSchemas(): Promise<SchemaMetadata[]>;
9
9
  /**
10
- * Get table metadata.
10
+ * Get tables and views metadata.
11
11
  */
12
12
  getTables(options?: DatabaseMetadataOptions): Promise<TableMetadata[]>;
13
13
  /**
@@ -29,12 +29,14 @@ export interface SchemaMetadata {
29
29
  }
30
30
  export interface DatabaseMetadata {
31
31
  /**
32
- * The tables found in the database.
32
+ * The tables and views found in the database.
33
+ * * The propery isView can be used to tell them apart.
33
34
  */
34
35
  readonly tables: TableMetadata[];
35
36
  }
36
37
  export interface TableMetadata {
37
38
  readonly name: string;
39
+ readonly isView: boolean;
38
40
  readonly columns: ColumnMetadata[];
39
41
  readonly schema?: string;
40
42
  }
@@ -8,7 +8,7 @@ export declare class MysqlIntrospector implements DatabaseIntrospector {
8
8
  */
9
9
  getSchemas(): Promise<SchemaMetadata[]>;
10
10
  /**
11
- * Get table metadata.
11
+ * Get tables and views metadata.
12
12
  */
13
13
  getTables(options?: DatabaseMetadataOptions): Promise<TableMetadata[]>;
14
14
  /**
@@ -19,24 +19,29 @@ class MysqlIntrospector {
19
19
  }
20
20
  async getTables(options = { withInternalKyselyTables: false }) {
21
21
  let query = this.#db
22
- .selectFrom('information_schema.columns')
22
+ .selectFrom('information_schema.columns as columns')
23
+ .innerJoin('information_schema.tables as tables', (b) => b
24
+ .onRef('columns.TABLE_CATALOG', '=', 'tables.TABLE_CATALOG')
25
+ .onRef('columns.TABLE_SCHEMA', '=', 'tables.TABLE_SCHEMA')
26
+ .onRef('columns.TABLE_NAME', '=', 'tables.TABLE_NAME'))
23
27
  .select([
24
- 'COLUMN_NAME',
25
- 'COLUMN_DEFAULT',
26
- 'TABLE_NAME',
27
- 'TABLE_SCHEMA',
28
- 'IS_NULLABLE',
29
- 'DATA_TYPE',
30
- 'EXTRA',
28
+ 'columns.COLUMN_NAME',
29
+ 'columns.COLUMN_DEFAULT',
30
+ 'columns.TABLE_NAME',
31
+ 'columns.TABLE_SCHEMA',
32
+ 'tables.TABLE_TYPE',
33
+ 'columns.IS_NULLABLE',
34
+ 'columns.DATA_TYPE',
35
+ 'columns.EXTRA',
31
36
  ])
32
- .where('table_schema', '=', (0, sql_js_1.sql) `database()`)
33
- .orderBy('table_name')
34
- .orderBy('ordinal_position')
37
+ .where('columns.TABLE_SCHEMA', '=', (0, sql_js_1.sql) `database()`)
38
+ .orderBy('columns.TABLE_NAME')
39
+ .orderBy('columns.ORDINAL_POSITION')
35
40
  .$castTo();
36
41
  if (!options.withInternalKyselyTables) {
37
42
  query = query
38
- .where('table_name', '!=', migrator_js_1.DEFAULT_MIGRATION_TABLE)
39
- .where('table_name', '!=', migrator_js_1.DEFAULT_MIGRATION_LOCK_TABLE);
43
+ .where('columns.TABLE_NAME', '!=', migrator_js_1.DEFAULT_MIGRATION_TABLE)
44
+ .where('columns.TABLE_NAME', '!=', migrator_js_1.DEFAULT_MIGRATION_LOCK_TABLE);
40
45
  }
41
46
  const rawColumns = await query.execute();
42
47
  return this.#parseTableMetadata(rawColumns);
@@ -52,6 +57,7 @@ class MysqlIntrospector {
52
57
  if (!table) {
53
58
  table = (0, object_utils_js_1.freeze)({
54
59
  name: it.TABLE_NAME,
60
+ isView: it.TABLE_TYPE === 'VIEW',
55
61
  schema: it.TABLE_SCHEMA,
56
62
  columns: [],
57
63
  });
@@ -8,7 +8,7 @@ export declare class PostgresIntrospector implements DatabaseIntrospector {
8
8
  */
9
9
  getSchemas(): Promise<SchemaMetadata[]>;
10
10
  /**
11
- * Get table metadata.
11
+ * Get tables and views metadata.
12
12
  */
13
13
  getTables(options?: DatabaseMetadataOptions): Promise<TableMetadata[]>;
14
14
  /**
@@ -34,6 +34,7 @@ class PostgresIntrospector {
34
34
  'a.attnotnull as not_null',
35
35
  'a.atthasdef as has_default',
36
36
  'c.relname as table',
37
+ 'c.relkind as table_type',
37
38
  'ns.nspname as schema',
38
39
  'typ.typname as type',
39
40
  'dtns.nspname as type_schema',
@@ -49,7 +50,7 @@ class PostgresIntrospector {
49
50
  .as('auto_incrementing'),
50
51
  ])
51
52
  // r == normal table
52
- .where('c.relkind', '=', 'r')
53
+ .where('c.relkind', 'in', ['r', 'v'])
53
54
  .where('ns.nspname', '!~', '^pg_')
54
55
  .where('ns.nspname', '!=', 'information_schema')
55
56
  // No system columns
@@ -78,6 +79,7 @@ class PostgresIntrospector {
78
79
  if (!table) {
79
80
  table = (0, object_utils_js_1.freeze)({
80
81
  name: it.table,
82
+ isView: it.table_type === 'v',
81
83
  schema: it.schema,
82
84
  columns: [],
83
85
  });
@@ -8,7 +8,7 @@ export declare class SqliteIntrospector implements DatabaseIntrospector {
8
8
  */
9
9
  getSchemas(): Promise<SchemaMetadata[]>;
10
10
  /**
11
- * Get table metadata.
11
+ * Get tables and views metadata.
12
12
  */
13
13
  getTables(options?: DatabaseMetadataOptions): Promise<TableMetadata[]>;
14
14
  /**
@@ -15,7 +15,7 @@ class SqliteIntrospector {
15
15
  async getTables(options = { withInternalKyselyTables: false }) {
16
16
  let query = this.#db
17
17
  .selectFrom('sqlite_schema')
18
- .where('type', '=', 'table')
18
+ .where('type', 'in', ['table', 'view'])
19
19
  .where('name', 'not like', 'sqlite_%')
20
20
  .select('name')
21
21
  .orderBy('name')
@@ -36,14 +36,14 @@ class SqliteIntrospector {
36
36
  async #getTableMetadata(table) {
37
37
  const db = this.#db;
38
38
  // Get the SQL that was used to create the table.
39
- const createSql = await db
39
+ const tableDefinition = await db
40
40
  .selectFrom('sqlite_master')
41
41
  .where('name', '=', table)
42
- .select('sql')
42
+ .select(['sql', 'type'])
43
43
  .$castTo()
44
- .execute();
44
+ .executeTakeFirstOrThrow();
45
45
  // Try to find the name of the column that has `autoincrement` 🤦
46
- const autoIncrementCol = createSql[0]?.sql
46
+ const autoIncrementCol = tableDefinition.sql
47
47
  ?.split(/[\(\),]/)
48
48
  ?.find((it) => it.toLowerCase().includes('autoincrement'))
49
49
  ?.trimStart()
@@ -56,6 +56,7 @@ class SqliteIntrospector {
56
56
  .execute();
57
57
  return {
58
58
  name: table,
59
+ isView: tableDefinition.type === 'view',
59
60
  columns: columns.map((col) => ({
60
61
  name: col.name,
61
62
  dataType: col.type,
@@ -1,12 +1,13 @@
1
1
  import { OperationNode } from './operation-node.js';
2
2
  import { OverNode } from './over-node.js';
3
+ import { SelectAllNode } from './select-all-node.js';
3
4
  import { SimpleReferenceExpressionNode } from './simple-reference-expression-node.js';
4
5
  import { WhereNode } from './where-node.js';
5
6
  declare type AggregateFunction = 'avg' | 'count' | 'max' | 'min' | 'sum';
6
7
  export interface AggregateFunctionNode extends OperationNode {
7
8
  readonly kind: 'AggregateFunctionNode';
8
9
  readonly func: AggregateFunction;
9
- readonly column: SimpleReferenceExpressionNode;
10
+ readonly aggregated: SimpleReferenceExpressionNode | SelectAllNode;
10
11
  readonly distinct?: boolean;
11
12
  readonly filter?: WhereNode;
12
13
  readonly over?: OverNode;
@@ -16,7 +17,7 @@ export interface AggregateFunctionNode extends OperationNode {
16
17
  */
17
18
  export declare const AggregateFunctionNode: Readonly<{
18
19
  is(node: OperationNode): node is AggregateFunctionNode;
19
- create(aggregateFunction: AggregateFunction, column: SimpleReferenceExpressionNode): AggregateFunctionNode;
20
+ create(aggregateFunction: AggregateFunction, aggregated: SimpleReferenceExpressionNode | SelectAllNode): AggregateFunctionNode;
20
21
  cloneWithDistinct(aggregateFunctionNode: AggregateFunctionNode): AggregateFunctionNode;
21
22
  cloneWithFilter(aggregateFunctionNode: AggregateFunctionNode, filter: OperationNode): AggregateFunctionNode;
22
23
  cloneWithOrFilter(aggregateFunctionNode: AggregateFunctionNode, filter: OperationNode): AggregateFunctionNode;
@@ -10,11 +10,11 @@ exports.AggregateFunctionNode = (0, object_utils_js_1.freeze)({
10
10
  is(node) {
11
11
  return node.kind === 'AggregateFunctionNode';
12
12
  },
13
- create(aggregateFunction, column) {
13
+ create(aggregateFunction, aggregated) {
14
14
  return (0, object_utils_js_1.freeze)({
15
15
  kind: 'AggregateFunctionNode',
16
16
  func: aggregateFunction,
17
- column,
17
+ aggregated,
18
18
  });
19
19
  },
20
20
  cloneWithDistinct(aggregateFunctionNode) {
@@ -26,7 +26,7 @@ export interface DeleteQueryNode extends OperationNode {
26
26
  */
27
27
  export declare const DeleteQueryNode: Readonly<{
28
28
  is(node: OperationNode): node is DeleteQueryNode;
29
- create(fromItem: OperationNode, withNode?: WithNode): DeleteQueryNode;
29
+ create(fromItems: OperationNode[], withNode?: WithNode): DeleteQueryNode;
30
30
  cloneWithOrderByItem(deleteNode: DeleteQueryNode, item: OrderByItemNode): DeleteQueryNode;
31
31
  cloneWithLimit(deleteNode: DeleteQueryNode, limit: LimitNode): DeleteQueryNode;
32
32
  cloneWithExplain(deleteNode: DeleteQueryNode, explain: ExplainNode): DeleteQueryNode;
@@ -12,10 +12,10 @@ exports.DeleteQueryNode = (0, object_utils_js_1.freeze)({
12
12
  is(node) {
13
13
  return node.kind === 'DeleteQueryNode';
14
14
  },
15
- create(fromItem, withNode) {
15
+ create(fromItems, withNode) {
16
16
  return (0, object_utils_js_1.freeze)({
17
17
  kind: 'DeleteQueryNode',
18
- from: from_node_js_1.FromNode.create([fromItem]),
18
+ from: from_node_js_1.FromNode.create(fromItems),
19
19
  ...(withNode && { with: withNode }),
20
20
  });
21
21
  },
@@ -651,7 +651,7 @@ class OperationNodeTransformer {
651
651
  transformAggregateFunction(node) {
652
652
  return (0, require_all_props_js_1.requireAllProps)({
653
653
  kind: 'AggregateFunctionNode',
654
- column: this.transformNode(node.column),
654
+ aggregated: this.transformNode(node.aggregated),
655
655
  distinct: node.distinct,
656
656
  filter: this.transformNode(node.filter),
657
657
  func: node.func,
@@ -695,7 +695,7 @@ class OperationNodeTransformer {
695
695
  transformUsing(node) {
696
696
  return (0, require_all_props_js_1.requireAllProps)({
697
697
  kind: 'UsingNode',
698
- tables: node.tables,
698
+ tables: this.transformNodeList(node.tables),
699
699
  });
700
700
  }
701
701
  transformDataType(node) {
@@ -26,6 +26,6 @@ function parseAliasedExpression(exp) {
26
26
  }
27
27
  exports.parseAliasedExpression = parseAliasedExpression;
28
28
  function isExpressionOrFactory(obj) {
29
- return (0, expression_js_1.isExpression)(obj) || (0, object_utils_js_1.isFunction)(obj);
29
+ return (0, expression_js_1.isExpression)(obj) || (0, expression_js_1.isAliasedExpression)(obj) || (0, object_utils_js_1.isFunction)(obj);
30
30
  }
31
31
  exports.isExpressionOrFactory = isExpressionOrFactory;
@@ -6,6 +6,7 @@ import { AliasedExpression } from '../expression/expression.js';
6
6
  export declare type TableExpression<DB, TB extends keyof DB> = TableReference<DB> | AliasedExpressionOrFactory<DB, TB>;
7
7
  export declare type TableExpressionOrList<DB, TB extends keyof DB> = TableExpression<DB, TB> | ReadonlyArray<TableExpression<DB, TB>>;
8
8
  export declare type TableReference<DB> = AnyAliasedTable<DB> | AnyTable<DB> | AliasedExpression<any, any>;
9
+ export declare type TableReferenceOrList<DB> = TableReference<DB> | ReadonlyArray<TableReference<DB>>;
9
10
  export declare type From<DB, TE> = {
10
11
  [C in keyof DB | ExtractAliasFromTableExpression<DB, TE>]: C extends ExtractAliasFromTableExpression<DB, TE> ? ExtractRowTypeFromTableExpression<DB, TE, C> : C extends keyof DB ? DB[C] : never;
11
12
  };
@@ -26,6 +26,12 @@ export interface CamelCasePluginOptions {
26
26
  * Defaults to false.
27
27
  */
28
28
  underscoreBetweenUppercaseLetters?: boolean;
29
+ /**
30
+ * If true, nested object's keys will not be converted to camel case.
31
+ *
32
+ * Defaults to false.
33
+ */
34
+ maintainNestedObjectKeys?: boolean;
29
35
  }
30
36
  /**
31
37
  * A plugin that converts snake_case identifiers in the database into
@@ -93,6 +99,7 @@ export interface CamelCasePluginOptions {
93
99
  */
94
100
  export declare class CamelCasePlugin implements KyselyPlugin {
95
101
  #private;
102
+ readonly opt: CamelCasePluginOptions;
96
103
  constructor(opt?: CamelCasePluginOptions);
97
104
  /**
98
105
  * This is called for each query before it is executed. You can modify the query by
@@ -69,10 +69,12 @@ const camel_case_js_1 = require("./camel-case.js");
69
69
  * ```
70
70
  */
71
71
  class CamelCasePlugin {
72
+ opt;
72
73
  #camelCase;
73
74
  #snakeCase;
74
75
  #snakeCaseTransformer;
75
76
  constructor(opt = {}) {
77
+ this.opt = opt;
76
78
  this.#camelCase = (0, camel_case_js_1.createCamelCaseMapper)(opt);
77
79
  this.#snakeCase = (0, camel_case_js_1.createSnakeCaseMapper)(opt);
78
80
  this.#snakeCaseTransformer = new camel_case_transformer_js_1.SnakeCaseTransformer(this.snakeCase.bind(this));
@@ -93,9 +95,9 @@ class CamelCasePlugin {
93
95
  return Object.keys(row).reduce((obj, key) => {
94
96
  let value = row[key];
95
97
  if (Array.isArray(value)) {
96
- value = value.map((it) => (canMap(it) ? this.mapRow(it) : it));
98
+ value = value.map((it) => (canMap(it, this.opt) ? this.mapRow(it) : it));
97
99
  }
98
- else if (canMap(value)) {
100
+ else if (canMap(value, this.opt)) {
99
101
  value = this.mapRow(value);
100
102
  }
101
103
  obj[this.camelCase(key)] = value;
@@ -110,6 +112,10 @@ class CamelCasePlugin {
110
112
  }
111
113
  }
112
114
  exports.CamelCasePlugin = CamelCasePlugin;
113
- function canMap(obj) {
114
- return ((0, object_utils_js_1.isObject)(obj) && !(0, object_utils_js_1.isDate)(obj) && !(0, object_utils_js_1.isBuffer)(obj) && !(0, object_utils_js_1.isArrayBufferOrView)(obj));
115
+ function canMap(obj, opt) {
116
+ return ((0, object_utils_js_1.isObject)(obj) &&
117
+ !(0, object_utils_js_1.isDate)(obj) &&
118
+ !(0, object_utils_js_1.isBuffer)(obj) &&
119
+ !(0, object_utils_js_1.isArrayBufferOrView)(obj) &&
120
+ !opt?.maintainNestedObjectKeys);
115
121
  }
@@ -5,7 +5,7 @@ import { From, FromTables, TableExpression } from '../parser/table-parser.js';
5
5
  import { SelectExpression } from '../parser/select-parser.js';
6
6
  import { ReturningRow } from '../parser/returning-parser.js';
7
7
  import { ReferenceExpression } from '../parser/reference-parser.js';
8
- import { MergePartial, Nullable, SingleResultType } from '../util/type-utils.js';
8
+ import { MergePartial, Nullable, SimplifyResult, SimplifySingleResult } from '../util/type-utils.js';
9
9
  import { Compilable } from '../util/compilable.js';
10
10
  import { QueryExecutor } from '../query-executor/query-executor.js';
11
11
  import { QueryId } from '../util/query-id.js';
@@ -878,18 +878,18 @@ export declare class DeleteQueryBuilder<DB, TB extends keyof DB, O> implements W
878
878
  */
879
879
  withPlugin(plugin: KyselyPlugin): DeleteQueryBuilder<DB, TB, O>;
880
880
  toOperationNode(): DeleteQueryNode;
881
- compile(): CompiledQuery<O>;
881
+ compile(): CompiledQuery<SimplifyResult<O>>;
882
882
  /**
883
883
  * Executes the query and returns an array of rows.
884
884
  *
885
885
  * Also see the {@link executeTakeFirst} and {@link executeTakeFirstOrThrow} methods.
886
886
  */
887
- execute(): Promise<O[]>;
887
+ execute(): Promise<SimplifyResult<O>[]>;
888
888
  /**
889
889
  * Executes the query and returns the first result or undefined if
890
890
  * the query returned no result.
891
891
  */
892
- executeTakeFirst(): Promise<SingleResultType<O>>;
892
+ executeTakeFirst(): Promise<SimplifySingleResult<O>>;
893
893
  /**
894
894
  * Executes the query and returns the first result or throws if
895
895
  * the query returned no result.
@@ -898,7 +898,7 @@ export declare class DeleteQueryBuilder<DB, TB extends keyof DB, O> implements W
898
898
  * provide a custom error class as the only argument to throw a different
899
899
  * error.
900
900
  */
901
- executeTakeFirstOrThrow(errorConstructor?: NoResultErrorConstructor): Promise<O>;
901
+ executeTakeFirstOrThrow(errorConstructor?: NoResultErrorConstructor): Promise<SimplifyResult<O>>;
902
902
  /**
903
903
  * Executes query with `explain` statement before `delete` keyword.
904
904
  *
@@ -354,7 +354,7 @@ class DeleteQueryBuilder {
354
354
  return [
355
355
  new delete_result_js_1.DeleteResult(
356
356
  // TODO: remove numUpdatedOrDeletedRows.
357
- (result.numAffectedRows ?? result.numUpdatedOrDeletedRows)),
357
+ result.numAffectedRows ?? result.numUpdatedOrDeletedRows ?? 0n),
358
358
  ];
359
359
  }
360
360
  /**