@protobase/server 0.21.11 → 0.21.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/check-views.js +2 -2
- package/dist/view-access.js +55 -40
- package/package.json +4 -4
package/dist/check-views.js
CHANGED
|
@@ -7,7 +7,7 @@ import { mapDisplayErrors, mapErrors } from "./view-map.js";
|
|
|
7
7
|
import { relatedColumnErrors } from "./view-related-column.js";
|
|
8
8
|
import { editableErrors } from "./view-editable.js";
|
|
9
9
|
import { conditionProblems } from "@protobase/layout";
|
|
10
|
-
import { actionInputErrors, addressErrors, addressPlaceholders, boardErrors, calendarErrors, chartFields, displayFields, fieldRefsIn, hrefField, hrefPlaceholders, linkActionError, promptError, promptFields } from "@protobase/schema/internal";
|
|
10
|
+
import { actionInputErrors, addressErrors, addressPlaceholders, boardErrors, calendarErrors, chartFields, displayFields, fieldRefsIn, hrefField, hrefPlaceholders, layoutItems, linkActionError, promptError, promptFields } from "@protobase/schema/internal";
|
|
11
11
|
import { isRecordCondition } from "@protobase/schema";
|
|
12
12
|
//#region src/check-views.ts
|
|
13
13
|
const linkFields = (run) => run?.kind !== "link" ? [] : "to" in run ? addressPlaceholders(run.to) : hrefPlaceholders(run.href);
|
|
@@ -152,7 +152,7 @@ const checkViews = (registry, views, pages = [], fieldTypes = {}) => {
|
|
|
152
152
|
const problems = views.flatMap((view) => {
|
|
153
153
|
const model = models[view.resource];
|
|
154
154
|
if (!model) return [];
|
|
155
|
-
const related = [...view.layout.flatMap((item) => item.kind === "related" ? relatedErrors(item, view.resource, models).map((error) => `related "${item.title}": ${error}`) : []), ...relatedColumnsErrors(view, model, models)];
|
|
155
|
+
const related = [...layoutItems(view.layout).flatMap((item) => item.kind === "related" ? relatedErrors(item, view.resource, models).map((error) => `related "${item.title}": ${error}`) : []), ...relatedColumnsErrors(view, model, models)];
|
|
156
156
|
const photos = [
|
|
157
157
|
...(view.list?.displays ?? []).flatMap((display) => display.kind === "cards" && display.photos ? cardPhotosErrors(display.photos, view.resource, models).map((error) => `display "${display.name}" photos: ${error}`) : []),
|
|
158
158
|
...sharedPhotosErrors(view),
|
package/dist/view-access.js
CHANGED
|
@@ -158,52 +158,67 @@ const widgetShape = shapes.oneOf({
|
|
|
158
158
|
label: shapes.data
|
|
159
159
|
}, { requires: ["fields"] })
|
|
160
160
|
});
|
|
161
|
-
const layoutShape = (resource, model, models) =>
|
|
162
|
-
|
|
161
|
+
const layoutShape = (resource, model, models) => {
|
|
162
|
+
const when = recordWhenShape(resource, models);
|
|
163
|
+
const section = shapes.object({
|
|
163
164
|
kind: shapes.data,
|
|
164
165
|
title: shapes.data,
|
|
165
166
|
help: shapes.data,
|
|
166
167
|
helpWhen: shapes.data,
|
|
167
168
|
presentation: shapes.data,
|
|
168
|
-
when
|
|
169
|
+
when,
|
|
169
170
|
fields: shapes.list(shapes.field, { nonEmpty: true })
|
|
170
|
-
}, { requires: ["fields", "when"] })
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
})
|
|
171
|
+
}, { requires: ["fields", "when"] });
|
|
172
|
+
const related = shapes.map((item) => pruneRelated(item, resource, models));
|
|
173
|
+
return shapes.oneOf({
|
|
174
|
+
section,
|
|
175
|
+
sidebar: shapes.object({
|
|
176
|
+
kind: shapes.data,
|
|
177
|
+
fields: shapes.list(shapes.field, { nonEmpty: true }),
|
|
178
|
+
when
|
|
179
|
+
}, { requires: ["fields", "when"] }),
|
|
180
|
+
related,
|
|
181
|
+
group: shapes.object({
|
|
182
|
+
kind: shapes.data,
|
|
183
|
+
title: shapes.data,
|
|
184
|
+
collapsed: shapes.data,
|
|
185
|
+
when,
|
|
186
|
+
items: shapes.list(shapes.oneOf({
|
|
187
|
+
section,
|
|
188
|
+
related
|
|
189
|
+
}), { nonEmpty: true })
|
|
190
|
+
}, { requires: ["items", "when"] }),
|
|
191
|
+
custom: shapes.object({
|
|
192
|
+
kind: shapes.data,
|
|
193
|
+
component: shapes.data,
|
|
194
|
+
title: shapes.data,
|
|
195
|
+
sidebar: shapes.data,
|
|
196
|
+
when: shapes.data,
|
|
197
|
+
props: shapes.refs
|
|
198
|
+
}, { requires: ["props"] }),
|
|
199
|
+
map: shapes.object({
|
|
200
|
+
kind: shapes.data,
|
|
201
|
+
title: shapes.data,
|
|
202
|
+
latitude: shapes.field,
|
|
203
|
+
longitude: shapes.field,
|
|
204
|
+
zoom: shapes.data,
|
|
205
|
+
sidebar: shapes.data,
|
|
206
|
+
when: shapes.data
|
|
207
|
+
}, { requires: ["latitude", "longitude"] }),
|
|
208
|
+
gallery: shapes.map((item) => pruneGallery(item, resource, model, models)),
|
|
209
|
+
history: shapes.object({
|
|
210
|
+
kind: shapes.data,
|
|
211
|
+
title: shapes.data,
|
|
212
|
+
limit: shapes.data,
|
|
213
|
+
when: shapes.data
|
|
214
|
+
}),
|
|
215
|
+
comments: shapes.object({
|
|
216
|
+
kind: shapes.data,
|
|
217
|
+
title: shapes.data,
|
|
218
|
+
when: shapes.data
|
|
219
|
+
})
|
|
220
|
+
});
|
|
221
|
+
};
|
|
207
222
|
const linkShape = (model, models) => shapes.map((run) => {
|
|
208
223
|
return ("to" in run ? addressErrors(run.to, {
|
|
209
224
|
models,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/server",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.12",
|
|
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": {
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@better-auth/passkey": "^1.7.7",
|
|
33
33
|
"@better-auth/sso": "^1.7.7",
|
|
34
|
-
"@protobase/layout": "0.21.
|
|
35
|
-
"@protobase/query": "0.21.
|
|
36
|
-
"@protobase/schema": "0.21.
|
|
34
|
+
"@protobase/layout": "0.21.12",
|
|
35
|
+
"@protobase/query": "0.21.12",
|
|
36
|
+
"@protobase/schema": "0.21.12",
|
|
37
37
|
"@react-email/render": "^2.1.0",
|
|
38
38
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
39
39
|
"@sentry/core": "^11.7.0",
|