@xata.io/kysely
Advanced tools
Comparing version 0.0.0-alpha.vfc446ea to 0.0.0-alpha.vfc9ddd5
# @xata.io/kysely | ||
## 0.0.0-alpha.vfc446ea | ||
## 0.0.0-alpha.vfc9ddd5 | ||
### Patch Changes | ||
- [#893](https://github.com/xataio/client-ts/pull/893) [`0a56a28e`](https://github.com/xataio/client-ts/commit/0a56a28e12dd6c7b648f05ed2af3ba1e6fb40098) Thanks [@SferaDev](https://github.com/SferaDev)! - Initial release | ||
- Updated dependencies []: | ||
- @xata.io/client@0.0.0-alpha.vfc9ddd5 | ||
- Updated dependencies [[`0a56a28e`](https://github.com/xataio/client-ts/commit/0a56a28e12dd6c7b648f05ed2af3ba1e6fb40098)]: | ||
- @xata.io/client@0.0.0-alpha.vfc446ea | ||
## 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 | ||
### Minor Changes | ||
- [#893](https://github.com/xataio/client-ts/pull/893) [`6ec862f8`](https://github.com/xataio/client-ts/commit/6ec862f8f799eb692f62be79dd0b613b83a34780) Thanks [@SferaDev](https://github.com/SferaDev)! - Initial release | ||
### Patch Changes | ||
- Updated dependencies [[`6ec862f8`](https://github.com/xataio/client-ts/commit/6ec862f8f799eb692f62be79dd0b613b83a34780), [`0c0149ad`](https://github.com/xataio/client-ts/commit/0c0149ad1ee3f7c0fe9d31030552b022c907edb0)]: | ||
- @xata.io/client@0.26.0 |
@@ -1,12 +0,43 @@ | ||
import { XataRecord, XataPlugin, XataPluginOptions, EditableData } from '@xata.io/client'; | ||
import { Kysely } from 'kysely'; | ||
import { SQLPluginResult, XataRecord, XataPlugin, XataPluginOptions, EditableData } 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; | ||
}; | ||
}; | ||
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>> = { | ||
type Model<Schemas extends Record<string, XataRecord>> = { | ||
[Model in keyof Schemas]: EditableData<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.vfc446ea", | ||
"version": "0.0.0-alpha.vfc9ddd5", | ||
"description": "", | ||
@@ -21,6 +21,6 @@ "main": "./dist/index.cjs", | ||
"dependencies": { | ||
"@xata.io/client": "0.0.0-alpha.vfc446ea" | ||
"@xata.io/client": "0.0.0-alpha.vfc9ddd5" | ||
}, | ||
"devDependencies": { | ||
"kysely": "^0.26.1" | ||
"kysely": "^0.26.3" | ||
}, | ||
@@ -27,0 +27,0 @@ "peerDependencies": { |
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35154
240
42
+ Added@xata.io/client@0.0.0-alpha.vfc9ddd5(transitive)
- Removed@xata.io/client@0.0.0-alpha.vfc446ea(transitive)