@typesql/core 0.1.0 → 0.1.2

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,19 @@
1
1
  # @typesql/core
2
2
 
3
+ ## 0.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - npm package pages link to the documentation site and the issue tracker, and list keywords.
8
+
9
+ - READMEs link to an example in the TypeScript Playground.
10
+
11
+ ## 0.1.1
12
+
13
+ ### Patch Changes
14
+
15
+ - Docs, package descriptions and error messages spell the project name TypeSQL.
16
+
3
17
  ## 0.1.0
4
18
 
5
19
  ### Minor Changes
package/README.md CHANGED
@@ -9,6 +9,8 @@ dependencies.
9
9
  pnpm add @typesql/core
10
10
  ```
11
11
 
12
+ [Open an example in the TypeScript Playground](https://www.typescriptlang.org/play/#code/PTAEBUE8AcFMGUCKAZAXKACgewM4BcBzAJ1h1CWQBpRoBDInWAE1ACNIIYEBjIgS2h4A5GTxdQOSPlgBbAHSgAokz55QeABaxyKULQB2LDVgBusIuq3quOVACgQoIlgDuZAyzpFaM2HnNkAGZYADYhrtQeoDJ8+LQA1qR6JKDcWDLQfCHa5s4MoFj6ltr4-PoEcnZ8GVhEagDeqSS0-vAAjiHUYnCgAMKhXeIA4rD65i3Mgz0AcgCuYbSs2VPaGPQ+OFBwK6AASq5b2gC+oIHOMqAARAAC3aQdwGkklwDcdlX6-kSBtNzaACIAIVA9TsoFAs0YDHQoPB4L4THQIzG3n8TAAPJc+J8ACyXAB8L1Ajg0tHcoCYsB+8zw6Cwgj4hVoIQKRQAktN4IpduAwXDZLQsuh+iFMf4AB54AlvOEU2LQEK0SAAfX0Plg6DmCyWsDFsEl0r54N4sAmTGVLSRo3GaLF1VIeB8ggAXobwUcZTRcHhbCCjaAEVaUWbMdi8AAON1w2izTS1ZWBvqhUO4qPgvCqbLC5OXCVSwn+1hYJiQTXzRU6vUGgvut5Hd5pfT4CQdUAAXiaptaHXRQPxAAoAJRvBxgZCKABi4FAACkAPIc6IJJKabT8AgaNQ4BHafTlxbZIkAEgAjOpl2RVKJxGd0hC5AjKo3m212y2Qv2AAZc8e9aezB8mGoACBSyahoDkDM8Gyf1ZTg8EJ12OcAFkIShMhZlAccp1nBdpi9fAyGgUA53wiCYzjIgExYDsAIRWD4NlAB1AAJblFHvBE31PT9qAAdmHOw7j2Vw332FxDnRO4sECUA2gLRxwQAPQAfiE8Q1m8GQyA7TSNkk6TZPkt5FNAVT3kcABBAhiFgAgJncQxUlCWYZCKNVfCCUJwhcTBvVs300lmT5+wAKkHANL0+cNIgkPAygICFDHMUB9GLWAAFpoH8kgcCfQpmziH03xwDovx-RQ-z0WNjCohFqCCkLwuoGRaHFfsoOyCLLPgUBFX8ZtEJQgjiqGJCAFUMFAQEAE1qso6jP0E4T4EdYqO3EgyuBkuKWhwBSwGUtTR1ANl9BCbFtBMZlZiSegSlGNQyVAI8ii8dUvkclhuC0bhEhYWh7OxZsXC0FJVw4e60OYfKmzUUCWQ7S5aCYWhrn1J1sjkNIZFeOxnzUE0zRKsrPw5LkeVO6ZwDnaH8n7BGIoANUs5BxsUXr+yPepSpCOR3pkBnWqyQcjgi3ZFHAcbdmmDkhgDIDOzNC08CWt5hN6Zo0TEg4uCk7bZKJtEDrhcyTuQ2JHUSdwUhxzJslAXJajIQpih0ZA4oShQJz4cVihkexefKxRf2nfRfFAIbUMhAI1eJMAnaIdA0hCVyikucPYEuCksCSNL4fFS27CDsnOW5acORpkayA6zNYGZ1n2c509B14q4WNgMIsEuYd48dog8nQCjauoyLQGmOdp2mcbkA9qJSTINKKSpGMQjwOwgA) <!-- playground:core --> to hover the types and edit the SQL, with nothing to install.
13
+
12
14
  Add the adapter for your driver to run queries: [`@typesql/pg`](https://www.npmjs.com/package/@typesql/pg)
13
15
  (node-postgres) or [`@typesql/postgres`](https://www.npmjs.com/package/@typesql/postgres)
14
16
  (postgres.js). Already describing your database for an ORM? `@typesql/kysely`,
@@ -187,7 +187,7 @@ type GetRel<DB, Ref extends TableRef> = IsTop<Ref["schema"]> extends true ? Ref[
187
187
  type SchemaExists<DB, S> = IsTop<S> extends true ? true : S extends string ? IsSchemaKey<DB, S> : false;
188
188
  type NoSchema<S> = SqlError<`schema "${S & string}" does not exist`, null>;
189
189
  /** A new top-level relation would overwrite a schema (schemas and public relations share `DB`'s keys). */
190
- type SchemaClash<DB, Ref extends TableRef> = IsTop<Ref["schema"]> extends true ? Ref["name"] extends keyof DB ? SqlError<`cannot create relation "${Ref["name"]}": a schema with that name exists (typesql keeps schemas and public relations in one object)`, null> : null : null;
190
+ type SchemaClash<DB, Ref extends TableRef> = IsTop<Ref["schema"]> extends true ? Ref["name"] extends keyof DB ? SqlError<`cannot create relation "${Ref["name"]}": a schema with that name exists (TypeSQL keeps schemas and public relations in one object)`, null> : null : null;
191
191
  /** Checks before adding a relation at `Ref`: `null` when it can be added. */
192
192
  type CanCreate<DB, Ref extends TableRef> = SchemaExists<DB, Ref["schema"]> extends false ? NoSchema<Ref["schema"]> : SchemaClash<DB, Ref>;
193
193
  type PutRel<DB, Ref extends TableRef, V> = IsTop<Ref["schema"]> extends true ? SetKey<DB, Ref["name"], V> : Ref["schema"] extends keyof DB ? SetKey<DB, Ref["schema"] & string, SetKey<DB[Ref["schema"]], Ref["name"], V>> : NoSchema<Ref["schema"]>;
@@ -281,7 +281,7 @@ type NameCols<C extends Cols, Names, Acc extends Cols, TooMany extends string> =
281
281
  } ? NameCols<R, NR, [...Acc, {
282
282
  readonly n: N;
283
283
  readonly t: I;
284
- }], TooMany> : SqlError<"a column name list cannot rename the columns of a * projection (typesql limitation): list the columns explicitly", null> : SqlError<TooMany, null> : [...Acc, ...C];
284
+ }], TooMany> : SqlError<"a column name list cannot rename the columns of a * projection (TypeSQL limitation): list the columns explicitly", null> : SqlError<TooMany, null> : [...Acc, ...C];
285
285
  /** First duplicate output name, or null. */
286
286
  type DupCol<C extends Cols, Seen> = C extends readonly [infer H, ...infer R extends Cols] ? H extends {
287
287
  readonly star: infer M;
@@ -438,7 +438,7 @@ type DropTypeNs<NS, N extends string> = Rebuild<{
438
438
  type StripCols<Tbl, N extends string> = Rebuild<{
439
439
  [K in keyof Tbl as ColUses<Tbl[K], N> extends true ? never : K]: Tbl[K];
440
440
  }>;
441
- type ApplyCreateSchema<DB, Ine, Name extends string> = Name extends "public" ? (Ine extends true ? DB : SqlError<`schema "public" already exists`, null>) : Name extends keyof DB ? IsSchemaKey<DB, Name> extends true ? (Ine extends true ? DB : SqlError<`schema "${Name}" already exists`, null>) : SqlError<`cannot create schema "${Name}": a relation with that name exists (typesql keeps schemas and public relations in one object)`, null> : SetKey<DB, Name, {}>;
441
+ type ApplyCreateSchema<DB, Ine, Name extends string> = Name extends "public" ? (Ine extends true ? DB : SqlError<`schema "public" already exists`, null>) : Name extends keyof DB ? IsSchemaKey<DB, Name> extends true ? (Ine extends true ? DB : SqlError<`schema "${Name}" already exists`, null>) : SqlError<`cannot create schema "${Name}": a relation with that name exists (TypeSQL keeps schemas and public relations in one object)`, null> : SetKey<DB, Name, {}>;
442
442
  type ApplyDropSchemas<DB, Names, Ife, Casc> = Names extends readonly [infer N extends string, ...infer Rest] ? N extends "public" ? SqlError<"DROP SCHEMA public is not supported", null> : IsSchemaKey<DB, N> extends true ? [keyof DB[N & keyof DB]] extends [never] ? ApplyDropSchemas<DelKey<DB, N>, Rest, Ife, Casc> : Casc extends true ? ApplyDropSchemas<DelKey<DB, N>, Rest, Ife, Casc> : SqlError<`cannot drop schema ${N} because other objects depend on it`, null> : Ife extends true ? ApplyDropSchemas<DB, Rest, Ife, Casc> : SqlError<`schema "${N}" does not exist`, null> : DB;
443
443
  type ApplyRenameSchema<DB, F extends string, To extends string> = IsSchemaKey<DB, F> extends true ? To extends keyof DB | "public" ? SqlError<`schema "${To}" already exists`, null> : RenameKey<DB, F, To> : SqlError<`schema "${F}" does not exist`, null>;
444
444
  export {};
@@ -1,7 +1,7 @@
1
1
  import type { Col, Nullable, View } from "./column.js";
2
2
  /**
3
3
  * Relations of `pg_catalog` in the {@link PgCatalog} slice. Catalog tables are declared as
4
- * views too: typesql treats the whole slice as read-only.
4
+ * views too: TypeSQL treats the whole slice as read-only.
5
5
  */
6
6
  export interface PgCatalogNamespace {
7
7
  /** Table `pg_catalog.pg_am`: Access methods. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typesql/core",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Type-level Postgres SQL inference for TypeScript. Zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -34,6 +34,23 @@
34
34
  "typescript": "7.0.2",
35
35
  "vitest": "^5.0.4"
36
36
  },
37
+ "homepage": "https://typesql.karsli.net",
38
+ "bugs": {
39
+ "url": "https://github.com/ismailkarsli/typesql/issues"
40
+ },
41
+ "author": "İsmail Karslı",
42
+ "keywords": [
43
+ "sql",
44
+ "postgres",
45
+ "postgresql",
46
+ "typescript",
47
+ "type-safe",
48
+ "type-level",
49
+ "raw-sql",
50
+ "no-codegen",
51
+ "sql-parser",
52
+ "database"
53
+ ],
37
54
  "scripts": {
38
55
  "build": "tsc -p tsconfig.build.json",
39
56
  "typecheck": "tsc -p tsconfig.json --noEmit",
@@ -177,7 +177,7 @@ type NoSchema<S> = SqlError<`schema "${S & string}" does not exist`, null>;
177
177
  /** A new top-level relation would overwrite a schema (schemas and public relations share `DB`'s keys). */
178
178
  type SchemaClash<DB, Ref extends TableRef> =
179
179
  IsTop<Ref["schema"]> extends true
180
- ? Ref["name"] extends keyof DB ? SqlError<`cannot create relation "${Ref["name"]}": a schema with that name exists (typesql keeps schemas and public relations in one object)`, null> : null
180
+ ? Ref["name"] extends keyof DB ? SqlError<`cannot create relation "${Ref["name"]}": a schema with that name exists (TypeSQL keeps schemas and public relations in one object)`, null> : null
181
181
  : null;
182
182
  /** Checks before adding a relation at `Ref`: `null` when it can be added. */
183
183
  type CanCreate<DB, Ref extends TableRef> =
@@ -326,7 +326,7 @@ type NameCols<C extends Cols, Names, Acc extends Cols, TooMany extends string> =
326
326
  Names extends readonly [infer N extends string, ...infer NR]
327
327
  ? C extends readonly [infer H, ...infer R extends Cols]
328
328
  ? H extends { readonly n: string; readonly t: infer I extends ColInfo } ? NameCols<R, NR, [...Acc, { readonly n: N; readonly t: I }], TooMany>
329
- : SqlError<"a column name list cannot rename the columns of a * projection (typesql limitation): list the columns explicitly", null>
329
+ : SqlError<"a column name list cannot rename the columns of a * projection (TypeSQL limitation): list the columns explicitly", null>
330
330
  : SqlError<TooMany, null>
331
331
  : [...Acc, ...C];
332
332
 
@@ -585,7 +585,7 @@ type ApplyCreateSchema<DB, Ine, Name extends string> =
585
585
  Name extends "public" ? (Ine extends true ? DB : SqlError<`schema "public" already exists`, null>)
586
586
  : Name extends keyof DB
587
587
  ? IsSchemaKey<DB, Name> extends true ? (Ine extends true ? DB : SqlError<`schema "${Name}" already exists`, null>)
588
- : SqlError<`cannot create schema "${Name}": a relation with that name exists (typesql keeps schemas and public relations in one object)`, null>
588
+ : SqlError<`cannot create schema "${Name}": a relation with that name exists (TypeSQL keeps schemas and public relations in one object)`, null>
589
589
  : SetKey<DB, Name, {}>;
590
590
 
591
591
  type ApplyDropSchemas<DB, Names, Ife, Casc> =
@@ -3,7 +3,7 @@ import type { Col, Nullable, View } from "./column.js";
3
3
 
4
4
  /**
5
5
  * Relations of `pg_catalog` in the {@link PgCatalog} slice. Catalog tables are declared as
6
- * views too: typesql treats the whole slice as read-only.
6
+ * views too: TypeSQL treats the whole slice as read-only.
7
7
  */
8
8
  export interface PgCatalogNamespace {
9
9
  /** Table `pg_catalog.pg_am`: Access methods. */