@supawatch/target-supabase-types 0.1.2 → 0.2.0
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/README.md +38 -0
- package/package.json +14 -2
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# @supawatch/target-supabase-types
|
|
2
|
+
|
|
3
|
+
The `Database` interface target for
|
|
4
|
+
[supawatch](https://github.com/omar-dulaimi/supawatch). Emits a single
|
|
5
|
+
`database.types.ts` compatible with `@supabase/supabase-js` generics, so
|
|
6
|
+
generated validators and your Supabase client share one source of truth.
|
|
7
|
+
|
|
8
|
+
Configure it in `supawatch.config.ts` (the CLI loads this package by name):
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
targets: [{ kind: "supabase-types", path: "src" }]
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Then:
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { createClient } from "@supabase/supabase-js";
|
|
18
|
+
import type { Database } from "./database.types.js";
|
|
19
|
+
|
|
20
|
+
const client = createClient<Database>(url, key);
|
|
21
|
+
const { data } = await client.from("tasks").select("id, status");
|
|
22
|
+
// data[].status is "todo" | "doing" | "done" | "archived"
|
|
23
|
+
// data[].id is number (int8 over PostgREST JSON)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The interface carries Tables with `Row`, `Insert`, `Update` and
|
|
27
|
+
`Relationships` built from real foreign-key introspection, plus Views,
|
|
28
|
+
Enums and CompositeTypes. Types always follow the measured PostgREST JSON
|
|
29
|
+
profile: numeric and int8 as numbers, dates as strings, enum arrays as real
|
|
30
|
+
arrays.
|
|
31
|
+
|
|
32
|
+
> [!WARNING]
|
|
33
|
+
> int8 over PostgREST JSON loses precision past 2^53; this was measured,
|
|
34
|
+
> not assumed.
|
|
35
|
+
|
|
36
|
+
`Functions` is currently an empty placeholder.
|
|
37
|
+
|
|
38
|
+
MIT.
|
package/package.json
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supawatch/target-supabase-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "A supabase-js compatible Database interface generated from live Postgres by supawatch, foreign-key relationships included.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"supabase",
|
|
7
|
+
"postgres",
|
|
8
|
+
"postgresql",
|
|
9
|
+
"codegen",
|
|
10
|
+
"schema",
|
|
11
|
+
"typescript",
|
|
12
|
+
"supabase-js",
|
|
13
|
+
"database-types",
|
|
14
|
+
"gen-types"
|
|
15
|
+
],
|
|
4
16
|
"license": "MIT",
|
|
5
17
|
"author": "Omar Dulaimi",
|
|
6
18
|
"repository": {
|
|
@@ -21,7 +33,7 @@
|
|
|
21
33
|
"dist"
|
|
22
34
|
],
|
|
23
35
|
"dependencies": {
|
|
24
|
-
"@supawatch/core": "0.
|
|
36
|
+
"@supawatch/core": "0.2.0"
|
|
25
37
|
},
|
|
26
38
|
"devDependencies": {
|
|
27
39
|
"@types/node": "^22.20.1",
|