@supabase/lite 0.2.1-next.2 → 0.3.1-next.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/README.md +1 -2
- package/STATUS.md +18 -30
- package/dist/{Connection-CSVCuMv-.d.ts → Connection-DF_xKWko.d.ts} +5 -1
- package/dist/cli/index.js +144 -117
- package/dist/cli/lib.js +38 -32
- package/dist/db/fallback.d.ts +1 -1
- package/dist/db/postgres/{BasePostgresConnection-B7zHDAib.d.ts → BasePostgresConnection-NlNmZWv1.d.ts} +5 -1
- package/dist/db/postgres/PostgresConnection.d.ts +1 -1
- package/dist/db/postgres/PostgresConnection.js +20 -23
- package/dist/db/postgres/pglite/PgliteConnection.d.ts +1 -1
- package/dist/db/postgres/pglite/PgliteConnection.js +26 -27
- package/dist/index.d.ts +3 -3
- package/dist/index.js +42 -50
- package/dist/vite/index.d.ts +1 -0
- package/package.json +3 -7
package/README.md
CHANGED
|
@@ -174,7 +174,6 @@ supabase/
|
|
|
174
174
|
```toml
|
|
175
175
|
[api]
|
|
176
176
|
port = 54321
|
|
177
|
-
max_rows = 1000
|
|
178
177
|
|
|
179
178
|
[db]
|
|
180
179
|
driver = "sqlite-postgres" # or "sqlite" | "pglite" | "postgres"
|
|
@@ -204,7 +203,7 @@ enable_confirmations = false
|
|
|
204
203
|
|
|
205
204
|
Write **Postgres DDL** in `supabase/schemas/*.sql`. When the DB driver is SQLite, DDL is translated on the fly (`SERIAL` → `INTEGER PRIMARY KEY AUTOINCREMENT`, `NOW()` → `datetime('now')`, `JSONB` → `TEXT` with a `json_valid()` check, and so on). Postgres-only features that don't translate (ranges, `LATERAL`, table inheritance) throw a descriptive error.
|
|
206
205
|
|
|
207
|
-
RLS works across all backends: on SQLite, policies are extracted from DDL and enforced at the application layer by rewriting the query AST; on PGlite/Postgres, native RLS is used. `auth.uid()`, `auth.jwt()`, and roles (`anon`, `authenticated`) resolve from the JWT.
|
|
206
|
+
RLS works across all backends: on SQLite, policies are extracted from DDL and enforced at the application layer by rewriting the query AST; on PGlite/Postgres, native RLS is used. `auth.uid()`, `auth.jwt()`, and roles (`anon`, `authenticated`, `service_role`) resolve from the JWT.
|
|
208
207
|
|
|
209
208
|
Full translation reference: [STATUS.md#postgres-to-sqlite-translation](https://github.com/supabase-community/lite/blob/HEAD/STATUS.md#postgres-to-sqlite-translation) and [`app/POSTGRES-SQLITE-COMPAT.md`](https://github.com/supabase-community/lite/blob/HEAD/app/POSTGRES-SQLITE-COMPAT.md).
|
|
210
209
|
|
package/STATUS.md
CHANGED
|
@@ -34,9 +34,9 @@ Feature and API compatibility tracking for @supabase/lite. For usage docs, see [
|
|
|
34
34
|
|
|
35
35
|
## Postgres-to-SQLite Translation
|
|
36
36
|
|
|
37
|
-
When using SQLite databases, SQL schemas written in Postgres dialect are translated on the fly. The translator extends the Postgres deparser. It passes through 1:1 compatible syntax unchanged, rewrites constructs that have SQLite equivalents (for example `SERIAL` → `INTEGER PRIMARY KEY AUTOINCREMENT`, `NOW()` → `datetime('now')`), silently drops Postgres-only decorators (storage parameters, locking clauses), and errors on features that have no SQLite counterpart (`LATERAL` joins, table inheritance).
|
|
37
|
+
When using SQLite databases, SQL schemas written in Postgres dialect are translated on the fly. The translator extends the Postgres deparser. It passes through 1:1 compatible syntax unchanged, rewrites constructs that have SQLite equivalents (for example `SERIAL` → `INTEGER PRIMARY KEY AUTOINCREMENT`, `NOW()` → `datetime('now')`), silently drops Postgres-only decorators and relation/schema privilege metadata (storage parameters, locking clauses, table/schema/sequence grants), and errors on features that have no SQLite counterpart (`LATERAL` joins, table inheritance, function grants).
|
|
38
38
|
|
|
39
|
-
📋 See [`app/POSTGRES-SQLITE-COMPAT.md`](https://github.com/supabase-community/lite/blob/HEAD/app/POSTGRES-SQLITE-COMPAT.md) for the full auto-generated compatibility reference (
|
|
39
|
+
📋 See [`app/POSTGRES-SQLITE-COMPAT.md`](https://github.com/supabase-community/lite/blob/HEAD/app/POSTGRES-SQLITE-COMPAT.md) for the full auto-generated compatibility reference (71 entries).
|
|
40
40
|
|
|
41
41
|
Here is an example of a Postgres schema that is translated to SQLite:
|
|
42
42
|
|
|
@@ -190,7 +190,7 @@ RLS is supported on all database backends. The enforcement strategy differs by d
|
|
|
190
190
|
|
|
191
191
|
📖 See [`internal/docs/postgres/rls.md`](https://github.com/supabase-community/lite/blob/HEAD/internal/docs/postgres/rls.md) for the full RLS reference and behavior matrix.
|
|
192
192
|
|
|
193
|
-
**PGlite / PostgreSQL auto-setup:** When any table has `ENABLE ROW LEVEL SECURITY`, supalite creates `anon` and `
|
|
193
|
+
**PGlite / PostgreSQL auto-setup:** When any table has `ENABLE ROW LEVEL SECURITY`, supalite creates `anon`, `authenticated`, and `service_role` roles (if missing; `service_role` uses `BYPASSRLS`) and grants default privileges on all tables and sequences in the relevant schemas. No manual `CREATE ROLE` or `GRANT` statements needed for these built-in roles.
|
|
194
194
|
|
|
195
195
|
### PL/pgSQL Trigger Functions
|
|
196
196
|
|
|
@@ -394,31 +394,18 @@ All operators are parsed into the AST. The "Status" column reflects whether a wo
|
|
|
394
394
|
|
|
395
395
|
### PostgREST spec: SQLite skip breakdown
|
|
396
396
|
|
|
397
|
-
The
|
|
397
|
+
The 25 cases skipped on SQLite (out of 1,702) cluster into a small set of upstream Postgres features that have no SQLite analogue, would require generic product work, or remain tracked REST-spec deltas. Generated from the **actual skipped cases by code** section in `cd app && bun run test:spec:status`.
|
|
398
398
|
|
|
399
399
|
| Category | Skipped | Why |
|
|
400
400
|
|----------|--------:|--------------------------------------------------------------------------------------|
|
|
401
|
-
| `feature_haskell_divergence_strict` | 46 | Strict Haskell PostgREST behaviour (header parsing, prefer modes) lite intentionally diverges from |
|
|
402
|
-
| `domain_type` | 37 | Postgres `CREATE DOMAIN` types; no SQLite equivalent |
|
|
403
|
-
| `pg_only_operators` | 36 | Postgres-specific operator syntax (`~`, `~*`, dictionary FTS, etc.) |
|
|
404
|
-
| `tx_preferences` | 36 | `Prefer: tx=commit/rollback` and pre-request GUCs; no SQLite txn boundary |
|
|
405
|
-
| `cache_fk_names` | 23 | FK disambiguation paths exercising specific PG catalog metadata |
|
|
406
|
-
| `pg_dictionary_fts` | 16 | Language-tagged full-text search dictionaries |
|
|
407
|
-
| `feature_error_codes` | 11 | PostgREST/PG-specific SQLSTATE shapes |
|
|
408
|
-
| `cache_pg_types` | 10 | JSON operator behaviour tied to PG type cache |
|
|
409
|
-
| `pg_extension_specific` | 10 | CORS / custom media types relying on PG extensions |
|
|
410
|
-
| `view_embedding` | 10 | View-FK resolution in PG-only metadata |
|
|
411
|
-
| `state_dependent` | 8 | Cases dependent on connection-pool/session state |
|
|
412
|
-
| `pg_role_set` | 4 | `SET LOCAL role` / JWT-driven role switching |
|
|
413
401
|
| `lite_anon_bearer_fallback` | 4 | Lite-specific JWT fallback handling |
|
|
414
|
-
| `computed_column` |
|
|
415
|
-
| `
|
|
416
|
-
| `
|
|
417
|
-
| `
|
|
418
|
-
| `mutation_embed_two_query_limit` | 2 | Embedded mutation w/ two-query plan |
|
|
419
|
-
| `computed_relations` | 1 | PG computed relationship overrides |
|
|
402
|
+
| `computed_column` | 4 | PostgREST computed columns require PG function metadata |
|
|
403
|
+
| `custom_media_handlers` | 10 | Fixture raw-media handlers require generic custom media metadata/config |
|
|
404
|
+
| `pg_role_set` | 2 | `SET LOCAL role` / JWT-driven role switching |
|
|
405
|
+
| `private_schema_visibility` | 2 | Private-schema junction visibility must not be emulated via `private_*` names |
|
|
420
406
|
| `collation_locale` | 1 | Locale-sensitive ordering |
|
|
421
|
-
| `
|
|
407
|
+
| `computed_relations` | 1 | PG computed relationship overrides |
|
|
408
|
+
| `mutation_embed_two_query_limit` | 1 | Embedded mutation w/ two-query plan |
|
|
422
409
|
|
|
423
410
|
Run `bun run test:spec:analyze` (or `:sqlite-postgres`, `:pglite`, `:postgres`) to regenerate per backend.
|
|
424
411
|
|
|
@@ -644,7 +631,7 @@ Help groups match upstream: **Local Development** (commands you run from a proje
|
|
|
644
631
|
|
|
645
632
|
| Command | Status | Notes |
|
|
646
633
|
|-----------|--------|--------------------------------------------------------------------|
|
|
647
|
-
| `init` | ✅ |
|
|
634
|
+
| `init` | ✅ | Scaffolds API, migration/seed paths, and auth defaults; flags differ upstream |
|
|
648
635
|
| `start` | ✅ | In-process; no Docker stack flags (`-x`, `--ignore-health-check`) |
|
|
649
636
|
| `status` | 🧪 | `[experimental]` `[lite]`: shows linked project metadata |
|
|
650
637
|
| `login` | 🧪 | `[experimental]` Email/password against supalite cloud |
|
|
@@ -667,11 +654,12 @@ Help groups match upstream: **Local Development** (commands you run from a proje
|
|
|
667
654
|
|
|
668
655
|
| Command | Status | Notes |
|
|
669
656
|
|---------------|--------|----------------------------------------------------------------------|
|
|
670
|
-
| `db diff` | ✅ |
|
|
657
|
+
| `db diff` | ✅ | `--local` semantics; `-f` emits pg-DDL migrations from declarative schemas |
|
|
671
658
|
| `db query` | ✅ | Renamed from top-level `exec`; supports `--remote` and `--config` |
|
|
672
659
|
| `db schema` | ✅ | `[lite]`: moved from top-level; `--diff` and `--sql` modes |
|
|
673
660
|
| `db push` | 🔄 | Not registered; use `lite cloud deploy` |
|
|
674
|
-
| `db
|
|
661
|
+
| `db reset` | ✅ | Replays migrations + seed; does not apply declarative schema_paths |
|
|
662
|
+
| `db pull`, `db dump`, `db lint`, `db advisors` | 🔄 | Not registered |
|
|
675
663
|
| `db start` | 🚫 | Not applicable; in-process, no separate DB start |
|
|
676
664
|
|
|
677
665
|
### `migration` group
|
|
@@ -776,10 +764,10 @@ PostgREST spec status (`cd app && bun run test:spec:status`):
|
|
|
776
764
|
|
|
777
765
|
| Backend | Total | Passing | Pass % | Skipped | Skip % | Failed |
|
|
778
766
|
|---------|------:|--------:|-------:|--------:|-------:|-------:|
|
|
779
|
-
| Postgres | 2,460 | **1,
|
|
780
|
-
| PGlite | 2,460 | **1,
|
|
781
|
-
| SQLite | 1,702 | **1,
|
|
782
|
-
| SQLite-Postgres | 1,702 | **1,
|
|
767
|
+
| Postgres | 2,460 | **1,923** | 78.2% | 537 | 21.8% | 0 |
|
|
768
|
+
| PGlite | 2,460 | **1,933** | 78.6% | 527 | 21.4% | 0 |
|
|
769
|
+
| SQLite | 1,702 | **1,677** | 98.5% | 25 | 1.5% | 0 |
|
|
770
|
+
| SQLite-Postgres | 1,702 | **1,677** | 98.5% | 25 | 1.5% | 0 |
|
|
783
771
|
|
|
784
772
|
Auth supabase-spec status (`cd app && bun run test:spec:auth`):
|
|
785
773
|
|
|
@@ -246,7 +246,9 @@ type TranslatorConfig = {
|
|
|
246
246
|
parseBody?: (req: Request) => Promise<BodyResult>;
|
|
247
247
|
parseQueryParams?: (req: Request) => QueryParamsResult;
|
|
248
248
|
resolveType?: (route: RouteResult, method: string, headers: HeadersResult) => ASTType;
|
|
249
|
-
resolveFilters?: (queryParams: QueryParamsResult, embeddedAliases: Set<string>) => FiltersResult;
|
|
249
|
+
resolveFilters?: (queryParams: QueryParamsResult, embeddedAliases: Set<string>, fromTable?: string, parentColumns?: ReadonlySet<string>) => FiltersResult;
|
|
250
|
+
/** Physical columns on the request table (for embed/column homonym filters). */
|
|
251
|
+
parentColumns?: ReadonlySet<string>;
|
|
250
252
|
resolveTransforms?: (queryParams: QueryParamsResult, embeddedAliases: Set<string>) => TransformsResult;
|
|
251
253
|
resolveMeta?: (headers: HeadersResult, queryParams: QueryParamsResult, method: string) => Meta;
|
|
252
254
|
resolveRpcParams?: (route: RouteResult, method: string, queryParams: QueryParamsResult, body: BodyResult) => RpcResult;
|
|
@@ -299,6 +301,8 @@ interface ForeignKeyInfo {
|
|
|
299
301
|
schema: string;
|
|
300
302
|
ref_schema?: string;
|
|
301
303
|
foreign_key_name: string;
|
|
304
|
+
/** Internal grouping key for derived FK paths that share a display constraint name. */
|
|
305
|
+
foreign_key_group?: string;
|
|
302
306
|
fk_def: string;
|
|
303
307
|
is_visible?: boolean;
|
|
304
308
|
}
|