Skip to content

Commit

Permalink
v0.27.2
Browse files Browse the repository at this point in the history
  • Loading branch information
koskimas committed Jan 6, 2024
1 parent e034c0e commit 5091048
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 45 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kysely",
"version": "0.27.1",
"version": "0.27.2",
"description": "Type safe SQL query builder",
"repository": {
"type": "git",
Expand Down
2 changes: 0 additions & 2 deletions src/query-builder/insert-query-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {
} from '../parser/select-parser.js'
import {
InsertExpression,
InsertObjectOrList,
InsertObjectOrListFactory,
parseInsertExpression,
} from '../parser/insert-values-parser.js'
import { InsertQueryNode } from '../operation-node/insert-query-node.js'
Expand Down
2 changes: 0 additions & 2 deletions src/query-builder/update-query-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ import {
import { UpdateQueryNode } from '../operation-node/update-query-node.js'
import {
UpdateObjectExpression,
UpdateObject,
UpdateObjectFactory,
ExtractUpdateTypeFromReferenceExpression,
parseUpdate,
} from '../parser/update-set-parser.js'
Expand Down
58 changes: 20 additions & 38 deletions test/typings/test-d/kysely-any.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,59 +1,41 @@
import {
DeleteResult,
InsertResult,
Kysely,
UpdateResult,
expressionBuilder,
} from '..'
import { DeleteResult, InsertResult, Kysely, UpdateResult } from '..'
import { expectType } from 'tsd'

async function testKyselyAnySelects(db: Kysely<any>) {
const r1 = await db.selectFrom('foo').select('bar').execute()
expectType<
{
bar: any
}[]
>(r1)
expectType<{ bar: any }[]>(r1)

const r2 = await db.selectFrom('foo').select(['bar', 'baz']).execute()
expectType<
{
bar: any
baz: any
}[]
>(r2)
expectType<{ bar: any; baz: any }[]>(r2)

const r3 = await db.selectFrom('foo').select('foo.bar').execute()
expectType<
{
bar: any
}[]
>(r3)
expectType<{ bar: any }[]>(r3)

const r4 = await db
.selectFrom('foo')
.select(['spam', 'foo.bar', 'foo.baz'])
.execute()
expectType<
{
spam: any
bar: any
baz: any
}[]
>(r4)
expectType<{ spam: any; bar: any; baz: any }[]>(r4)

const r5 = await db
.selectFrom(['foo1', 'foo2'])
.select(['spam', 'foo1.bar', 'foo2.baz', 'doesnotexists.fux'])
.execute()
expectType<
{
spam: any
bar: any
baz: any
fux: never
}[]
>(r5)
expectType<{ spam: any; bar: any; baz: any; fux: never }[]>(r5)

const r6 = await db
.selectFrom('foo')
.select((eb) => [
eb.lit(1).as('baz'),
eb.ref('foo.bar').as('bar'),
eb
.selectFrom('bar')
.select('spam')
.whereRef('foo.id', '=', 'bar.id')
.as('spam'),
])
.executeTakeFirstOrThrow()
expectType<{ bar: any; spam: any; baz: 1 }>(r6)
}

async function testKyselyAnyInserts(db: Kysely<any>) {
Expand Down
4 changes: 2 additions & 2 deletions test/typings/test-d/update.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ async function testUpdate(db: Kysely<Database>) {
db
.updateTable('pet as p')
.where('p.id', '=', '1')
.set({ not_a_column: 'Fluffy' })
.set({ name: 'Fluffy', not_a_column: 'not_a_column' })
)

// Non-existent column in a callback
expectError(
db
.updateTable('pet as p')
.where('p.id', '=', '1')
.set((eb) => ({ not_a_column: 'Fluffy' }))
.set((eb) => ({ not_a_column: eb.val('not_a_column') }))
)

// GeneratedAlways column is not allowed to be updated
Expand Down

1 comment on commit 5091048

@vercel
Copy link

@vercel vercel bot commented on 5091048 Jan 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

kysely – ./

kysely-git-master-kysely-team.vercel.app
www.kysely.dev
kysely-kysely-team.vercel.app
kysely.dev

Please sign in to comment.