@protobase/cli 0.21.1 → 0.21.3

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.
@@ -62,6 +62,35 @@ const relatedShapes = (item, owner, models) => {
62
62
  }
63
63
  }];
64
64
  };
65
+ const handOrderShapes = (model, view, list, models) => {
66
+ const own = model.position && model.position.within === void 0 && model.fields[model.position.field];
67
+ const listed = own ? [{
68
+ resource: model.name,
69
+ request: request(model.name, void 0, [[own.name, "asc"]]),
70
+ from: `${list} sorted by hand`,
71
+ query: { sort: [[own.name, "asc"]] }
72
+ }] : [];
73
+ const related = view.layout.flatMap((item) => {
74
+ if (item.kind !== "related" || item.through || item.filter) return [];
75
+ const target = models[item.resource];
76
+ const position = target?.position;
77
+ if (!target || position?.within !== item.field) return [];
78
+ const field = target.fields[position.field];
79
+ const match = target.fields[item.field];
80
+ if (!field || !match) return [];
81
+ const sort = [[field.name, "asc"]];
82
+ return [{
83
+ resource: target.name,
84
+ request: request(target.name, `${match.name} = …`, sort),
85
+ from: `related "${item.title}" on the ${model.name} record page, sorted by hand`,
86
+ query: {
87
+ filter: compare(match),
88
+ sort
89
+ }
90
+ }];
91
+ });
92
+ return [...listed, ...related];
93
+ };
65
94
  const galleryShapes = (item, owner, models) => {
66
95
  const holder = item.photos && models[item.photos.resource];
67
96
  const field = holder?.fields[item.photos.field];
@@ -167,7 +196,7 @@ const recentShapes = (model, view) => {
167
196
  };
168
197
  /**
169
198
  * The reads a view's pages make: its list in its order, the filter widgets and their counts, its chart per value, its displays' maps,
170
- * board columns and photos, the records of its related sections and the photos of its galleries, the recent records in the sidebar and a saved search's new records.
199
+ * board columns and photos, the records of its related sections and the photos of its galleries, the recent records in the sidebar, a saved search's new records and the records sorted by hand.
171
200
  */
172
201
  const viewShapes = (view, models) => {
173
202
  const model = models[view.resource];
@@ -186,7 +215,8 @@ const viewShapes = (view, models) => {
186
215
  ...chartShapes(model, view, list),
187
216
  ...view.layout.flatMap((item) => item.kind === "related" ? relatedShapes(item, model.name, models) : item.kind === "gallery" ? galleryShapes(item, model.name, models) : []),
188
217
  ...recentShapes(model, view),
189
- ...searchesShapes(view, models)
218
+ ...searchesShapes(view, models),
219
+ ...handOrderShapes(model, view, list, models)
190
220
  ];
191
221
  };
192
222
  //#endregion
package/dist/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.21.1";
2
+ var version = "0.21.3";
3
3
  //#endregion
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/cli",
3
- "version": "0.21.1",
3
+ "version": "0.21.3",
4
4
  "description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -34,11 +34,11 @@
34
34
  "dependencies": {
35
35
  "@hono/node-server": "^2.1.3",
36
36
  "@hono/vite-dev-server": "^0.26.1",
37
- "@protobase/layout": "0.21.1",
38
- "@protobase/query": "0.21.1",
39
- "@protobase/schema": "0.21.1",
40
- "@protobase/server": "0.21.1",
41
- "@protobase/ui": "0.21.1",
37
+ "@protobase/layout": "0.21.3",
38
+ "@protobase/query": "0.21.3",
39
+ "@protobase/schema": "0.21.3",
40
+ "@protobase/server": "0.21.3",
41
+ "@protobase/ui": "0.21.3",
42
42
  "@react-email/render": "^2.1.0",
43
43
  "@scalar/hono-api-reference": "^0.12.10",
44
44
  "@tailwindcss/vite": "^4.3.3",