slopkit 0.4.0-rc.0 → 0.4.0-rc.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 CHANGED
@@ -209,6 +209,9 @@ const sync = syncHandlers({ api, store, ledger: store.ledger, log, server: (call
209
209
  await serveSync({ name: "notes", api, sync, home, config, env, log, page, assets: "dist/web" });
210
210
  ```
211
211
 
212
+ `unpaged` and `everything` get the caller too, so a table only people may read (`caller.person`) comes back empty to
213
+ a service login, in its pulls and its checksum alike.
214
+
212
215
  your outcome union must admit the kit's own answers (`failed` with `conflict` or `forbidden`, and `retired`): if it
213
216
  can't, `serveSync` doesn't compile. the page runs the same engine headless or in a browser:
214
217
 
@@ -82,12 +82,18 @@ export declare function syncHandlers<R extends Record<string, {
82
82
  history: HistoryOptions<R[H]> & {
83
83
  row: H;
84
84
  };
85
- /** The other row keys' rows changed after `since`, or every live row for 0. */
86
- unpaged: (since: number) => {
85
+ /**
86
+ * The other row keys' rows changed after `since`, or every live row for 0, as this caller may read them (a table
87
+ * only people see is empty for a service).
88
+ */
89
+ unpaged: (since: number, caller: V) => {
87
90
  [Key in Exclude<keyof R, H>]: R[Key][];
88
91
  };
89
- /** Every live row of every table (what a complete copy holds), for a verifying pull's checksum. */
90
- everything: () => {
92
+ /**
93
+ * Every live row of every table this caller may read (what its complete copy holds), for a verifying pull's
94
+ * checksum: the same rows `unpaged(0, caller)` gives.
95
+ */
96
+ everything: (caller: V) => {
91
97
  [Key in keyof R]: readonly R[Key][];
92
98
  };
93
99
  /** The history rows (by key) a receipt names: they come in the reply that carries it. */
@@ -68,7 +68,7 @@ export function syncHandlers(options) {
68
68
  revision: () => store.revision(),
69
69
  known: (since) => store.known(since),
70
70
  paged,
71
- unpaged: options.unpaged,
71
+ unpaged: (since) => options.unpaged(since, caller),
72
72
  receipts: {
73
73
  read: (ask) => ask.commands === undefined
74
74
  ? ledger
@@ -102,7 +102,7 @@ export function syncHandlers(options) {
102
102
  });
103
103
  const { reply } = pulls.pull(request, caller);
104
104
  const partial = reply.page !== undefined && reply.page.next !== null;
105
- const all = request.verify === true && !partial ? options.everything() : undefined;
105
+ const all = request.verify === true && !partial ? options.everything(caller) : undefined;
106
106
  store.served(reply.revision);
107
107
  if (all === undefined) {
108
108
  return reply;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slopkit",
3
- "version": "0.4.0-rc.0",
3
+ "version": "0.4.0-rc.1",
4
4
  "description": "Opinionated standards and libraries for fast, local-first personal software: state machines, exhaustive state tables, sync, a command ledger, jobs, a guarded server, and the conformance suite that proves them",
5
5
  "keywords": [
6
6
  "conformance",