kysely 0.28.3 → 0.28.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.
@@ -204,7 +204,7 @@ export * from './util/compilable.js';
204
204
  export * from './util/explainable.js';
205
205
  export * from './util/streamable.js';
206
206
  export * from './util/log.js';
207
- export { AnyAliasedColumn, AnyAliasedColumnWithTable, AnyColumn, AnyColumnWithTable, Equals, UnknownRow, Simplify, SqlBool, Nullable, NotNull, ShallowDehydrateObject, ShallowDehydrateValue, StringsWhenDataTypeNotAvailable, } from './util/type-utils.js';
207
+ export { AnyAliasedColumn, AnyAliasedColumnWithTable, AnyColumn, AnyColumnWithTable, Equals, UnknownRow, Simplify, SqlBool, Nullable, NumbersWhenDataTypeNotAvailable, NotNull, NumericString, ShallowDehydrateObject, ShallowDehydrateValue, StringsWhenDataTypeNotAvailable, } from './util/type-utils.js';
208
208
  export * from './util/infer-result.js';
209
209
  export { logOnce } from './util/log-once.js';
210
210
  export { createQueryId, QueryId } from './util/query-id.js';
@@ -514,7 +514,7 @@ export interface FunctionModule<DB, TB extends keyof DB> {
514
514
  * $1 = any("person"."nicknames")
515
515
  * ```
516
516
  */
517
- any<RE extends StringReference<DB, TB>>(expr: RE): Exclude<ExtractTypeFromStringReference<DB, TB, RE>, null> extends ReadonlyArray<infer I> ? ExpressionWrapper<DB, TB, I> : KyselyTypeError<'any(expr) call failed: expr must be an array'>;
517
+ any<RE extends StringReference<DB, TB>>(expr: RE): Exclude<ExtractTypeFromReferenceExpression<DB, TB, RE>, null> extends ReadonlyArray<infer I> ? ExpressionWrapper<DB, TB, I> : KyselyTypeError<'any(expr) call failed: expr must be an array'>;
518
518
  any<T>(subquery: SelectQueryBuilderExpression<Record<string, T>>): ExpressionWrapper<DB, TB, T>;
519
519
  any<T>(expr: Expression<ReadonlyArray<T>>): ExpressionWrapper<DB, TB, T>;
520
520
  /**
@@ -180,9 +180,10 @@ export type ShallowDehydrateObject<O> = {
180
180
  /**
181
181
  * Dehydrates a value when it is not a valid JSON type.
182
182
  *
183
- * For now, we catch anything in {@link StringsWhenDataTypeNotAvailable} and convert it to `string`.
183
+ * For now, we catch anything in {@link StringsWhenDataTypeNotAvailable} and convert it to `string`,
184
+ * and anything in {@link NumbersWhenDataTypeNotAvailable} and convert it to `number`.
184
185
  */
185
- export type ShallowDehydrateValue<T> = [T] extends [
186
- (infer U)[] | null | undefined
187
- ] ? Array<ShallowDehydrateValue<U>> | Extract<T, null | undefined> : T extends Exclude<T, StringsWhenDataTypeNotAvailable> ? T : string | Exclude<T, StringsWhenDataTypeNotAvailable>;
188
- export type StringsWhenDataTypeNotAvailable = ArrayBuffer | bigint | Buffer | Date;
186
+ export type ShallowDehydrateValue<T> = T extends null | undefined ? T : T extends (infer U)[] | null | undefined ? Array<ShallowDehydrateValue<U>> | Extract<T, null | undefined> : Exclude<T, StringsWhenDataTypeNotAvailable | NumbersWhenDataTypeNotAvailable> | ([Extract<T, NumbersWhenDataTypeNotAvailable>] extends [never] ? never : number) | ([Extract<T, StringsWhenDataTypeNotAvailable>] extends [never] ? never : string);
187
+ export type StringsWhenDataTypeNotAvailable = Date | Uint8Array;
188
+ export type NumbersWhenDataTypeNotAvailable = bigint | NumericString;
189
+ export type NumericString = `${number}`;
@@ -204,7 +204,7 @@ export * from './util/compilable.js';
204
204
  export * from './util/explainable.js';
205
205
  export * from './util/streamable.js';
206
206
  export * from './util/log.js';
207
- export { AnyAliasedColumn, AnyAliasedColumnWithTable, AnyColumn, AnyColumnWithTable, Equals, UnknownRow, Simplify, SqlBool, Nullable, NotNull, ShallowDehydrateObject, ShallowDehydrateValue, StringsWhenDataTypeNotAvailable, } from './util/type-utils.js';
207
+ export { AnyAliasedColumn, AnyAliasedColumnWithTable, AnyColumn, AnyColumnWithTable, Equals, UnknownRow, Simplify, SqlBool, Nullable, NumbersWhenDataTypeNotAvailable, NotNull, NumericString, ShallowDehydrateObject, ShallowDehydrateValue, StringsWhenDataTypeNotAvailable, } from './util/type-utils.js';
208
208
  export * from './util/infer-result.js';
209
209
  export { logOnce } from './util/log-once.js';
210
210
  export { createQueryId, QueryId } from './util/query-id.js';
@@ -514,7 +514,7 @@ export interface FunctionModule<DB, TB extends keyof DB> {
514
514
  * $1 = any("person"."nicknames")
515
515
  * ```
516
516
  */
517
- any<RE extends StringReference<DB, TB>>(expr: RE): Exclude<ExtractTypeFromStringReference<DB, TB, RE>, null> extends ReadonlyArray<infer I> ? ExpressionWrapper<DB, TB, I> : KyselyTypeError<'any(expr) call failed: expr must be an array'>;
517
+ any<RE extends StringReference<DB, TB>>(expr: RE): Exclude<ExtractTypeFromReferenceExpression<DB, TB, RE>, null> extends ReadonlyArray<infer I> ? ExpressionWrapper<DB, TB, I> : KyselyTypeError<'any(expr) call failed: expr must be an array'>;
518
518
  any<T>(subquery: SelectQueryBuilderExpression<Record<string, T>>): ExpressionWrapper<DB, TB, T>;
519
519
  any<T>(expr: Expression<ReadonlyArray<T>>): ExpressionWrapper<DB, TB, T>;
520
520
  /**
@@ -180,9 +180,10 @@ export type ShallowDehydrateObject<O> = {
180
180
  /**
181
181
  * Dehydrates a value when it is not a valid JSON type.
182
182
  *
183
- * For now, we catch anything in {@link StringsWhenDataTypeNotAvailable} and convert it to `string`.
183
+ * For now, we catch anything in {@link StringsWhenDataTypeNotAvailable} and convert it to `string`,
184
+ * and anything in {@link NumbersWhenDataTypeNotAvailable} and convert it to `number`.
184
185
  */
185
- export type ShallowDehydrateValue<T> = [T] extends [
186
- (infer U)[] | null | undefined
187
- ] ? Array<ShallowDehydrateValue<U>> | Extract<T, null | undefined> : T extends Exclude<T, StringsWhenDataTypeNotAvailable> ? T : string | Exclude<T, StringsWhenDataTypeNotAvailable>;
188
- export type StringsWhenDataTypeNotAvailable = ArrayBuffer | bigint | Buffer | Date;
186
+ export type ShallowDehydrateValue<T> = T extends null | undefined ? T : T extends (infer U)[] | null | undefined ? Array<ShallowDehydrateValue<U>> | Extract<T, null | undefined> : Exclude<T, StringsWhenDataTypeNotAvailable | NumbersWhenDataTypeNotAvailable> | ([Extract<T, NumbersWhenDataTypeNotAvailable>] extends [never] ? never : number) | ([Extract<T, StringsWhenDataTypeNotAvailable>] extends [never] ? never : string);
187
+ export type StringsWhenDataTypeNotAvailable = Date | Uint8Array;
188
+ export type NumbersWhenDataTypeNotAvailable = bigint | NumericString;
189
+ export type NumericString = `${number}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kysely",
3
- "version": "0.28.3",
3
+ "version": "0.28.5",
4
4
  "description": "Type safe SQL query builder",
5
5
  "repository": {
6
6
  "type": "git",
@@ -50,36 +50,6 @@
50
50
  "default": "./dist/cjs/helpers/sqlite.js"
51
51
  }
52
52
  },
53
- "scripts": {
54
- "clean": "rm -rf dist & rm -rf test/node/dist & rm -rf test/browser/bundle.js & rm -rf helpers",
55
- "bench:ts": "npm run build && cd ./test/ts-benchmarks && node --experimental-strip-types ./index.ts",
56
- "test": "npm run build && npm run test:node:build && npm run test:node:run && npm run test:typings && npm run test:esmimports && npm run test:exports",
57
- "test:node:build": "tsc -p test/node",
58
- "test:node": "npm run build && npm run test:node:build && npm run test:node:run",
59
- "test:node:run": "mocha --timeout 15000 test/node/dist/**/*.test.js",
60
- "test:browser:build": "rm -rf test/browser/bundle.js && esbuild test/browser/main.ts --bundle --outfile=test/browser/bundle.js",
61
- "test:browser": "npm run build && npm run test:browser:build && node test/browser/test.js",
62
- "test:bun": "npm run build && bun link && cd test/bun && bun install && bun run test",
63
- "test:cloudflare-workers": "npm run build && cd test/cloudflare-workers && npm ci && npm test",
64
- "test:deno": "deno run --allow-env --allow-read --allow-net test/deno/local.test.ts && deno run --allow-env --allow-read --allow-net test/deno/cdn.test.ts",
65
- "test:typings": "tsd test/typings",
66
- "test:esmimports": "node scripts/check-esm-imports.js",
67
- "test:esbuild": "esbuild --bundle --platform=node --external:pg-native dist/esm/index.js --outfile=/dev/null",
68
- "test:exports": "attw --pack . && node scripts/check-exports.js",
69
- "test:jsdocs": "deno check --doc-only --no-lock --unstable-sloppy-imports --config=\"deno.check.json\" ./src",
70
- "test:outdatedts": "npm run build && cd test/outdated-ts && npm ci && npm test",
71
- "prettier": "prettier --write 'src/**/*.ts' 'test/**/*.ts'",
72
- "build": "npm run clean && (npm run build:esm & npm run build:cjs) && npm run script:module-fixup && npm run script:copy-interface-doc",
73
- "build:esm": "tsc -p tsconfig.json && npm run script:add-deno-type-references",
74
- "build:cjs": "tsc -p tsconfig-cjs.json",
75
- "script:module-fixup": "node scripts/module-fixup.js",
76
- "script:copy-interface-doc": "node scripts/copy-interface-documentation.js",
77
- "script:add-deno-type-references": "node scripts/add-deno-type-references.js",
78
- "script:align-site-version": "node scripts/align-site-version.js",
79
- "script:generate-site-examples": "node scripts/generate-site-examples.js",
80
- "prepublishOnly": "npm run build && npm run test:exports",
81
- "version": "npm run script:align-site-version && git add ."
82
- },
83
53
  "author": "Sami Koskimäki <sami@jakso.me>",
84
54
  "license": "MIT",
85
55
  "contributors": [
@@ -92,7 +62,6 @@
92
62
  "@types/better-sqlite3": "^7.6.13",
93
63
  "@types/chai": "^5.0.1",
94
64
  "@types/chai-as-promised": "^8.0.2",
95
- "@types/chai-subset": "^1.3.6",
96
65
  "@types/mocha": "^10.0.10",
97
66
  "@types/node": "^22.15.3",
98
67
  "@types/pg": "^8.11.14",
@@ -103,7 +72,6 @@
103
72
  "better-sqlite3": "^11.9.1",
104
73
  "chai": "^5.2.0",
105
74
  "chai-as-promised": "^8.0.1",
106
- "chai-subset": "^1.6.0",
107
75
  "esbuild": "^0.25.3",
108
76
  "lodash": "^4.17.21",
109
77
  "mocha": "^11.2.2",
@@ -119,5 +87,34 @@
119
87
  "tedious": "^19.0.0",
120
88
  "tsd": "^0.32.0",
121
89
  "typescript": "^5.8.3"
90
+ },
91
+ "scripts": {
92
+ "clean": "rm -rf dist & rm -rf test/node/dist & rm -rf test/browser/bundle.js & rm -rf helpers",
93
+ "bench:ts": "pnpm build && cd ./test/ts-benchmarks && node --experimental-strip-types ./index.ts",
94
+ "test": "pnpm build && pnpm test:node:build && pnpm test:node:run && pnpm test:typings && pnpm test:esmimports && pnpm test:exports",
95
+ "test:node:build": "tsc -p test/node",
96
+ "test:node": "pnpm build && pnpm test:node:build && pnpm test:node:run",
97
+ "test:node:run": "mocha --timeout 15000 test/node/dist/**/*.test.js",
98
+ "test:browser:build": "rm -rf test/browser/bundle.js && esbuild test/browser/main.ts --bundle --outfile=test/browser/bundle.js",
99
+ "test:browser": "pnpm build && pnpm test:browser:build && node test/browser/test.js",
100
+ "test:bun": "pnpm build && bun link && cd test/bun && bun install && bun run test",
101
+ "test:cloudflare-workers": "pnpm build && pnpm -r test --filter kysely-cloudflare-workers-test",
102
+ "test:deno": "deno run --allow-env --allow-read --allow-net test/deno/local.test.ts && deno run --allow-env --allow-read --allow-net test/deno/cdn.test.ts",
103
+ "test:typings": "tsd test/typings",
104
+ "test:esmimports": "node scripts/check-esm-imports.js",
105
+ "test:esbuild": "esbuild --bundle --platform=node --external:pg-native dist/esm/index.js --outfile=/dev/null",
106
+ "test:exports": "attw --pack . && node scripts/check-exports.js",
107
+ "test:jsdocs": "deno check --doc-only --no-lock --unstable-sloppy-imports --config=\"deno.check.json\" ./src",
108
+ "test:outdatedts": "pnpm build && cd test/outdated-ts && pnpm i && pnpm test",
109
+ "prettier": "prettier --write 'src/**/*.ts' 'test/**/*.ts'",
110
+ "build": "pnpm clean && (pnpm build:esm & pnpm build:cjs) && pnpm script:module-fixup && pnpm script:copy-interface-doc",
111
+ "build:esm": "tsc -p tsconfig.json && pnpm script:add-deno-type-references",
112
+ "build:cjs": "tsc -p tsconfig-cjs.json",
113
+ "script:module-fixup": "node scripts/module-fixup.js",
114
+ "script:copy-interface-doc": "node scripts/copy-interface-documentation.js",
115
+ "script:add-deno-type-references": "node scripts/add-deno-type-references.js",
116
+ "script:align-site-version": "node --experimental-strip-types scripts/align-site-version.mts",
117
+ "script:generate-site-examples": "node scripts/generate-site-examples.js",
118
+ "version": "pnpm script:align-site-version && git add ."
122
119
  }
123
- }
120
+ }