@protobase/server 0.65.1 → 0.66.0
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/check-views.js +6 -2
- package/dist/package.js +1 -1
- package/dist/view-related.js +16 -1
- package/package.json +4 -4
package/dist/check-views.js
CHANGED
|
@@ -157,7 +157,7 @@ const listOfErrors = (model, name, models) => {
|
|
|
157
157
|
* field the resource does not have, labels or colours values its enum does not have, shows a field with a field type of
|
|
158
158
|
* `fieldTypes` (each with the storage types it shows) or a built-in one that does not show it,
|
|
159
159
|
* edits a list column in its cell that is not a field with an editor of one line the API may write,
|
|
160
|
-
* has a section, related section or sidebar whose `when` condition names what the app does not have, a related section or related list column, a cards display's or gallery's photos or a cards display's favorite button, a `listOf`, a "Save search" button or a
|
|
160
|
+
* has a section, related section or sidebar whose `when` condition names what the app does not have, a related section or related list column, more than one related section of lines, a cards display's or gallery's photos or a cards display's favorite button, a `listOf`, a "Save search" button or a
|
|
161
161
|
* `searchesOf` that do not fit the resources, cards
|
|
162
162
|
* displays of one list that name different photos, a chart per value that cannot group or add up its fields, a chart of related records that does not fit them, a map that cannot show the
|
|
163
163
|
* record's position or a map display that cannot find the records in its view, a board whose columns are no filterable enum, a calendar or timeline whose dates are no filterable date or timestamp fields, a link to an address the app does not have, an action whose `when` reads what the record does not have, an AI action that cannot write its field, action inputs that do not fit, or a create page that is not one of `pages`.
|
|
@@ -167,7 +167,11 @@ const checkViews = (registry, views, pages = [], fieldTypes = {}) => {
|
|
|
167
167
|
const pageNames = new Set(pages);
|
|
168
168
|
const createPages = new Set(views.filter((view) => view.create).map((view) => view.resource));
|
|
169
169
|
const viewProblems = (view, model) => {
|
|
170
|
-
const related = [
|
|
170
|
+
const related = [
|
|
171
|
+
...layoutItems(view.layout).flatMap((item) => item.kind === "related" ? [...relatedErrors(item, view.resource, models), ...relatedActionErrors(item, views)].map((error) => `related "${item.title}": ${error}`) : []),
|
|
172
|
+
...relatedColumnsErrors(view, model, models),
|
|
173
|
+
...layoutItems(view.layout).filter((item) => item.kind === "related" && item.lines).length > 1 ? ["only one related section holds the lines"] : []
|
|
174
|
+
];
|
|
171
175
|
const photos = [
|
|
172
176
|
...(view.list?.displays ?? []).flatMap((display) => display.kind === "cards" && display.photos ? cardPhotosErrors(display.photos, view.resource, models).map((error) => `display "${display.name}" photos: ${error}`) : []),
|
|
173
177
|
...sharedPhotosErrors(view),
|
package/dist/package.js
CHANGED
package/dist/view-related.js
CHANGED
|
@@ -56,6 +56,20 @@ const fromErrors = (item, from, owner, target) => {
|
|
|
56
56
|
if (!match) return [];
|
|
57
57
|
return source.type === match.type && source.relation?.resource === match.relation?.resource ? [] : [`from: "${from}" on ${owner.name} and "${item.field}" on ${target.name} do not hold the same kind of value`];
|
|
58
58
|
};
|
|
59
|
+
const linesOptions = /* @__PURE__ */ new Set([
|
|
60
|
+
"kind",
|
|
61
|
+
"title",
|
|
62
|
+
"help",
|
|
63
|
+
"resource",
|
|
64
|
+
"field",
|
|
65
|
+
"when",
|
|
66
|
+
"lines"
|
|
67
|
+
]);
|
|
68
|
+
/** What is wrong with a related section that holds the record's lines: all records ordered `within` the record by `field`. */
|
|
69
|
+
const linesErrors = (item, target) => {
|
|
70
|
+
if (!item.lines) return [];
|
|
71
|
+
return [...Object.keys(item).filter((key) => !linesOptions.has(key)).map((key) => `lines cannot be combined with "${key}"`), ...target.position?.within === item.field ? [] : [`lines need ${target.name} ordered within "${item.field}", with .position(..., { within })`]];
|
|
72
|
+
};
|
|
59
73
|
/**
|
|
60
74
|
* What is wrong with a related section on the record page of `resource`, against these models; empty when it can be
|
|
61
75
|
* shown. Against the full models it checks the config; against a caller's models, whether that caller can use it.
|
|
@@ -77,7 +91,8 @@ const relatedErrors = (item, resource, models) => {
|
|
|
77
91
|
...item.limit === void 0 || Number.isInteger(item.limit) && item.limit >= 1 && item.limit <= 100 ? [] : ["limit must be a whole number from 1 to 100"],
|
|
78
92
|
...openErrors(item, models),
|
|
79
93
|
...item.presentation === void 0 || item.presentation === "cards" ? [] : [`presentation must be "cards", not "${String(item.presentation)}"`],
|
|
80
|
-
...item.actions === void 0 || item.presentation === "cards" ? [] : ["actions need presentation \"cards\""]
|
|
94
|
+
...item.actions === void 0 || item.presentation === "cards" ? [] : ["actions need presentation \"cards\""],
|
|
95
|
+
...linesErrors(item, target)
|
|
81
96
|
];
|
|
82
97
|
};
|
|
83
98
|
/** The `actions` of a related section that are no named action of its resource's view, among `views`. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.66.0",
|
|
4
4
|
"description": "The Protobase REST API as a Hono app, with Better Auth sign-in.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"@better-auth/sso": "^1.7.12",
|
|
43
43
|
"@livekit/protocol": "1.53.1",
|
|
44
44
|
"@modelcontextprotocol/server": "^2.3.1",
|
|
45
|
-
"@protobase/layout": "0.
|
|
46
|
-
"@protobase/query": "0.
|
|
47
|
-
"@protobase/schema": "0.
|
|
45
|
+
"@protobase/layout": "0.66.0",
|
|
46
|
+
"@protobase/query": "0.66.0",
|
|
47
|
+
"@protobase/schema": "0.66.0",
|
|
48
48
|
"@react-email/render": "^2.1.0",
|
|
49
49
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
50
50
|
"@sentry/core": "^11.7.0",
|