@protobase/server 0.55.6 → 0.55.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/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.55.6";
2
+ var version = "0.55.7";
3
3
  //#endregion
4
4
  export { version };
@@ -4,11 +4,14 @@
4
4
  * scope on the parent's resource: tenant, read row filter, soft delete and its own parents. A caller who cannot read the
5
5
  * parent resource, or whose read rule there needs the record, which no query can express, reads no parent. `chain` holds
6
6
  * the resources whose parents led here: one already on it is not followed further, so a resource that is its own parent,
7
- * such as a tree, is checked one level up.
7
+ * such as a tree, is checked one level up. Reached as its own parent, the last on `chain`, it still follows its other
8
+ * parents, so a reply read through its thread keeps to the thread's channel too.
8
9
  */
9
10
  const parentReads = async (entry, session, chain, accessOf, find) => {
10
- if (chain.includes(entry.name)) return [];
11
- const reads = (entry.model.parents ?? []).filter((parent) => parent.access === "read");
11
+ const ownParent = chain.at(-1) === entry.name;
12
+ if (!ownParent && chain.includes(entry.name)) return [];
13
+ const isSelf = (field) => entry.model.fields[field].relation.resource === entry.name;
14
+ const reads = (entry.model.parents ?? []).filter((parent) => parent.access === "read" && !(ownParent && isSelf(parent.field)));
12
15
  return Promise.all(reads.map(async ({ field }) => {
13
16
  const relation = entry.model.fields[field];
14
17
  const parentEntry = find(relation.relation.resource);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/server",
3
- "version": "0.55.6",
3
+ "version": "0.55.7",
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": {
@@ -40,9 +40,9 @@
40
40
  "@better-auth/passkey": "^1.7.12",
41
41
  "@better-auth/sso": "^1.7.12",
42
42
  "@modelcontextprotocol/server": "^2.3.1",
43
- "@protobase/layout": "0.55.6",
44
- "@protobase/query": "0.55.6",
45
- "@protobase/schema": "0.55.6",
43
+ "@protobase/layout": "0.55.7",
44
+ "@protobase/query": "0.55.7",
45
+ "@protobase/schema": "0.55.7",
46
46
  "@react-email/render": "^2.1.0",
47
47
  "@scalar/hono-api-reference": "^0.12.10",
48
48
  "@sentry/core": "^11.7.0",