@xata.io/kysely
Advanced tools
Comparing version 0.0.0-alpha.vc71ade5676ee932f117593c812e510bede6a65fd to 0.0.0-alpha.vc74f24c559710e0a575c0ffe192d378e497278e7
# @xata.io/kysely | ||
## 0.0.0-alpha.vc71ade5676ee932f117593c812e510bede6a65fd | ||
## 0.0.0-alpha.vc74f24c559710e0a575c0ffe192d378e497278e7 | ||
### Major Changes | ||
- [#1477](https://github.com/xataio/client-ts/pull/1477) [`e9c165d`](https://github.com/xataio/client-ts/commit/e9c165d3765bed18b2f4d7f6d8b815fef489ee61) Thanks [@SferaDev](https://github.com/SferaDev)! - Version 1.0 | ||
### Patch Changes | ||
@@ -9,5 +13,2 @@ | ||
- Updated dependencies []: | ||
- @xata.io/client@0.0.0-alpha.vc71ade5676ee932f117593c812e510bede6a65fd | ||
## 0.2.0 | ||
@@ -14,0 +15,0 @@ |
@@ -1,2 +0,1 @@ | ||
import { SQLPluginResult, XataRecord, XataPlugin, XataPluginOptions } from '@xata.io/client'; | ||
import { Dialect, PostgresAdapter, Driver, QueryCompiler, Kysely, DatabaseIntrospector, DatabaseConnection, CompiledQuery, QueryResult } from 'kysely'; | ||
@@ -6,3 +5,3 @@ | ||
xata: { | ||
sql: SQLPluginResult; | ||
sql: any; | ||
}; | ||
@@ -41,30 +40,6 @@ /** | ||
type KyselyPluginResult<Schemas extends Record<string, XataRecord>> = Kysely<Model<Schemas>>; | ||
declare class KyselyPlugin<Schemas extends Record<string, XataRecord>> extends XataPlugin { | ||
build(pluginOptions: XataPluginOptions): KyselyPluginResult<Schemas>; | ||
} | ||
type XataFilePgFields = { | ||
id?: string; | ||
mediaType?: string; | ||
size?: number; | ||
name?: string; | ||
enablePublicUrl?: boolean; | ||
signedUrlTimeout?: number; | ||
storageKey?: string; | ||
uploadKey?: string; | ||
uploadUrlTimeout?: number; | ||
version?: number; | ||
}; | ||
type RowTypeFields<T> = T extends { | ||
mediaType?: string; | ||
} ? XataFilePgFields : T extends Array<{ | ||
mediaType?: string; | ||
}> ? XataFilePgFields[] : T; | ||
type RowType<O> = { | ||
[K in keyof O]: RowTypeFields<NonNullable<O[K]>>; | ||
}; | ||
type Model<Schemas extends Record<string, any>> = { | ||
[Model in keyof Schemas]: RowType<Schemas[Model]>; | ||
[Model in keyof Schemas]: Schemas[Model]; | ||
}; | ||
export { KyselyPlugin, type KyselyPluginResult, type Model, XataConnection, XataDialect, type XataDialectConfig, XataDriver }; | ||
export { type Model, XataConnection, XataDialect, type XataDialectConfig, XataDriver }; |
{ | ||
"name": "@xata.io/kysely", | ||
"version": "0.0.0-alpha.vc71ade5676ee932f117593c812e510bede6a65fd", | ||
"version": "0.0.0-alpha.vc74f24c559710e0a575c0ffe192d378e497278e7", | ||
"description": "", | ||
@@ -20,5 +20,3 @@ "main": "./dist/index.cjs", | ||
}, | ||
"dependencies": { | ||
"@xata.io/client": "0.0.0-alpha.vc71ade5676ee932f117593c812e510bede6a65fd" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
@@ -25,0 +23,0 @@ "kysely": "^0.27.4" |
@@ -37,6 +37,6 @@ import { Kysely } from 'kysely'; | ||
describe('@xata.io/kysely plugin', () => { | ||
test('Select multiple columns', async () => { | ||
test.skip('Select multiple columns', async () => { | ||
const user = await xata.db.users.create({ name: 'John Doe', attachments: [file] }); | ||
const users = await db.selectFrom('users').selectAll().where('id', '=', user.id).execute(); | ||
const users = await db.selectFrom('users').selectAll().where('xata_id', '=', user.xata_id).execute(); | ||
@@ -47,3 +47,3 @@ expect(users).toHaveLength(1); | ||
expect(users[0].attachments?.[0].enablePublicUrl).toBe(false); | ||
expect(users[0].attachments?.[0].id).toBeDefined(); | ||
expect(users[0].attachments?.[0].xata_id).toBeDefined(); | ||
expect(users[0].attachments?.[0].mediaType).toBe('application/octet-stream'); | ||
@@ -61,3 +61,3 @@ expect(users[0].attachments?.[0].name).toBe(''); | ||
expect(users[0].full_name).toBe('John Doe'); | ||
expect(users[0].id).toBeDefined(); | ||
expect(users[0].xata_id).toBeDefined(); | ||
expect(users[0].index).toBe(null); | ||
@@ -85,5 +85,5 @@ expect(users[0].name).toBe('John Doe'); | ||
await db.updateTable('users').set('name', 'Jane Doe').where('id', '=', user.id).execute(); | ||
await db.updateTable('users').set('name', 'Jane Doe').where('xata_id', '=', user.xata_id).execute(); | ||
const users = await db.selectFrom('users').selectAll().where('id', '=', user.id).execute(); | ||
const users = await db.selectFrom('users').selectAll().where('xata_id', '=', user.xata_id).execute(); | ||
@@ -97,5 +97,5 @@ expect(users).toHaveLength(1); | ||
await db.updateTable('users').set('account_value', 200).where('id', '=', user.id).execute(); | ||
await db.updateTable('users').set('account_value', 200).where('xata_id', '=', user.xata_id).execute(); | ||
const users = await db.selectFrom('users').selectAll().where('id', '=', user.id).execute(); | ||
const users = await db.selectFrom('users').selectAll().where('xata_id', '=', user.xata_id).execute(); | ||
@@ -105,7 +105,7 @@ expect(users).toHaveLength(1); | ||
const incremented = await xata.db.users.update(user.id, { account_value: { $increment: 100 } }); | ||
const incremented = await xata.db.users.update(user.xata_id, { account_value: { $increment: 100 } }); | ||
expect(incremented?.account_value).toBe(300); | ||
const users2 = await db.selectFrom('users').selectAll().where('id', '=', user.id).execute(); | ||
const users2 = await db.selectFrom('users').selectAll().where('xata_id', '=', user.xata_id).execute(); | ||
@@ -119,3 +119,3 @@ expect(users2).toHaveLength(1); | ||
const users = await db.selectFrom('users').select('name as name2').where('id', '=', user.id).execute(); | ||
const users = await db.selectFrom('users').select('name as name2').where('xata_id', '=', user.xata_id).execute(); | ||
@@ -129,8 +129,12 @@ expect(users).toHaveLength(1); | ||
const teams = await db.selectFrom('teams').select(['id', 'labels']).where('id', '=', team.id).execute(); | ||
const teams = await db | ||
.selectFrom('teams') | ||
.select(['xata_id', 'labels']) | ||
.where('xata_id', '=', team.xata_id) | ||
.execute(); | ||
expect(teams).toHaveLength(1); | ||
expect(teams[0].id).toBeDefined(); | ||
expect(teams[0].xata_id).toBeDefined(); | ||
expect(teams[0].labels).toEqual(['A', 'B']); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1
42683
314
- Removed@xata.io/client@0.0.0-alpha.vc71ade5676ee932f117593c812e510bede6a65fd
- Removed@xata.io/client@0.0.0-alpha.vc71ade5676ee932f117593c812e510bede6a65fd(transitive)
- Removedtypescript@5.7.3(transitive)