snapback4 0.0.6 → 0.0.7

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
@@ -206,7 +206,11 @@ The horizon `last N by index` bounds what a device acquires per group;
206
206
  older rows are online-only, and a device's read past them says
207
207
  `complete: false`. Joining a group delivers its rows; leaving it delivers
208
208
  one scope tombstone, and the table's `retain` says what the device keeps.
209
- A table without `sync` is online-only: its queries run on the server.
209
+ What it keeps under `delivered-history` it can still read locally through
210
+ a query without a membership `require` (the server refuses the same query
211
+ once the membership is gone, so a "history" query answers on the device
212
+ and is empty online). A table without `sync` is online-only: its queries
213
+ run on the server.
210
214
 
211
215
  ## 4. The client
212
216
 
@@ -308,7 +312,8 @@ flips the link.
308
312
  - **`snapback4 run <op> '<json args>' --as alice [--json]`** runs one
309
313
  operation against the local store and prints the result and the meter.
310
314
  - **`snapback4 test [--fixture dir] [--as persona]`** loads a fixture
311
- (one `<table>.jsonl` per table), runs every query as each persona with
315
+ (one `<table>.jsonl` per table) into a fresh store in memory (without a
316
+ fixture, the project's dev store), runs every query as each persona with
312
317
  arguments derived from the data (a reference is the table's first row,
313
318
  a principal the persona, a text the shortest that fits), prints the
314
319
  meters beside the ceilings and the arguments it used, and names any
@@ -91,7 +91,12 @@ export declare class Interpreter {
91
91
  * counted. */
92
92
  private visibility;
93
93
  private ruleTrue;
94
- /** The read rule for one row, with probes over the replica. */
94
+ /** Whether the viewer may read a held row. A synced table's rows are
95
+ * the partition: the server delivered each under the read rule and
96
+ * withdrew what it revoked, so what the device holds it may read — and
97
+ * what `retain delivered-history` kept after a leave stays readable here
98
+ * even though the server now refuses it. Only an online-only table's
99
+ * rows (none, unless predicted) meet the rule on the device. */
95
100
  readable(table: string, row: Row): Promise<boolean>;
96
101
  private rule;
97
102
  private permitted;
@@ -703,9 +703,17 @@ export class Interpreter {
703
703
  default: return false;
704
704
  }
705
705
  }
706
- /** The read rule for one row, with probes over the replica. */
706
+ /** Whether the viewer may read a held row. A synced table's rows are
707
+ * the partition: the server delivered each under the read rule and
708
+ * withdrew what it revoked, so what the device holds it may read — and
709
+ * what `retain delivered-history` kept after a leave stays readable here
710
+ * even though the server now refuses it. Only an online-only table's
711
+ * rows (none, unless predicted) meet the rule on the device. */
707
712
  async readable(table, row) {
708
- const rule = this.schema.tables[table].rules.read;
713
+ const definition = this.schema.tables[table];
714
+ if (definition?.sync)
715
+ return true;
716
+ const rule = definition.rules.read;
709
717
  return this.rule(rule, undefined, row, false);
710
718
  }
711
719
  async rule(rule, old, next, insert) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snapback4",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "type": "module",
5
5
  "description": "Snapback 4: the card (contract), the online and local-first clients (IndexedDB, SQLite), React hooks, sign-in, a labelled mock, and the `snapback4` CLI. LLP 3000.",
6
6
  "bin": {
@@ -42,7 +42,7 @@
42
42
  "README.md"
43
43
  ],
44
44
  "optionalDependencies": {
45
- "snapback4-darwin-arm64": "0.0.6"
45
+ "snapback4-darwin-arm64": "0.0.7"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "tsc -p tsconfig.build.json",