@protobase/server 0.15.2 → 0.15.4

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.
@@ -3,7 +3,7 @@ import { cardPhotosErrors } from "./view-card-photos.js";
3
3
  import { cardFavoriteErrors, favoriteOwnerErrors } from "./view-card-favorite.js";
4
4
  import { saveSearchErrors, searchesOfErrors } from "./view-saved-search.js";
5
5
  import { mapDisplayErrors, mapErrors } from "./view-map.js";
6
- import { addressErrors, addressPlaceholders, appHrefError, displayFields, fieldRefsIn, hrefPlaceholders } from "@protobase/schema/internal";
6
+ import { addressErrors, addressPlaceholders, displayFields, fieldRefsIn, hrefField, hrefPlaceholders, linkActionError } from "@protobase/schema/internal";
7
7
  //#region src/check-views.ts
8
8
  const linkFields = (run) => run?.kind !== "link" ? [] : "to" in run ? addressPlaceholders(run.to) : hrefPlaceholders(run.href);
9
9
  const sensitiveErrors = (view, model) => {
@@ -37,17 +37,17 @@ const valueColorErrors = (view, model) => Object.entries(view.fields).flatMap(([
37
37
  if (field?.type !== "enum") return [`value colours of "${name}" need an enum field`];
38
38
  return Object.keys(hints.valueColors).filter((value) => !field.enumValues?.includes(value)).map((value) => `value colour "${value}" is not a value of "${name}"`);
39
39
  });
40
- const linkErrors = (view, model, models, pages) => view.actions.flatMap(({ name, run }) => {
40
+ const linkErrors = (view, model, models, pages) => view.actions.flatMap(({ name, label, run }) => {
41
41
  if (run?.kind !== "link") return [];
42
- if ("href" in run) {
43
- const error = appHrefError(run.href);
44
- return error ? [`action "${name}": ${error}`] : [];
45
- }
46
- return addressErrors(run.to, {
42
+ const error = linkActionError(label, run);
43
+ if (error) return [`action "${name}": ${error}`];
44
+ const field = "href" in run ? hrefField(run.href) : void 0;
45
+ if (field !== void 0 && !Object.hasOwn(model.fields, field)) return [`action "${name}": href names field "${field}", which ${model.name} does not have`];
46
+ return "to" in run ? addressErrors(run.to, {
47
47
  models,
48
48
  pages,
49
49
  source: model
50
- }).map((error) => `action "${name}": ${error}`);
50
+ }).map((error) => `action "${name}": ${error}`) : [];
51
51
  });
52
52
  const unknownFieldErrors = (view, model) => {
53
53
  const unknown = (names, what) => names.filter((name) => !Object.hasOwn(model.fields, name)).map((name) => `${what} names field "${name}", which ${model.name} does not have`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/server",
3
- "version": "0.15.2",
3
+ "version": "0.15.4",
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": {
@@ -30,9 +30,9 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@better-auth/passkey": "^1.7.7",
33
- "@protobase/layout": "0.15.2",
34
- "@protobase/query": "0.15.2",
35
- "@protobase/schema": "0.15.2",
33
+ "@protobase/layout": "0.15.4",
34
+ "@protobase/query": "0.15.4",
35
+ "@protobase/schema": "0.15.4",
36
36
  "@react-email/render": "^2.1.0",
37
37
  "@scalar/hono-api-reference": "^0.12.10",
38
38
  "@sentry/core": "^11.7.0",