@xata.io/kysely
Advanced tools
Comparing version 0.0.0-alpha.ve1e9676 to 0.0.0-alpha.ve2280a6f6a845750b4b7748f7513671bf6aeb4ce
179
CHANGELOG.md
# @xata.io/kysely | ||
## 0.0.0-alpha.ve1e9676 | ||
## 0.0.0-alpha.ve2280a6f6a845750b4b7748f7513671bf6aeb4ce | ||
### Patch Changes | ||
- Updated dependencies [[`1b0e04ab`](https://github.com/xataio/client-ts/commit/1b0e04ab7b336b0d8b8bb14c4de84b48343476ad)]: | ||
- @xata.io/client@0.0.0-alpha.ve1e9676 | ||
- Force canary build | ||
- Updated dependencies []: | ||
- @xata.io/client@0.0.0-alpha.ve2280a6f6a845750b4b7748f7513671bf6aeb4ce | ||
## 0.2.1 | ||
### Patch Changes | ||
- Updated dependencies [[`8fe6fbf`](https://github.com/xataio/client-ts/commit/8fe6fbf3e6f0983723d770c942a5a202eee6fb8f)]: | ||
- @xata.io/client@0.30.1 | ||
## 0.2.0 | ||
### Minor Changes | ||
- [#1535](https://github.com/xataio/client-ts/pull/1535) [`40f97d5`](https://github.com/xataio/client-ts/commit/40f97d53091af3d268fe40b4e027245270d42a26) Thanks [@SferaDev](https://github.com/SferaDev)! - Improve types | ||
### Patch Changes | ||
- Updated dependencies [[`cc673c9`](https://github.com/xataio/client-ts/commit/cc673c9a7885351082020e360630eab5db78c652)]: | ||
- @xata.io/client@0.30.0 | ||
## 0.1.22 | ||
### Patch Changes | ||
- [#1491](https://github.com/xataio/client-ts/pull/1491) [`f4a5ee7`](https://github.com/xataio/client-ts/commit/f4a5ee707dd04280f59919c97ff9cc0b1e9b01e6) Thanks [@SferaDev](https://github.com/SferaDev)! - [Kysely] Add consistency to client initialization | ||
## 0.1.21 | ||
### Patch Changes | ||
- Updated dependencies [[`6b754d2`](https://github.com/xataio/client-ts/commit/6b754d2f6a1f7b9378a96fe27502ff6c29ff5ed8)]: | ||
- @xata.io/client@0.29.5 | ||
## 0.1.20 | ||
### Patch Changes | ||
- Updated dependencies [[`2140a24`](https://github.com/xataio/client-ts/commit/2140a24f32a94f36bab8c8268033c7dcf235dddc), [`d8032f2`](https://github.com/xataio/client-ts/commit/d8032f2e07bdcc653db1606796d27f08d397cdbe)]: | ||
- @xata.io/client@0.29.4 | ||
## 0.1.19 | ||
### Patch Changes | ||
- Updated dependencies [[`02053fb`](https://github.com/xataio/client-ts/commit/02053fbb10479b8e9453691f957d3235762555aa), [`e27cb74`](https://github.com/xataio/client-ts/commit/e27cb74143aa9b6c654713878e5d3776858e5290)]: | ||
- @xata.io/client@0.29.3 | ||
## 0.1.18 | ||
### Patch Changes | ||
- Updated dependencies [[`e8db1cd`](https://github.com/xataio/client-ts/commit/e8db1cd394ccbed32403548bf9d09a5c3973d850)]: | ||
- @xata.io/client@0.29.2 | ||
## 0.1.17 | ||
### Patch Changes | ||
- Updated dependencies [[`d0f5d12`](https://github.com/xataio/client-ts/commit/d0f5d125e6c2f4c82f8a0a6b4a30d255c58e8326), [`212b53d`](https://github.com/xataio/client-ts/commit/212b53d07498def0d2ed8942691eff982e448969), [`9fd8c42`](https://github.com/xataio/client-ts/commit/9fd8c428d71b476f1951123c6cba5e803b983e54), [`368d4aa`](https://github.com/xataio/client-ts/commit/368d4aa16cd1cc1da93a142406c5d41bbc15b082)]: | ||
- @xata.io/client@0.29.1 | ||
## 0.1.16 | ||
### Patch Changes | ||
- Updated dependencies [[`0ec026a`](https://github.com/xataio/client-ts/commit/0ec026a92bdb1a405cb9d90cb1d506ff159f98e8), [`6414bd3`](https://github.com/xataio/client-ts/commit/6414bd3d8bdb84961e68968df4b0b025503f0d72), [`27773df`](https://github.com/xataio/client-ts/commit/27773df5addf0013d1a7238ac490904e7aad2334)]: | ||
- @xata.io/client@0.29.0 | ||
## 0.1.15 | ||
### Patch Changes | ||
- Updated dependencies [[`adc961b`](https://github.com/xataio/client-ts/commit/adc961b886b789010e6512c17cb2377eceab665a), [`6031a9d`](https://github.com/xataio/client-ts/commit/6031a9de63c264b7db5b031bb1795258c2bf8150)]: | ||
- @xata.io/client@0.28.4 | ||
## 0.1.14 | ||
### Patch Changes | ||
- Updated dependencies [[`b7f3ec9`](https://github.com/xataio/client-ts/commit/b7f3ec9eabe3642929131e244bd774f4d3134482)]: | ||
- @xata.io/client@0.28.3 | ||
## 0.1.13 | ||
### Patch Changes | ||
- Updated dependencies [[`c9178e1`](https://github.com/xataio/client-ts/commit/c9178e1e3f2268513e78dcfce396a99a8fca5dfb)]: | ||
- @xata.io/client@0.28.2 | ||
## 0.1.12 | ||
### Patch Changes | ||
- Updated dependencies [[`9a7e3f5`](https://github.com/xataio/client-ts/commit/9a7e3f5029e53efc6750e9c86bab936427788209)]: | ||
- @xata.io/client@0.28.1 | ||
## 0.1.11 | ||
### Patch Changes | ||
- Updated dependencies [[`e97d1999`](https://github.com/xataio/client-ts/commit/e97d1999f3c25f149213ceca81958e1674624e05)]: | ||
- @xata.io/client@0.28.0 | ||
## 0.1.10 | ||
### Patch Changes | ||
- Updated dependencies [[`19c5dd47`](https://github.com/xataio/client-ts/commit/19c5dd47e3a032fcb19d990527b8faaa9326d97d), [`d282d18f`](https://github.com/xataio/client-ts/commit/d282d18f025094e0729ade6009b34fc0d34ebbba)]: | ||
- @xata.io/client@0.27.0 | ||
## 0.1.9 | ||
### Patch Changes | ||
- Updated dependencies [[`302798e8`](https://github.com/xataio/client-ts/commit/302798e8d210c89f420a5c927e0f836a27dbaed9)]: | ||
- @xata.io/client@0.26.9 | ||
## 0.1.8 | ||
### Patch Changes | ||
- Updated dependencies [[`fa2883b0`](https://github.com/xataio/client-ts/commit/fa2883b0639e48d68097401bf515c8cb95df5b4b), [`c04faece`](https://github.com/xataio/client-ts/commit/c04faece8830699d978e03c89f29e383e479e824), [`cb45cc9f`](https://github.com/xataio/client-ts/commit/cb45cc9f6829e1b555762e656cc1b0b2e977aaf9)]: | ||
- @xata.io/client@0.26.8 | ||
## 0.1.7 | ||
### Patch Changes | ||
- Updated dependencies [[`0e1c50de`](https://github.com/xataio/client-ts/commit/0e1c50de5850db2dfbbdfff9d66eda3bf1322836), [`d093d363`](https://github.com/xataio/client-ts/commit/d093d363a51fc23c8513d51600bb3b31bbc45334)]: | ||
- @xata.io/client@0.26.7 | ||
## 0.1.6 | ||
### Patch Changes | ||
- Updated dependencies [[`3330c9cf`](https://github.com/xataio/client-ts/commit/3330c9cf8d8db18b8e355a576e4afd589b6152bf), [`a738816d`](https://github.com/xataio/client-ts/commit/a738816d355f4415b0622bb5a23b4154f9855177)]: | ||
- @xata.io/client@0.26.6 | ||
## 0.1.5 | ||
### Patch Changes | ||
- Updated dependencies [[`b9b9058f`](https://github.com/xataio/client-ts/commit/b9b9058f0bc81b660da45318c27191a62f041f21)]: | ||
- @xata.io/client@0.26.5 | ||
## 0.1.4 | ||
### Patch Changes | ||
- Updated dependencies [[`7166797c`](https://github.com/xataio/client-ts/commit/7166797c28839198d20a9115d0414cebc2fed39b), [`b85df75f`](https://github.com/xataio/client-ts/commit/b85df75f2f466762a8b3d9824c9292c7e3db03fd)]: | ||
- @xata.io/client@0.26.4 | ||
## 0.1.3 | ||
### Patch Changes | ||
- Updated dependencies [[`4910dce2`](https://github.com/xataio/client-ts/commit/4910dce29d3cc17d13aadf32e4eb476ffb571fad)]: | ||
- @xata.io/client@0.26.3 | ||
## 0.1.2 | ||
### Patch Changes | ||
- Updated dependencies [[`22fccb51`](https://github.com/xataio/client-ts/commit/22fccb51709749c319897702c15749b74ce4b820)]: | ||
- @xata.io/client@0.26.2 | ||
## 0.1.1 | ||
### Patch Changes | ||
- Updated dependencies [[`922e6e54`](https://github.com/xataio/client-ts/commit/922e6e54e8b31641770a36b6b4ff8f4fa65d304d), [`13f6f3e4`](https://github.com/xataio/client-ts/commit/13f6f3e4b1a2f925d50a5380b62ef1057f5c3893), [`f02fc165`](https://github.com/xataio/client-ts/commit/f02fc165bf6558e4377eb9f8e1d0f4222f004c70)]: | ||
- @xata.io/client@0.26.1 | ||
## 0.1.0 | ||
@@ -11,0 +184,0 @@ |
@@ -1,12 +0,68 @@ | ||
import { XataRecord, XataPlugin, XataPluginOptions, EditableData } from '@xata.io/client'; | ||
import { Kysely } from 'kysely'; | ||
import { SQLPluginResult, XataRecord, XataPlugin, XataPluginOptions } from '@xata.io/client'; | ||
import { Dialect, PostgresAdapter, Driver, QueryCompiler, Kysely, DatabaseIntrospector, DatabaseConnection, CompiledQuery, QueryResult } from 'kysely'; | ||
type KyselyPluginResult<Schemas extends Record<string, XataRecord>> = Kysely<TransformSchema<Schemas>>; | ||
type XataDialectConfig = { | ||
xata: { | ||
sql: SQLPluginResult; | ||
}; | ||
/** | ||
* The consistency level to use when reading data. | ||
* @default 'strong' | ||
*/ | ||
consistency?: 'strong' | 'eventual'; | ||
}; | ||
declare class XataDialect implements Dialect { | ||
private config; | ||
constructor(config: XataDialectConfig); | ||
createAdapter(): PostgresAdapter; | ||
createDriver(): Driver; | ||
createQueryCompiler(): QueryCompiler; | ||
createIntrospector(db: Kysely<any>): DatabaseIntrospector; | ||
} | ||
declare class XataDriver implements Driver { | ||
private config; | ||
constructor(config: XataDialectConfig); | ||
init(): Promise<void>; | ||
acquireConnection(): Promise<DatabaseConnection>; | ||
beginTransaction(): Promise<void>; | ||
commitTransaction(): Promise<void>; | ||
rollbackTransaction(): Promise<void>; | ||
releaseConnection(_conn: XataConnection): Promise<void>; | ||
destroy(): Promise<void>; | ||
} | ||
declare class XataConnection implements DatabaseConnection { | ||
#private; | ||
constructor(config: XataDialectConfig); | ||
executeQuery<O>(compiledQuery: CompiledQuery): Promise<QueryResult<O>>; | ||
streamQuery<O>(_compiledQuery: CompiledQuery, _chunkSize: number): AsyncIterableIterator<QueryResult<O>>; | ||
} | ||
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 TransformSchema<Schemas extends Record<string, XataRecord>> = { | ||
[Model in keyof Schemas]: EditableData<Schemas[Model]>; | ||
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]>; | ||
}; | ||
export { KyselyPlugin, type KyselyPluginResult }; | ||
export { KyselyPlugin, type KyselyPluginResult, type Model, XataConnection, XataDialect, type XataDialectConfig, XataDriver }; |
{ | ||
"name": "@xata.io/kysely", | ||
"version": "0.0.0-alpha.ve1e9676", | ||
"version": "0.0.0-alpha.ve2280a6f6a845750b4b7748f7513671bf6aeb4ce", | ||
"description": "", | ||
@@ -21,9 +21,9 @@ "main": "./dist/index.cjs", | ||
"dependencies": { | ||
"@xata.io/client": "0.0.0-alpha.ve1e9676" | ||
"@xata.io/client": "0.0.0-alpha.ve2280a6f6a845750b4b7748f7513671bf6aeb4ce" | ||
}, | ||
"devDependencies": { | ||
"kysely": "^0.26.3" | ||
"kysely": "^0.27.4" | ||
}, | ||
"peerDependencies": { | ||
"kysely": "^0.26.1" | ||
"kysely": "*" | ||
}, | ||
@@ -30,0 +30,0 @@ "scripts": { |
@@ -10,2 +10,5 @@ # @xata.io/kysely | ||
```bash | ||
# with bun | ||
bun install kysely @xata.io/kysely @xata.io/client | ||
# with pnpm | ||
@@ -27,9 +30,14 @@ pnpm add kysely @xata.io/kysely @xata.io/client | ||
import { Kysely } from 'kysely'; | ||
import { XataDialect } from '@xata.io/kysely'; | ||
import { XataDialect, Model } from '@xata.io/kysely'; | ||
import { DatabaseSchema, getXataClient } from './xata.ts'; | ||
const db = new Kysely<Database>({ | ||
xata // Your Xata client instance | ||
const xata = getXataClient(); | ||
const db = new Kysely<Model<DatabaseSchema>>({ | ||
dialect: new XataDialect({ xata }) | ||
}); | ||
const drivers = await db.selectFrom('users').select(['name', 'email']).execute(); | ||
``` | ||
`XataDialect` accepts your Xata client instance as its only option. You can find more information about creating a Xata client instance in our [getting started guide](https://xata.io/docs/getting-started/installation). |
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
47268
11
350
42
+ Added@xata.io/client@0.0.0-alpha.ve2280a6f6a845750b4b7748f7513671bf6aeb4ce(transitive)
+ Addedkysely@0.27.5(transitive)
- Removed@xata.io/client@0.0.0-alpha.ve1e9676(transitive)
- Removedkysely@0.26.3(transitive)
Updated@xata.io/client@0.0.0-alpha.ve2280a6f6a845750b4b7748f7513671bf6aeb4ce