@protobase/schema 0.121.11 → 0.121.12

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/dist/model.d.ts CHANGED
@@ -1441,6 +1441,16 @@ export type NavRecentModel = {
1441
1441
  * project UI's `marks`, which the sidebar calls in the browser. Presentation only: it is no field, filter or sort key.
1442
1442
  */
1443
1443
  marks?: string;
1444
+ /**
1445
+ * Says "typing…" beside a record while someone else types in it, wherever the reader is in the app: a record of a
1446
+ * channel resource of the app's realtime relay, whose conversation page has `typing`.
1447
+ */
1448
+ typing?: true;
1449
+ /**
1450
+ * Draws a record bold with the count of its unread messages, from the view's conversation page and its `readPosition`:
1451
+ * counted once as the app opens and after the relay reconnects, then kept by the relay's notices without reading.
1452
+ */
1453
+ unread?: true;
1444
1454
  };
1445
1455
  /**
1446
1456
  * The record the app opens at `/`: the first that the filter finds in the order given, read with the caller's access, such
@@ -1781,6 +1791,11 @@ export type ConversationPageModel = {
1781
1791
  placeholder?: string;
1782
1792
  /** What the conversation says while it has no messages. */
1783
1793
  empty?: string;
1794
+ /**
1795
+ * Says who else types, above the box, and tells the others while the reader types: `typing` events on the record's
1796
+ * channel of the app's realtime relay, which declares them.
1797
+ */
1798
+ typing?: true;
1784
1799
  };
1785
1800
  /**
1786
1801
  * The resource that keeps how far each reader has read a record's conversation: one record per reader and record, its
@@ -33,7 +33,8 @@ const navRecentErrors = (recent, model) => [
33
33
  ...recent.limit === void 0 || Number.isInteger(recent.limit) && recent.limit >= 1 && recent.limit <= maxLimit ? [] : [`limit must be a whole number from 1 to ${maxLimit}`],
34
34
  ...recent.filter === void 0 ? [] : filterErrors(model, recent.filter).map((error) => `filter: ${error.message}`),
35
35
  ...recent.orderBy === void 0 ? [] : orderByErrors(model, recent.orderBy).map((error) => `orderBy: ${error.message}`),
36
- ...recent.marks === void 0 || typeof recent.marks === "string" && recent.marks !== "" ? [] : ["marks needs the name of a hook in the project UI's marks"]
36
+ ...recent.marks === void 0 || typeof recent.marks === "string" && recent.marks !== "" ? [] : ["marks needs the name of a hook in the project UI's marks"],
37
+ ...["typing", "unread"].flatMap((name) => recent[name] === void 0 || recent[name] === true ? [] : [`${name} is true or left out`])
37
38
  ];
38
39
  //#endregion
39
40
  export { defaultRecentLimit, filterErrors, navRecentErrors, orderByErrors, statusTones };
package/dist/view.js CHANGED
@@ -428,6 +428,9 @@ var ViewBuilder = class ViewBuilder {
428
428
  if (typeof nav?.create === "object" && nav.create.label.trim() === "") throw new Error(`View "${this.state.resource}": nav.create needs a label, or true for "New <singular>"`);
429
429
  const recentErrors = resource && nav?.recent ? navRecentErrors(nav.recent, resource) : [];
430
430
  if (recentErrors.length > 0) throw new Error(`View "${this.state.resource}": nav.recent ${recentErrors.join("; ")}`);
431
+ const conversation = this.state.record && "conversation" in this.state.record ? this.state.record.conversation : void 0;
432
+ if (nav?.recent?.unread && !conversation?.readPosition) throw new Error(`View "${this.state.resource}": nav.recent.unread counts from the conversation's read positions, so the view needs .record({ conversation }) with readPosition`);
433
+ if (nav?.recent?.typing && !conversation?.typing) throw new Error(`View "${this.state.resource}": nav.recent.typing shows the typing of the record's conversation, so the view needs .record({ conversation }) with typing`);
431
434
  const startErrors = resource && nav?.start ? navStartErrors(nav.start, resource) : [];
432
435
  if (startErrors.length > 0) throw new Error(`View "${this.state.resource}": nav.start ${startErrors.join("; ")}`);
433
436
  const opensUnknown = resource ? (this.state.recordOpens ?? []).flatMap(addressPlaceholders).find((name) => !Object.hasOwn(resource.fields, name)) : void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/schema",
3
- "version": "0.121.11",
3
+ "version": "0.121.12",
4
4
  "description": "Resource, field, view and access definitions for Protobase configs.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {