kysely 0.28.11 → 0.28.13

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 {
@@ -392,7 +392,7 @@ class DefaultQueryCompiler extends operation_node_visitor_js_1.OperationNodeVisi
392
392
  }
393
393
  visitCreateTable(node) {
394
394
  this.append('create ');
395
- if (node.frontModifiers && node.frontModifiers.length > 0) {
395
+ if (node.frontModifiers?.length) {
396
396
  this.compileList(node.frontModifiers, ' ');
397
397
  this.append(' ');
398
398
  }
@@ -404,22 +404,22 @@ class DefaultQueryCompiler extends operation_node_visitor_js_1.OperationNodeVisi
404
404
  this.append('if not exists ');
405
405
  }
406
406
  this.visitNode(node.table);
407
- if (node.selectQuery) {
408
- this.append(' as ');
409
- this.visitNode(node.selectQuery);
410
- }
411
- else {
407
+ if (!node.selectQuery) {
412
408
  this.append(' (');
413
409
  this.compileList([...node.columns, ...(node.constraints ?? [])]);
414
410
  this.append(')');
415
- if (node.onCommit) {
416
- this.append(' on commit ');
417
- this.append(node.onCommit);
418
- }
419
- if (node.endModifiers && node.endModifiers.length > 0) {
420
- this.append(' ');
421
- this.compileList(node.endModifiers, ' ');
422
- }
411
+ }
412
+ if (node.onCommit) {
413
+ this.append(' on commit ');
414
+ this.append(node.onCommit);
415
+ }
416
+ if (node.endModifiers?.length) {
417
+ this.append(' ');
418
+ this.compileList(node.endModifiers, ' ');
419
+ }
420
+ if (node.selectQuery) {
421
+ this.append(' as ');
422
+ this.visitNode(node.selectQuery);
423
423
  }
424
424
  }
425
425
  visitColumnDefinition(node) {
@@ -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
  }
@@ -144,7 +144,7 @@ export type Selectable<R> = DrainOuterGeneric<{
144
144
  * // }
145
145
  * ```
146
146
  */
147
- export type Insertable<R> = DrainOuterGeneric<{
147
+ export type Insertable<R> = DrainOuterGeneric<object & {
148
148
  [K in NonNullableInsertKeys<R>]: InsertType<R[K]>;
149
149
  } & {
150
150
  [K in NullableInsertKeys<R>]?: InsertType<R[K]>;
@@ -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 {
@@ -390,7 +390,7 @@ export class DefaultQueryCompiler extends OperationNodeVisitor {
390
390
  }
391
391
  visitCreateTable(node) {
392
392
  this.append('create ');
393
- if (node.frontModifiers && node.frontModifiers.length > 0) {
393
+ if (node.frontModifiers?.length) {
394
394
  this.compileList(node.frontModifiers, ' ');
395
395
  this.append(' ');
396
396
  }
@@ -402,22 +402,22 @@ export class DefaultQueryCompiler extends OperationNodeVisitor {
402
402
  this.append('if not exists ');
403
403
  }
404
404
  this.visitNode(node.table);
405
- if (node.selectQuery) {
406
- this.append(' as ');
407
- this.visitNode(node.selectQuery);
408
- }
409
- else {
405
+ if (!node.selectQuery) {
410
406
  this.append(' (');
411
407
  this.compileList([...node.columns, ...(node.constraints ?? [])]);
412
408
  this.append(')');
413
- if (node.onCommit) {
414
- this.append(' on commit ');
415
- this.append(node.onCommit);
416
- }
417
- if (node.endModifiers && node.endModifiers.length > 0) {
418
- this.append(' ');
419
- this.compileList(node.endModifiers, ' ');
420
- }
409
+ }
410
+ if (node.onCommit) {
411
+ this.append(' on commit ');
412
+ this.append(node.onCommit);
413
+ }
414
+ if (node.endModifiers?.length) {
415
+ this.append(' ');
416
+ this.compileList(node.endModifiers, ' ');
417
+ }
418
+ if (node.selectQuery) {
419
+ this.append(' as ');
420
+ this.visitNode(node.selectQuery);
421
421
  }
422
422
  }
423
423
  visitColumnDefinition(node) {
@@ -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
  }
@@ -144,7 +144,7 @@ export type Selectable<R> = DrainOuterGeneric<{
144
144
  * // }
145
145
  * ```
146
146
  */
147
- export type Insertable<R> = DrainOuterGeneric<{
147
+ export type Insertable<R> = DrainOuterGeneric<object & {
148
148
  [K in NonNullableInsertKeys<R>]: InsertType<R[K]>;
149
149
  } & {
150
150
  [K in NullableInsertKeys<R>]?: InsertType<R[K]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kysely",
3
- "version": "0.28.11",
3
+ "version": "0.28.13",
4
4
  "description": "Type safe SQL query builder",
5
5
  "repository": {
6
6
  "type": "git",
@@ -68,6 +68,7 @@
68
68
  "default": "./dist/cjs/helpers/sqlite.js"
69
69
  }
70
70
  },
71
+ "sideEffects": false,
71
72
  "author": "Sami Koskimäki <sami@jakso.me>",
72
73
  "license": "MIT",
73
74
  "contributors": [
@@ -81,30 +82,30 @@
81
82
  "@types/chai": "^5.2.3",
82
83
  "@types/chai-as-promised": "^8.0.2",
83
84
  "@types/mocha": "^10.0.10",
84
- "@types/node": "^24.10.1",
85
- "@types/pg": "^8.16.0",
85
+ "@types/node": "^25.5.0",
86
+ "@types/pg": "^8.18.0",
86
87
  "@types/pg-cursor": "^2.7.2",
87
88
  "@types/semver": "^7.7.1",
88
89
  "@types/sinon": "^21.0.0",
89
- "better-sqlite3": "^12.6.2",
90
+ "better-sqlite3": "^12.8.0",
90
91
  "chai": "^6.2.2",
91
92
  "chai-as-promised": "^8.0.2",
92
- "esbuild": "^0.27.2",
93
- "jsr": "^0.14.1",
93
+ "esbuild": "^0.27.4",
94
+ "jsr": "^0.14.3",
94
95
  "lodash": "^4.17.23",
95
96
  "mocha": "^11.7.5",
96
- "mysql2": "^3.16.2",
97
+ "mysql2": "^3.20.0",
97
98
  "pathe": "^2.0.3",
98
- "pg": "^8.17.2",
99
- "pg-cursor": "^2.16.2",
99
+ "pg": "^8.20.0",
100
+ "pg-cursor": "^2.19.0",
100
101
  "pkg-types": "^2.3.0",
101
- "playwright": "^1.58.0",
102
+ "playwright": "^1.58.2",
102
103
  "prettier": "^3.8.1",
103
- "semver": "^7.7.3",
104
- "sinon": "^21.0.1",
105
- "std-env": "^3.10.0",
104
+ "semver": "^7.7.4",
105
+ "sinon": "^21.0.3",
106
+ "std-env": "^4.0.0",
106
107
  "tarn": "^3.0.2",
107
- "tedious": "^19.2.0",
108
+ "tedious": "^19.2.1",
108
109
  "tsd": "^0.33.0",
109
110
  "typescript": "~5.9.3"
110
111
  },