@adhdev/mesh-shared 1.0.82-rc.10 → 1.0.82-rc.11
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/index.js +11 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -6
- package/dist/index.mjs.map +1 -1
- package/dist/path-ownership.d.ts +1 -1
- package/package.json +1 -1
- package/src/keyed-doc-delta.ts +9 -1
- package/src/path-ownership.ts +4 -6
package/dist/path-ownership.d.ts
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
*/
|
|
34
34
|
/** One normalized ownership entry: a repo-relative path, optionally a `**` subtree prefix. */
|
|
35
35
|
export interface OwnedPathEntry {
|
|
36
|
-
/** Repo-relative path with forward slashes, no leading `./`, no trailing slash. */
|
|
36
|
+
/** Repo-relative path with forward slashes, no leading `./`, no trailing slash; empty for the whole-repo subtree. */
|
|
37
37
|
readonly path: string;
|
|
38
38
|
/** True when this entry was declared as `<path>/**` (owns the whole subtree). */
|
|
39
39
|
readonly subtree: boolean;
|
package/package.json
CHANGED
package/src/keyed-doc-delta.ts
CHANGED
|
@@ -326,7 +326,15 @@ export function foldKeyedDoc<T extends Record<string, unknown>>(held: T, delta:
|
|
|
326
326
|
const heldList = heldCollections.get(path)
|
|
327
327
|
if (change?.absent) {
|
|
328
328
|
const [head, tail] = splitPath(path)
|
|
329
|
-
if (!tail)
|
|
329
|
+
if (!tail) {
|
|
330
|
+
delete next[head]
|
|
331
|
+
continue
|
|
332
|
+
}
|
|
333
|
+
const parent = next[head]
|
|
334
|
+
if (!isRecord(parent) || !(tail in parent)) continue
|
|
335
|
+
const copy = { ...parent }
|
|
336
|
+
delete copy[tail]
|
|
337
|
+
next[head] = copy
|
|
330
338
|
continue
|
|
331
339
|
}
|
|
332
340
|
if (!change && heldList === undefined) continue
|
package/src/path-ownership.ts
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
|
|
35
35
|
/** One normalized ownership entry: a repo-relative path, optionally a `**` subtree prefix. */
|
|
36
36
|
export interface OwnedPathEntry {
|
|
37
|
-
/** Repo-relative path with forward slashes, no leading `./`, no trailing slash. */
|
|
37
|
+
/** Repo-relative path with forward slashes, no leading `./`, no trailing slash; empty for the whole-repo subtree. */
|
|
38
38
|
readonly path: string
|
|
39
39
|
/** True when this entry was declared as `<path>/**` (owns the whole subtree). */
|
|
40
40
|
readonly subtree: boolean
|
|
@@ -159,16 +159,14 @@ export function normalizeOwnedPaths(input: unknown): NormalizeOwnedPathsResult {
|
|
|
159
159
|
/** True when `path` is exactly `base`, or (when `base` is a subtree entry) nested under it. */
|
|
160
160
|
function entryContains(base: OwnedPathEntry, path: string): boolean {
|
|
161
161
|
if (path === base.path) return true
|
|
162
|
-
|
|
162
|
+
// An empty subtree prefix is the repo root, so it contains every normalized path.
|
|
163
|
+
if (base.subtree && (base.path === '' || path.startsWith(`${base.path}/`))) return true
|
|
163
164
|
return false
|
|
164
165
|
}
|
|
165
166
|
|
|
166
167
|
/** True when two normalized entries' claimed sets intersect (exact match, or one contains the other's directory). */
|
|
167
168
|
function entriesOverlap(a: OwnedPathEntry, b: OwnedPathEntry): boolean {
|
|
168
|
-
|
|
169
|
-
if (a.subtree && (b.path === a.path || b.path.startsWith(`${a.path}/`))) return true
|
|
170
|
-
if (b.subtree && (a.path === b.path || a.path.startsWith(`${b.path}/`))) return true
|
|
171
|
-
return false
|
|
169
|
+
return entryContains(a, b.path) || entryContains(b, a.path)
|
|
172
170
|
}
|
|
173
171
|
|
|
174
172
|
/** True when two declarations claim any overlapping path. Pure set comparison — no policy (refuse vs warn) here. */
|