mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-19 21:02:01 +03:00
2.0 KiB
2.0 KiB
Tree
:tree
is the web filesystem interface.
Data retrieval interface
Async provides loading by schema
{path name sein sibs next prev}
are all immediately accesible from the store
a getPath
method, if present (defaulting to current url), is used to determine the query root node.
Internals
something something coffeescript
/[desk]/tree/{path}.json
tree/json.hook accepts a query string schema q
in light noun encoding¹
++ schema (dict ,[term $|(mark schema)])
++ dict |*(a=_,* $&([a (dict a)] a))
which is normalized and type-checked(request types are %t
text, %r
html-derived tree, and %j
arbitrary json) to a query
list of
[%kids query]
, the only recursive value, which executes for all subpaths XX descent is only currently supported to a single level as a performance optimization[%name %t]
, the node name[%path %t]
, the current path[%snip %r]
, a snippet, extracted viareact-snip-json
[%head %r]
, the first<h1/>
, extracted viareact-head-json
[%body %r]
, thereact-json
body[%meta %j]
, json frontmatter per themdy
mark definition
Per this specification, the current access points will be migrated:
- (json.hook)
""
tobody:'r' kids:{name:'t'}
"?body.r__kids_name.t"
"?kids"
tokids:{name:'t' body:'r'}
"?kids_name.t_body.r"
"?snip"
tokids:{name:'t' snip:'r' head:'r' meta:'j'}
"?kids_name.t_snip.r_head.r_meta.j"
¹In the examples,
=< (cook to-noun (cook to-tree apex))
|%
++ data $|(term [n=@ l=data r=data])
++ apex ;~(plug sym (star ;~(plug delim sym)))
++ delim ;~(pose (cold 0 dot) (cook lent (plus cab)))
++ to-noun |=(a=data ?@(a a [$(a l.a) $(a r.a)]))
++ to-tree
|= [acc=data a=(list ,[p=@u q=term])]
%+ roll a =< .(acc ^acc)
|= [[n=@u v=term] acc=data]
?@ acc [n acc v]
?: (gth n n.acc) [n acc v]
acc(r $(acc r.acc))
--
XX Curtis, this can be full coin %many
if you wish.