@protobase/schema 0.16.0 → 0.16.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.
@@ -15,6 +15,8 @@ export declare const addressWords: {
15
15
  readonly filterLayout: "layout";
16
16
  /** Where a list's map display looks: `latitude,longitude,zoom`. */
17
17
  readonly map: "map";
18
+ /** The saved search a list was opened from, by its key. */
19
+ readonly savedSearch: "saved_search";
18
20
  /** The second path segment that opens a resource's create form instead of a record. */
19
21
  readonly create: "new";
20
22
  };
@@ -15,6 +15,8 @@ const addressWords = {
15
15
  filterLayout: "layout",
16
16
  /** Where a list's map display looks: `latitude,longitude,zoom`. */
17
17
  map: "map",
18
+ /** The saved search a list was opened from, by its key. */
19
+ savedSearch: "saved_search",
18
20
  /** The second path segment that opens a resource's create form instead of a record. */
19
21
  create: "new"
20
22
  };
@@ -22,7 +24,8 @@ const listWords = [
22
24
  "display",
23
25
  "filter",
24
26
  "orderBy",
25
- "filterLayout"
27
+ "filterLayout",
28
+ "savedSearch"
26
29
  ];
27
30
  const mapText = (view) => `${view.latitude.toFixed(5)},${view.longitude.toFixed(5)},${view.zoom.toFixed(2)}`;
28
31
  const inRange = (value, limit, low = -limit) => Number.isFinite(value) && value >= low && value <= limit;
@@ -101,6 +104,7 @@ const readAppPath = (pathAndQuery, pages) => {
101
104
  const orderBy = params.get(addressWords.orderBy) || void 0;
102
105
  const layout = filterLayout(params.get(addressWords.filterLayout));
103
106
  const map = readMap(params.get(addressWords.map));
107
+ const savedSearch = params.get(addressWords.savedSearch) || void 0;
104
108
  return {
105
109
  kind: "list",
106
110
  resource: first,
@@ -108,7 +112,8 @@ const readAppPath = (pathAndQuery, pages) => {
108
112
  ...filter && { filter },
109
113
  ...orderBy && { orderBy },
110
114
  ...layout && { filterLayout: layout },
111
- ...map && { map }
115
+ ...map && { map },
116
+ ...savedSearch && { savedSearch }
112
117
  };
113
118
  };
114
119
  //#endregion
package/dist/model.d.ts CHANGED
@@ -176,6 +176,11 @@ export type AppAddress = {
176
176
  filterLayout?: FilterLayout;
177
177
  /** Where its map display looks. */
178
178
  map?: MapView;
179
+ /**
180
+ * The saved search the list was opened from, by its key in the text form the record API takes: while the list's
181
+ * filter differs from the search's, the list offers to update the search.
182
+ */
183
+ savedSearch?: string;
179
184
  } | {
180
185
  /** One record. */
181
186
  kind: 'record';
@@ -402,13 +407,14 @@ export type SearchesOfModel = {
402
407
  resource: string;
403
408
  /** The text field holding the search's filter, as the list's address has it. */
404
409
  filter: string;
405
- /** The text field a new search is named in, from its filters; the view's title shows it. */
410
+ /** The text field holding the name the user gives a search, if any; without one, the search's filters are its title. */
406
411
  name?: string;
407
412
  /** Enum and boolean fields changed in place on each search, such as how often to hear of new records. */
408
413
  controls?: string[];
409
414
  /**
410
- * With it, each search shows only the records new to the user: those whose `field` (of `resource`) is after the
411
- * search's `seenAt` (a timestamp field of this resource), which opening all of its results sets to now.
415
+ * With it, each search shows its records newest first by `field` (of `resource`) and marks those new to the user:
416
+ * those whose `field` is after the search's `seenAt` (a timestamp field of this resource), which opening all of its
417
+ * results sets to now.
412
418
  */
413
419
  unseen?: {
414
420
  /** When the user last opened the search's results. */
@@ -416,7 +422,7 @@ export type SearchesOfModel = {
416
422
  /** The searched resource's timestamp that makes a record new, such as when it was published. */
417
423
  field: string;
418
424
  };
419
- /** How many records each search shows; default 12. */
425
+ /** How many records each search shows at most; default every one it finds, loaded as its row scrolls. */
420
426
  limit?: number;
421
427
  };
422
428
  /** A view's list page (`.list(...)`). */
package/dist/view.d.ts CHANGED
@@ -122,8 +122,8 @@ export declare class ViewBuilder<R extends {
122
122
  saveSearch(search: SaveSearchModel): ViewBuilder<R>;
123
123
  /**
124
124
  * This resource holds saved searches of `resource`, which a list page saves with `.saveSearch(...)`: its list page
125
- * shows each of the user's searches with its filters, its `controls` to change in place, the newest records it finds
126
- * (with `unseen`, only those new since the user last opened its results) and a link to all of them. Throws in
125
+ * shows each of the user's searches with its filters, its `controls` to change in place, the records it finds (with
126
+ * `unseen`, newest first, those new since the user last opened its results marked) and a link to all of them. Throws in
127
127
  * `toModel` when `filter` or `name` is not a text field, `unseen.seenAt` not a timestamp or a control not an enum or
128
128
  * boolean field.
129
129
  * See [Saved searches](website/src/content/docs/reference/ui-config.mdx#saved-searches).
package/dist/view.js CHANGED
@@ -153,8 +153,8 @@ var ViewBuilder = class ViewBuilder {
153
153
  }
154
154
  /**
155
155
  * This resource holds saved searches of `resource`, which a list page saves with `.saveSearch(...)`: its list page
156
- * shows each of the user's searches with its filters, its `controls` to change in place, the newest records it finds
157
- * (with `unseen`, only those new since the user last opened its results) and a link to all of them. Throws in
156
+ * shows each of the user's searches with its filters, its `controls` to change in place, the records it finds (with
157
+ * `unseen`, newest first, those new since the user last opened its results marked) and a link to all of them. Throws in
158
158
  * `toModel` when `filter` or `name` is not a text field, `unseen.seenAt` not a timestamp or a control not an enum or
159
159
  * boolean field.
160
160
  * See [Saved searches](website/src/content/docs/reference/ui-config.mdx#saved-searches).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/schema",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "description": "Resource, field, view and access definitions for Protobase configs.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {