From 13cba9b0be736433d8ac44c0ef046cb001918a07 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 7 Nov 2026 22:35:09 +0100 Subject: store: keys_at tells no map from an empty one registry::exists counted any value at _continuum/users as a registry; keys_at answers None where there is no map, and its users (records, members, forget records, remakes) say what they make of it. Auth plan M1 (fix). --- src/document/store.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/document/store.rs') diff --git a/src/document/store.rs b/src/document/store.rs index b343a2e..2e27b44 100644 --- a/src/document/store.rs +++ b/src/document/store.rs @@ -650,16 +650,15 @@ fn summary( Ok(JsonValue::Object(out)) } -/// Whether `path` holds a map (one, or concurrent ones merged). -pub(crate) fn is_map(doc: &impl ReadDoc, path: &[String]) -> bool { - matches!(resolve_through(doc, path), Ok(Some(Resolved::Maps(_)))) -} - -/// Keys of the merged map at `path`; empty if it doesn't exist or isn't a map. -pub(crate) fn keys_at(doc: &impl ReadDoc, path: &[String]) -> Result, StoreError> { +/// Keys of the merged map at `path`; None if there is no map there (nothing, or +/// another value). +pub(crate) fn keys_at( + doc: &impl ReadDoc, + path: &[String], +) -> Result>, StoreError> { Ok(match resolve_through(doc, path)? { - Some(Resolved::Maps(maps)) => merged_keys(doc, &maps).into_iter().collect(), - _ => Vec::new(), + Some(Resolved::Maps(maps)) => Some(merged_keys(doc, &maps).into_iter().collect()), + _ => None, }) } -- cgit v1.3.1