@protobase/server 0.19.9 → 0.19.10

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.
@@ -56,6 +56,7 @@ const linkErrors = (view, model, models, pages) => view.actions.flatMap(({ name,
56
56
  source: model
57
57
  }).map((error) => `action "${name}": ${error}`) : [];
58
58
  });
59
+ const createErrors = (view, pages) => view.create && !pages.has(view.create.page) ? [`create: unknown page "${view.create.page}"`] : [];
59
60
  const unknownFieldErrors = (view, model) => {
60
61
  const unknown = (names, what) => names.filter((name) => !Object.hasOwn(model.fields, name)).map((name) => `${what} names field "${name}", which ${model.name} does not have`);
61
62
  return [
@@ -94,7 +95,7 @@ const listOfErrors = (model, name, models) => {
94
95
  * has a related section, a cards display's or gallery's photos or a cards display's favorite button, a `listOf`, a "Save search" button or a
95
96
  * `searchesOf` that do not fit the resources, cards
96
97
  * displays of one list that name different photos, a map that cannot show the
97
- * record's position or a map display that cannot find the records in its view, or a link to an address the app does not have.
98
+ * record's position or a map display that cannot find the records in its view, a link to an address the app does not have, or a create page that is not one of `pages`.
98
99
  */
99
100
  const checkViews = (registry, views, pages = [], fieldTypes = {}) => {
100
101
  const models = Object.fromEntries(registry.entries.map((entry) => [entry.name, entry.model]));
@@ -125,7 +126,8 @@ const checkViews = (registry, views, pages = [], fieldTypes = {}) => {
125
126
  ...listOf,
126
127
  ...searches,
127
128
  ...maps,
128
- ...linkErrors(view, model, models, pageNames)
129
+ ...linkErrors(view, model, models, pageNames),
130
+ ...createErrors(view, pageNames)
129
131
  ].map((problem) => `View "${view.resource}": ${problem}`);
130
132
  });
131
133
  if (problems.length > 0) throw new Error(`The views do not match the resources:\n${problems.map((problem) => ` - ${problem}`).join("\n")}`);
@@ -195,7 +195,8 @@ const viewShape = (resource, model, models, prompted) => shapes.object({
195
195
  saveSearch: shapes.map((search) => prompted.has(search.resource) || models[search.resource] ? search : void 0),
196
196
  searchesOf: shapes.map((searches) => searchesOfFor(searches, resource, models)),
197
197
  import: shapes.data,
198
- export: shapes.data
198
+ export: shapes.data,
199
+ create: shapes.data
199
200
  });
200
201
  /**
201
202
  * The view with every reference to a field the caller cannot read removed: list columns, sort, search and displays,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/server",
3
- "version": "0.19.9",
3
+ "version": "0.19.10",
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.19.9",
34
- "@protobase/query": "0.19.9",
35
- "@protobase/schema": "0.19.9",
33
+ "@protobase/layout": "0.19.10",
34
+ "@protobase/query": "0.19.10",
35
+ "@protobase/schema": "0.19.10",
36
36
  "@react-email/render": "^2.1.0",
37
37
  "@scalar/hono-api-reference": "^0.12.10",
38
38
  "@sentry/core": "^11.7.0",