kysely 0.28.10 → 0.28.12

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.
@@ -35,10 +35,10 @@ export interface MysqlPool {
35
35
  end(callback: (error: unknown) => void): void;
36
36
  }
37
37
  export interface MysqlPoolConnection {
38
- query(sql: string, parameters: ReadonlyArray<unknown>): {
38
+ query(sql: string, parameters: Array<unknown>): {
39
39
  stream: <T>(options: MysqlStreamOptions) => MysqlStream<T>;
40
40
  };
41
- query(sql: string, parameters: ReadonlyArray<unknown>, callback: (error: unknown, result: MysqlQueryResult) => void): void;
41
+ query(sql: string, parameters: Array<unknown>, callback: (error: unknown, result: MysqlQueryResult) => void): void;
42
42
  release(): void;
43
43
  }
44
44
  export interface MysqlStreamOptions {
@@ -565,7 +565,8 @@ class TransactionBuilder {
565
565
  const settings = { isolationLevel, accessMode };
566
566
  (0, driver_js_1.validateTransactionSettings)(settings);
567
567
  return this.#props.executor.provideConnection(async (connection) => {
568
- const executor = this.#props.executor.withConnectionProvider(new single_connection_provider_js_1.SingleConnectionProvider(connection));
568
+ const state = { isCommitted: false, isRolledBack: false };
569
+ const executor = new NotCommittedOrRolledBackAssertingExecutor(this.#props.executor.withConnectionProvider(new single_connection_provider_js_1.SingleConnectionProvider(connection)), state);
569
570
  const transaction = new Transaction({
570
571
  ...kyselyProps,
571
572
  executor,
@@ -576,11 +577,13 @@ class TransactionBuilder {
576
577
  transactionBegun = true;
577
578
  const result = await callback(transaction);
578
579
  await this.#props.driver.commitTransaction(connection);
580
+ state.isCommitted = true;
579
581
  return result;
580
582
  }
581
583
  catch (error) {
582
584
  if (transactionBegun) {
583
585
  await this.#props.driver.rollbackTransaction(connection);
586
+ state.isRolledBack = true;
584
587
  }
585
588
  throw error;
586
589
  }
@@ -581,6 +581,10 @@ class DefaultQueryCompiler extends operation_node_visitor_js_1.OperationNodeVisi
581
581
  this.append(' ');
582
582
  this.visitNode(node.where);
583
583
  }
584
+ if (node.returning) {
585
+ this.append(' ');
586
+ this.visitNode(node.returning);
587
+ }
584
588
  if (node.orderBy) {
585
589
  this.append(' ');
586
590
  this.visitNode(node.orderBy);
@@ -589,10 +593,6 @@ class DefaultQueryCompiler extends operation_node_visitor_js_1.OperationNodeVisi
589
593
  this.append(' ');
590
594
  this.visitNode(node.limit);
591
595
  }
592
- if (node.returning) {
593
- this.append(' ');
594
- this.visitNode(node.returning);
595
- }
596
596
  if (wrapInParens) {
597
597
  this.append(')');
598
598
  }
@@ -1169,7 +1169,9 @@ class DefaultQueryCompiler extends operation_node_visitor_js_1.OperationNodeVisi
1169
1169
  visitJSONPathLeg(node) {
1170
1170
  const isArrayLocation = node.type === 'ArrayLocation';
1171
1171
  this.append(isArrayLocation ? '[' : '.');
1172
- this.append(String(node.value));
1172
+ this.append(typeof node.value === 'string'
1173
+ ? this.sanitizeStringLiteral(node.value)
1174
+ : String(node.value));
1173
1175
  if (isArrayLocation) {
1174
1176
  this.append(']');
1175
1177
  }
@@ -35,10 +35,10 @@ export interface MysqlPool {
35
35
  end(callback: (error: unknown) => void): void;
36
36
  }
37
37
  export interface MysqlPoolConnection {
38
- query(sql: string, parameters: ReadonlyArray<unknown>): {
38
+ query(sql: string, parameters: Array<unknown>): {
39
39
  stream: <T>(options: MysqlStreamOptions) => MysqlStream<T>;
40
40
  };
41
- query(sql: string, parameters: ReadonlyArray<unknown>, callback: (error: unknown, result: MysqlQueryResult) => void): void;
41
+ query(sql: string, parameters: Array<unknown>, callback: (error: unknown, result: MysqlQueryResult) => void): void;
42
42
  release(): void;
43
43
  }
44
44
  export interface MysqlStreamOptions {
@@ -559,7 +559,8 @@ export class TransactionBuilder {
559
559
  const settings = { isolationLevel, accessMode };
560
560
  validateTransactionSettings(settings);
561
561
  return this.#props.executor.provideConnection(async (connection) => {
562
- const executor = this.#props.executor.withConnectionProvider(new SingleConnectionProvider(connection));
562
+ const state = { isCommitted: false, isRolledBack: false };
563
+ const executor = new NotCommittedOrRolledBackAssertingExecutor(this.#props.executor.withConnectionProvider(new SingleConnectionProvider(connection)), state);
563
564
  const transaction = new Transaction({
564
565
  ...kyselyProps,
565
566
  executor,
@@ -570,11 +571,13 @@ export class TransactionBuilder {
570
571
  transactionBegun = true;
571
572
  const result = await callback(transaction);
572
573
  await this.#props.driver.commitTransaction(connection);
574
+ state.isCommitted = true;
573
575
  return result;
574
576
  }
575
577
  catch (error) {
576
578
  if (transactionBegun) {
577
579
  await this.#props.driver.rollbackTransaction(connection);
580
+ state.isRolledBack = true;
578
581
  }
579
582
  throw error;
580
583
  }
@@ -579,6 +579,10 @@ export class DefaultQueryCompiler extends OperationNodeVisitor {
579
579
  this.append(' ');
580
580
  this.visitNode(node.where);
581
581
  }
582
+ if (node.returning) {
583
+ this.append(' ');
584
+ this.visitNode(node.returning);
585
+ }
582
586
  if (node.orderBy) {
583
587
  this.append(' ');
584
588
  this.visitNode(node.orderBy);
@@ -587,10 +591,6 @@ export class DefaultQueryCompiler extends OperationNodeVisitor {
587
591
  this.append(' ');
588
592
  this.visitNode(node.limit);
589
593
  }
590
- if (node.returning) {
591
- this.append(' ');
592
- this.visitNode(node.returning);
593
- }
594
594
  if (wrapInParens) {
595
595
  this.append(')');
596
596
  }
@@ -1167,7 +1167,9 @@ export class DefaultQueryCompiler extends OperationNodeVisitor {
1167
1167
  visitJSONPathLeg(node) {
1168
1168
  const isArrayLocation = node.type === 'ArrayLocation';
1169
1169
  this.append(isArrayLocation ? '[' : '.');
1170
- this.append(String(node.value));
1170
+ this.append(typeof node.value === 'string'
1171
+ ? this.sanitizeStringLiteral(node.value)
1172
+ : String(node.value));
1171
1173
  if (isArrayLocation) {
1172
1174
  this.append(']');
1173
1175
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kysely",
3
- "version": "0.28.10",
3
+ "version": "0.28.12",
4
4
  "description": "Type safe SQL query builder",
5
5
  "repository": {
6
6
  "type": "git",
@@ -81,30 +81,30 @@
81
81
  "@types/chai": "^5.2.3",
82
82
  "@types/chai-as-promised": "^8.0.2",
83
83
  "@types/mocha": "^10.0.10",
84
- "@types/node": "^24.10.1",
85
- "@types/pg": "^8.16.0",
84
+ "@types/node": "^25.5.0",
85
+ "@types/pg": "^8.18.0",
86
86
  "@types/pg-cursor": "^2.7.2",
87
87
  "@types/semver": "^7.7.1",
88
88
  "@types/sinon": "^21.0.0",
89
- "better-sqlite3": "^12.6.0",
89
+ "better-sqlite3": "^12.6.2",
90
90
  "chai": "^6.2.2",
91
91
  "chai-as-promised": "^8.0.2",
92
- "esbuild": "^0.27.2",
93
- "jsr": "^0.13.4",
94
- "lodash": "^4.17.21",
92
+ "esbuild": "^0.27.4",
93
+ "jsr": "^0.14.3",
94
+ "lodash": "^4.17.23",
95
95
  "mocha": "^11.7.5",
96
- "mysql2": "^3.16.1",
96
+ "mysql2": "^3.19.1",
97
97
  "pathe": "^2.0.3",
98
- "pg": "^8.17.1",
99
- "pg-cursor": "^2.16.1",
98
+ "pg": "^8.20.0",
99
+ "pg-cursor": "^2.19.0",
100
100
  "pkg-types": "^2.3.0",
101
- "playwright": "^1.57.0",
102
- "prettier": "^3.8.0",
103
- "semver": "^7.7.3",
104
- "sinon": "^21.0.1",
105
- "std-env": "^3.10.0",
101
+ "playwright": "^1.58.2",
102
+ "prettier": "^3.8.1",
103
+ "semver": "^7.7.4",
104
+ "sinon": "^21.0.2",
105
+ "std-env": "^4.0.0",
106
106
  "tarn": "^3.0.2",
107
- "tedious": "^19.2.0",
107
+ "tedious": "^19.2.1",
108
108
  "tsd": "^0.33.0",
109
109
  "typescript": "~5.9.3"
110
110
  },