@typesql/kysely 0.1.0 → 0.1.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @typesql/kysely
2
2
 
3
+ ## 0.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Docs, package descriptions and error messages spell the project name TypeSQL.
8
+
9
+ - Updated dependencies:
10
+ - @typesql/core@0.1.1
11
+
3
12
  ## 0.1.0
4
13
 
5
14
  ### Minor Changes
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @typesql/kysely
2
2
 
3
- Use the `DB` interface you already have for [Kysely](https://kysely.dev) as a typesql schema:
3
+ Use the `DB` interface you already have for [Kysely](https://kysely.dev) as a TypeSQL schema:
4
4
  the one generated by [kysely-codegen](https://github.com/RobinBlomberg/kysely-codegen), by
5
5
  [prisma-kysely](https://github.com/valtyr/prisma-kysely), or written by hand. The conversion is
6
6
  type-level only; nothing is generated and no database is contacted.
@@ -58,7 +58,7 @@ const same = createCoreSql<FromKysely<DB>, PgTypeMap>(); // types only, no clien
58
58
  ```
59
59
 
60
60
  Queries are sent as `CompiledQuery.raw(q.text, q.values)` through
61
- `db.withoutPlugins().executeQuery(...)`. Plugins are bypassed on purpose: typesql's row types
61
+ `db.withoutPlugins().executeQuery(...)`. Plugins are bypassed on purpose: TypeSQL's row types
62
62
  describe what Postgres returns (`created_at`), and a result transformer such as
63
63
  `CamelCasePlugin` would rename the keys (use `{ rowKeys: "camelCase" }` for camelCase rows).
64
64
  Logging, the dialect and the connection pool are unaffected. Inside a Kysely transaction,
@@ -66,7 +66,7 @@ Logging, the dialect and the connection pool are unaffected. Inside a Kysely tra
66
66
 
67
67
  ## How columns are converted
68
68
 
69
- Kysely describes a column by its TS type; typesql needs a Postgres type name. The TS shape
69
+ Kysely describes a column by its TS type; TypeSQL needs a Postgres type name. The TS shape
70
70
  is read back as follows (for `ColumnType<S, I, U>` the select type `S` decides, the insert type
71
71
  `I` breaks ties):
72
72
 
@@ -187,7 +187,7 @@ const post = await sql("SELECT author_id, created_at FROM blog_posts WHERE id =
187
187
  `unknown` either way; only `INSERT` stops requiring the column. Override with
188
188
  `{ nullable: false }` to get the not-null check back.
189
189
  - **JSON shapes are not kept.** `JSONColumnType<{ a: number }>` becomes `jsonb`, read as
190
- `unknown` (the type map decides; typesql has no per-column TS types).
190
+ `unknown` (the type map decides; TypeSQL has no per-column TS types).
191
191
  - **Views look like tables.** Kysely interfaces do not mark views; mark them with `$view: true`
192
192
  to have writes rejected.
193
193
  - **Defaults come from `Generated`/`GeneratedAlways` only.** A column with a default that the
package/dist/client.d.ts CHANGED
@@ -2,7 +2,7 @@ import { CompiledQuery, type QueryResult } from "kysely";
2
2
  import { type Executor, type SqlDriver } from "@typesql/core";
3
3
  /**
4
4
  * What the adapter uses from a `Kysely<DB>` or `Transaction<DB>`. Queries run through
5
- * `withoutPlugins()`: typesql's row types describe what the driver returns, so result
5
+ * `withoutPlugins()`: TypeSQL's row types describe what the driver returns, so result
6
6
  * transformers such as `CamelCasePlugin` must not rename the columns (`createSql(db,
7
7
  * { rowKeys: "camelCase" })` renames the top-level keys instead, in the types too).
8
8
  */
@@ -1,7 +1,7 @@
1
1
  import type { ColDesc, PgScalarName, View } from "@typesql/core";
2
2
  /**
3
3
  * Converting a Kysely `DB` interface (kysely-codegen, prisma-kysely or hand-written) into a
4
- * typesql schema. Kysely describes columns with TS types, typesql with Postgres type names, so
4
+ * TypeSQL schema. Kysely describes columns with TS types, TypeSQL with Postgres type names, so
5
5
  * the conversion reads the TS shape back into a type name. That is lossy (`number` may be
6
6
  * `int4` or `float8`); `Overrides` pins the exact type per column.
7
7
  *
@@ -46,10 +46,10 @@ export type KyselyOptions = {
46
46
  readonly camelCase?: boolean;
47
47
  };
48
48
  /**
49
- * A typesql schema from a Kysely `DB` interface.
49
+ * A TypeSQL schema from a Kysely `DB` interface.
50
50
  *
51
51
  * type Schema = FromKysely<DB, { users: { id: "int8" } }>;
52
- * const sql = createSql<Schema>(); // typesql's createSql
52
+ * const sql = createSql<Schema>(); // TypeSQL's createSql
53
53
  *
54
54
  * `"auth.users"` becomes `Schema["auth"]["users"]`; `"public.users"` becomes `Schema["users"]`.
55
55
  * String-literal unions become enums registered in `Schema["$types"]` (see `KyselyOverrides`).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@typesql/kysely",
3
- "version": "0.1.0",
4
- "description": "Use Kysely database interfaces (kysely-codegen, prisma-kysely) as a typesql schema.",
3
+ "version": "0.1.1",
4
+ "description": "Use Kysely database interfaces (kysely-codegen, prisma-kysely) as a TypeSQL schema.",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -28,7 +28,7 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@typesql/core": "0.1.0"
31
+ "@typesql/core": "0.1.1"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "kysely": ">=0.27"
package/src/client.ts CHANGED
@@ -3,7 +3,7 @@ import { runTransaction, type Executor, type SqlDriver } from "@typesql/core";
3
3
 
4
4
  /**
5
5
  * What the adapter uses from a `Kysely<DB>` or `Transaction<DB>`. Queries run through
6
- * `withoutPlugins()`: typesql's row types describe what the driver returns, so result
6
+ * `withoutPlugins()`: TypeSQL's row types describe what the driver returns, so result
7
7
  * transformers such as `CamelCasePlugin` must not rename the columns (`createSql(db,
8
8
  * { rowKeys: "camelCase" })` renames the top-level keys instead, in the types too).
9
9
  */
@@ -2,7 +2,7 @@ import type { ColDesc, PgScalarName, View } from "@typesql/core";
2
2
 
3
3
  /**
4
4
  * Converting a Kysely `DB` interface (kysely-codegen, prisma-kysely or hand-written) into a
5
- * typesql schema. Kysely describes columns with TS types, typesql with Postgres type names, so
5
+ * TypeSQL schema. Kysely describes columns with TS types, TypeSQL with Postgres type names, so
6
6
  * the conversion reads the TS shape back into a type name. That is lossy (`number` may be
7
7
  * `int4` or `float8`); `Overrides` pins the exact type per column.
8
8
  *
@@ -48,10 +48,10 @@ export type KyselyOverrides = { readonly [table: string]: TableOverride };
48
48
  export type KyselyOptions = { readonly camelCase?: boolean };
49
49
 
50
50
  /**
51
- * A typesql schema from a Kysely `DB` interface.
51
+ * A TypeSQL schema from a Kysely `DB` interface.
52
52
  *
53
53
  * type Schema = FromKysely<DB, { users: { id: "int8" } }>;
54
- * const sql = createSql<Schema>(); // typesql's createSql
54
+ * const sql = createSql<Schema>(); // TypeSQL's createSql
55
55
  *
56
56
  * `"auth.users"` becomes `Schema["auth"]["users"]`; `"public.users"` becomes `Schema["users"]`.
57
57
  * String-literal unions become enums registered in `Schema["$types"]` (see `KyselyOverrides`).