@spooky-sync/cli 0.0.1-canary.180 → 0.0.1-canary.182

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.
Files changed (2) hide show
  1. package/AGENTS.md +9 -0
  2. package/package.json +6 -6
package/AGENTS.md CHANGED
@@ -51,6 +51,10 @@ In your `.surql` source, comment annotations attached to `DEFINE FIELD` / `DEFIN
51
51
  - `-- @crdt text` (above a `DEFINE FIELD`) — marks a field as a Loro CRDT text field. Consumers must use `useCrdtField` to read/write it; plain `useQuery` will see stale or unmerged content.
52
52
  - `-- @parent` (suffix on `DEFINE FIELD ... TYPE record<...>`) — marks the column as the parent side of a relationship; written automatically from the auth context, never by client code.
53
53
  - `-- @nosync` (above a `DEFINE TABLE`) — marks a table as server-only: it is omitted from generated types and relations (and any `record<...>` link pointing at it is dropped), no sync events are emitted for it, and the scheduler/SSP exclude it from snapshots and bootstrap. The table still lives in the main DB and is still backed up. The CLI bakes a `COMMENT 'sp00ky:nosync'` marker onto the server-side `DEFINE TABLE` so the runtime services detect it via `INFO FOR DB`. Distinct from `PERMISSIONS FOR select WHERE false`, which only locks reads — a permission-locked table is still synced.
54
+ - `-- @nosync` (above a `DEFINE FIELD`) — marks a single field server-only: omitted from generated types and from the client's local cache schema, omitted from sync event payloads, and omitted from the scheduler replica and SSP bootstrap row scans. **Not a read barrier**: a client's down-sync `SELECT` still returns the column over the wire, and it is only discarded on arrival (`cleanRecord`). For real secrecy use `PERMISSIONS FOR select WHERE false` on the field, or move it to a `@nosync` table.
55
+ - `-- @opaque` (above a `DEFINE FIELD`) — the field IS synced to the client (it stays in generated types and the local cache, flagged `opaque: true` on the column) but no server-side component stores the value. Intended for large blobs you render but never query on. Because nothing holds the value it cannot be evaluated: using it in `where`/`orderBy`/a join throws in the query builder and is rejected with a 400 at SSP registration, and a schema whose `PERMISSIONS` or `DEFINE INDEX` references one fails to build. Delivery works because sync payloads carry ids + versions, not field values — the client reads the row body straight from SurrealDB.
56
+
57
+ All three field-level exclusions (`@nosync`, `@crdt`, `@opaque`) get `COMMENT 'sp00ky:opaque'` baked onto the server `DEFINE FIELD` (`schema_builder::add_opaque_field_markers`). The scheduler replica and the SSP bootstrap read that marker from `INFO FOR TABLE` and turn it into a `SELECT * OMIT ...` projection. Both halves are required: skipping a field from the ingest payload while the bootstrap still loads it makes the SSP circuit and the scheduler replica disagree about the row's key set permanently (the replica applies updates with `MERGE`, the circuit replaces the whole row), which shows up as an unfixable `spky verify` mismatch.
54
58
 
55
59
  Example:
56
60
  ```sql
@@ -61,10 +65,15 @@ DEFINE FIELD content ON TABLE thread TYPE string ASSERT $value != NONE;
61
65
 
62
66
  DEFINE FIELD author ON TABLE thread TYPE record<user>; -- @parent
63
67
 
68
+ -- @opaque
69
+ DEFINE FIELD preview_png ON TABLE thread TYPE option<bytes>;
70
+
64
71
  -- @nosync
65
72
  DEFINE TABLE audit_log SCHEMALESS;
66
73
  ```
67
74
 
75
+ A descriptor must sit directly above its statement (no blank line between). One that attaches to nothing is warned about, not silently dropped (`annotations::warn_unattached_annotations`).
76
+
68
77
  ## Docker dev apps (`type: docker`)
69
78
 
70
79
  Besides `backend`/`frontend` apps, `sp00ky.yml` can declare `type: docker` apps —
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spooky-sync/cli",
3
- "version": "0.0.1-canary.180",
3
+ "version": "0.0.1-canary.182",
4
4
  "description": "Generate TypeScript/Dart types from SurrealDB schema files",
5
5
  "type": "module",
6
6
  "main": "./dist/syncgen.cjs",
@@ -61,10 +61,10 @@
61
61
  "vitest": "^1.0.0"
62
62
  },
63
63
  "optionalDependencies": {
64
- "@spooky-sync/cli-darwin-arm64": "0.0.1-canary.180",
65
- "@spooky-sync/cli-darwin-x64": "0.0.1-canary.180",
66
- "@spooky-sync/cli-linux-arm64": "0.0.1-canary.180",
67
- "@spooky-sync/cli-linux-x64": "0.0.1-canary.180",
68
- "@spooky-sync/cli-win32-x64": "0.0.1-canary.180"
64
+ "@spooky-sync/cli-darwin-arm64": "0.0.1-canary.182",
65
+ "@spooky-sync/cli-darwin-x64": "0.0.1-canary.182",
66
+ "@spooky-sync/cli-linux-arm64": "0.0.1-canary.182",
67
+ "@spooky-sync/cli-linux-x64": "0.0.1-canary.182",
68
+ "@spooky-sync/cli-win32-x64": "0.0.1-canary.182"
69
69
  }
70
70
  }