nowity 1.1.0 → 1.1.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
@@ -574,7 +574,9 @@ return the same thing.
574
574
  A field the method leaves `undefined` is absent in the browser too — not
575
575
  `null` — and one that disappears between two results is removed there. A query whose read set comes out empty is revalidated on every
576
576
  transaction rather than quietly stopping — not knowing what a query reads may
577
- never mean not recomputing it.
577
+ never mean not recomputing it. The exception has to be said out loud:
578
+ `@query({ tables: [] })` declares that the method reads no table at all — who
579
+ is asking, from the session — and such a query is never recomputed.
578
580
 
579
581
  `@list` takes the same options, and needs no others: when the framework cannot
580
582
  push a window into a collection — the last `findMany` is not the one that
@@ -22,6 +22,11 @@ export interface QueryOptions {
22
22
  * Declaring them *adds* to what the tracker finds, it never replaces it. A
23
23
  * method whose read set ends up empty is revalidated on every transaction —
24
24
  * correct but slow, and it warns in development.
25
+ *
26
+ * `tables: []` is the one declaration that says something on its own: this
27
+ * method reads no table at all — its answer comes from the session, say —
28
+ * so an empty read set is the truth rather than a blind spot, and no
29
+ * transaction ever recomputes it.
25
30
  */
26
31
  tables?: string[];
27
32
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/api/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,kBAAkB,CAAC;AAG1B,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;AAEzD,6EAA6E;AAC7E,MAAM,WAAW,YAAY;IACzB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,YAAY,CAAC;AAEvC,MAAM,WAAW,eAAe;IAC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AAG,eAAe,CAIvE;AAgBD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,IAAI,YAAY,EAAE,CAmBjD;AAED,uFAAuF;AACvF,wBAAgB,cAAc,IAAI,YAAY,EAAE,CAE/C;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,QAAQ,GAAG,YAAY,GAAG,SAAS,CAErE;AAED,0EAA0E;AAC1E,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAUhE;AAED,oDAAoD;AACpD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAErE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,oEAAoE;AACpE,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,WAAW,CAOpE;AAED,mDAAmD;AACnD,wBAAgB,cAAc,IAAI,IAAI,CAIrC"}
@@ -224,7 +224,13 @@ function readSetOf(execution, options) {
224
224
  if (execution.untracked)
225
225
  return options.tables?.length ? [...options.tables] : undefined;
226
226
  const tables = new Set([...execution.reads, ...(options.tables ?? [])]);
227
- return tables.size ? [...tables] : undefined;
227
+ if (tables.size)
228
+ return [...tables];
229
+ // Nothing seen is still "I could not tell" — a read through a client the
230
+ // tracker is not wrapped around looks exactly like this. Only `tables: []`
231
+ // turns it into "I read nothing": the endpoint said so, so nothing a
232
+ // transaction does can change its answer.
233
+ return options.tables ? [] : undefined;
228
234
  }
229
235
  /**
230
236
  * The read set narrowed to rows, when every read could be seen.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nowity",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Realtime object model over PostgreSQL: logical change stream, query-scoped subscriptions, MobX identity map",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {