@crossworks/content-core 0.232.356 → 0.232.362

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossworks/content-core",
3
- "version": "0.232.356",
3
+ "version": "0.232.362",
4
4
  "description": "Browser-safe content logic — markdown, blocks, pages, tables, formulas — shared by the server and any client. Zero server deps by design: nothing here may reach @mantle/db, node-only APIs, or the network (the jackdaw-repo-split P0 boundary).",
5
5
  "exports": {
6
6
  "./app-nav": "./src/app-nav.ts",
@@ -31,7 +31,7 @@
31
31
  "./tree": "./src/tree.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@mantle/client-types": "npm:@crossworks/client-types@0.232.356",
34
+ "@mantle/client-types": "npm:@crossworks/client-types@0.232.362",
35
35
  "marked": "^18.0.11",
36
36
  "mathjs": "15.2.0"
37
37
  },
@@ -857,6 +857,13 @@ export type TableRow = {
857
857
  rowCount: number;
858
858
  /** Access level (admin > team > client > public); the owner UI's badge. */
859
859
  audience: AccessLevel;
860
+ /** The share it inherits from a folder above it (team or client), or
861
+ * null; it is read at the more open of this and `audience`. Optional:
862
+ * absent from brains before the folder audit fixes. */
863
+ inherited?: 'team' | 'client' | null;
864
+ /** The share it is read at through something that embeds it (migration
865
+ * 0208), or null. Optional: absent from brains before it. */
866
+ embedded?: 'team' | 'client' | null;
860
867
  createdAt: string;
861
868
  updatedAt: string;
862
869
  };
package/src/tree.ts CHANGED
@@ -17,20 +17,26 @@ import type { AccessLevel } from '@mantle/client-types';
17
17
  const LEVEL_RANK: Record<AccessLevel, number> = { public: 0, client: 1, team: 2, admin: 3 };
18
18
 
19
19
  /**
20
- * The level an item is read at: the more open of its own level and the share
21
- * it inherits from a folder (public < client < team < admin). This is the
22
- * level its pill shows, its embeds follow and its indexed page text is
23
- * folded for. Folding for the more open reader is safe for every reader of
24
- * the row: what a public or client reader may see, every reader above may
25
- * too. (Which ROLES read the row is the database's union of the two:
26
- * nodes_viewer_read, migration 0204.)
20
+ * The level an item is read at: the most open of its own level, the share it
21
+ * inherits from a folder, and the share of something that embeds it
22
+ * (public < client < team < admin). This is the level its pill shows and its
23
+ * indexed page text is folded for. Folding for the more open reader is safe
24
+ * for every reader of the row: what a public or client reader may see, every
25
+ * reader above may too. (Which ROLES read the row is the database's union of
26
+ * the three: nodes_viewer_read, migrations 0204 and 0208.)
27
27
  */
28
28
  export function effectiveLevel(
29
29
  own: AccessLevel,
30
30
  inherited: TreeShareLevel | null | undefined,
31
+ /** The share of something that embeds the item (a shared note's image),
32
+ * when the brain sends it. */
33
+ embedded?: TreeShareLevel | null,
31
34
  ): AccessLevel {
32
- if (!inherited) return own;
33
- return LEVEL_RANK[inherited] < LEVEL_RANK[own] ? inherited : own;
35
+ let level = own;
36
+ for (const share of [inherited, embedded]) {
37
+ if (share && LEVEL_RANK[share] < LEVEL_RANK[level]) level = share;
38
+ }
39
+ return level;
34
40
  }
35
41
 
36
42
  function labels(path: string): string[] {
@@ -72,9 +78,9 @@ export function isTreeFolderPathAllowed(path: string): boolean {
72
78
 
73
79
  /**
74
80
  * Cut a folder path that would sit too deep back to the deepest allowed
75
- * level: the extra levels are lifted into the third. Inbound paths use it (an
76
- * agent's `mkdir -p`, the crawler, Accept), so a deep chain lands in the
77
- * deepest folder instead of failing.
81
+ * level: the extra levels are lifted into the third. For clients; the brain's
82
+ * inbound paths clamp with their own helpers (Files: clampFilesFolderPath;
83
+ * Accept: accept-place.ts; member rows: carrySpaceRows).
78
84
  */
79
85
  export function clampTreePath(path: string): string {
80
86
  const parts = labels(path);