latticesql 1.13.6 → 1.13.8

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 CHANGED
@@ -65,6 +65,7 @@ Lattice has no opinions about your schema, your agents, or your file format. You
65
65
  - [Examples](#examples)
66
66
  - [Staying up to date](#staying-up-to-date)
67
67
  - [Auto-update](#auto-update-v11)
68
+ - [Telemetry](#telemetry)
68
69
  - [Contributing](#contributing)
69
70
  - [Changelog](#changelog)
70
71
 
@@ -2158,7 +2159,29 @@ await db.init();
2158
2159
  | `~/.lattice/keys/<label>.token` | Per-joined-team bearer tokens (`chmod 0600`) |
2159
2160
  | `~/.lattice/db-credentials.enc` | AES-GCM-encrypted Postgres URLs keyed by label |
2160
2161
 
2161
- The GUI's User Config view edits `identity.json` directly; the Project Config "Database" panel writes saved Postgres URLs into `db-credentials.enc` and rewrites `lattice.config.yml`'s `db:` line to `${LATTICE_DB:<label>}`. The config parser resolves that reference at open time so connection passwords never sit in YAML on disk.
2162
+ The GUI's User Settings view edits `identity.json` directly; the Database Settings page writes saved Postgres URLs into `db-credentials.enc` and rewrites `lattice.config.yml`'s `db:` line to `${LATTICE_DB:<label>}`. The config parser resolves that reference at open time so connection passwords never sit in YAML on disk.
2163
+
2164
+ `~/.lattice/preferences.json` (v1.13.8+) holds machine-local UI preferences keyed by name. Currently a single flag `show_system_tables: boolean` (default `false`) — see _Sidebar system-tables toggle (v1.13.8+)_ below.
2165
+
2166
+ **Information architecture, v1.13.8+.** The GUI treats every database as either Local (single-user SQLite) or Cloud (Postgres, one or more invited team members), with the database itself as the first-class concept. "Team" describes the set of members on a cloud database — there is no separate "create a team" step, and the verbiage for member management ("Invite Team", "Join Team", "Team Members") stays where it belongs. Concretely:
2167
+
2168
+ - **Editable database name** at the top of Database Settings. For cloud DBs the rename writes `__lattice_team_identity.team_name` (and broadcasts to every member via the realtime channel below); for local DBs it writes a `name:` key into the YAML config, parsed by `parseConfigFile()` and surfaced as `ParsedConfig.name`. New endpoint `POST /api/dbconfig/rename`.
2169
+ - **Three-step Create Database wizard.** Opened from the header dropdown's `+ New database` button and from Lattice Settings → Add new database. Step 1: name + Local|Cloud + cloud credentials. Step 2: starter entities, each with a pre-checked "Share with cloud" checkbox when cloud. Step 3: review + create.
2170
+ - **Header dropdown** shows the friendly database name + a Local|Cloud kind chip + a connectivity dot per row (green = cloud live, yellow = local SQLite, red = cloud disconnected). The `+ New database` button at the bottom opens the wizard.
2171
+ - **Settings sidebar** is reorganized into Lattice Settings (catalog of all databases this lattice can reach + Add-new entry), Database Settings (renamed from Project Config — editable name header on top, the existing Database panel and cloud-databases list below), Data Model, and User Settings. The legacy `/settings/project-config` route still resolves for back-compat.
2172
+ - **Migrate-to-Cloud per-table share checkboxes.** The migrate modal lists every user-defined table with "Share with cloud" pre-checked; uncheck individual tables to keep them cloud-stored but unshared. After the migrate, only checked tables call `shareObject`.
2173
+ - **New-entity flow** on a cloud-connected database pre-checks a "Share with cloud" box; the share runs best-effort after the entity is created.
2174
+
2175
+ **Realtime cloud subscriptions (v1.13.8+).** Cloud Postgres-backed lattices stream changes to every connected GUI in realtime. A Postgres trigger on `__lattice_change_log` emits `pg_notify('lattice_changes', …)` after every insert; the GUI server holds a dedicated `pg.Client` with `LISTEN lattice_changes` and fans payloads out via a new Server-Sent Events endpoint:
2176
+
2177
+ | Route | Method | Description |
2178
+ | ---------------------- | ------ | -------------------------------------------------------------------------------- |
2179
+ | `/api/realtime/stream` | GET | SSE stream; `event: state` on connection transitions, `event: change` per NOTIFY |
2180
+ | `/api/realtime/status` | GET | JSON snapshot of `{ mode: 'local'\|'cloud', state, connected }` |
2181
+
2182
+ The browser's `EventSource` invalidates the entity cache on every `change` event; connection state drives a colored dot in the topbar (green/yellow/red). SQLite databases are unchanged — LISTEN/NOTIFY is Postgres-only and the broker is skipped on those. The trigger installer (`installCloudInternalTriggers`) is exported from `latticesql/teams/internal-tables` for callers that bootstrap cloud schemas outside the GUI.
2183
+
2184
+ **Sidebar system-tables toggle (v1.13.8+).** Internal `__lattice_*` and `_lattice_gui_*` tables are hidden from the sidebar by default. Enable the "Show system tables in sidebar" checkbox in User Settings → Preferences to surface them under a "System" section. Persisted to `~/.lattice/preferences.json`; exposed via `GET`/`POST /api/userconfig/preferences`.
2162
2185
 
2163
2186
  ---
2164
2187
 
@@ -2201,6 +2224,8 @@ The cloud rejects redemption if the caller's claimed email doesn't match the inv
2201
2224
 
2202
2225
  **Same flows from the GUI.** The local `lattice gui` Project Config view drives the entire teams lifecycle — create / join, invite by email, share tables, link rows, see sync status. Identity (display name + email) comes from `~/.lattice/identity.json` and is prefilled in every modal.
2203
2226
 
2227
+ **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.
2228
+
2204
2229
  **Cloud server mode**: `lattice gui --team-cloud` boots the same binary as a cloud server. It exposes the bearer-token-gated `/api/team*` endpoints + the `/objects`/`/changes`/`/rows`/`/links` sync routes, and disables the local dev-tool surface (table viewer, CRUD endpoints, register-and-create modal).
2205
2230
 
2206
2231
  The full architecture, schema, and HTTP surface live in [docs/teams.md](./docs/teams.md).
@@ -2566,6 +2591,45 @@ interface AutoUpdateResult {
2566
2591
 
2567
2592
  ---
2568
2593
 
2594
+ ## Telemetry
2595
+
2596
+ `latticesql` includes [Scarf](https://scarf.sh) install analytics so we can understand how the package is used in the wild — what versions are running, on what platforms, at roughly what scale. This signal is what lets us prioritize fixes, deprecations, and new features against real usage instead of guesswork.
2597
+
2598
+ **What is sent — once, at `npm install` time, by the `@scarf/scarf` postinstall hook:**
2599
+
2600
+ - Package name + version (e.g. `latticesql@1.13.6`)
2601
+ - Node.js version, OS, CPU architecture
2602
+ - A coarse, non-identifying hash derived from the install host (Scarf's default — used for deduplication, not identification)
2603
+ - The public IP of the install request (visible to any HTTPS endpoint; not stored long-term by Scarf)
2604
+
2605
+ **What is NOT sent:**
2606
+
2607
+ - No data from your application code, schemas, rows, or query strings
2608
+ - No environment variables, file paths, hostnames, or usernames
2609
+ - No runtime telemetry — `latticesql` makes zero outbound telemetry calls after install. The only network requests it makes at runtime are the explicit `checkForUpdate()` / `autoUpdate()` calls to `registry.npmjs.org`, which you opt into by calling them.
2610
+
2611
+ **How to opt out** — any one of these suppresses the install ping:
2612
+
2613
+ ```bash
2614
+ # Per-install (recommended for CI):
2615
+ SCARF_ANALYTICS=false npm install latticesql
2616
+
2617
+ # Or, project-wide (add to .npmrc):
2618
+ scarf-analytics=false
2619
+
2620
+ # Or, the cross-tool standard:
2621
+ DO_NOT_TRACK=1 npm install latticesql
2622
+
2623
+ # Or, disable all postinstall scripts entirely:
2624
+ npm install latticesql --ignore-scripts
2625
+ ```
2626
+
2627
+ Opting out has no effect on functionality — the package works identically. The Scarf postinstall is a fire-and-forget HTTPS ping with a short timeout; even when enabled it cannot fail your install.
2628
+
2629
+ See Scarf's own [privacy documentation](https://docs.scarf.sh) for the upstream policy.
2630
+
2631
+ ---
2632
+
2569
2633
  ## Contributing
2570
2634
 
2571
2635
  See [CONTRIBUTING.md](./CONTRIBUTING.md) for dev setup, test commands, and contribution guidelines.