latticesql 1.16.1 → 1.16.3
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 +30 -28
- package/dist/cli.js +560 -286
- package/dist/index.cjs +69 -1
- package/dist/index.d.cts +32 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +69 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2146,7 +2146,7 @@ The convergence means you don't need to duplicate entity-context definitions in
|
|
|
2146
2146
|
|
|
2147
2147
|
**Switch vs. migrate (v1.13.2+ wording).** "Connect to existing cloud" _switches_ the project's `db:` line to point at the cloud; the local SQLite file stays on disk and you can switch back by editing the YAML or via the Databases catalog under User Config. Use "Migrate to cloud" only when you want to _push_ the local data into a fresh empty target.
|
|
2148
2148
|
|
|
2149
|
-
**
|
|
2149
|
+
**Cloud workspaces initialize automatically (v1.16.3+).** A cloud database _is_ a cloud workspace with members — there is no separate "upgrade to team" step. The moment a database is migrated or connected to Postgres, its member/share machinery is created automatically (the workspace name is used as the identity; an existing un-initialized cloud initializes on open, with the opener as owner). The underlying mechanism is the `registerDirectViaPostgres()` helper, which drives the identity/member INSERT sequence directly against the cloud Postgres (the older HTTP `/api/auth/register` path is still used when the cloud URL is `http(s)://`). The standalone "Upgrade to team cloud" action and its `/api/dbconfig/upgrade-to-team` route were removed in 1.16.3.
|
|
2150
2150
|
|
|
2151
2151
|
**Dashboard renders every entity (v1.13.3+).** Previously the dashboard cards filtered through a hardcoded entity list (`meetings`, `people`, `messages`, `projects`, `repositories`, `files`). Installs whose YAML declared different names saw a blank dashboard. Now every first-class entity gets a card; the hardcoded list survives as an ordering preference only.
|
|
2152
2152
|
|
|
@@ -2160,7 +2160,7 @@ The convergence means you don't need to duplicate entity-context definitions in
|
|
|
2160
2160
|
- **Table view** (`#/objects/<entity>`, Advanced mode) — intrinsic columns, `belongsTo` chips, and a column per junction this entity participates in.
|
|
2161
2161
|
- **Detail view** (`#/objects/<entity>/<id>`, Advanced mode) — read mode by default; `Edit` flips cells into inputs (`Save` PATCHes, `Cancel` reverts).
|
|
2162
2162
|
- **Settings** (v2.0+) — opened from the header gear (Database / Lattice / User tabs + the Advanced-mode toggle); the legacy `#/settings/*` hashes still resolve and open the drawer.
|
|
2163
|
-
- **Data Model** (inside **
|
|
2163
|
+
- **Data Model** (inside **Workspace Settings**, v1.14+) — entity-level graph including the native `files`/`secrets` objects, with a per-entity editor. On a cloud workspace each table you own carries a **Share with workspace / Make private** toggle, and graph nodes are colored by share status (yellow = shared, red = private, green = selected) with a legend. (Pre-1.14 this was a separate `#/settings/data-model` nav item; that hash still resolves for back-compat.)
|
|
2164
2164
|
|
|
2165
2165
|
**Internal tables added on first open**
|
|
2166
2166
|
|
|
@@ -2176,22 +2176,22 @@ These tables are prefixed with `_lattice_gui_` and are hidden from `/api/entitie
|
|
|
2176
2176
|
|
|
2177
2177
|
**HTTP surface** (all routes scoped to `http://127.0.0.1:<port>/api`):
|
|
2178
2178
|
|
|
2179
|
-
| Route | Method | Lattice call
|
|
2180
|
-
| ------------------------------ | ------ |
|
|
2181
|
-
| `/project` | GET | (config + manifest summary)
|
|
2182
|
-
| `/entities` | GET | tables + `db.count` per table
|
|
2183
|
-
| `/graph` | GET | (schema graph for Data Model)
|
|
2184
|
-
| `/tables/:table/rows` | GET | `db.query(table, …)`
|
|
2185
|
-
| `/tables/:table/rows` | POST | `db.insert(table, body)`
|
|
2186
|
-
| `/tables/:table/rows/:id` | GET | `db.get(table, id)`
|
|
2187
|
-
| `/tables/:table/rows/:id` | PATCH | `db.update(table, id, body)`
|
|
2188
|
-
| `/tables/:table/rows/:id` | DELETE | `db.delete(table, id)`
|
|
2189
|
-
| `/tables/:junction/link` | POST | `db.link(junction, body)`
|
|
2190
|
-
| `/tables/:junction/unlink` | POST | `db.unlink(junction, body)`
|
|
2191
|
-
| `/schema/entities` | POST | create a new entity/table
|
|
2192
|
-
| `/schema/entities/:name/share` | POST | share/unshare a table you own with the
|
|
2193
|
-
|
|
2194
|
-
On a
|
|
2179
|
+
| Route | Method | Lattice call |
|
|
2180
|
+
| ------------------------------ | ------ | ------------------------------------------------------------------- |
|
|
2181
|
+
| `/project` | GET | (config + manifest summary) |
|
|
2182
|
+
| `/entities` | GET | tables + `db.count` per table |
|
|
2183
|
+
| `/graph` | GET | (schema graph for Data Model) |
|
|
2184
|
+
| `/tables/:table/rows` | GET | `db.query(table, …)` |
|
|
2185
|
+
| `/tables/:table/rows` | POST | `db.insert(table, body)` |
|
|
2186
|
+
| `/tables/:table/rows/:id` | GET | `db.get(table, id)` |
|
|
2187
|
+
| `/tables/:table/rows/:id` | PATCH | `db.update(table, id, body)` |
|
|
2188
|
+
| `/tables/:table/rows/:id` | DELETE | `db.delete(table, id)` |
|
|
2189
|
+
| `/tables/:junction/link` | POST | `db.link(junction, body)` |
|
|
2190
|
+
| `/tables/:junction/unlink` | POST | `db.unlink(junction, body)` |
|
|
2191
|
+
| `/schema/entities` | POST | create a new entity/table |
|
|
2192
|
+
| `/schema/entities/:name/share` | POST | share/unshare a table you own with the cloud workspace (owner-only) |
|
|
2193
|
+
|
|
2194
|
+
On a cloud workspace, `/entities` and `/graph` (and the queryable `/tables/*` allowlist) are filtered to the tables you own plus tables shared to the workspace — so the API surface matches exactly what the GUI shows; a table you can't see is not reachable. `/entities` rows carry `shared` / `ownedByMe` flags in that mode.
|
|
2195
2195
|
|
|
2196
2196
|
The server only binds to `127.0.0.1` and has no authentication. See [SECURITY.md](./SECURITY.md) for the threat model — do not expose this port to a non-loopback interface.
|
|
2197
2197
|
|
|
@@ -2312,7 +2312,7 @@ lattice teams dlq purge --team <name> [--id <id>] # discard without applying
|
|
|
2312
2312
|
|
|
2313
2313
|
**Per-table ownership + opt-in sharing (v1.14+).** Team members share one physical Postgres, so visibility is enforced at the app layer via a `__lattice_object_owners` table: each table records its creator, and a user sees only the tables they own plus tables explicitly shared to the team. The native `files`/`secrets` objects are owned by the database creator and private by default. Sharing is an explicit, owner-only action (not a side effect of creating a table). The filter gates API access, not just the display.
|
|
2314
2314
|
|
|
2315
|
-
**Same flows from the GUI (v1.14+).** The local `lattice gui` drives the entire
|
|
2315
|
+
**Same flows from the GUI (v1.14+).** The local `lattice gui` drives the entire cloud-workspace lifecycle from **Workspace Settings**: rename (owner-only), invite by email (owner-only), the inline Members list with pending invitees (the owner is always shown as `creator`; your own row offers Leave/Destroy; non-owners can't kick), share/unshare from the Data Model, and sync status. Member admin is resolved from `GET /api/dbconfig` against the active cloud DB, so it works even when the cloud workspace itself is the active database. Identity (display name + email) comes from `~/.lattice/identity.json` and is locked in the Join modal. Leaving a workspace removes the local config + credential and switches you to another database.
|
|
2316
2316
|
|
|
2317
2317
|
**Joining via the GUI is one click (v1.13.7+).** When you click "Join via invite" and the redeem succeeds, the team's cloud URL is automatically saved as a switchable database credential and a sibling YAML config is written to your project directory. The new entry shows up in the database dropdown as `<team-name>.config`. Clicking it opens the SPA with the team's shared tables already populated — no YAML editing, no `db.define()` calls.
|
|
2318
2318
|
|
|
@@ -2327,11 +2327,11 @@ The full architecture, schema, and HTTP surface live in [docs/teams.md](./docs/t
|
|
|
2327
2327
|
Lattice Teams + the GUI's Database panel now flow through a state machine:
|
|
2328
2328
|
|
|
2329
2329
|
```
|
|
2330
|
-
LOCAL → CLOUD
|
|
2331
|
-
(migrate)
|
|
2330
|
+
LOCAL → CLOUD WORKSPACE (owner | member | needs-invite)
|
|
2331
|
+
(migrate / connect)
|
|
2332
2332
|
```
|
|
2333
2333
|
|
|
2334
|
-
|
|
2334
|
+
Migrating or connecting to Postgres produces a cloud workspace directly — its member/share machinery is initialized automatically, with no separate "upgrade" step (the intermediate `cloud-connected` state was removed in 1.16.3). The transition is one-way: once on cloud, the panel does not surface a revert-to-local button. Disconnecting from the cloud temporarily is a follow-up; the in-place reconnection happens automatically when the GUI reopens.
|
|
2335
2335
|
|
|
2336
2336
|
Public API surface (the GUI's `/api/dbconfig/*` routes are thin wrappers):
|
|
2337
2337
|
|
|
@@ -2368,17 +2368,20 @@ await client.connectToExistingCloud({
|
|
|
2368
2368
|
name: 'Bob',
|
|
2369
2369
|
});
|
|
2370
2370
|
|
|
2371
|
-
// 4.
|
|
2372
|
-
|
|
2371
|
+
// 4. Initialize the workspace member/share machinery on a cloud DB.
|
|
2372
|
+
// The GUI now does this automatically on migrate/connect/open; the
|
|
2373
|
+
// helper remains for programmatic use (idempotent — a no-op if the
|
|
2374
|
+
// cloud is already a workspace).
|
|
2375
|
+
await client.ensureCloudWorkspaceIdentity({
|
|
2373
2376
|
label: 'atlas',
|
|
2374
2377
|
cloudUrl: 'postgres://u:p@host/db',
|
|
2375
|
-
|
|
2378
|
+
workspaceName: 'Atlas',
|
|
2376
2379
|
email: 'alice@example.com',
|
|
2377
2380
|
displayName: 'Alice',
|
|
2378
2381
|
});
|
|
2379
2382
|
```
|
|
2380
2383
|
|
|
2381
|
-
GUI consumers don't need to call these directly — the Database panel surfaces them as wizards (`Migrate to cloud →`, `Connect to existing cloud
|
|
2384
|
+
GUI consumers don't need to call these directly — the Database panel surfaces them as wizards (`Migrate to cloud →`, `Connect to existing cloud →`); workspace initialization is automatic.
|
|
2382
2385
|
|
|
2383
2386
|
HTTP surface (all under `/api/dbconfig/*`, localhost-only, same auth model as the rest of `lattice gui`):
|
|
2384
2387
|
|
|
@@ -2388,10 +2391,9 @@ HTTP surface (all under `/api/dbconfig/*`, localhost-only, same auth model as th
|
|
|
2388
2391
|
| POST | `/api/dbconfig/probe` | `probeCloud(url)` |
|
|
2389
2392
|
| POST | `/api/dbconfig/migrate-to-cloud` | `migrateLatticeData` + `archiveLocalSqlite` |
|
|
2390
2393
|
| POST | `/api/dbconfig/connect-existing` | `TeamsClient.connectToExistingCloud` |
|
|
2391
|
-
| POST | `/api/dbconfig/upgrade-to-team` | `TeamsClient.upgradeToTeamCloud` |
|
|
2392
2394
|
| POST | `/api/dbconfig/save` / `connect` / `test` | unchanged from v1.12 |
|
|
2393
2395
|
|
|
2394
|
-
The `state` field on `GET /api/dbconfig` is one of: `local`, `
|
|
2396
|
+
The `state` field on `GET /api/dbconfig` is one of: `local`, `team-cloud-creator`, `team-cloud-member`, `team-cloud-needs-invite` (the `cloud-connected` state was removed in 1.16.3). The SPA badge color-codes them (labeled "CLOUD · OWNER / MEMBER / NEEDS INVITE"); the routes use them only for response shape.
|
|
2395
2397
|
|
|
2396
2398
|
---
|
|
2397
2399
|
|