@protobase/cli 0.22.5 → 0.22.7
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/doctor/page-shapes.js +17 -6
- package/dist/doctor/view-shapes.js +9 -6
- package/dist/package.js +1 -1
- package/package.json +6 -6
|
@@ -16,20 +16,31 @@ const blockSort = (node, model, view) => {
|
|
|
16
16
|
return node.type === "RecordRow" ? listSort(model, view) : void 0;
|
|
17
17
|
};
|
|
18
18
|
const title = (node) => text(node.props.title) ?? text(node.props.label);
|
|
19
|
-
const
|
|
19
|
+
const chartShapes = (page, node, model) => {
|
|
20
20
|
const source = text(node.props.filter);
|
|
21
21
|
const filter = configFilter(model, source);
|
|
22
22
|
const groupBy = String(node.props.groupBy);
|
|
23
23
|
const named = title(node);
|
|
24
|
-
|
|
24
|
+
const splitBy = text(node.props.splitBy);
|
|
25
|
+
const request = `GET /${model.name}:aggregate?group_by=${groupBy}${source?.trim() ? `&filter=${source}` : ""}`;
|
|
26
|
+
const from = `page "${page.name}", <Chart${named ? ` "${named}"` : ""}>`;
|
|
27
|
+
return [{
|
|
25
28
|
resource: model.name,
|
|
26
|
-
request
|
|
27
|
-
from
|
|
29
|
+
request,
|
|
30
|
+
from,
|
|
28
31
|
query: {
|
|
29
32
|
...filter && { filter },
|
|
30
33
|
groupBy
|
|
31
34
|
}
|
|
32
|
-
}
|
|
35
|
+
}, ...splitBy === void 0 ? [] : [{
|
|
36
|
+
resource: model.name,
|
|
37
|
+
request: `${request}&split_by=${splitBy}`,
|
|
38
|
+
from,
|
|
39
|
+
query: {
|
|
40
|
+
...filter && { filter },
|
|
41
|
+
groupBy: splitBy
|
|
42
|
+
}
|
|
43
|
+
}]];
|
|
33
44
|
};
|
|
34
45
|
/** The reads of a composed page: each block that lists records, with its filter and sort, and each chart's grouping. */
|
|
35
46
|
const pageShapes = (page, models, views) => {
|
|
@@ -37,7 +48,7 @@ const pageShapes = (page, models, views) => {
|
|
|
37
48
|
walkTree(page.tree, (node) => {
|
|
38
49
|
const model = node.custom ? void 0 : models[text(node.props.resource) ?? ""];
|
|
39
50
|
if (model && node.type === "Chart") {
|
|
40
|
-
shapes.push(
|
|
51
|
+
shapes.push(...chartShapes(page, node, model));
|
|
41
52
|
return;
|
|
42
53
|
}
|
|
43
54
|
if (!model || !listing.includes(node.type) || node.type === "RecordCard" && node.props.recordKey !== void 0) return;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { all, any, anyOf, compare, configFilter, configSort, isTrue, sortText } from "./shape-filters.js";
|
|
2
|
-
import { isGroupChart, layoutItems } from "@protobase/schema/internal";
|
|
2
|
+
import { isGroupChart, layoutItems, viewOfList } from "@protobase/schema/internal";
|
|
3
3
|
//#region src/doctor/view-shapes.ts
|
|
4
4
|
const numberTypes = [
|
|
5
5
|
"integer",
|
|
@@ -231,6 +231,12 @@ const openingShape = (model, view, list, sort) => {
|
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
233
|
};
|
|
234
|
+
const listShapes = (model, view, list, models) => [
|
|
235
|
+
openingShape(model, view, list, listSort(model, view)),
|
|
236
|
+
...view.filters.flatMap((widget) => widgetShapes(model, widget, `${list}'s ${widget.kind === "dateRange" ? "date range" : widget.kind} filter`)),
|
|
237
|
+
...displayShapes(model, view, models),
|
|
238
|
+
...chartShapes(model, view, list)
|
|
239
|
+
];
|
|
234
240
|
/**
|
|
235
241
|
* 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,
|
|
236
242
|
* 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.
|
|
@@ -238,13 +244,10 @@ const openingShape = (model, view, list, sort) => {
|
|
|
238
244
|
const viewShapes = (view, models) => {
|
|
239
245
|
const model = models[view.resource];
|
|
240
246
|
if (!model) return [];
|
|
241
|
-
const sort = listSort(model, view);
|
|
242
247
|
const list = view.roles ? `the ${model.name} list for ${view.roles.join(", ")}` : `the ${model.name} list`;
|
|
243
248
|
return [
|
|
244
|
-
|
|
245
|
-
...view.
|
|
246
|
-
...displayShapes(model, view, models),
|
|
247
|
-
...chartShapes(model, view, list),
|
|
249
|
+
...listShapes(model, view, list, models),
|
|
250
|
+
...(view.lists ?? []).flatMap((named) => listShapes(model, viewOfList(view, named.name), `${list} "${named.name}"`, models)),
|
|
248
251
|
...layoutItems(view.layout).flatMap((item) => item.kind === "related" ? relatedShapes(item, model.name, models) : item.kind === "gallery" ? galleryShapes(item, model.name, models) : []),
|
|
249
252
|
...recentShapes(model, view),
|
|
250
253
|
...searchesShapes(view, models),
|
package/dist/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.7",
|
|
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.22.
|
|
38
|
-
"@protobase/query": "0.22.
|
|
39
|
-
"@protobase/schema": "0.22.
|
|
40
|
-
"@protobase/server": "0.22.
|
|
41
|
-
"@protobase/ui": "0.22.
|
|
37
|
+
"@protobase/layout": "0.22.7",
|
|
38
|
+
"@protobase/query": "0.22.7",
|
|
39
|
+
"@protobase/schema": "0.22.7",
|
|
40
|
+
"@protobase/server": "0.22.7",
|
|
41
|
+
"@protobase/ui": "0.22.7",
|
|
42
42
|
"@react-email/render": "^2.1.0",
|
|
43
43
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
44
44
|
"@tailwindcss/vite": "^4.3.3",
|