Merge branch 'master' into m/next-gen-term

This commit is contained in:
fang 2021-03-10 01:19:00 +01:00
commit da5177aeac
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972
371 changed files with 11434 additions and 6091 deletions

27
.github/workflows/merge-master.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: merge
on:
push:
branches:
- 'master'
jobs:
merge-to-next-js:
runs-on: ubuntu-latest
name: "Merge master to release/next-js"
steps:
- uses: actions/checkout@v2
- uses: devmasx/merge-branch@v1.3.1
with:
type: now
target_branch: release/next-js
github_token: ${{ secrets.JANEWAY_BOT_TOKEN }}
merge-to-group-timer:
runs-on: ubuntu-latest
name: "Merge master to ops/group-timer"
steps:
- uses: actions/checkout@v2
- uses: devmasx/merge-branch@v1.3.1
with:
type: now
target_branch: ops/group-timer
github_token: ${{ secrets.JANEWAY_BOT_TOKEN }}

View File

@ -1,17 +1,17 @@
name: merge
name: ops-merge
on:
push:
branches:
- 'master'
- 'release/*'
jobs:
merge-to-next-js:
merge-release-to-ops:
runs-on: ubuntu-latest
name: "Merge master to release/next-js"
name: "Merge to ops-tlon"
steps:
- uses: actions/checkout@v2
- uses: devmasx/merge-branch@v1.3.1
with:
type: now
target_branch: release/next-js
target_branch: ops-tlon
github_token: ${{ secrets.JANEWAY_BOT_TOKEN }}

20
.github/workflows/ops-group-timer.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: group-timer
on:
push:
branches:
- 'ops/group-timer'
jobs:
glob:
runs-on: ubuntu-latest
name: "Create and deploy a glob to ~difmex-passed"
steps:
- uses: actions/checkout@v2
with:
lfs: true
- uses: ./.github/actions/glob
with:
ship: 'difmex-passed'
credentials: ${{ secrets.JANEWAY_SERVICE_KEY }}
ssh-sec-key: ${{ secrets.JANEWAY_SSH_SEC_KEY }}
ssh-pub-key: ${{ secrets.JANEWAY_SSH_PUB_KEY }}

View File

@ -0,0 +1,60 @@
name: publish-npm-packages
on:
push:
branches:
- 'master'
jobs:
publish-api:
runs-on: ubuntu-latest
name: "Publish '@urbit/api' if a new version is available"
steps:
- uses: actions/checkout@v2
with:
lfs: true
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: 'npm install'
working-directory: 'pkg/npm/api'
- uses: JS-DevTools/npm-publish@v1
with:
check-version: true
package: './pkg/npm/api/package.json'
token: ${{ secrets.NPM_TOKEN }}
publish-http-api:
runs-on: ubuntu-latest
name: "Publish '@urbit/http-api' if a new version is available"
steps:
- uses: actions/checkout@v2
with:
lfs: true
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: 'npm install'
working-directory: 'pkg/npm/http-api'
- uses: JS-DevTools/npm-publish@v1
with:
check-version: true
package: './pkg/npm/http-api/package.json'
token: ${{ secrets.NPM_TOKEN }}
publish-eslint-config:
runs-on: ubuntu-latest
name: "Publish '@urbit/eslint-config' if a new version is available"
steps:
- uses: actions/checkout@v2
with:
lfs: true
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: 'npm install'
working-directory: 'pkg/npm/eslint-config'
- uses: JS-DevTools/npm-publish@v1
with:
check-version: true
package: './pkg/npm/eslint-config/package.json'
token: ${{ secrets.NPM_TOKEN }}

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9433e0a7f1edbdcc6c8ac3e70c9516061d35218e5a1dc3192b2189dfb28cdc88
size 9539470
oid sha256:24e674adc2bc225cbf522da9ebbb6f1ca0364730392be4e59fbbd65b5028efa5
size 9283548

View File

@ -67,18 +67,20 @@
++ on-arvo on-arvo:def
++ on-fail on-fail:def
::
++ should-proxy-update
|= =vase
^- ?
=/ =update:store !<(update:store vase)
++ transform-proxy-update
|= vas=vase
^- (unit vase)
:: TODO: should check if user is allowed to %add, %remove, %edit
:: contact
=/ =update:store !<(update:store vas)
?- -.update
%initial %.n
%add %.y
%remove %.y
%edit %.y
%allow %.n
%disallow %.n
%set-public %.n
%initial ~
%add `vas
%remove `vas
%edit `vas
%allow ~
%disallow ~
%set-public ~
==
::
++ resource-for-update resource-for-update:con

View File

@ -593,10 +593,10 @@
%& (ship p.lane)
::
%|
?~ l=((soft ,[=@tas =@if =@ud]) (cue p.lane))
s+(scot %x p.lane)
=, u.l
(tape "%{(trip tas)}, {(scow %if if)}, {(scow %ud ud)}")
%- tape
=/ ip=@if (end [0 32] p.lane)
=/ pt=@ud (cut 0 [32 16] p.lane)
"{(scow %if ip)}:{((d-co:co 1) pt)} ({(scow %ux p.lane)})"
==
==
::

View File

@ -240,7 +240,12 @@
=/ mime-type=@t (rsh 3 (crip <p.u.data>))
:: Should maybe inspect to see how long cache should hold
::
[[200 ['content-type' mime-type] max-1-da:gen ~] `q.u.data]
=/ headers
:~ content-type+mime-type
max-1-da:gen
'Service-Worker-Allowed'^'/'
==
[[200 headers] `q.u.data]
==
::
++ lowercase

View File

@ -5,7 +5,7 @@
/- glob
/+ default-agent, verb, dbug
|%
++ hash 0v5.pmklm.qttdl.n8bs0.0tnc4.gg633
++ hash 0v7.sjbvb.4gg0l.1qmbv.fmobl.d2tsq
+$ state-0 [%0 hash=@uv glob=(unit (each glob:glob tid=@ta))]
+$ all-states
$% state-0
@ -105,12 +105,15 @@
(cat 3 js-name '.js')
=+ .^(js=@t %cx :(weld home /app/landscape/js/bundle /[js-name]/js))
=+ .^(map=@t %cx :(weld home /app/landscape/js/bundle /[map-name]/map))
=+ .^(sw=@t %cx :(weld home /app/landscape/js/bundle /serviceworker/js))
=+ !<(=js=mime (js-tube !>(js)))
=+ !<(=sw=mime (js-tube !>(sw)))
=+ !<(=map=mime (map-tube !>(map)))
=/ =glob:glob
%- ~(gas by *glob:glob)
:~ /[js-name]/js^js-mime
/[map-name]/map^map-mime
/serviceworker/js^sw-mime
==
=/ =path /(cat 3 'glob-' (scot %uv (sham glob)))/glob
[%pass /make %agent [our.bowl %hood] %poke %drum-put !>([path (jam glob)])]~

View File

@ -63,31 +63,110 @@
=* mark i.t.wire
:_ this
(build-permissions mark i.t.t.wire %next)^~
::
[%transform-add @ ~]
=* mark i.t.wire
:_ this
(build-transform-add mark %next)^~
==
::
++ on-fail on-fail:def
::
++ should-proxy-update
|= =vase
^- ?
=/ =update:store !<(update:store vase)
++ transform-proxy-update
|= vas=vase
^- (unit vase)
=/ =update:store !<(update:store vas)
=* rid resource.q.update
=. p.update now.bowl
?- -.q.update
%add-graph %.n
%remove-graph %.n
%add-nodes (is-allowed-add:hc resource.q.update nodes.q.update)
%remove-nodes (is-allowed-remove:hc resource.q.update indices.q.update)
%add-signatures %.n
%remove-signatures %.n
%archive-graph %.n
%unarchive-graph %.n
%add-tag %.n
%remove-tag %.n
%keys %.n
%tags %.n
%tag-queries %.n
%run-updates %.n
%add-nodes
?. (is-allowed-add:hc rid nodes.q.update)
~
=/ mark (get-mark:gra rid)
?~ mark `vas
|^
=/ transform
!< $-([index:store post:store atom ?] [index:store post:store])
%. !>(*indexed-post:store)
.^(tube:clay (scry:hc %cc %home /[u.mark]/transform-add-nodes))
=/ [* result=(list [index:store node:store])]
%+ roll
(flatten-node-map ~(tap by nodes.q.update))
(transform-list transform)
=. nodes.q.update
%- ~(gas by *(map index:store node:store))
result
[~ !>(update)]
::
++ flatten-node-map
|= lis=(list [index:store node:store])
^- (list [index:store node:store])
|^
%- sort-nodes
%+ welp
(turn lis empty-children)
%- zing
%+ turn lis
|= [=index:store =node:store]
^- (list [index:store node:store])
?: ?=(%empty -.children.node)
~
%+ turn
(tap-deep:gra index p.children.node)
empty-children
::
++ empty-children
|= [=index:store =node:store]
^- [index:store node:store]
[index node(children [%empty ~])]
::
++ sort-nodes
|= unsorted=(list [index:store node:store])
^- (list [index:store node:store])
%+ sort unsorted
|= [p=[=index:store *] q=[=index:store *]]
^- ?
(lth (lent index.p) (lent index.q))
--
::
++ transform-list
|= transform=$-([index:store post:store atom ?] [index:store post:store])
|= $: [=index:store =node:store]
[indices=(set index:store) lis=(list [index:store node:store])]
==
=/ l (lent index)
=/ parent-modified=?
%- ~(rep in indices)
|= [i=index:store out=_|]
?: out out
=/ k (lent i)
?: (lte l k)
%.n
=((swag [0 k] index) i)
=/ [ind=index:store =post:store]
(transform index post.node now.bowl parent-modified)
:- (~(put in indices) index)
(snoc lis [ind node(post post)])
--
::
%remove-nodes
?. (is-allowed-remove:hc resource.q.update indices.q.update)
~
`vas
::
%add-graph ~
%remove-graph ~
%add-signatures ~
%remove-signatures ~
%archive-graph ~
%unarchive-graph ~
%add-tag ~
%remove-tag ~
%keys ~
%tags ~
%tag-queries ~
%run-updates ~
==
::
++ resource-for-update resource-for-update:gra
::
++ initial-watch
@ -111,7 +190,7 @@
|= =vase
^- [(list card) agent]
=/ =update:store !<(update:store vase)
?+ -.q.update [~ this]
?+ -.q.update [~ this]
%add-graph
?~ mark.q.update `this
=* mark u.mark.q.update
@ -119,6 +198,7 @@
:_ this(marks (~(put in marks) mark))
:~ (build-permissions:hc mark %add %sing)
(build-permissions:hc mark %remove %sing)
(build-transform-add:hc mark %sing)
==
::
%remove-graph
@ -133,19 +213,14 @@
|_ =bowl:gall
+* grp ~(. group bowl)
met ~(. mdl bowl)
gra ~(. graph bowl)
gra ~(. graph bowl)
::
++ scry
|= [care=@t desk=@t =path]
%+ weld
/[care]/(scot %p our.bowl)/[desk]/(scot %da now.bowl)
path
::
++ scry-mark
|= =resource:res
.^ (unit mark)
(scry %gx %graph-store /graph-mark/(scot %p entity.resource)/[name.resource]/noun)
==
::
++ perm-mark-name
|= perm=@t
^- @t
@ -216,6 +291,8 @@
%- some
%+ levy ~(tap by nodes)
|= [=index:store =node:store]
?. =(author.post.node src.bowl)
%.n
=/ =permissions:store
%^ add-mark resource vip
(node-to-indexed-post node)
@ -262,5 +339,13 @@
=/ =mood:clay [%c da+now.bowl /[mark]/(perm-mark-name kind)]
=/ =rave:clay ?:(?=(%sing mode) [mode mood] [mode mood])
[%pass wire %arvo %c %warp our.bowl %home `rave]
::
++ build-transform-add
|= [=mark mode=?(%sing %next)]
^- card
=/ =wire /transform-add/[mark]
=/ =mood:clay [%c da+now.bowl /[mark]/transform-add-nodes]
=/ =rave:clay ?:(?=(%sing mode) [mode mood] [mode mood])
[%pass wire %arvo %c %warp our.bowl %home `rave]
--

View File

@ -386,14 +386,14 @@
::
?~ t.index
=* p post.node
?~ hash.p node(signatures.post *signatures:store)
=/ =validated-portion:store
[parent-hash author.p time-sent.p contents.p]
=/ =hash:store `@ux`(sham validated-portion)
?~ hash.p node(signatures.post *signatures:store)
~| "signatures do not match the calculated hash"
?> (are-signatures-valid:sigs our.bowl signatures.p hash now.bowl)
~| "hash of post does not match calculated hash"
?> =(hash u.hash.p)
~| "signatures do not match the calculated hash"
?> (are-signatures-valid:sigs our.bowl signatures.p hash now.bowl)
node
:: recurse children
::

View File

@ -110,12 +110,12 @@
++ on-arvo on-arvo:def
++ on-fail on-fail:def
::
++ should-proxy-update
|= =vase
=/ =update:store
!<(update:store vase)
++ transform-proxy-update
|= vas=vase
^- (unit vase)
=/ =update:store !<(update:store vas)
?: ?=(%initial -.update)
%.n
~
|^
=/ role=(unit (unit role-tag))
(role-for-ship:grp resource.update src.bowl)
@ -128,24 +128,36 @@
%moderator moderator
%janitor member
==
::
++ member
?: ?=(%add-members -.update)
=(~(tap in ships.update) ~[src.bowl])
?: ?=(%remove-members -.update)
=(~(tap in ships.update) ~[src.bowl])
%.n
?: ?| ?& ?=(%add-members -.update)
=(~(tap in ships.update) ~[src.bowl])
==
?& ?=(%remove-members -.update)
=(~(tap in ships.update) ~[src.bowl])
== ==
`vas
~
::
++ admin
!?=(?(%remove-group %add-group) -.update)
?. ?=(?(%remove-group %add-group) -.update)
`vas
~
::
++ moderator
?= $? %add-members %remove-members
%add-tag %remove-tag ==
-.update
?: ?=(?(%add-members %remove-members %add-tag %remove-tag) -.update)
`vas
~
::
++ non-member
?& ?=(%add-members -.update)
(can-join:grp resource.update src.bowl)
=(~(tap in ships.update) ~[src.bowl])
==
?: ?& ?=(%add-members -.update)
(can-join:grp resource.update src.bowl)
=(~(tap in ships.update) ~[src.bowl])
==
`vas
~
--
::
++ resource-for-update resource-for-update:grp
::
++ take-update

View File

@ -24,8 +24,6 @@
watch-on-self=_&
==
::
+$ notif-kind
[name=@t parent-lent=@ud mode=?(%each %count %none) watch=?]
::
++ scry
|* [[our=@p now=@da] =mold p=path]
@ -223,11 +221,11 @@
|= [=index:graph-store out=(list card)]
=| =indexed-post:graph-store
=. index.p.indexed-post index
=+ !<(u-notif-kind=(unit notif-kind) (tube !>(indexed-post)))
=+ !<(u-notif-kind=(unit notif-kind:hook) (tube !>(indexed-post)))
?~ u-notif-kind out
=* notif-kind u.u-notif-kind
=/ =stats-index:store
[%graph rid (scag parent-lent.notif-kind index)]
[%graph rid (scag parent.index-len.notif-kind index)]
?. ?=(%each mode.notif-kind) out
:_ out
(poke-hark %read-each stats-index index)
@ -382,8 +380,12 @@
update-core(hark-pokes [action hark-pokes])
::
++ new-watch
|= =index:graph-store
update-core(new-watches [index new-watches])
|= [=index:graph-store =watch-for:hook =index-len:hook]
=? new-watches =(%siblings watch-for)
[(scag parent.index-len index) new-watches]
=? new-watches =(%children watch-for)
[(scag self.index-len index) new-watches]
update-core
::
++ check
|- ^+ update-core
@ -411,7 +413,7 @@
|= =node:graph-store
^+ update-core
=. update-core (check-node-children node)
=+ !< notif-kind=(unit notif-kind)
=+ !< notif-kind=(unit notif-kind:hook)
(get-conversion !>([0 post.node]))
?~ notif-kind
update-core
@ -421,11 +423,11 @@
name.u.notif-kind
=* not-kind u.notif-kind
=/ parent=index:post
(scag parent-lent.not-kind index.post.node)
(scag parent.index-len.not-kind index.post.node)
=/ notif-index=index:store
[%graph group rid module desc parent]
?: =(our.bowl author.post.node)
(self-post node notif-index [mode watch]:not-kind)
(self-post node notif-index not-kind)
=. update-core
(update-unread-count not-kind notif-index [time-sent index]:post.node)
=? update-core
@ -438,7 +440,7 @@
update-core
::
++ update-unread-count
|= [=notif-kind =index:store time=@da ref=index:graph-store]
|= [=notif-kind:hook =index:store time=@da ref=index:graph-store]
=/ =stats-index:store
(to-stats-index:store index)
?- mode.notif-kind
@ -450,19 +452,18 @@
++ self-post
|= $: =node:graph-store
=index:store
mode=?(%count %each %none)
watch=?
=notif-kind:hook
==
^+ update-core
?: ?=(%none mode) update-core
?: ?=(%none mode.notif-kind) update-core
=/ =stats-index:store
(to-stats-index:store index)
=. update-core
(hark %seen-index time-sent.post.node stats-index)
=? update-core ?=(%count mode)
=? update-core ?=(%count mode.notif-kind)
(hark %read-count stats-index)
=? update-core &(watch watch-on-self)
(new-watch index.post.node)
=? update-core watch-on-self
(new-watch index.post.node [watch-for index-len]:notif-kind)
update-core
::
++ add-unread

View File

@ -23,6 +23,7 @@
state-2
state-3
state-4
state-5
==
+$ unread-stats
[indices=(set index:graph-store) last=@da]
@ -46,8 +47,11 @@
+$ state-4
[%4 base-state]
::
+$ state-5
[%5 base-state]
::
+$ inflated-state
$: state-4
$: state-5
cache
==
:: $cache: useful to have precalculated, but can be derived from state
@ -88,9 +92,18 @@
=| cards=(list card)
|^
?- -.old
%4
%5
:- (flop cards)
this(-.state old, +.state (inflate-cache:ha old))
::
%4
%_ $
-.old %5
::
last-seen.old
%- ~(run by last-seen.old)
|=(old=@da (min old now.bowl))
==
::
%3
%_ $
@ -279,7 +292,6 @@
%+ turn
~(tap by unreads-count)
|= [=stats-index:store count=@ud]
?> ?=(%graph -.stats-index)
:* stats-index
~(wyt in (~(gut by by-index) stats-index ~))
[%count count]
@ -297,10 +309,27 @@
(~(gut by last-seen) stats-index *time)
==
::
++ give-group-unreads
^- (list [stats-index:store stats:store])
%+ murn ~(tap by by-index)
|= [=stats-index:store nots=(set [time index:store])]
?. ?=(%group -.stats-index)
~
:- ~
:* stats-index
~(wyt in nots)
[%count 0]
*time
==
::
++ give-unreads
^- update:store
:- %unreads
(weld give-each-unreads give-since-unreads)
;: weld
give-each-unreads
give-since-unreads
give-group-unreads
==
--
::
++ on-peek
@ -749,8 +778,10 @@
==
::
++ inflate-cache
|= state-4
|= state-5
^+ +.state
=. +.state
*cache
=/ nots=(list [p=@da =timebox:store])
(tap:orm notifications)
|- =* outer $

Binary file not shown.

View File

@ -24,6 +24,6 @@
<div id="portal-root"></div>
<script src="/~landscape/js/channel.js"></script>
<script src="/~landscape/js/session.js"></script>
<script src="/~landscape/js/bundle/index.ee4aea08fefb9c47dcfd.js"></script>
<script src="/~landscape/js/bundle/index.8a99030d28740234ac24.js"></script>
</body>
</html>

View File

@ -5,7 +5,7 @@
easy-print=language-server-easy-print,
rune-snippet=language-server-rune-snippet,
build=language-server-build,
default-agent
default-agent, verb
|%
+$ card card:agent:gall
+$ lsp-req
@ -44,6 +44,7 @@
==
--
^- agent:gall
%+ verb |
=| state-zero
=* state -
=<
@ -69,7 +70,7 @@
|= old-state=vase
^- (quip card _this)
~& > %lsp-upgrade
[~ this(state *state-zero)]
[~ this(state !<(state-zero old-state))]
::
++ on-poke
^+ on-poke:*agent:gall
@ -275,12 +276,14 @@
++ handle-did-open
|= item=text-document-item:lsp-sur
^- (quip card _state)
=/ =path
(uri-to-path:build uri.item)
?: ?=(%sys -.path)
`state
=/ buf=wall
(to-wall (trip text.item))
=. bufs
(~(put by bufs) uri.item buf)
=/ =path
(uri-to-path:build uri.item)
:_ state
%+ weld
(give-rpc-notification (get-diagnostics uri.item))
@ -318,12 +321,12 @@
?~ p.tab-list ~
?~ u.p.tab-list ~
:- ~
%- crip
;: weld
"`"
~(ram re ~(duck easy-print detail.i.u.p.tab-list))
"`"
==
=- (crip :(weld "```hoon\0a" tape "\0a```"))
^- =tape
%- zing
%+ join "\0a"
%+ scag 40
(~(win re ~(duck easy-print detail.i.u.p.tab-list)) 0 140)
::
++ sync-buf
|= [buf=wall changes=(list change:lsp-sur)]

View File

@ -56,22 +56,27 @@
++ on-arvo on-arvo:def
++ on-fail on-fail:def
::
++ should-proxy-update
|= =vase
=+ !<(=update:store vase)
++ transform-proxy-update
|= vas=vase
^- (unit vase)
=/ =update:store !<(update:store vas)
?. ?=(?(%add %remove) -.update)
%.n
~
=/ role=(unit (unit role-tag))
(role-for-ship:grp group.update src.bowl)
=/ =metadatum:store
(need (peek-metadatum:met %groups group.update))
?~ role %.n
?~ role ~
?^ u.role
?=(?(%admin %moderator) u.u.role)
?. ?=(%add -.update) %.n
?& =(src.bowl entity.resource.resource.update)
?=(%member-metadata vip.metadatum)
==
?: ?=(?(%admin %moderator) u.u.role)
`vas
~
?. ?=(%add -.update) ~
?: ?& =(src.bowl entity.resource.resource.update)
?=(%member-metadata vip.metadatum)
==
`vas
~
::
++ resource-for-update resource-for-update:met
++ take-update

View File

@ -1,16 +1,15 @@
/- *settings
/+ verb, dbug, default-agent
/+ verb, dbug, default-agent, agentio
|%
+$ card card:agent:gall
+$ versioned-state
$% state-0
state-1
==
+$ state-0
$: %0
=settings
==
+$ state-0 [%0 settings=settings-0]
+$ state-1 [%1 =settings]
--
=| state-0
=| state-1
=* state -
::
%- agent:dbug
@ -21,10 +20,14 @@
+* this .
do ~(. +> bol)
def ~(. (default-agent this %|) bol)
io ~(. agentio bol)
::
++ on-init
^- (quip card _this)
`this
=^ cards state
(put-entry:do %tutorial %seen b+|)
[cards this]
::
++ on-save !>(state)
::
@ -32,8 +35,10 @@
|= =old=vase
^- (quip card _this)
=/ old !<(versioned-state old-vase)
|-
?- -.old
%0 [~ this(state old)]
%0 $(old [%1 +.old])
%1 [~ this(state old)]
==
::
++ on-poke

View File

@ -40,7 +40,7 @@
=. mar-ok.state %.y
=+ .^(paz=(list path) ct+(en-beam now-beak /mar))
|- ^+ [fex this]
?~ paz [fex this]
?~ paz [(flop fex) this]
=/ xap=path (flop i.paz)
?. ?=([%hoon *] xap)
$(paz t.paz)
@ -63,7 +63,7 @@
?> =(~ app.state)
=. app-ok.state %.y
=+ .^(app-arch=arch cy+(en-beam now-beak /app))
=/ daz ~(tap in ~(key by dir.app-arch))
=/ daz (sort ~(tap in ~(key by dir.app-arch)) |=((pair) !(aor p q)))
|- ^+ [fex this]
?~ daz [fex this]
=/ dap-pax=path /app/[i.daz]/hoon
@ -86,7 +86,7 @@
=. gen-ok.state %.y
=+ .^(paz=(list path) ct+(en-beam now-beak /gen))
|- ^+ [fex this]
?~ paz [fex this]
?~ paz [(flop fex) this]
=/ xap=path (flop i.paz)
?. ?=([%hoon *] xap)
$(paz t.paz)
@ -106,11 +106,18 @@
++ on-peek on-peek:def
++ on-agent on-agent:def
++ on-arvo
=> |%
++ report
|* [=path ok=?]
=/ =tank leaf+"{?:(ok "built " "FAILED")} {(spud path)}"
~>(%slog.[0 tank] same)
--
::
|= [=wire =sign-arvo]
^- [(list card) _this]
?. ?=([%build *] wire)
(on-arvo:def wire sign-arvo)
?. ?=(%writ +<.sign-arvo)
?. ?& ?=([%build *] wire)
?=([%clay %writ *] sign-arvo)
==
(on-arvo:def wire sign-arvo)
=/ =path t.wire
?+ path ~|(path+path !!)
@ -118,41 +125,29 @@
=/ ok
?~ p.sign-arvo |
(~(nest ut -:!>(*agent:gall)) | -:!<(vase q.r.u.p.sign-arvo))
~& ?: ok
agent-built+path
agent-failed+path
%- (report path ok)
=? app-ok.state !ok %.n
=. app.state (~(del in app.state) path)
~? =(~ app.state)
?: app-ok.state
%all-agents-built
%some-agents-failed
?:(app-ok.state %all-agents-built %some-agents-failed)
[~ this]
::
[%mar *]
=/ ok ?=(^ p.sign-arvo)
~& ?: ok
mark-built+path
mark-failed+path
%- (report path ok)
=? mar-ok.state !ok %.n
=. mar.state (~(del in mar.state) path)
~? =(~ mar.state)
?: mar-ok.state
%all-marks-built
%some-marks-failed
?:(mar-ok.state %all-marks-built %some-marks-failed)
[~ this]
::
[%gen *]
=/ ok ?=(^ p.sign-arvo)
~& ?: ok
generator-built+path
generator-failed+path
%- (report path ok)
=? gen-ok.state !ok %.n
=. gen.state (~(del in gen.state) path)
~? =(~ gen.state)
?: gen-ok.state
%all-generators-built
%some-generators-failed
?:(gen-ok.state %all-generators-built %some-generators-failed)
[~ this]
==
++ on-fail on-fail:def

View File

@ -21,7 +21,7 @@
|^ :- %kiln-merge
^- $@(~ [syd=desk her=ship sud=desk cas=case gem=?(germ %auto)])
?- arg
~ ((slog (turn help-text |=(=@t leaf+(trip t)))) ~)
~ ((slog (turn `wain`help-text |=(=@t leaf+(trip t)))) ~)
[@ @ ~]
=+(arg [sud ?.(=(our her) her (sein:title p.bek now her)) sud (opt-case da+now) gem])
::

View File

@ -34,10 +34,8 @@
=/ groups=(list [local=? resource:re members=@ud])
%+ murn
%~ tap in
%~ key by
dir:(scry arch %y %group-store /groups)
|= i=@ta
=/ r=resource:re (de-path:re (stab i))
(scry (set resource:re) %y %group-store /groups)
|= r=resource:re
=/ g=(unit group:gr)
%+ scry (unit group:gr)
[%x %group-store [%groups (snoc (en-path:re r) %noun)]]
@ -59,18 +57,28 @@
%~ tap by
%+ scry associations:md
[%x %metadata-store [%group (snoc (en-path:re r) %noun)]]
|= [[* m=md-resource:md] metadata:md]
|= [m=md-resource:md association:md]
::NOTE we only count graphs for now
?. &(=(%graph app-name.m) =(our creator)) ~
`[module (de-path:re app-path.m)]
?. &(=(%graph app-name.m) =(our creator.metadatum)) ~
`[module.metadatum resource.m]
:: for sanity checks
::
=/ real=(set resource:re)
=/ upd=update:ga
%+ scry update:ga
[%x %graph-store /keys/graph-update]
?> ?=(%keys -.q.upd)
resources.q.upd
:: count activity per channel
::
=/ activity=(list [resource:re members=@ud (list [resource:re mod=term week=@ud authors=@ud])])
%+ turn crowds
|= [g=resource:re m=@ud]
:+ g m
%+ turn (~(got by channels) g)
%+ murn (~(got by channels) g)
|= [m=term r=resource:re]
?. (~(has in real) r) ~
%- some
:+ r m
::NOTE graph-store doesn't use the full resource-style path here!
=/ upd=update:ga

15
pkg/arvo/lib/gcp.hoon Normal file
View File

@ -0,0 +1,15 @@
/- *gcp
|%
++ token-to-json
|= =token
^- json
=, enjs:format
%+ frond %gcp-token
%: pairs
[%'accessKey' s+access-key.token]
:- %'expiresIn'
%- numb
(div (mul 1.000 expires-in.token) ~s1)
~
==
--

View File

@ -1,4 +1,4 @@
/- sur=graph-view
/- sur=graph-view, store=graph-store
/+ resource, group-store
^?
=< [sur .]
@ -17,6 +17,7 @@
leave+leave
groupify+groupify
eval+so
pending-indices+pending-indices
::invite+invite
==
::
@ -51,6 +52,9 @@
:~ resource+(un dejs:resource)
to+(uf ~ (mu dejs:resource))
==
::
++ pending-indices (op hex (su ;~(pfix fas (more fas dem))))
::
++ invite !!
::
++ associated
@ -60,4 +64,35 @@
==
--
--
::
++ enjs
=, enjs:format
|%
++ action
|= act=^action
^- json
?> ?=(%pending-indices -.act)
%+ frond %pending-indices
%- pairs
%+ turn ~(tap by pending.act)
|= [h=hash:store i=index:store]
^- [@t json]
=/ idx (index i)
?> ?=(%s -.idx)
[p.idx s+(scot %ux h)]
::
++ index
|= i=index:store
^- json
?: =(~ i) s+'/'
=/ j=^tape ""
|-
?~ i [%s (crip j)]
=/ k=json (numb i.i)
?> ?=(%n -.k)
%_ $
i t.i
j (weld j (weld "/" (trip +.k)))
==
--
--

View File

@ -104,26 +104,35 @@
resources.q.update
::
++ tap-deep
|= =graph:store
|= [=index:store =graph:store]
^- (list [index:store node:store])
=| =index:store
=/ nodes=(list [atom node:store])
(tap:orm:store graph)
|- =* tap-nodes $
^- (list [index:store node:store])
%- zing
%+ turn
nodes
|= [=atom =node:store]
^- (list [index:store node:store])
%+ welp
^- (list [index:store node:store])
[(snoc index atom) node]~
?. ?=(%graph -.children.node)
~
%_ tap-nodes
index (snoc index atom)
nodes (tap:orm:store p.children.node)
%+ roll (tap:orm:store graph)
|= $: [=atom =node:store]
lis=(list [index:store node:store])
==
=/ child-index (snoc index atom)
=/ childless-node node(children [%empty ~])
?: ?=(%empty -.children.node)
(snoc lis [child-index childless-node])
%+ weld
(snoc lis [child-index childless-node])
(tap-deep child-index p.children.node)
::
++ got-deep
|= [=graph:store =index:store]
^- node:store
=/ ind index
?> ?=(^ index)
=/ =node:store (need (get:orm:store graph `atom`i.index))
=. ind t.index
|- ^- node:store
?~ ind
node
?: ?=(%empty -.children.node)
!!
%_ $
ind t.ind
node (need (get:orm:store p.children.node i.ind))
==
::
++ get-mark

View File

@ -185,6 +185,7 @@
[%zpmc *] (both p.gen q.gen)
[%zpts *] loop(gen p.gen)
[%zppt *] (both q.gen r.gen)
[%zpgl *] (spec-and-hoon p.gen q.gen)
[%zpzp *] ~
*
=+ doz=~(open ap gen)
@ -245,15 +246,25 @@
^- (unit [term type])
~
::
++ get-id-sym
|= [pos=@ud =tape]
%^ get-id pos tape
^- $-(nail (like (unit @t)))
;~(sfix (punt sym) (star ;~(pose prn (just `@`10))))
::
++ get-id-cord
|= [pos=@ud =tape]
%^ get-id pos tape
^- $-(nail (like (unit @t)))
;~(sfix (punt (cook crip (star prn))) (star ;~(pose prn (just `@`10))))
::
++ get-id
|= [pos=@ud txt=tape]
|= [pos=@ud txt=tape seek=$-(nail (like (unit @t)))]
^- [forward=(unit @t) backward=(unit @t) id=(unit @t)]
=/ seek
;~(sfix (punt (cook crip (star prn))) (star ;~(pose prn (just `@`10))))
=/ forward=(unit @t)
(scan (slag pos txt) seek)
=/ backward=(unit @t)
%- (lift |=(t=@tas (swp 3 t)))
%- (lift |=(t=@t (swp 3 t)))
(scan (flop (scag pos txt)) seek)
=/ id=(unit @t)
?~ forward
@ -272,7 +283,7 @@
^- [back-pos=@ud fore-pos=@ud txt=tape]
:: Find beg-pos by searching backward to where the current term
:: begins
=+ (get-id pos txt)
=+ (get-id-sym pos txt)
=/ back-pos
?~ backward
pos
@ -343,7 +354,7 @@
[%| p.res]
:- %&
~? > debug %parsed-good
((cury tab-list-hoon sut) hoon.p.res)
((cury tab-list-hoon sut) hoon:`pile:clay`p.res)
::
:: Generators
++ tab-generators

View File

@ -5,75 +5,59 @@
++ pile-rule
|= pax=path
%- full
%+ ifix [gay gay]
%+ cook |=(pile +<)
;~ pfix
%+ ifix
:_ gay
:: parse optional /? and ignore
::
;~ pose
(cold ~ ;~(plug fas wut gap dem gap))
(easy ~)
;~(plug gay (punt ;~(plug fas wut gap dem gap)))
|^
;~ plug
%+ cook (bake zing (list (list taut)))
%+ rune hep
(most ;~(plug com gaw) taut-rule)
::
%+ cook (bake zing (list (list taut)))
%+ rune lus
(most ;~(plug com gaw) taut-rule)
::
%+ rune tis
;~(plug sym ;~(pfix gap fas (more fas urs:ab)))
::
%+ rune cen
;~(plug sym ;~(pfix gap ;~(pfix cen sym)))
::
%+ rune buc
;~ (glue gap)
sym
;~(pfix cen sym)
;~(pfix cen sym)
==
::
;~ plug
;~ pose
;~ sfix
%+ cook |=((list (list taut)) (zing +<))
%+ more gap
;~ pfix ;~(plug fas hep gap)
(most ;~(plug com gaw) taut-rule)
==
gap
==
(easy ~)
==
::
;~ pose
;~ sfix
%+ cook |=((list (list taut)) (zing +<))
%+ more gap
;~ pfix ;~(plug fas lus gap)
(most ;~(plug com gaw) taut-rule)
==
gap
==
(easy ~)
==
::
;~ pose
;~ sfix
%+ cook |=((list [face=term =path]) +<)
%+ more gap
;~ pfix ;~(plug fas tis gap)
%+ cook |=([term path] +<)
;~(plug sym ;~(pfix ;~(plug gap fas) (more fas urs:ab)))
==
gap
==
(easy ~)
==
::
;~ pose
;~ sfix
%+ cook |=((list [face=term =mark =path]) +<)
%+ more gap
;~ pfix ;~(plug fas tar gap)
%+ cook |=([term mark path] +<)
;~ plug
sym
;~(pfix ;~(plug gap cen) sym)
;~(pfix ;~(plug gap fas) (more fas urs:ab))
==
==
gap
==
(easy ~)
==
::
%+ cook |=(huz=(list hoon) `hoon`tssg+huz)
(most gap tall:(vang & pax))
%+ rune tar
;~ (glue gap)
sym
;~(pfix cen sym)
;~(pfix fas (more fas urs:ab))
==
::
%+ stag %tssg
(most gap tall:(vang & pax))
==
::
++ pant
|* fel=^rule
;~(pose fel (easy ~))
::
++ mast
|* [bus=^rule fel=^rule]
;~(sfix (more bus fel) bus)
::
++ rune
|* [bus=^rule fel=^rule]
%- pant
%+ mast gap
;~(pfix fas bus gap fel)
--
::
++ taut-rule
%+ cook |=(taut +<)

View File

@ -13,9 +13,7 @@
=/ members
~(wyt in (members:grp rid))
=/ =metadatum:store
%- need
%+ mate (peek-metadatum %groups rid)
(peek-metadatum %graph rid)
(need (peek-metadatum %groups rid))
[rid channels members channel-count metadatum]
::
++ channels

View File

@ -85,15 +85,15 @@
++ take-update
|~ vase
*[(list card) _^|(..on-init)]
:: +should-proxy-update: should forward update to store
:: +transform-proxy-update: optionally transform update
::
:: If %.y is produced, then the update is forwarded to the local
:: store. If %.n is produced then the update is not forwarded and
:: the poke fails.
:: If ^ is produced, then the update is forwarded to the local
:: store. If ~ is produced, the update is not forwarded and the
:: poke fails.
::
++ should-proxy-update
++ transform-proxy-update
|~ vase
*?
*(unit vase)
:: +initial-watch: produce initial state for a subscription
::
:: .resource is the resource being subscribed to.
@ -301,20 +301,20 @@
+* og ~(. push-hook bowl)
::
++ poke-update
|= =vase
|= vas=vase
^- (quip card:agent:gall _state)
?> (should-proxy-update:og vase)
=/ wire
(make-wire /store)
=/ vax=(unit vase) (transform-proxy-update:og vas)
?> ?=(^ vax)
=/ wire (make-wire /store)
:_ state
[%pass wire %agent [our.bowl store-name.config] %poke update-mark.config vase]~
[%pass wire %agent [our.bowl store-name.config] %poke update-mark.config u.vax]~
::
++ poke-hook-action
|= =action
^- (quip card:agent:gall _state)
|^
?- -.action
%add (add +.action)
%add (add +.action)
%remove (remove +.action)
%revoke (revoke +.action)
==

View File

@ -50,7 +50,7 @@
%- pairs
:~ bucket-key+s+b
entry-key+s+k
value+(val v)
value+(value v)
==
::
++ del-entry
@ -68,6 +68,7 @@
%s val
%b val
%n (numb p.val)
%a [%a (turn p.val value)]
==
::
++ bucket
@ -105,7 +106,7 @@
%- ot
:~ bucket-key+so
entry-key+so
value+val
value+value
==
::
++ del-entry
@ -121,6 +122,7 @@
%s jon
%b jon
%n [%n (rash p.jon dem)]
%a [%a (turn p.jon value)]
==
::
++ bucket

View File

@ -291,7 +291,7 @@
++ tab
|= pos=@ud
^- (quip card _cli-state)
=+ (get-id:auto pos (tufa buf.cli-state))
=+ (get-id-cord:auto pos (tufa buf.cli-state))
=/ needle=term
(fall id %$)
:: autocomplete empty command iff user at start of command

View File

@ -442,19 +442,19 @@
;< ~ bind:m (send-request (hiss-to-request:html hiss))
take-maybe-sigh
::
:: +build-fail: build the source file at the specified $beam
:: +build-file: build the source file at the specified $beam
::
++ build-file
|= [[=ship =desk =case] =spur]
=* arg +<
=/ m (strand ,vase)
=/ m (strand ,(unit vase))
^- form:m
;< =riot:clay bind:m
(warp ship desk ~ %sing %a case spur)
?~ riot
(strand-fail %build-file >arg< ~)
(pure:m ~)
?> =(%vase p.r.u.riot)
(pure:m !<(vase q.r.u.riot))
(pure:m (some !<(vase q.r.u.riot)))
:: +build-mark: build a mark definition to a $dais
::
++ build-mark
@ -468,9 +468,9 @@
(strand-fail %build-mark >arg< ~)
?> =(%dais p.r.u.riot)
(pure:m !<(dais:clay q.r.u.riot))
:: +build-cast: build a mark conversion gate ($tube)
:: +build-tube: build a mark conversion gate ($tube)
::
++ build-cast
++ build-tube
|= [[=ship =desk =case] =mars:clay]
=* arg +<
=/ m (strand ,tube:clay)
@ -478,10 +478,37 @@
;< =riot:clay bind:m
(warp ship desk ~ %sing %c case /[a.mars]/[b.mars])
?~ riot
(strand-fail %build-cast >arg< ~)
(strand-fail %build-tube >arg< ~)
?> =(%tube p.r.u.riot)
(pure:m !<(tube:clay q.r.u.riot))
::
:: +build-nave: build a mark definition to a $nave
::
++ build-nave
|= [[=ship =desk =case] mak=mark]
=* arg +<
=/ m (strand ,vase)
^- form:m
;< =riot:clay bind:m
(warp ship desk ~ %sing %b case /[mak])
?~ riot
(strand-fail %build-nave >arg< ~)
?> =(%nave p.r.u.riot)
(pure:m q.r.u.riot)
:: +build-cast: build a mark conversion gate (static)
::
++ build-cast
|= [[=ship =desk =case] =mars:clay]
=* arg +<
=/ m (strand ,vase)
^- form:m
;< =riot:clay bind:m
(warp ship desk ~ %sing %f case /[a.mars]/[b.mars])
?~ riot
(strand-fail %build-cast >arg< ~)
?> =(%cast p.r.u.riot)
(pure:m q.r.u.riot)
::
:: Read from Clay
::
++ warp

View File

@ -11,6 +11,6 @@
--
++ grab :: convert from
|%
++ noun [path @] :: clam from %noun
+$ noun [path @] :: clam from %noun
--
--

View File

@ -6,7 +6,7 @@
=, html
|_ own=manx
::
++ grad %mime
++ grad %noun
++ grow :: convert to
|%
++ hymn ;html:(head body:"+{own}") :: convert to %hymn

View File

@ -0,0 +1,13 @@
/+ *gcp
|_ tok=token
++ grad %noun
++ grow
|%
++ noun tok
++ json (token-to-json tok)
--
++ grab
|%
++ noun token
--
--

View File

@ -18,8 +18,14 @@
::
++ notification-kind
?+ index.p.i ~
[@ ~] `[%message 0 %count %.n]
[@ ~] `[%message [0 1] %count %none]
==
::
++ transform-add-nodes
|= [=index =post =atom was-parent-modified=?]
^- [^index ^post]
=- [- post(index -)]
[atom ~]
--
++ grab
|%

View File

@ -26,9 +26,22 @@
::
++ notification-kind
?+ index.p.i ~
[@ ~] `[%link 0 %each %.y]
[@ @ %1 ~] `[%comment 1 %count %.n]
[@ @ @ ~] `[%edit-comment 1 %none %.n]
[@ ~] `[%link [0 1] %each %children]
[@ @ %1 ~] `[%comment [1 2] %count %siblings]
[@ @ @ ~] `[%edit-comment [1 2] %none %none]
==
::
++ transform-add-nodes
|= [=index =post =atom was-parent-modified=?]
^- [^index ^post]
=- [- post(index -)]
?+ index ~|(transform+[index post] !!)
[@ ~] [atom ~]
[@ @ ~] [i.index atom ~]
[@ @ @ ~]
?: was-parent-modified
[i.index atom i.t.t.index ~]
index
==
--
++ grab

View File

@ -25,10 +25,31 @@
::
++ notification-kind
?+ index.p.i ~
[@ %1 %1 ~] `[%note 0 %each %.n]
[@ %1 @ ~] `[%edit-note 0 %none %.n]
[@ %2 @ %1 ~] `[%comment 1 %count %.n]
[@ %2 @ @ ~] `[%edit-comment 1 %none %.n]
[@ %1 %1 ~] `[%note [0 1] %each %children]
[@ %1 @ ~] `[%edit-note [0 1] %none %none]
[@ %2 @ %1 ~] `[%comment [1 3] %count %siblings]
[@ %2 @ @ ~] `[%edit-comment [1 3] %none %none]
==
::
++ transform-add-nodes
|= [=index =post =atom was-parent-modified=?]
^- [^index ^post]
=- [- post(index -)]
?+ index ~|(transform+[index post] !!)
[@ ~] [atom ~]
[@ %1 ~] [atom %1 ~]
::
[@ %1 @ ~]
?: was-parent-modified
[atom %1 i.t.t.index ~]
index
::
[@ %2 ~] [atom %2 ~]
[@ %2 @ ~] [i.index %2 atom ~]
[@ %2 @ @ ~]
?: was-parent-modified
[i.index %2 atom i.t.t.t.index ~]
index
==
--
++ grab

View File

@ -4,6 +4,7 @@
++ grow
|%
++ noun act
++ json (action:enjs act)
--
++ grab
|%

View File

@ -6,7 +6,7 @@
=, format
|_ txt=cord
::
++ grad %mime
++ grad %noun
++ grab :: convert from
|%
++ noun @t :: clam from %noun

View File

@ -6,7 +6,6 @@
:::: compute
::
=, html
^|
|_ htm=@t
++ grow :: convert to
^?

View File

@ -6,7 +6,7 @@
=, html
|_ own=manx
::
++ grad %mime
++ grad %noun
++ grow :: convert to
|%
++ html (crip (en-xml own)) :: convert to %html

View File

@ -4,7 +4,7 @@
++ grad %noun
++ grab
|%
++ noun not
++ noun all:notification
++ json
|= jon=^json
(notification:dejs:lsp-json jon)

View File

@ -8,7 +8,7 @@
--
++ grab
|%
++ noun req
++ noun all:request
++ json
|= jon=^json
(request:dejs:lsp-json jon)

View File

@ -3,7 +3,6 @@
::
/? 310
::
^|
|_ own=mime
++ grow
^?
@ -14,7 +13,7 @@
++ grab :: convert from
^?
|%
+$ noun mime :: clam from %noun
++ noun mime :: clam from %noun
++ tape
|=(a=_"" [/application/x-urb-unknown (as-octt:mimes:html a)])
--
@ -25,5 +24,9 @@
++ diff |=(mime +<)
++ pact |=(mime +<)
++ join |=([mime mime] `(unit mime)`~)
++ mash
|= [[ship desk mime] [ship desk mime]]
^- mime
~|(%mime-mash !!)
--
--

View File

@ -14,5 +14,6 @@
++ diff |=(* +<)
++ pact |=(* +<)
++ join |=([* *] *(unit *))
++ mash |=([[ship desk *] [ship desk *]] `*`~|(%noun-mash !!))
--
--

View File

@ -15,7 +15,7 @@
++ mime
|= (pair mite octs)
=+ o=(pair ,* ,*) :: ,*)
=+ (,[boot-ova=* kernel-ova=(list o) userspace-ova=(list o)] (cue q.q))
=+ (,[%pill nam=term boot-ova=(list) kernel-ova=(list o) userspace-ova=(list o)] (cue q.q))
=/ convert
|= ova=(list o)
^- (list unix-event)
@ -30,7 +30,7 @@
:: =/ boot-ova (convert boot-ova)
=/ kernel-ova (convert kernel-ova)
=/ userspace-ova (convert userspace-ova)
[boot-ova kernel-ova userspace-ova]
[%pill nam boot-ova kernel-ova userspace-ova]
--
++ grad %mime
--

View File

@ -1,4 +1,4 @@
|_ dat=@t
|_ dat=@
++ grow
|%
++ mime [/image/png (as-octs:mimes:html dat)]
@ -6,7 +6,7 @@
++ grab
|%
++ mime |=([p=mite q=octs] q.q)
++ noun @t
++ noun @
--
++ grad %mime
--

View File

@ -43,7 +43,7 @@
::
=, mimes:html
|_ [hed=marl tal=marl]
++ grad %mime
++ grad %noun
::
++ grow :: convert to
|%
@ -55,6 +55,7 @@
++ html (crip (en-xml hymn)) :: convert to %html
++ mime [/text/html (as-octs html)] :: convert to %mime
--
++ noun [hed tal]
--
++ grab |% :: convert from
++ noun ,[marl marl] :: clam from %noun

View File

@ -6,7 +6,7 @@
=, html
|_ own=manx
::
++ grad %mime
++ grad %noun
++ grow :: convert to
|%
++ hymn ;html:(head body:"+{own}") :: convert to %hymn

6
pkg/arvo/sur/gcp.hoon Normal file
View File

@ -0,0 +1,6 @@
|%
+$ token
$: access-key=@t
expires-in=@dr
==
--

View File

@ -42,6 +42,7 @@
[%groupify rid=resource to=(unit resource)]
[%forward rid=resource =update:store]
[%eval =cord]
[%pending-indices pending=(map hash:store index:store)]
==
--

View File

@ -1,6 +1,17 @@
/- *resource, graph-store, post
^?
|%
::
+$ mode ?(%each %count %none)
::
+$ watch-for ?(%siblings %children %none)
::
+$ index-len
[parent=@ud self=@ud]
::
+$ notif-kind
[name=@t =index-len =mode =watch-for]
::
+$ action
$%
[?(%listen %ignore) graph=resource =index:post]

View File

@ -1,11 +1,21 @@
|%
+$ settings-0 (map key bucket-0)
+$ bucket-0 (map key val-0)
+$ val-0
$% [%s p=@t]
[%b p=?]
[%n p=@]
==
::
+$ settings (map key bucket)
+$ bucket (map key val)
+$ key term
+$ val
$~ [%n 0]
$% [%s p=@t]
[%b p=?]
[%n p=@]
[%a p=(list val)]
==
+$ event
$% [%put-bucket =key =bucket]

View File

@ -796,7 +796,7 @@
$: face=(unit term)
file-path=term
==
+$ care ?(%a %b %c %d %p %r %s %t %u %v %w %x %y %z) :: clay submode
+$ care ?(%a %b %c %d %e %f %p %r %s %t %u %v %w %x %y %z) :: clay submode
+$ case :: ship desk case spur
$% [%da p=@da] :: date
[%tas p=@tas] :: label
@ -928,12 +928,16 @@
:: /- sur-file :: surface imports from /sur
:: /+ lib-file :: library imports from /lib
:: /= face /path :: imports built hoon file at path
:: /% face %mark :: imports mark definition from /mar
:: /$ face %from %to :: imports mark converter from /mar
:: /* face %mark /path :: unbuilt file imports, as mark
::
+$ pile
$: sur=(list taut)
lib=(list taut)
raw=(list [face=term =path])
maz=(list [face=term =mark])
caz=(list [face=term =mars])
bar=(list [face=term =mark =path])
=hoon
==
@ -942,9 +946,25 @@
+$ taut [face=(unit term) pax=term]
:: $mars: mark conversion request
:: $tube: mark conversion gate
:: $nave: typed mark core
::
+$ mars [a=mark b=mark]
+$ tube $-(vase vase)
++ nave
|$ [typ dif]
$_
^?
|%
++ bunt *typ
++ diff |~([old=typ new=typ] *dif)
++ form *mark
++ join |~([a=dif b=dif] *(unit (unit dif)))
++ mash
|~ [a=[ship desk dif] b=[ship desk dif]]
*(unit dif)
++ pact |~([typ dif] *typ)
++ vale |~(noun *typ)
--
:: $dais: processed mark core
::
+$ dais
@ -959,7 +979,6 @@
*(unit vase)
++ pact |~(diff=vase sam)
++ vale |~(noun sam)
++ volt |~(noun sam)
--
::
++ get-fit

View File

@ -829,7 +829,7 @@
:: lifecycle arms; mostly pass-throughs to the contained adult ames
::
++ scry scry:adult-core
++ stay [%4 %larva queued-events ames-state.adult-gate]
++ stay [%5 %larva queued-events ames-state.adult-gate]
++ load
|= $= old
$% $: %4
@ -839,6 +839,13 @@
==
[%adult state=_ames-state.adult-gate]
== ==
$: %5
$% $: %larva
events=(qeu queued-event)
state=_ames-state.adult-gate
==
[%adult state=_ames-state.adult-gate]
== ==
==
?- old
[%4 %adult *] (load:adult-core %4 state.old)
@ -848,6 +855,14 @@
=. queued-events events.old
=. adult-gate (load:adult-core %4 state.old)
larval-gate
::
[%5 %adult *] (load:adult-core %5 state.old)
::
[%5 %larva *]
~> %slog.1^leaf/"ames: larva: load"
=. queued-events events.old
=. adult-gate (load:adult-core %5 state.old)
larval-gate
==
--
:: adult ames, after metamorphosis from larva
@ -919,13 +934,38 @@
[moves ames-gate]
:: +stay: extract state before reload
::
++ stay [%4 %adult ames-state]
++ stay [%5 %adult ames-state]
:: +load: load in old state after reload
::
++ load
|= old-state=[%4 ^ames-state]
|= $= old-state
$% [%4 ^ames-state]
[%5 ^ames-state]
==
|^
^+ ames-gate
=? old-state ?=(%4 -.old-state) %5^(state-4-to-5 +.old-state)
::
?> ?=(%5 -.old-state)
ames-gate(ames-state +.old-state)
::
++ state-4-to-5
|= =^ames-state
^- ^^ames-state
=. peers.ames-state
%- ~(run by peers.ames-state)
|= =ship-state
?. ?=(%known -.ship-state)
ship-state
=. snd.ship-state
%- ~(run by snd.ship-state)
|= =message-pump-state
=. num-live.metrics.packet-pump-state.message-pump-state
~(wyt in live.packet-pump-state.message-pump-state)
message-pump-state
ship-state
ames-state
--
:: +scry: dereference namespace
::
++ scry
@ -1217,7 +1257,7 @@
on-hear-forward
::
?: ?& ?=(%pawn (clan:title sndr.packet))
!(~(has by peers.ames-state) sndr.packet)
!?=([~ %known *] (~(get by peers.ames-state) sndr.packet))
==
on-hear-open
on-hear-shut
@ -1289,14 +1329,9 @@
|= [=lane =packet dud=(unit goof)]
^+ event-core
=/ sndr-state (~(get by peers.ames-state) sndr.packet)
:: if we don't know them, maybe enqueue a jael %public-keys request
::
:: Ignore encrypted packets from alien comets.
:: TODO: maybe crash?
:: if we don't know them, ask jael for their keys and enqueue
::
?. ?=([~ %known *] sndr-state)
?: =(%pawn (clan:title sndr.packet))
event-core
(enqueue-alien-todo sndr.packet |=(alien-agenda +<))
:: decrypt packet contents using symmetric-key.channel
::
@ -1909,6 +1944,11 @@
=/ =bone bone.shut-packet
::
?: ?=(%& -.meat.shut-packet)
=+ ?~ dud ~
%. ~
%+ slog
leaf+"ames: {<her.channel>} fragment crashed {<mote.u.dud>}"
?.(msg.veb ~ tang.u.dud)
(run-message-sink bone %hear lane shut-packet ?=(~ dud))
:: Just try again on error, printing trace
::
@ -1917,7 +1957,10 @@
::
=+ ?~ dud ~
%. ~
(slog leaf+"ames: crashed on message ack" >mote.u.dud< tang.u.dud)
%+ slog leaf+"ames: {<her.channel>} ack crashed {<mote.u.dud>}"
?. msg.veb ~
:- >[bone=bone message-num=message-num meat=meat]:shut-packet<
tang.u.dud
(run-message-pump bone %hear [message-num +.meat]:shut-packet)
:: +on-memo: handle request to send message
::
@ -2203,12 +2246,15 @@
?. ?=([%hear * * ok=%.n] task)
:: fresh boon; give message to client vane
::
%- (trace msg.veb |.("boon {<her.channel^bone=bone -.task>}"))
%- %+ trace msg.veb
=/ dat [her.channel bone=bone message-num=message-num -.task]
|.("sink boon {<dat>}")
peer-core
:: we previously crashed on this message; notify client vane
::
%- %+ trace msg.veb
|.("crashed on boon {<her.channel^bone=bone -.task>}")
=/ dat [her.channel bone=bone message-num=message-num -.task]
|.("crashed on sink boon {<dat>}")
boon-to-lost
:: +boon-to-lost: convert all boons to losts
::
@ -2226,7 +2272,9 @@
++ on-sink-nack-trace
|= [=message-num message=*]
^+ peer-core
%- (trace msg.veb |.("nack trace {<her.channel^bone=bone>}"))
%- %+ trace msg.veb
=/ dat [her.channel bone=bone message-num=message-num]
|.("sink naxplanation {<dat>}")
::
=+ ;; =naxplanation message
:: ack nack-trace message (only applied if we don't later crash)
@ -2243,7 +2291,9 @@
++ on-sink-plea
|= [=message-num message=*]
^+ peer-core
%- (trace msg.veb |.("plea {<her.channel^bone=bone>}"))
%- %+ trace msg.veb
=/ dat [her.channel bone=bone message-num=message-num]
|.("sink plea {<dat>}")
:: is this the first time we're trying to process this message?
::
?. ?=([%hear * * ok=%.n] task)

View File

@ -118,9 +118,11 @@
:: Ford cache
::
+$ ford-cache
$: vases=(map path [res=vase dez=(set path)])
$: files=(map path [res=vase dez=(set path)])
naves=(map mark [res=vase dez=(set path)])
marks=(map mark [res=dais dez=(set path)])
casts=(map mars [res=tube dez=(set path)])
casts=(map mars [res=vase dez=(set path)])
tubes=(map mars [res=tube dez=(set path)])
==
:: $reef-cache: built system files
::
@ -462,7 +464,9 @@
+$ build
$% [%file =path]
[%mark =mark]
[%dais =mark]
[%cast =mars]
[%tube =mars]
[%vale =path]
==
+$ state
@ -494,8 +498,9 @@
=? stack.nub ?=(^ stack.nub)
stack.nub(i (~(uni in i.stack.nub) top))
[top stack.nub]
:: +read-file: retrieve marked, validated file contents at path
::
++ get-value
++ read-file
|= =path
^- [cage state]
~| %error-validating^path
@ -519,13 +524,13 @@
?< (~(has in deletes) path)
~| %file-not-found^path
:_(nub (need (~(get an ankh) path)))
:: +get-mark: build a mark definition
:: +build-nave: build a statically typed mark core
::
++ get-mark
++ build-nave
|= mak=mark
^- [dais state]
^- [vase state]
~| %error-building-mark^mak
?^ got=(~(get by marks.cache.nub) mak)
?^ got=(~(get by naves.cache.nub) mak)
=? stack.nub ?=(^ stack.nub)
stack.nub(i (~(uni in i.stack.nub) dez.u.got))
[res.u.got nub]
@ -533,99 +538,128 @@
~|(cycle+mark+mak^stack.nub !!)
=. cycle.nub (~(put in cycle.nub) mark+mak)
=. stack.nub [~ stack.nub]
=; res=[=vase nub=state]
=. nub nub.res
=^ top stack.nub pop-stack
=. naves.cache.nub (~(put by naves.cache.nub) mak [vase.res top])
[vase.res nub]
=^ cor=vase nub (build-fit %mar mak)
=/ gad=vase (slap cor limb/%grad)
?@ q.gad
=+ !<(mok=mark gad)
=^ deg=vase nub $(mak mok)
=^ tub=vase nub (build-cast mak mok)
=^ but=vase nub (build-cast mok mak)
:_ nub
^- vase :: vase of nave
%+ slap
(with-faces deg+deg tub+tub but+but cor+cor nave+!>(nave) ~)
!, *hoon
=/ typ _+<.cor
=/ dif diff:deg
^- (nave typ dif)
|%
++ bunt +<.cor
++ diff
|= [old=typ new=typ]
^- dif
(diff:deg (tub old) (tub new))
++ form form:deg
++ join join:deg
++ mash mash:deg
++ pact
|= [v=typ d=dif]
^- typ
(but (pact:deg (tub v) d))
++ vale noun:grab:cor
--
:_ nub
^- vase :: vase of nave
%+ slap (slop (with-face cor+cor) bud)
!, *hoon
=/ typ _+<.cor
=/ dif _*diff:grad:cor
^- (nave:clay typ dif)
|%
++ bunt +<.cor
++ diff |=([old=typ new=typ] (diff:~(grad cor old) new))
++ form form:grad:cor
++ join
|= [a=dif b=dif]
^- (unit (unit dif))
?: =(a b)
~
`(join:grad:cor a b)
++ mash
|= [a=[=ship =desk =dif] b=[=ship =desk =dif]]
^- (unit dif)
?: =(dif.a dif.b)
~
`(mash:grad:cor a b)
++ pact |=([v=typ d=dif] (pact:~(grad cor v) d))
++ vale noun:grab:cor
--
:: +build-dais: build a dynamically typed mark definition
::
++ build-dais
|= mak=mark
^- [dais state]
~| %error-building-dais^mak
?^ got=(~(get by marks.cache.nub) mak)
=? stack.nub ?=(^ stack.nub)
stack.nub(i (~(uni in i.stack.nub) dez.u.got))
[res.u.got nub]
?: (~(has in cycle.nub) dais+mak)
~|(cycle+dais+mak^stack.nub !!)
=. cycle.nub (~(put in cycle.nub) dais+mak)
=. stack.nub [~ stack.nub]
=; res=[=dais nub=state]
=. nub nub.res
=^ top stack.nub pop-stack
=. marks.cache.nub (~(put by marks.cache.nub) mak [dais.res top])
[dais.res nub]
=^ cor=vase nub (build-fit %mar mak)
=/ gad=vase (slap cor %limb %grad)
?@ q.gad
=+ !<(mok=mark gad)
=^ deg=dais nub $(mak mok)
=^ tub=tube nub (get-cast mak mok)
=^ but=tube nub (get-cast mok mak)
:_ nub
^- dais
|_ sam=vase
++ bunt (slap cor $+6)
++ diff
|= new=vase
^- vase
(~(diff deg (tub sam)) (tub new))
++ form form:deg
++ join join:deg
++ mash mash:deg
++ pact
|= diff=vase
^+ sam
(but (~(pact deg (tub sam)) diff))
++ vale
|= =noun
^+ sam
(slam (slap cor !,(*hoon noun:grab)) !>(noun))
++ volt
|= =noun
^+ sam
[p:bunt noun]
--
=^ nav=vase nub (build-nave mak)
:_ nub
=+ !<(fom=mark (slap gad %limb %form))
^- dais
|_ sam=vase
++ bunt (slap cor $+6)
++ bunt (slap nav limb/%bunt)
++ diff
|= new=vase
^- vase
%+ slap
(with-faces cor+cor sam+sam new+new ~)
!, *hoon
(diff:~(grad cor sam) new)
++ form fom
(slam (slap nav limb/%diff) (slop sam new))
++ form !<(mark (slap nav limb/%form))
++ join
|= [a=vase b=vase]
^- (unit (unit vase))
?: =(q.a q.b)
~
=; res `?~(q.res ~ `(slap res !,(*hoon ?~(. !! u))))
(slam (slap cor !,(*hoon join:grad)) (slop a b))
=/ res=vase (slam (slap nav limb/%join) (slop a b))
?~ q.res ~
?~ +.q.res [~ ~]
``(slap res !,(*hoon ?>(?=([~ ~ *] .) u.u)))
++ mash
|= [a=[=ship =desk diff=vase] b=[=ship =desk diff=vase]]
^- (unit vase)
?: =(q.diff.a q.diff.b)
=/ res=vase
%+ slam (slap nav limb/%mash)
%+ slop
:(slop !>(ship.a) !>(desk.a) diff.a)
:(slop !>(ship.b) !>(desk.b) diff.b)
?~ q.res
~
:- ~
%+ slam (slap cor !,(*hoon mash:grad))
%+ slop
:(slop !>(ship.a) !>(desk.a) diff.a)
:(slop !>(ship.b) !>(desk.b) diff.b)
`(slap res !,(*hoon ?>((^ .) u)))
++ pact
|= diff=vase
^+ sam
%+ slap
(with-faces cor+cor sam+sam diff+diff ~)
!, *hoon
(pact:~(grad cor sam) diff)
(slam (slap nav limb/%pact) (slop sam diff))
++ vale
|= =noun
^+ sam
(slam (slap cor !,(*hoon noun:grab)) !>(noun))
++ volt
|= =noun
^+ sam
[p:bunt noun]
(slam (slap nav limb/%vale) noun/noun)
--
:: +get-cast: produce a $tube mark conversion gate from .a to .b
:: +build-cast: produce gate to convert mark .a to, statically typed
::
++ get-cast
++ build-cast
|= [a=mark b=mark]
^- [tube state]
^- [vase state]
~| error-building-cast+[a b]
?: =([%mime %hoon] [a b])
:_ nub
|= sam=vase
=+ !<(=mime sam)
!>(q.q.mime)
:_(nub !>(|=(m=mime q.q.m)))
?^ got=(~(get by casts.cache.nub) [a b])
=? stack.nub ?=(^ stack.nub)
stack.nub(i (~(uni in i.stack.nub) dez.u.got))
@ -633,11 +667,11 @@
?: (~(has in cycle.nub) cast+[a b])
~|(cycle+cast+[a b]^stack.nub !!)
=. stack.nub [~ stack.nub]
=; res=[=tube nub=state]
=; res=[=vase nub=state]
=. nub nub.res
=^ top stack.nub pop-stack
=. casts.cache.nub (~(put by casts.cache.nub) [a b] [tube.res top])
[tube.res nub]
=. casts.cache.nub (~(put by casts.cache.nub) [a b] [vase.res top])
[vase.res nub]
:: try +grow; is there a +grow core with a .b arm?
::
=^ old=vase nub (build-fit %mar a)
@ -649,47 +683,57 @@
:: +grow core has .b arm; use that
::
:_ nub
^- tube
|= sam=vase
^- vase
%+ slap
(with-faces old+old sam+sam ~)
:+ %sgzp !,(*hoon old=old)
:+ %sgzp !,(*hoon sam=sam)
:+ %tsgl [%limb b]
!, *hoon
~(grow old sam)
%+ slap (with-faces cor+old ~)
^- hoon
:+ %brcl !,(*hoon v=+<.cor)
:+ %tsgl limb/b
!,(*hoon ~(grow cor v))
:: try direct +grab
::
=^ new=vase nub (build-fit %mar b)
=/ rab
%- mule |.
%+ slap new
:+ %tsgl [%limb a]
[%limb %grab]
=/ rab (mule |.((slap new tsgl/[limb/a limb/%grab])))
?: &(?=(%& -.rab) ?=(^ q.p.rab))
:_(nub |=(sam=vase ~|([%grab a b] (slam p.rab sam))))
:_(nub p.rab)
:: try +jump
::
=/ jum
%- mule |.
%+ slap old
:+ %tsgl [%limb b]
[%limb %jump]
=/ jum (mule |.((slap old tsgl/[limb/b limb/%jump])))
?: ?=(%& -.jum)
(compose-casts a !<(mark p.jum) b)
:: try indirect +grab
::
?: ?=(%& -.rab)
(compose-casts a !<(mark p.rab) b)
?: ?=(%noun b)
:_(nub !>(|=(* +<)))
~|(no-cast-from+[a b] !!)
::
++ compose-casts
|= [x=mark y=mark z=mark]
^- [vase state]
=^ uno=vase nub (build-cast x y)
=^ dos=vase nub (build-cast y z)
:_ nub
%+ slap
(with-faces uno+uno dos+dos cork+!>(cork) ~)
!,(*hoon (cork uno dos))
:: +build-tube: produce a $tube mark conversion gate from .a to .b
::
++ build-tube
|= [a=mark b=mark]
^- [tube state]
=^ uno=tube nub (get-cast x y)
=^ dos=tube nub (get-cast y z)
:_(nub |=(sam=vase (dos (uno sam))))
~| error-building-tube+[a b]
?^ got=(~(get by tubes.cache.nub) [a b])
=? stack.nub ?=(^ stack.nub)
stack.nub(i (~(uni in i.stack.nub) dez.u.got))
[res.u.got nub]
?: (~(has in cycle.nub) tube+[a b])
~|(cycle+tube+[a b]^stack.nub !!)
=. stack.nub [~ stack.nub]
=; res=[=tube nub=state]
=. nub nub.res
=^ top stack.nub pop-stack
=. tubes.cache.nub (~(put by tubes.cache.nub) [a b] [tube.res top])
[tube.res nub]
=^ gat=vase nub (build-cast a b)
:_(nub |=(v=vase (slam gat v)))
::
++ lobe-to-page
|= =lobe
@ -713,7 +757,7 @@
?: =(mak p.page)
(page-to-cage page)
=^ [mark vax=vase] nub (page-to-cage page)
=^ =tube nub (get-cast p.page mak)
=^ =tube nub (build-tube p.page mak)
:_(nub [mak (tube vax)])
::
++ page-to-cage
@ -723,7 +767,7 @@
:_(nub [%hoon -:!>(*@t) q.page])
?: =(%mime p.page)
:_(nub [%mime !>(;;(mime q.page))])
=^ =dais nub (get-mark p.page)
=^ =dais nub (build-dais p.page)
:_(nub [p.page (vale:dais q.page)])
::
++ cast-path
@ -731,10 +775,10 @@
^- [cage state]
=/ mok (head (flop path))
~| error-casting-path+[path mok mak]
=^ cag=cage nub (get-value path)
=^ cag=cage nub (read-file path)
?: =(mok mak)
[cag nub]
=^ =tube nub (get-cast mok mak)
=^ =tube nub (build-tube mok mak)
~| error-running-cast+[path mok mak]
:_(nub [mak (tube q.cag)])
::
@ -746,14 +790,14 @@
=+ ;;(dif=(urge cord) q.diff)
=/ new=@t (of-wain:format (lurk:differ txt dif))
:_(nub [%hoon !>(new)])
=^ dys=dais nub (get-mark p.old)
=^ syd=dais nub (get-mark p.diff)
=^ dys=dais nub (build-dais p.old)
=^ syd=dais nub (build-dais p.diff)
:_(nub [p.old (~(pact dys (vale:dys q.old)) (vale:syd q.diff))])
::
++ prelude
|= =path
^- vase
=^ cag=cage nub (get-value path)
=^ cag=cage nub (read-file path)
?> =(%hoon p.cag)
=/ tex=tape (trip !<(@t q.cag))
=/ =pile (parse-pile path tex)
@ -765,7 +809,7 @@
|= =path
^- [vase state]
~| %error-building^path
?^ got=(~(get by vases.cache.nub) path)
?^ got=(~(get by files.cache.nub) path)
=? stack.nub ?=(^ stack.nub)
stack.nub(i (~(uni in i.stack.nub) dez.u.got))
[res.u.got nub]
@ -773,13 +817,13 @@
~|(cycle+file+path^stack.nub !!)
=. cycle.nub (~(put in cycle.nub) file+path)
=. stack.nub [(sy path ~) stack.nub]
=^ cag=cage nub (get-value path)
=^ cag=cage nub (read-file path)
?> =(%hoon p.cag)
=/ tex=tape (trip !<(@t q.cag))
=/ =pile (parse-pile path tex)
=^ res=vase nub (run-pile pile)
=^ top stack.nub pop-stack
=. vases.cache.nub (~(put by vases.cache.nub) path [res top])
=. files.cache.nub (~(put by files.cache.nub) path [res top])
[res nub]
::
++ run-pile
@ -787,6 +831,8 @@
=^ sut=vase nub (run-tauts bud %sur sur.pile)
=^ sut=vase nub (run-tauts sut %lib lib.pile)
=^ sut=vase nub (run-raw sut raw.pile)
=^ sut=vase nub (run-maz sut maz.pile)
=^ sut=vase nub (run-caz sut caz.pile)
=^ sut=vase nub (run-bar sut bar.pile)
=/ res=vase (road |.((slap sut hoon.pile)))
[res nub]
@ -824,6 +870,16 @@
::
%+ rune tis
;~(plug sym ;~(pfix gap fas (more fas urs:ab)))
::
%+ rune cen
;~(plug sym ;~(pfix gap ;~(pfix cen sym)))
::
%+ rune buc
;~ (glue gap)
sym
;~(pfix cen sym)
;~(pfix cen sym)
==
::
%+ rune tar
;~ (glue gap)
@ -875,6 +931,22 @@
=. p.pin [%face face.i.raw p.pin]
$(sut (slop pin sut), raw t.raw)
::
++ run-maz
|= [sut=vase maz=(list [face=term =mark])]
^- [vase state]
?~ maz [sut nub]
=^ pin=vase nub (build-nave mark.i.maz)
=. p.pin [%face face.i.maz p.pin]
$(sut (slop pin sut), maz t.maz)
::
++ run-caz
|= [sut=vase caz=(list [face=term =mars])]
^- [vase state]
?~ caz [sut nub]
=^ pin=vase nub (build-cast mars.i.caz)
=. p.pin [%face face.i.caz p.pin]
$(sut (slop pin sut), caz t.caz)
::
++ run-bar
|= [sut=vase bar=(list [face=term =mark =path])]
^- [vase state]
@ -1501,9 +1573,11 @@
%+ turn (tail (spud pux)) :: lose leading '/'
|=(c=@tD `@tD`?:(=('/' c) '-' c)) :: convert '/' to '-'
::
:* ((invalidate path vase) vases.ford-cache invalid)
:* ((invalidate path vase) files.ford-cache invalid)
((invalidate mark vase) naves.ford-cache invalid)
((invalidate mark dais) marks.ford-cache invalid)
((invalidate mars tube) casts.ford-cache invalid)
((invalidate mars vase) casts.ford-cache invalid)
((invalidate mars tube) tubes.ford-cache invalid)
==
::
++ invalidate
@ -1614,24 +1688,26 @@
::
++ checkout-changes
|= [=ford=args:ford:fusion changes=(map path (each page lobe))]
=/ cans=(list [=path change=(each page lobe)]) ~(tap by changes)
|- ^- [(map path [=lobe =cage]) ford-cache]
?~ cans
[~ ford-cache.ford-args]
^- [(map path [=lobe =cage]) ford-cache]
%+ roll `(list [path (each page lobe)])`~(tap by changes)
|= $: [=path change=(each page lobe)]
[built=(map path [lobe cage]) cache=_ford-cache.ford-args]
==
^+ [built cache]
=. ford-cache.ford-args cache
=^ cage ford-cache.ford-args
:: ~> %slog.[0 leaf+"clay: validating {(spud path.i.cans)}"]
:: ~> %slog.[0 leaf/"clay: validating {(spud path)}"]
%- wrap:fusion
(get-value:(ford:fusion ford-args) path.i.cans)
(read-file:(ford:fusion ford-args) path)
=/ =lobe
?- -.change.i.cans
%| p.change.i.cans
?- -.change
%| p.change
:: Don't use p.change.i.cans because that's before casting to
:: the correct mark.
::
%& (page-to-lobe [p q.q]:cage)
==
=^ so-far ford-cache.ford-args $(cans t.cans)
[(~(put by so-far) path.i.cans lobe cage) ford-cache.ford-args]
[(~(put by built) path [lobe cage]) ford-cache.ford-args]
::
:: Update ankh
::
@ -2209,7 +2285,7 @@
^- dais
=^ =dais fod.dom
%- wrap:fusion
(get-mark:(ford:fusion static-ford-args) mark)
(build-dais:(ford:fusion static-ford-args) mark)
dais
::
:: Diff two files on bob-desk
@ -2639,6 +2715,8 @@
%b ~| %i-guess-you-ought-to-build-your-own-marks !!
%c ~| %casts-should-be-compiled-on-your-own-ship !!
%d ~| %totally-temporary-error-please-replace-me !!
%e ~| %yes-naves-also-shouldnt-cross-the-network !!
%f ~| %even-static-casts-should-be-built-locally !!
%p ~| %requesting-foreign-permissions-is-invalid !!
%r ~| %no-cages-please-they-are-just-way-too-big !!
%s ~| %please-dont-get-your-takos-over-a-network !!
@ -3392,7 +3470,7 @@
^- [(unit (unit (each cage lobe))) ford-cache]
?. =(aeon let.dom)
[~ fod.dom]
=/ cached=(unit [=vase *]) (~(get by vases.fod.dom) path)
=/ cached=(unit [=vase *]) (~(get by files.fod.dom) path)
?^ cached
:_(fod.dom [~ ~ %& %vase !>(vase.u.cached)])
=/ x (read-x aeon path)
@ -3421,7 +3499,7 @@
:_(fod.dom [~ ~ %& %dais !>(dais.u.cached)])
=^ =dais fod.dom
%- wrap:fusion
(get-mark:(ford:fusion static-ford-args) i.path)
(build-dais:(ford:fusion static-ford-args) i.path)
:_(fod.dom [~ ~ %& %dais !>(dais)])
::
++ read-c
@ -3432,14 +3510,46 @@
[~ fod.dom]
?. ?=([@ @ ~] path)
[[~ ~] fod.dom]
=/ cached=(unit [=tube *]) (~(get by casts.fod.dom) [i i.t]:path)
=/ cached=(unit [=tube *]) (~(get by tubes.fod.dom) [i i.t]:path)
?^ cached
:_(fod.dom [~ ~ %& %tube !>(tube.u.cached)])
=^ =tube fod.dom
%- wrap:fusion
(get-cast:(ford:fusion static-ford-args) [i i.t]:path)
(build-tube:(ford:fusion static-ford-args) [i i.t]:path)
:_(fod.dom [~ ~ %& %tube !>(tube)])
::
++ read-e
!.
|= [=aeon =path]
^- [(unit (unit (each cage lobe))) ford-cache]
?. =(aeon let.dom)
[~ fod.dom]
?. ?=([@ ~] path)
[[~ ~] fod.dom]
=/ cached=(unit [=vase *]) (~(get by naves.fod.dom) i.path)
?^ cached
:_(fod.dom [~ ~ %& %nave !>(vase.u.cached)])
=^ =vase fod.dom
%- wrap:fusion
(build-nave:(ford:fusion static-ford-args) i.path)
:_(fod.dom [~ ~ %& %nave !>(vase)])
::
++ read-f
!.
|= [=aeon =path]
^- [(unit (unit (each cage lobe))) ford-cache]
?. =(aeon let.dom)
[~ fod.dom]
?. ?=([@ @ ~] path)
[[~ ~] fod.dom]
=/ cached=(unit [=vase *]) (~(get by casts.fod.dom) [i i.t]:path)
?^ cached
:_(fod.dom [~ ~ %& %cast vase.u.cached])
=^ =vase fod.dom
%- wrap:fusion
(build-cast:(ford:fusion static-ford-args) [i i.t]:path)
:_(fod.dom [~ ~ %& %cast vase])
::
:: Gets the permissions that apply to a particular node.
::
:: If the node has no permissions of its own, we use its parent's.
@ -3784,7 +3894,8 @@
:: virtualize to catch and produce deterministic failures
::
!.
=- ?:(?=(%& -<) p.- ((slog p.-) [[~ ~] fod]))
=- ?: ?=(%& -<) p.-
((slog leaf+"gall: read-at-aeon fail {<mun>}" p.-) [[~ ~] fod])
%- mule |.
?- care.mun
%d
@ -3800,6 +3911,8 @@
%a (read-a yon path.mun)
%b (read-b yon path.mun)
%c (read-c yon path.mun)
%e (read-e yon path.mun)
%f (read-f yon path.mun)
%p :_(fod (read-p path.mun))
%r :_(fod (bind (read-r yon path.mun) (lift |=(a=cage [%& a]))))
%s :_(fod (bind (read-s yon path.mun) (lift |=(a=cage [%& a]))))
@ -3845,7 +3958,7 @@
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
=| :: instrument state
$: ver=%6 :: vane version
$: ver=%7 :: vane version
ruf=raft :: revision tree
== ::
|= [now=@da eny=@uvJ rof=roof] :: current invocation
@ -4087,8 +4200,77 @@
==
::
++ load
|= old=[%6 raft]
..^$(ruf +.old)
=> |%
+$ raft-any
$% [%7 raft-7]
[%6 raft-6]
==
+$ raft-7 raft
+$ dojo-7 dojo
+$ ford-cache-7 ford-cache
+$ raft-6
$: rom=room-6 :: domestic
hoy=(map ship rung-6) :: foreign
ran=rang :: hashes
mon=(map term beam) :: mount points
hez=(unit duct) :: sync duct
cez=(map @ta crew) :: permission groups
pud=(unit [=desk =yoki]) :: pending update
== ::
+$ room-6 [hun=duct dos=(map desk dojo-6)]
+$ dojo-6
$: qyx=cult :: subscribers
dom=dome-6 :: desk state
per=regs :: read perms per path
pew=regs :: write perms per path
==
+$ dome-6
$: ank=ankh :: state
let=aeon :: top id
hit=(map aeon tako) :: versions by id
lab=(map @tas aeon) :: labels
mim=(map path mime) :: mime cache
fod=ford-cache-6 :: ford cache
fer=(unit reef-cache) :: reef cache
==
+$ rung-6
$: rus=(map desk rede-6)
==
+$ rede-6
$: lim=@da
ref=(unit rind)
qyx=cult
dom=dome-6
per=regs
pew=regs
==
+$ ford-cache-6 * :: discard old cache
--
|= old=raft-any
|^
=? old ?=(%6 -.old) 7+(raft-6-to-7 +.old)
?> ?=(%7 -.old)
..^^$(ruf +.old)
:: +raft-6-to-7: delete stale ford caches (they could all be invalid)
::
++ raft-6-to-7
|= raf=raft-6
^- raft-7
%= raf
dos.rom
%- ~(run by dos.rom.raf)
|= doj=dojo-6
^- dojo-7
doj(fod.dom *ford-cache-7)
::
hoy
%- ~(run by hoy.raf)
|= =rung-6
%- ~(run by rus.rung-6)
|= =rede-6
rede-6(dom dom.rede-6(fod *ford-cache-7))
==
--
::
++ scry :: inspect
^- roon
@ -4138,7 +4320,7 @@
dos.rom
%- ~(run by dos.rom.ruf)
|= =dojo
dojo(fod.dom [~ ~ ~])
dojo(fod.dom [~ ~ ~ ~ ~])
::
hoy
%- ~(run by hoy.ruf)
@ -4147,7 +4329,7 @@
rus
%- ~(run by rus.rung)
|= =rede
rede(fod.dom [~ ~ ~])
rede(fod.dom [~ ~ ~ ~ ~])
==
==
::
@ -4322,9 +4504,11 @@
:+ desk %|
:~ ankh+&+ank.dom.dojo
mime+&+mim.dom.dojo
ford-vases+&+vases.fod.dom.dojo
ford-files+&+files.fod.dom.dojo
ford-naves+&+naves.fod.dom.dojo
ford-marks+&+marks.fod.dom.dojo
ford-casts+&+casts.fod.dom.dojo
ford-tubes+&+tubes.fod.dom.dojo
==
:~ domestic+|+domestic
foreign+&+hoy.ruf

View File

@ -680,12 +680,9 @@
:: note this should only happen on reverse bones, so only facts
:: and kicks
::
=/ sys-wire [%sys wire]
:: TODO: %drip %kick so app crash can't kill the remote %pull
::
=/ =ames-request-all [%0 %u ~]
=. mo-core
(mo-pass sys-wire %a %plea ship %g /ge/[foreign-agent] ames-request-all)
=. mo-core (mo-send-foreign-request ship foreign-agent %leave ~)
=. mo-core (mo-give %unto %kick ~)
mo-core
==
@ -942,15 +939,13 @@
=/ sky (rof ~ %cb [our %home case] /[mark.ames-response])
?- sky
?(~ [~ ~])
=/ ror "gall: ames mark fail {<mark.ames-response>}"
(mo-give %done `vale+[leaf+ror]~)
(mean leaf+"gall: ames mark fail {<mark.ames-response>}" ~)
::
[~ ~ *]
=+ !<(=dais:clay q.u.u.sky)
=/ res (mule |.((vale:dais noun.ames-response)))
?: ?=(%| -.res)
=/ ror "gall: ames vale fail {<mark.deal>}"
(mo-give %done `vale+[leaf+ror p.res])
(mean leaf+"gall: ames vale fail {<mark.ames-response>}" p.res)
=. mo-core
%+ mo-pass /nowhere
[%c %warp our %home ~ %sing %b case /[mark.ames-response]]

View File

@ -3297,11 +3297,14 @@
%- flop
|- ^- ^tape
?:(=(0 a) ~ [(add '0' (mod a 10)) $(a (div a 10))])
:: :: ++sect:enjs:format
++ sect :: s timestamp
|= a=^time
(numb (unt:chrono:userlib a))
:: :: ++time:enjs:format
++ time :: ms timestamp
|= a=^time
=- (numb (div (mul - 1.000) ~s1))
(add (div ~s1 2.000) (sub a ~1970.1.1))
(numb (unm:chrono:userlib a))
:: :: ++path:enjs:format
++ path :: string from path
|= a=^path
@ -3365,10 +3368,10 @@
(poq (wit jon))
:: :: ++di:dejs:format
++ di :: millisecond date
%+ cu
|= a=@u ^- @da
(add ~1970.1.1 (div (mul ~s1 a) 1.000))
ni
(cu from-unix-ms:chrono:userlib ni)
:: :: ++du:dejs:format
++ du :: second date
(cu from-unix:chrono:userlib ni)
:: :: ++mu:dejs:format
++ mu :: true unit
|* wit=fist
@ -3578,10 +3581,7 @@
(bind (stud:chrono:userlib p.jon) |=(a=date (year a)))
::
++ di :: millisecond date
%+ cu
|= a=@u ^- @da
(add ~1970.1.1 (div (mul ~s1 a) 1.000))
ni
(cu from-unix-ms:chrono:userlib ni)
::
++ mu :: true unit
|* wit=fist
@ -5308,55 +5308,47 @@
=/ acc [stop=`?`%.n state=state]
=< abet =< main
|%
++ this .
++ abet [state.acc a]
:: +main: main recursive loop; performs a partial inorder traversal
::
++ main
^+ .
^+ this
:: stop if empty or we've been told to stop
::
?~ a .
?: stop.acc .
?: =(~ a) this
?: stop.acc this
:: inorder traversal: left -> node -> right, until .f sets .stop
::
=> left
?: stop.acc .
=> node
?: stop.acc .
right
=. this left
?: stop.acc this
=^ del this node
=? this !stop.acc right
=? a del (nip a)
this
:: +node: run .f on .n.a, updating .a, .state, and .stop
::
++ node
^+ .
^+ [del=*? this]
:: run .f on node, updating .stop.acc and .state.acc
::
=^ res acc
?> ?=(^ a)
(f state.acc n.a)
:: apply update to .a from .f's product
::
=. a
:: if .f requested node deletion, merge and balance .l.a and .r.a
::
?~ res (nip a)
:: we kept the node; replace its .val; order is unchanged
::
?> ?=(^ a)
a(val.n u.res)
::
..node
?> ?=(^ a)
=^ res acc (f state.acc n.a)
?~ res
[del=& this]
[del=| this(val.n.a u.res)]
:: +left: recurse on left subtree, copying mutant back into .l.a
::
++ left
^+ .
?~ a .
^+ this
?~ a this
=/ lef main(a l.a)
lef(a a(l a.lef))
:: +right: recurse on right subtree, copying mutant back into .r.a
::
++ right
^+ .
?~ a .
^+ this
?~ a this
=/ rig main(a r.a)
rig(a a(r a.rig))
--
@ -5486,13 +5478,20 @@
:: ::::
++ chrono ^?
|%
:: +from-unix: unix timestamp to @da
:: +from-unix: unix seconds to @da
::
++ from-unix
|= timestamp=@ud
^- @da
%+ add ~1970.1.1
(mul timestamp ~s1)
:: +from-unix-ms: unix milliseconds to @da
::
++ from-unix-ms
|= timestamp=@ud
^- @da
%+ add ~1970.1.1
(div (mul ~s1 timestamp) 1.000)
:: :: ++dawn:chrono:
++ dawn :: Jan 1 weekday
|= yer=@ud
@ -5611,9 +5610,13 @@
++ dd :: two digits
(bass 10 (stun 2^2 dit))
-- ::
:: :: ++unm:chrono:userlib
++ unm :: Urbit to Unix ms
|= a=@da
(div (mul (sub a ~1970.1.1) 1.000) ~s1)
:: :: ++unt:chrono:userlib
++ unt :: Urbit to Unix time
|= a=@
|= a=@da
(div (sub a ~1970.1.1) ~s1)
:: :: ++yu:chrono:userlib
++ yu :: UTC format constants

View File

@ -74,13 +74,15 @@
=. next-timer ~
=. this
%- emit-aqua-events
?^ error
:: Should pass through errors to aqua, but doesn't
::
%- (slog leaf+"aqua-behn: timer failed" u.error)
~
:_ ~
^- aqua-event
:+ %event who
:- //behn/0v1n.2m9vh
?~ error
[%wake ~]
[%crud %fail u.error]
[//behn/0v1n.2m9vh [%wake ~]]
..abet-pe
--
--

View File

@ -9,5 +9,5 @@
?~ bem=(de-beam pax)
(strand-fail:strand %path-not-beam >pax< ~)
=/ =mars:clay [i i.t]:?>(?=([@ @ ~] s.u.bem) s.u.bem)
;< =tube:clay bind:m (build-cast:strandio -.u.bem mars)
(pure:m !>(tube))
;< =vase bind:m (build-cast:strandio -.u.bem mars)
(pure:m vase)

View File

@ -6,6 +6,9 @@
=/ m (strand ,vase)
^- form:m
=+ !<([~ pax=path] arg)
?^ bem=(de-beam pax)
(build-file:strandio u.bem)
(strand-fail:strand %path-not-beam >pax< ~)
?~ bem=(de-beam pax)
(strand-fail:strand %path-not-beam >pax< ~)
;< vax=(unit vase) bind:m (build-file:strandio u.bem)
?^ vax
(pure:m u.vax)
(strand-fail:strand %build-file >u.bem< ~)

View File

@ -0,0 +1,13 @@
/- spider
/+ strandio
=, strand=strand:spider
^- thread:spider
|= arg=vase
=/ m (strand ,vase)
^- form:m
=+ !<([~ pax=path] arg)
?~ bem=(de-beam pax)
(strand-fail:strand %path-not-beam >pax< ~)
=/ =mark (rear s.u.bem)
;< =vase bind:m (build-nave:strandio -.u.bem mark)
(pure:m vase)

View File

@ -0,0 +1,13 @@
/- spider
/+ strandio
=, strand=strand:spider
^- thread:spider
|= arg=vase
=/ m (strand ,vase)
^- form:m
=+ !<([~ pax=path] arg)
?~ bem=(de-beam pax)
(strand-fail:strand %path-not-beam >pax< ~)
=/ =mars:clay [i i.t]:?>(?=([@ @ ~] s.u.bem) s.u.bem)
;< =tube:clay bind:m (build-tube:strandio -.u.bem mars)
(pure:m !>(tube))

View File

@ -0,0 +1,144 @@
:: Gets a Google Storage access token.
::
:: This thread produces a pair of [access-key expires-in], where
:: access-key is a @t that can be used as a bearer token to talk
:: to the GCP Storage API on behalf of some service account, and
:: expires-in is a @dr after which the token will stop working and
:: need to be refreshed.
::
:: It expects settings-store to contain relevant fields from
:: a GCP service account JSON file, generally as poked by
:: sh/poke-gcp-account-json. Specifically, it depends on the
:: `token_uri`, `client_email`, `private_key_id`, and `private_key`
:: fields. If these fields are not in settings-store at the time
:: the thread is run, it will fail.
::
:: The thread works by first constructing a self-signed JWT using
:: the fields in settings-store. Then, it sends this JWT to the
:: specified token URI (usually https://oauth2.googleapis.com/token),
:: which responds with a bearer token and expiry.
::
::
/- gcp, spider, settings
/+ jose, pkcs, primitive-rsa, strandio
=, strand=strand:spider
=, rsa=primitive-rsa
^- thread:spider
|^
|= *
=/ m (strand ,vase)
^- form:m
;< =bowl:spider bind:m get-bowl:strandio
;< iss=@t bind:m (read-setting %client-email)
;< =key:rsa bind:m read-private-key
;< kid=@t bind:m (read-setting %private-key-id)
;< aud=@t bind:m (read-setting %token-uri)
=* scope
'https://www.googleapis.com/auth/devstorage.read_write'
=/ jot=@t
(make-jwt key kid iss scope aud now.bowl)
;< =token:gcp bind:m
(get-access-token jot aud)
(pure:m !>(token))
::
++ read-setting
|= key=term
=/ m (strand @t) ^- form:m
;< has=? bind:m
%+ scry:strandio ?
/gx/settings-store/has-entry/gcp-store/[key]/noun
?. has
(strand-fail:strandio (rap 3 %gcp-missing- key ~) ~)
;< =data:settings bind:m
%+ scry:strandio
data:settings
/gx/settings-store/entry/gcp-store/[key]/settings-data
?> ?=([%entry %s @] data)
(pure:m p.val.data)
::
++ read-private-key
=/ m (strand ,key:rsa) ^- form:m
;< dat=@t bind:m (read-setting %private-key)
%- pure:m
%. dat
;: cork
to-wain:format
ring:de:pem:pkcs8:pkcs
need
==
:: construct and return a self-signed JWT issued now, expiring in ~h1.
:: TODO: maybe move this into lib/jose/hoon
::
++ make-jwt
|= [=key:rsa kid=@t iss=@t scope=@t aud=@t iat=@da]
^- @t
=/ job=json
=, enjs:format
%^ sign:jws:jose key
:: the JWT's "header"
%: pairs
alg+s+'RS256'
typ+s+'JWT'
kid+s+kid
~
==
:: the JWT's "payload"
%: pairs
iss+s+iss
sub+s+iss :: per g.co, use iss for sub
scope+s+scope
aud+s+aud
iat+(sect iat)
exp+(sect (add iat ~h1))
~
==
=/ [pod=@t pad=@t sig=@t]
=, dejs:format
((ot 'protected'^so 'payload'^so 'signature'^so ~) job)
(rap 3 (join '.' `(list @t)`~[pod pad sig]))
:: RPC to get an access token. Probably only works with Google.
:: Described at:
:: https://developers.google.com/identity/protocols/oauth2/service-account
::
++ get-access-token
|= [jot=@t url=@t]
=/ m (strand ,token:gcp) ^- form:m
;< ~ bind:m
%: send-request:strandio
method=%'POST'
url=url
header-list=['Content-Type'^'application/json' ~]
^= body
%- some %- as-octt:mimes:html
%- en-json:html
%: pairs:enjs:format
:- 'grant_type'
s+'urn:ietf:params:oauth:grant-type:jwt-bearer'
assertion+s+jot
~
==
==
;< rep=client-response:iris bind:m
take-client-response:strandio
?> ?=(%finished -.rep)
?~ full-file.rep
(strand-fail:strandio %gcp-no-response ~)
=/ body=@t q.data.u.full-file.rep
=/ jon=(unit json) (de-json:html body)
?~ jon
~| body
(strand-fail:strandio %gcp-bad-body ~)
=* job u.jon
~| job
=, dejs:format
=/ [typ=@t =token:gcp]
%. job
%: ot
'token_type'^so
'access_token'^so
'expires_in'^(cu |=(a=@ (mul a ~s1)) ni)
~
==
?> =('Bearer' typ)
(pure:m token)
--

View File

@ -0,0 +1,49 @@
:: Tells whether GCP Storage appears to be configured.
::
:: Thread since it needs to be called from Landscape.
::
::
/- gcp, spider, settings
/+ strandio
=, strand=strand:spider
=, enjs:format
^- thread:spider
|^
|= *
=/ m (strand ,vase)
^- form:m
;< has=? bind:m
%: has-settings
%client-email
%private-key
%private-key-id
%token-uri
~
==
%- pure:m
!>
%+ frond %gcp-configured
b+has
::
++ has-settings
|= set=(list @tas)
=/ m (strand ?)
^- form:m
?~ set
(pure:m %.y)
;< has=? bind:m (has-setting i.set)
?. has
(pure:m %.n)
;< has=? bind:m (has-settings t.set)
(pure:m has)
::
++ has-setting
|= key=@tas
=/ m (strand ?)
^- form:m
;< has=? bind:m
%+ scry:strandio ?
/gx/settings-store/has-entry/gcp-store/[key]/noun
(pure:m has)
::
--

View File

@ -0,0 +1,131 @@
/- spider
/+ strandio, store=graph-store, gra=graph, graph-view, sig=signatures
=, strand=strand:spider
=>
|%
++ scry-graph
|= rid=resource:store
=/ m (strand ,graph:store)
^- form:m
;< =update:store bind:m
%+ scry:strandio update:store
/gx/graph-store/graph/(scot %p entity.rid)/[name.rid]/noun
?> ?=(%0 -.update)
?> ?=(%add-graph -.q.update)
(pure:m graph.q.update)
--
::
^- thread:spider
|= arg=vase
=/ m (strand:spider ,vase)
^- form:m
=+ !<([~ =update:store] arg)
?> ?=(%add-nodes -.q.update)
=* poke-our poke-our:strandio
;< =bowl:spider bind:m get-bowl:strandio
;< =graph:store bind:m (scry-graph resource.q.update)
|^
=. nodes.q.update
%- ~(gas by *(map index:store node:store))
%+ turn
(concat-by-parent (sort-nodes nodes.q.update))
add-hash-to-node
=/ hashes (nodes-to-pending-indices nodes.q.update)
;< ~ bind:m
%^ poke-our %graph-push-hook
%graph-update
!>(update)
(pure:m !>(`action:graph-view`[%pending-indices hashes]))
::
++ sort-nodes
|= nodes=(map index:store node:store)
^- (list [index:store node:store])
%+ sort ~(tap by nodes)
|= [p=[=index:store *] q=[=index:store *]]
^- ?
(lth (lent index.p) (lent index.q))
::
++ concat-by-parent
|= lis=(list [index:store node:store])
^- (list [index:store node:store])
%~ tap by
%+ roll lis
|= $: [=index:store =node:store]
nds=(map index:store node:store)
==
?: ?=(~ index) !!
?: ?=([@ ~] index)
(~(put by nds) index node)
=/ ind (snip `(list atom)`index)
=/ nod (~(get by nds) ind)
?~ nod
(~(put by nds) index node)
=. children.u.nod
:- %graph
?: ?=(%empty -.children.u.nod)
%+ gas:orm:store *graph:store
[(rear index) node]~
%^ put:orm:store p.children.u.nod
(rear index)
node
(~(put by nds) ind u.nod)
::
++ add-hash-to-node
=| parent-hash=(unit hash:store)
|= [=index:store =node:store]
^- [index:store node:store]
=* loop $
:- index
=* p post.node
=/ =hash:store
=- `@ux`(sham -)
:^ ?^ parent-hash
parent-hash
(index-to-parent-hash index)
author.p
time-sent.p
contents.p
%_ node
hash.post `hash
::
:: TODO: enable signing our own post as soon as we're ready
:: signatures.post
:: %- ~(gas in *signatures:store)
:: [(sign:sig our.bowl now.bowl hash)]~
::
children
?: ?=(%empty -.children.node)
children.node
:- %graph
%+ gas:orm:store *graph:store
%+ turn (tap:orm:store p.children.node)
|= [=atom =node:store]
=/ [* nod=node:store]
%_ loop
parent-hash `hash
index (snoc index atom)
node node
==
[atom nod]
==
::
++ index-to-parent-hash
|= =index:store
^- (unit hash:store)
?: ?=(~ index)
!!
?: ?=([@ ~] index)
~
=/ node (got-deep:gra graph (snip `(list atom)`index))
hash.post.node
::
++ nodes-to-pending-indices
|= nodes=(map index:store node:store)
^- (map hash:store index:store)
%- ~(gas by *(map hash:store index:store))
%+ turn ~(tap by nodes)
|= [=index:store =node:store]
^- [hash:store index:store]
?> ?=(^ hash.post.node)
[u.hash.post.node index]
--

View File

@ -1,4 +1,5 @@
/- spider, graph-view, graph=graph-store, *metadata-store, *group, *metadata-store
/- spider, graph-view, graph=graph-store,
met=metadata-store, *group, *metadata-store
/+ strandio, resource
=>
|%
@ -28,11 +29,11 @@
::
++ scry-metadatum
|= rid=resource
=/ m (strand ,metadata)
=/ m (strand ,metadatum:met)
^- form:m
=/ enc-path=@t (scot %t (spat (en-path:resource rid)))
;< umeta=(unit metadata) bind:m
%+ scry:strandio (unit metadata)
;< umeta=(unit metadatum:met) bind:m
%+ scry:strandio (unit metadatum:met)
%+ weld /gx/metadata-store/metadata
/[enc-path]/graph/[enc-path]/noun
?> ?=(^ umeta)
@ -48,24 +49,25 @@
;< =group bind:m (scry-group rid.action)
?. hidden.group
(strand-fail:strandio %bad-request ~)
;< =metadata bind:m (scry-metadatum rid.action)
;< =metadatum:met bind:m (scry-metadatum rid.action)
?~ to.action
;< ~ bind:m
%+ poke-our %contact-view
:- %contact-view-action
!>([%groupify rid.action title.metadata description.metadata])
!>([%groupify rid.action title.metadatum description.metadatum])
(pure:m !>(~))
;< new=^group bind:m (scry-group u.to.action)
?< hidden.new
=/ new-path (en-path:resource u.to.action)
=/ app-path (en-path:resource rid.action)
=/ add-md=metadata-action
[%add new-path graph+app-path metadata]
;< ~ bind:m
(poke-our %metadata-store metadata-action+!>(add-md))
;< ~ bind:m
%+ poke-our %metadata-store
metadata-action+!>([%remove app-path graph+app-path])
:- %metadata-action
!> ^- action:met
[%add u.to.action [%graph rid.action] metadatum]
;< ~ bind:m
%+ poke-our %metadata-store
:- %metadata-action
!> ^- action:met
[%remove rid.action [%graph rid.action]]
;< ~ bind:m
(poke-our %group-store %group-update !>([%remove-group rid.action ~]))
(pure:m !>(~))

View File

@ -1,4 +1,4 @@
/- spider, graph=graph-store, *metadata-store, *group, group-store
/- spider, graph=graph-store, met=metadata-store, *group, group-store, push-hook
/+ strandio, resource, graph-view
=>
|%
@ -23,17 +23,22 @@
::
:: Setup metadata
::
=/ =metadata
%* . *metadata
=/ =metadatum:met
%* . *metadatum:met
title title
description description
date-created now.bowl
creator our.bowl
module module
==
=/ act=metadata-action
[%add (en-path:resource group) graph+(en-path:resource rid) metadata]
;< ~ bind:m (poke-our %metadata-hook %metadata-action !>(act))
;< ~ bind:m
(poke-our %metadata-hook %metadata-hook-action !>([%add-owned (en-path:resource group)]))
%+ poke-our %metadata-push-hook
:- %metadata-action
!> ^- action:met
[%add group [%graph rid] metadatum]
;< ~ bind:m
%+ poke-our %metadata-push-hook
:- %push-hook-action
!> ^- action:push-hook
[%add group]
(pure:m !>(~))

View File

@ -1,84 +0,0 @@
/- spider, *metadata-store
/+ strandio
=, strand=strand:spider
^- thread:spider
|= arg=vase
=/ m (strand ,vase)
^- form:m
=/ [~ og-path=path ng-path=path] !<([~ path path] arg)
;< bol=bowl:spider bind:m get-bowl:strandio
|^
::
=/ og=(unit (set ship)) (scry-for (unit (set ship)) %group-store og-path)
?~ og
(pure:m !>("no such group: {<og-path>}"))
=/ ng=(unit (set ship)) (scry-for (unit (set ship)) %group-store ng-path)
?~ ng
(pure:m !>("no such group: {<ng-path>}"))
::
=/ assoc=associations (scry-for associations %metadata-store [%group og-path])
=/ assoc-list=(list [[group-path md-resource] metadata]) ~(tap by assoc)
::
|-
=* loop $
?~ assoc-list
;< ~ bind:m
(poke-our:strandio %group-store %group-action !>([%unbundle og-path]))
(pure:m !>("done"))
=/ [[g-path=group-path res=md-resource] meta=metadata] i.assoc-list
?. =(our.bol creator.meta)
loop(assoc-list t.assoc-list)
?> =(g-path og-path)
=/ output=(list card:agent:gall)
?+ app-name.res ~
::
?(%chat %link)
%- (slog leaf+"migrating {<app-name.res>} : {<app-path.res>}" ~)
:~ :* %pass /poke %agent
[our.bol %metadata-hook]
%poke %metadata-action
!>([%add ng-path res meta])
==
:* %pass /poke %agent
[our.bol %metadata-hook]
%poke %metadata-action
!>([%remove g-path res])
==
==
%publish
%- (slog leaf+"migrating {<app-name.res>} : {<app-path.res>}" ~)
=/ book (scry-for notebook %publish [%book app-path.res])
?> ?=([@tas @tas ~] app-path.res)
:~ :* %pass /poke %agent
[our.bol %publish]
%poke %publish-action
!>
:* %edit-book
i.t.app-path.res
title.book
description.book
comments.book
`[ng-path ~ %.y %.n]
==
==
:* %pass /poke %agent
[our.bol %metadata-hook]
%poke %metadata-action
!>([%remove g-path res])
==
==
==
::
;< ~ bind:m (send-raw-cards:strandio output)
loop(assoc-list t.assoc-list)
::
++ scry-for
|* [mol=mold app=term pax=path]
.^ mol
%gx
(scot %p our.bol)
app
(scot %da now.bol)
(snoc `path`pax %noun)
==
--

View File

@ -1,46 +0,0 @@
/- spider,
contact-view,
*resource
/+ *ph-io, strandio
=, strand=strand:spider
::
^- thread:spider
|= vase
=/ m (strand ,vase)
;< ~ bind:m start-simple
;< bol=bowl:spider bind:m get-bowl:strandio
::
:: group setup
:: - ~zod creates an open group
:: - ~zod creates and invite-only group, and invites ~bus and ~web
:: - ~bus and ~web join the first, but not the second group, to keep
:: invite-store populated
::
=/ group-1=contact-view-action:contact-view
:* %create
%group-1
[%open ~ ~]
'Group 1'
'this is group 1'
==
=/ group-2=contact-view-action:contact-view
:* %create
%group-2
[%invite (sy ~bus ~web ~)]
'Group 2'
'this is group 2'
==
=/ join=contact-view-action:contact-view [%join ~zod %group-1]
;< ~ bind:m (poke-app ~zod %contact-view %contact-view-action group-1)
;< ~ bind:m (wait-for-output ~zod ">=")
;< ~ bind:m (poke-app ~zod %contact-view %contact-view-action group-2)
;< ~ bind:m (wait-for-output ~zod ">=")
;< ~ bind:m (sleep ~s10)
;< ~ bind:m (poke-app ~bus %contact-view %contact-view-action join)
;< ~ bind:m (wait-for-output ~bus ">=")
;< ~ bind:m (poke-app ~web %contact-view %contact-view-action join)
;< ~ bind:m (wait-for-output ~web ">=")
;< ~ bind:m (send-hi ~bus ~zod)
;< ~ bind:m (send-hi ~web ~zod)
;< ~ bind:m (sleep ~s2)
(pure:m *vase)

View File

@ -1,24 +0,0 @@
/- spider,
contact-view,
*resource,
group-store
/+ *ph-io, strandio
=, strand=strand:spider
::
^- thread:spider
|= vase
=/ m (strand ,vase)
;< ~ bind:m start-simple
;< bol=bowl:spider bind:m get-bowl:strandio
::
=/ join-2=contact-view-action:contact-view [%join ~zod %group-2]
=/ add-members-1=action:group-store
[%add-members [~zod %group-1] (sy ~def ~ten ~)]
=/ add-members-2=action:group-store
[%add-members [~zod %group-2] (sy ~def ~ten ~)]
;< ~ bind:m (poke-app ~bus %contact-view %contact-view-action join-2)
;< ~ bind:m (poke-app ~web %contact-view %contact-view-action join-2)
;< ~ bind:m (poke-app ~zod %group-store %group-action add-members-1)
;< ~ bind:m (poke-app ~zod %group-store %group-action add-members-2)
::
(pure:m *vase)

View File

@ -1,61 +0,0 @@
/- spider,
contact-view,
contact-store,
group-store,
metadata-store,
post,
graph-store,
*resource
/+ *ph-io, strandio
=, strand=strand:spider
::
::
^- thread:spider
|= vase
=/ m (strand ,vase)
;< ~ bind:m start-simple
;< bol=bowl:spider bind:m get-bowl:strandio
::
:: test metadata import
::
=/ change-group-1=metadata-action:metadata-store
:* %add
/ship/~zod/group-1
[%contacts /ship/~zod/group-1]
'New Group 1 Title'
'new description'
0x0
now.bol
~zod
'fake'
==
=/ change-web-book=metadata-action:metadata-store
:* %add
/ship/~web/graph-3
[%graph /ship/~web/graph-3]
'New Graph 3 Title'
'new description'
0x0
now.bol
~web
'fake'
==
;< ~ bind:m (poke-app ~zod %metadata-hook %metadata-action change-group-1)
;< ~ bind:m (sleep ~s5)
;< ~ bind:m (poke-app ~web %metadata-hook %metadata-action change-web-book)
;< ~ bind:m (sleep ~s5)
::
:: test contacts import
::
=/ add-zod=contact-action:contact-store
:* %add /ship/~zod/group-1 ~zod
'ZOD' '' '' '' '' 0x0 ~
==
=/ add-bus=contact-action:contact-store
:* %add /ship/~zod/group-2 ~bus
'BUS' '' '' '' '' 0x0 ~
==
;< ~ bind:m (poke-app ~zod %contact-hook %contact-action add-zod)
;< ~ bind:m (sleep ~s5)
;< ~ bind:m (poke-app ~bus %contact-hook %contact-action add-bus)
(pure:m *vase)

View File

@ -92,8 +92,12 @@
?. =(%hoon (rear p)) ~
(some [[-.i.bez p] ~])
loop(bez t.bez, fiz (~(gas in fiz) foz))
~| bad-test-beam+i.bez
=/ tex=term =-(?>(((sane %tas) -) -) (rear s.i.bez))
::
:: XX this logic appears to be vestigial
::
=/ tex=term
~| bad-test-beam+i.bez
=-(?>(((sane %tas) -) -) (rear s.i.bez))
=/ xup=path (snip s.i.bez)
;< hov=? bind:m (check-for-file:strandio i.bez(s (snoc xup %hoon)))
?. hov
@ -107,16 +111,23 @@
=/ paz=(list path)
(tail !<([~ (list path)] arg))
=/ bez=(list beam)
(turn paz |=(p=path (need (de-beam p))))
(turn paz |=(p=path ~|([%test-not-beam p] (need (de-beam p)))))
;< fiz=(set [=beam test=(unit term)]) bind:m (find-test-files bez)
=> .(fiz (sort ~(tap in fiz) aor))
=| test-arms=(map path (list test-arm))
=| build-ok=?
|- ^- form:m
=* gather-tests $
?^ fiz
~> %slog.0^leaf+"test: building {(spud s.beam.i.fiz)}"
;< cor=vase bind:m (build-file:strandio beam.i.fiz)
=/ arms=(list test-arm) (get-test-arms cor)
;< cor=(unit vase) bind:m (build-file:strandio beam.i.fiz)
?~ cor
~> %slog.0^leaf+"FAILED {(spud s.beam.i.fiz)} (build)"
gather-tests(fiz t.fiz, build-ok |)
~> %slog.0^leaf+"built {(spud s.beam.i.fiz)}"
=/ arms=(list test-arm) (get-test-arms u.cor)
::
:: XX this logic appears to be vestigial
::
=? arms ?=(^ test.i.fiz)
|- ^+ arms
?~ arms ~|(no-test-arm+i.fiz !!)
@ -127,7 +138,7 @@
gather-tests(fiz t.fiz)
%- pure:m !> ^= ok
%+ roll (resolve-test-paths test-arms)
|= [[=path =test-func] ok=_`?`%&]
|= [[=path =test-func] ok=_build-ok]
^+ ok
=/ res (run-test path test-func)
%- (slog (flop tang.res))

View File

@ -327,7 +327,7 @@
:: echo "hello" | openssl dgst -sha256 -sign private.pem | base64
%+ expect-eq
!> exp2b64
!> (en:base64 (met 3 sig) (swp 3 sig))
!> (en:base64:mimes:html (met 3 sig) (swp 3 sig))
==
::
++ test-csr

View File

@ -1,9 +1,15 @@
/+ *test
/= clay-raw /sys/vane/clay
/* hello-gen %hoon /gen/hello/hoon
/* strandio-lib %hoon /lib/strandio/hoon
/* strand-lib %hoon /lib/strand/hoon
/* spider-sur %hoon /sur/spider/hoon
/* gen-hello %hoon /gen/hello/hoon
/* lib-cram %hoon /lib/cram/hoon
/* lib-strandio %hoon /lib/strandio/hoon
/* lib-strand %hoon /lib/strand/hoon
/* sur-spider %hoon /sur/spider/hoon
/* mar-html %hoon /mar/html/hoon
/* mar-mime %hoon /mar/mime/hoon
/* mar-udon %hoon /mar/udon/hoon
/* mar-txt %hoon /mar/txt/hoon
/* mar-txt-diff %hoon /mar/txt-diff/hoon
::
!:
=, format
@ -14,32 +20,48 @@
::
|%
++ test-parse-pile ^- tang
=/ src "."
%+ expect-eq
!> ^- pile:fusion
:* ~ ~ ~ ~
:* ~ ~ ~ ~ ~ ~
tssg+[%dbug [/sur/foo/hoon [[1 1] [1 2]]] [%cnts ~[[%.y 1]] ~]]~
==
!> (parse-pile:(ford):fusion /sur/foo/hoon ".")
!> (parse-pile:(ford):fusion /sur/foo/hoon src)
::
++ test-parse-fascen ^- tang
=/ src "/% moo %mime\0a."
%+ expect-eq
!> ^- pile:fusion
:* sur=~ lib=~ raw=~
maz=[face=%moo mark=%mime]~
caz=~ bar=~
tssg+[%dbug [/sur/foo/hoon [[2 1] [2 2]]] [%cnts ~[[%.y 1]] ~]]~
==
!> (parse-pile:(ford):fusion /sur/foo/hoon src)
::
++ test-parse-fasbuc ^- tang
=/ src "/$ goo %mime %txt\0a."
%+ expect-eq
!> ^- pile:fusion
:* sur=~ lib=~ raw=~ maz=~
caz=[face=%goo from=%mime to=%txt]~
bar=~
tssg+[%dbug [/sur/foo/hoon [[2 1] [2 2]]] [%cnts ~[[%.y 1]] ~]]~
==
!> (parse-pile:(ford):fusion /sur/foo/hoon src)
::
++ test-parse-multiline-faslus ^- tang
=/ src
"""
:: :: ::
:::: /hoon/hood/app :: ::
:: :: ::
::
/? 310 :: zuse version
::
/- *sole
::
/+ sole :: libraries
:: XX these should really be separate apps, as
:: none of them interact with each other in
:: any fashion; however, to reduce boot-time
:: complexity and work around the current
:: non-functionality of end-to-end acknowledgments,
:: they have been bundled into :hood
::
:: |command handlers
::
/+ hood-helm, hood-kiln, hood-drum, hood-write
:: :: ::
::
.
"""
%+ expect-eq
@ -52,34 +74,21 @@
[`%hood-drum %hood-drum]
[`%hood-write %hood-write]
==
raw=~ bar=~
hoon=tssg+[p:(need q:(tall:(vang & /app/hood/hoon) [17 1] "."))]~
raw=~ maz=~ caz=~ bar=~
tssg+[%dbug [/sur/foo/hoon [[10 1] [10 2]]] [%cnts ~[[%.y 1]] ~]]~
==
!> (parse-pile:(ford):fusion /app/hood/hoon src)
!> (parse-pile:(ford):fusion /sur/foo/hoon src)
::
++ test-cycle ^- tang
=/ source=@t
'''
/+ self
.
'''
=/ =ankh:clay
:- fil=~
%- ~(gas by *(map @tas ankh:clay))
:~ :+ %lib fil=~
%- ~(gas by *(map @tas ankh:clay))
:~ :+ %self fil=~
%- ~(gas by *(map @tas ankh:clay))
:~ :+ %hoon fil=`[*lobe:clay hoon+!>(source)] dir=~
== == ==
=/ source=@t '/+ self\0a.'
%- expect-fail
|.
=/ ford
%: ford:fusion
bud
ankh
*ankh:clay
deletes=~
changes=~
changes=(my [/lib/self/hoon &+hoon+source]~)
file-store=~
*ford-cache:fusion
==
@ -89,22 +98,122 @@
%- expect-fail
|. (parse-pile:(ford):fusion /sur/foo/hoon "[")
::
++ test-hello-gen ^- tang
=/ =ankh:clay
:- fil=~
%- ~(gas by *(map @tas ankh:clay))
:~ :+ %gen fil=~
%- ~(gas by *(map @tas ankh:clay))
:~ :+ %hello fil=~
%- ~(gas by *(map @tas ankh:clay))
:~ :+ %hoon fil=`[*lobe:clay hoon+!>(hello-gen)] dir=~
== == ==
++ test-mar-mime ^- tang
=/ ford
%: ford:fusion
bud
ankh
*ankh:clay
deletes=~
changes=(my [/gen/hello/hoon &+hoon+hello-gen]~)
changes=(my [/mar/mime/hoon &+hoon+mar-mime]~)
file-store=~
*ford-cache:fusion
==
=/ [res=vase nub=state:ford:fusion] (build-nave:ford %mime)
;: weld
%+ expect-eq
!>(*mime)
(slap res limb/%bunt)
::
%+ expect-eq
!> (~(gas in *(set path)) /mar/mime/hoon ~)
!> dez:(~(got by files.cache.nub) /mar/mime/hoon)
==
::
++ test-mar-udon ^- tang
=/ ford
%: ford:fusion
bud
*ankh:clay
deletes=~
^= changes
%- my
:~ [/mar/udon/hoon &+hoon+mar-udon]
[/lib/cram/hoon &+hoon+lib-cram]
[/mar/txt/hoon &+hoon+mar-txt]
[/mar/txt-diff/hoon &+hoon+mar-txt-diff]
==
file-store=~
*ford-cache:fusion
==
=/ [res=vase nub=state:ford:fusion] (build-nave:ford %udon)
;: weld
%+ expect-eq
!>(*@t)
(slap res limb/%bunt)
::
%+ expect-eq
!> (~(gas in *(set path)) /mar/udon/hoon /lib/cram/hoon ~)
!> dez:(~(got by files.cache.nub) /mar/udon/hoon)
==
::
++ test-cast-html-mime ^- tang
=/ changes
%- my
:~ [/mar/mime/hoon &+hoon+mar-mime]
[/mar/html/hoon &+hoon+mar-html]
==
=/ ford
%: ford:fusion
bud
*ankh:clay
deletes=~
changes
file-store=~
*ford-cache:fusion
==
=/ [res=vase nub=state:ford:fusion] (build-cast:ford %html %mime)
%+ expect-eq
(slam res !>('<html></html>'))
!> `mime`[/text/html 13 '<html></html>']
::
++ test-fascen ^- tang
=/ changes
%- my
:~ [/mar/mime/hoon &+hoon+mar-mime]
[/lib/foo/hoon &+hoon+'/% moo %mime\0abunt:moo']
==
=/ ford
%: ford:fusion
bud
*ankh:clay
deletes=~
changes
file-store=~
*ford-cache:fusion
==
=/ [res=vase nub=state:ford:fusion] (build-file:ford /lib/foo/hoon)
%+ expect-eq
res
!> *mime
::
++ test-fasbuc ^- tang
=/ changes
%- my
:~ [/mar/mime/hoon &+hoon+mar-mime]
[/mar/html/hoon &+hoon+mar-html]
[/lib/foo/hoon &+hoon+'/$ foo %mime %html\0a*foo']
==
=/ ford
%: ford:fusion
bud
*ankh:clay
deletes=~
changes
file-store=~
*ford-cache:fusion
==
=/ [res=vase nub=state:ford:fusion] (build-file:ford /lib/foo/hoon)
%+ expect-eq
res
!> ''
::
++ test-gen-hello ^- tang
=/ ford
%: ford:fusion
bud
*ankh:clay
deletes=~
changes=(my [/gen/hello/hoon &+hoon+gen-hello]~)
file-store=~
*ford-cache:fusion
==
@ -116,37 +225,21 @@
::
%+ expect-eq
!> (~(gas in *(set path)) /gen/hello/hoon ~)
!> dez:(~(got by vases.cache.nub) /gen/hello/hoon)
!> dez:(~(got by files.cache.nub) /gen/hello/hoon)
==
::
++ test-strandio-lib ^- tang
=/ =ankh:clay
:- fil=~
%- ~(gas by *(map @tas ankh:clay))
:~ :+ %lib fil=~
%- ~(gas by *(map @tas ankh:clay))
:~ :+ %strandio fil=~
%- ~(gas by *(map @tas ankh:clay))
:~ :+ %hoon fil=`[*lobe:clay hoon+!>(strandio-lib)] dir=~
==
::
:+ %strand fil=~
%- ~(gas by *(map @tas ankh:clay))
:~ :+ %hoon fil=`[*lobe:clay hoon+!>(strand-lib)] dir=~
== ==
::
:+ %sur fil=~
%- ~(gas by *(map @tas ankh:clay))
:~ :+ %spider fil=~
%- ~(gas by *(map @tas ankh:clay))
:~ :+ %hoon fil=`[*lobe:clay hoon+!>(spider-sur)] dir=~
== == ==
++ test-lib-strandio ^- tang
=/ ford
%: ford:fusion
bud
ankh
*ankh:clay
deletes=~
changes=~
^= changes
%- my
:~ [/lib/strand/hoon &+hoon+lib-strand]
[/lib/strandio/hoon &+hoon+lib-strandio]
[/sur/spider/hoon &+hoon+sur-spider]
==
file-store=~
*ford-cache:fusion
==
@ -161,7 +254,7 @@
/lib/strand/hoon
/sur/spider/hoon
==
!> dez:(~(got by vases.cache.nub) /lib/strandio/hoon)
!> dez:(~(got by files.cache.nub) /lib/strandio/hoon)
==
::
:: |utilities: helper functions for testing

View File

@ -2360,7 +2360,6 @@
++ mash !!
++ pact !!
++ vale |=(=noun !>(;;(json noun)))
++ volt !!
--
::
?> =(%j view)

View File

@ -170,11 +170,15 @@
%+ expect-eq
!> [%o (molt props)]
!> (pairs props)
:: sect - stored as integer number of seconds since the unix epoch
%+ expect-eq
!> [%n '1']
!> (sect ~1970.1.1..0.0.1)
:: time - stored as integer number of milliseconds since the unix epoch
::
%+ expect-eq
!> [%n '1000']
!> (time ~1970.1.1..0.0.1)
!> [%n '1000']
!> (time ~1970.1.1..0.0.1)
:: ship - store ship identity as a string
::
%+ expect-eq

View File

@ -129,6 +129,30 @@
!> -.b
==
::
++ test-ordered-map-traverse-delete-all ^- tang
;: weld
=/ q ((ordered-map ,@ ,~) lte)
=/ o (gas:q ~ ~[1/~ 2/~ 3/~])
=/ b ((traverse:q ,~) o ~ |=([~ key=@ ~] [~ %| ~]))
%+ expect-eq
!> [~ ~]
!> b
::
=/ c
:~ [[2.127 1] ~] [[2.127 2] ~] [[2.127 3] ~]
[[2.127 7] ~] [[2.127 8] ~] [[2.127 9] ~]
==
=/ compare
|= [[aa=@ ab=@] [ba=@ bb=@]]
?:((lth aa ba) %.y ?:((gth aa ba) %.n (lte ab bb)))
=/ q ((ordered-map ,[@ @] ,~) compare)
=/ o (gas:q ~ c)
=/ b ((traverse:q ,~) o ~ |=([~ key=[@ @] ~] [~ %| ~]))
%+ expect-eq
!> [~ ~]
!> b
==
::
++ test-ordered-map-uni ^- tang
::
=/ a=(tree [@ud @tas]) (gas:atom-map ~ (scag 4 test-items))

View File

@ -1,186 +1,3 @@
const env = {
"browser": true,
"es6": true,
"node": true
};
const rules = {
"array-bracket-spacing": ["error", "never"],
"arrow-parens": [
"error",
"as-needed",
{
"requireForBlockBody": true
}
],
"arrow-spacing": "error",
"block-spacing": ["error", "always"],
"brace-style": ["error", "1tbs"],
"camelcase": [
"error",
{
"properties": "never"
}
],
"comma-dangle": ["error", "never"],
"eol-last": ["error", "always"],
"func-name-matching": "error",
"indent": [
"off",
2,
{
"ArrayExpression": "off",
"SwitchCase": 1,
"CallExpression": {
"arguments": "off"
},
"FunctionDeclaration": {
"parameters": "off"
},
"FunctionExpression": {
"parameters": "off"
},
"MemberExpression": "off",
"ObjectExpression": "off",
"ImportDeclaration": "off"
}
],
"handle-callback-err": "off",
"linebreak-style": ["error", "unix"],
"max-lines": [
"error",
{
"max": 300,
"skipBlankLines": true,
"skipComments": true
}
],
"max-lines-per-function": [
"warn",
{
"skipBlankLines": true,
"skipComments": true
}
],
"max-statements-per-line": [
"error",
{
"max": 1
}
],
"new-cap": [
"error",
{
"newIsCap": true,
"capIsNew": false
}
],
"new-parens": "error",
"no-buffer-constructor": "error",
"no-console": "off",
"no-extra-semi": "off",
"no-fallthrough": "off",
"no-func-assign": "off",
"no-implicit-coercion": "error",
"no-multi-assign": "error",
"no-multiple-empty-lines": [
"error",
{
"max": 1
}
],
"no-nested-ternary": "error",
"no-param-reassign": "off",
"no-return-assign": "error",
"no-return-await": "off",
"no-shadow-restricted-names": "error",
"no-tabs": "error",
"no-trailing-spaces": "error",
"no-unused-vars": [
"error",
{
"vars": "all",
"args": "none",
"ignoreRestSiblings": false
}
],
"no-use-before-define": [
"error",
{
"functions": false,
"classes": false
}
],
"no-useless-escape": "off",
"no-var": "error",
"nonblock-statement-body-position": ["error", "below"],
"object-curly-spacing": ["error", "always"],
"padded-blocks": ["error", "never"],
"prefer-arrow-callback": "error",
"prefer-const": [
"error",
{
"destructuring": "all",
"ignoreReadBeforeAssign": true
}
],
"prefer-template": "off",
"quotes": ["error", "single"],
"semi": ["error", "always"],
"spaced-comment": [
"error",
"always",
{
"exceptions": ["!"]
}
],
"space-before-blocks": "error",
"unicode-bom": ["error", "never"],
"valid-jsdoc": "error",
"wrap-iife": ["error", "inside"],
"react/jsx-closing-bracket-location": 1,
"react/jsx-tag-spacing": 1,
"react/jsx-max-props-per-line": ["error", { "maximum": 2, "when": "multiline" }],
"react/prop-types": 0
};
module.exports = {
"env": env,
"extends": [
"plugin:react/recommended",
"eslint:recommended",
],
"settings": {
"react": {
"version": "^16.5.2"
}
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 10,
"requireConfigFile": false,
"sourceType": "module"
},
"root": true,
"rules": rules,
"overrides": [
{
"files": ["**/*.ts", "**/*.tsx"],
"env": env,
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": { "jsx": true },
"ecmaVersion": 10,
"requireConfigFile": false,
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": rules
}
]
};
extends: "@urbit"
};

View File

@ -64,6 +64,12 @@ if(urbitrc.URL) {
return '/index.js'
}
},
'/~landscape/js/serviceworker.js': {
target: 'http://localhost:9000',
pathRewrite: (req, path) => {
return '/serviceworker.js'
}
},
'**': {
changeOrigin: true,
target: urbitrc.URL,
@ -78,7 +84,8 @@ if(urbitrc.URL) {
module.exports = {
mode: 'development',
entry: {
app: './src/index.js'
app: './src/index.js',
serviceworker: './src/serviceworker.js'
},
module: {
rules: [
@ -120,11 +127,11 @@ module.exports = {
plugins: [
new UrbitShipPlugin(urbitrc),
new webpack.DefinePlugin({
'process.env.TUTORIAL_HOST': JSON.stringify('~hastuc-dibtux'),
'process.env.TUTORIAL_HOST': JSON.stringify('~difmex-passed'),
'process.env.TUTORIAL_GROUP': JSON.stringify('beginner-island'),
'process.env.TUTORIAL_CHAT': JSON.stringify('chat-1704'),
'process.env.TUTORIAL_BOOK': JSON.stringify('book-9695'),
'process.env.TUTORIAL_LINKS': JSON.stringify('link-2827'),
'process.env.TUTORIAL_CHAT': JSON.stringify('introduce-yourself-7010'),
'process.env.TUTORIAL_BOOK': JSON.stringify('guides-9684'),
'process.env.TUTORIAL_LINKS': JSON.stringify('community-articles-2143'),
})
// new CleanWebpackPlugin(),
@ -135,10 +142,13 @@ module.exports = {
],
watch: true,
output: {
filename: 'index.js',
chunkFilename: 'index.js',
filename: (pathData) => {
return pathData.chunk.name === 'app' ? 'index.js' : '[name].js';
},
chunkFilename: '[name].js',
path: path.resolve(__dirname, '../dist'),
publicPath: '/'
publicPath: '/',
globalObject: 'this'
},
optimization: {
minimize: false,

View File

@ -3,11 +3,15 @@ const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
const webpack = require('webpack');
const { execSync } = require('child_process');
const GIT_DESC = execSync('git describe --always', { encoding: 'utf8' }).trim();
module.exports = {
mode: 'production',
entry: {
app: './src/index.js'
app: './src/index.js',
serviceworker: './src/serviceworker.js'
},
module: {
rules: [
@ -56,12 +60,12 @@ module.exports = {
new CleanWebpackPlugin(),
new webpack.DefinePlugin({
'process.env.LANDSCAPE_STREAM': JSON.stringify(process.env.LANDSCAPE_STREAM),
'process.env.LANDSCAPE_SHORTHASH': JSON.stringify(process.env.LANDSCAPE_SHORTHASH),
'process.env.TUTORIAL_HOST': JSON.stringify('~hastuc-dibtux'),
'process.env.LANDSCAPE_SHORTHASH': JSON.stringify(GIT_DESC),
'process.env.TUTORIAL_HOST': JSON.stringify('~difmex-passed'),
'process.env.TUTORIAL_GROUP': JSON.stringify('beginner-island'),
'process.env.TUTORIAL_CHAT': JSON.stringify('chat-8401'),
'process.env.TUTORIAL_BOOK': JSON.stringify('notebook-9148'),
'process.env.TUTORIAL_LINKS': JSON.stringify('links-4353'),
'process.env.TUTORIAL_CHAT': JSON.stringify('introduce-yourself-7010'),
'process.env.TUTORIAL_BOOK': JSON.stringify('guides-9684'),
'process.env.TUTORIAL_LINKS': JSON.stringify('community-articles-2143'),
}),
// new HtmlWebpackPlugin({
// title: 'Hot Module Replacement',
@ -69,7 +73,9 @@ module.exports = {
// }),
],
output: {
filename: 'index.[contenthash].js',
filename: (pathData) => {
return pathData.chunk.name === 'app' ? 'index.[contenthash].js' : '[name].js';
},
path: path.resolve(__dirname, '../../arvo/app/landscape/js/bundle'),
publicPath: '/'
},

File diff suppressed because it is too large Load Diff

View File

@ -10,8 +10,9 @@
"@reach/tabs": "^0.10.5",
"@tlon/indigo-dark": "^1.0.6",
"@tlon/indigo-light": "^1.0.6",
"@tlon/indigo-react": "1.2.17",
"@tlon/indigo-react": "^1.2.19",
"@tlon/sigil-js": "^1.4.3",
"@urbit/api": "file:../npm/api",
"aws-sdk": "^2.830.0",
"big-integer": "^1.6.48",
"classnames": "^2.2.6",
@ -28,6 +29,7 @@
"normalize-wheel": "1.0.1",
"oembed-parser": "^1.4.5",
"prop-types": "^15.7.2",
"querystring": "^0.2.0",
"react": "^16.14.0",
"react-codemirror2": "^6.0.1",
"react-dom": "^16.14.0",
@ -46,6 +48,10 @@
"urbit-ob": "^5.0.1",
"xterm": "^4.10.0",
"xterm-addon-fit": "^0.5.0",
"workbox-core": "^6.0.2",
"workbox-precaching": "^6.0.2",
"workbox-recipes": "^6.0.2",
"workbox-routing": "^6.0.2",
"yup": "^0.29.3",
"zustand": "^3.3.1"
},
@ -65,15 +71,15 @@
"@types/styled-components": "^5.1.7",
"@types/styled-system": "^5.1.10",
"@types/yup": "^0.29.11",
"@typescript-eslint/eslint-plugin": "^3.10.1",
"@typescript-eslint/parser": "^3.10.1",
"@typescript-eslint/eslint-plugin": "^4.15.0",
"@urbit/eslint-config": "file:../npm/eslint-config",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.2.2",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-root-import": "^6.6.0",
"clean-webpack-plugin": "^3.0.0",
"cross-env": "^7.0.3",
"eslint": "^6.8.0",
"eslint": "^7.19.0",
"eslint-plugin-react": "^7.22.0",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^4.5.1",
@ -87,12 +93,12 @@
"webpack-dev-server": "^3.11.2"
},
"scripts": {
"lint": "eslint ./src/**/*.{js,ts,tsx}",
"lint": "eslint ./src/**/*.{ts,tsx}",
"lint-file": "eslint",
"tsc": "tsc",
"tsc:watch": "tsc --watch",
"build:dev": "cross-env NODE_ENV=development webpack --config config/webpack.dev.js",
"build:prod": "cross-env NODE_ENV=production webpack --config config/webpack.prod.js",
"build:prod": "cd ../npm/api && npm i && cd ../../interface && cross-env NODE_ENV=production webpack --config config/webpack.prod.js",
"start": "webpack-dev-server --config config/webpack.dev.js",
"test": "echo \"Error: no test specified\" && exit 1"
},

View File

@ -1,6 +1,8 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import './register-sw';
import App from './views/App';
ReactDOM.render(<App />, document.getElementById('root'));

View File

@ -1,6 +1,5 @@
import _ from "lodash";
import { uuid } from "../lib/util";
import { Patp, Path } from "~/types/noun";
import _ from 'lodash';
import { Patp, Path } from '@urbit/api';
import BaseStore from '../store/base';
export default class BaseApi<S extends object = {}> {
@ -26,8 +25,8 @@ export default class BaseApi<S extends object = {}> {
data: event,
from: {
ship,
path,
},
path
}
});
},
(qui) => {
@ -50,14 +49,17 @@ export default class BaseApi<S extends object = {}> {
appl,
mark,
data,
(json) => { resolve(json); },
(err) => { reject(err); }
(json) => {
resolve(json);
},
(err) => {
reject(err);
}
);
});
}
scry<T>(app: string, path: Path): Promise<T> {
console.log(path);
return fetch(`/~/scry/${app}${path}.json`).then(r => r.json() as Promise<T>);
}
@ -69,5 +71,4 @@ export default class BaseApi<S extends object = {}> {
return res.json();
}
}

View File

@ -1,8 +1,7 @@
import BaseApi from './base';
import { StoreState } from '../store/type';
import { Patp, Path, Enc } from '~/types/noun';
import { Contact, ContactEdit } from '~/types/contact-update';
import { GroupPolicy, Resource } from '~/types/group-update';
import { Patp } from '@urbit/api';
import { ContactEdit } from '@urbit/api/contacts';
export default class ContactsApi extends BaseApi<StoreState> {
add(ship: Patp, contact: any) {
@ -31,7 +30,7 @@ export default class ContactsApi extends BaseApi<StoreState> {
ship,
'edit-field': editField,
timestamp: Date.now()
},
}
});
}
@ -62,7 +61,7 @@ export default class ContactsApi extends BaseApi<StoreState> {
return this.action(
'contact-push-hook',
'contact-share',
{ share: recipient },
{ share: recipient }
);
}
@ -85,7 +84,7 @@ export default class ContactsApi extends BaseApi<StoreState> {
}
private storeAction(action: any): Promise<any> {
return this.action('contact-store', 'contact-update', action)
return this.action('contact-store', 'contact-update', action);
}
private viewAction(threadName: string, action: any) {

View File

@ -0,0 +1,24 @@
import BaseApi from './base';
import {StoreState} from '../store/type';
import {GcpToken} from '../types/gcp-state';
export default class GcpApi extends BaseApi<StoreState> {
isConfigured() {
return this.spider('noun', 'json', 'gcp-is-configured', {})
.then((data) => {
this.store.handleEvent({
data
});
});
}
getToken() {
return this.spider('noun', 'gcp-token', 'gcp-get-token', {})
.then((token) => {
this.store.handleEvent({
data: token
});
});
}
};

View File

@ -1,4 +1,4 @@
import { Patp } from '~/types/noun';
import { Patp } from '@urbit/api';
import BaseApi from './base';
import { StoreState } from '../store/type';
import GlobalStore from '../store/store';
@ -10,7 +10,8 @@ import GroupsApi from './groups';
import LaunchApi from './launch';
import GraphApi from './graph';
import S3Api from './s3';
import {HarkApi} from './hark';
import GcpApi from './gcp';
import { HarkApi } from './hark';
import SettingsApi from './settings';
import TermApi from './term';
@ -21,6 +22,7 @@ export default class GlobalApi extends BaseApi<StoreState> {
contacts = new ContactsApi(this.ship, this.channel, this.store);
groups = new GroupsApi(this.ship, this.channel, this.store);
launch = new LaunchApi(this.ship, this.channel, this.store);
gcp = new GcpApi(this.ship, this.channel, this.store);
s3 = new S3Api(this.ship, this.channel, this.store);
graph = new GraphApi(this.ship, this.channel, this.store);
hark = new HarkApi(this.ship, this.channel, this.store);

View File

@ -1,14 +1,14 @@
import BaseApi from './base';
import { StoreState } from '../store/type';
import { Patp, Path, PatpNoSig } from '~/types/noun';
import { Patp, Path } from '@urbit/api';
import _ from 'lodash';
import {makeResource, resourceFromPath} from '../lib/group';
import {GroupPolicy, Enc, Post, NodeMap, Content, Resource} from '~/types';
import { makeResource, resourceFromPath } from '../lib/group';
import { GroupPolicy, Enc, Post, Content } from '@urbit/api';
import { numToUd, unixToDa, decToUd, deSig, resourceAsPath } from '~/logic/lib/util';
export const createBlankNodeWithChildPost = (
parentIndex: string = '',
childIndex: string = '',
parentIndex = '',
childIndex = '',
contents: Content[]
) => {
const date = unixToDa(Date.now()).toString();
@ -37,11 +37,11 @@ export const createBlankNodeWithChildPost = (
signatures: []
},
children: childGraph
};
};
};
function markPending(nodes: any) {
_.forEach(nodes, node => {
_.forEach(nodes, (node) => {
node.post.author = deSig(node.post.author);
node.post.pending = true;
markPending(node.children || {});
@ -50,8 +50,8 @@ function markPending(nodes: any) {
export const createPost = (
contents: Content[],
parentIndex: string = '',
childIndex:string = 'DATE_PLACEHOLDER'
parentIndex = '',
childIndex = 'DATE_PLACEHOLDER'
) => {
if (childIndex === 'DATE_PLACEHOLDER') {
childIndex = unixToDa(Date.now()).toString();
@ -80,11 +80,10 @@ function moduleToMark(mod: string): string | undefined {
}
export default class GraphApi extends BaseApi<StoreState> {
joiningGraphs = new Set<string>();
private storeAction(action: any): Promise<any> {
return this.action('graph-store', 'graph-update', action)
return this.action('graph-store', 'graph-update', action);
}
private viewAction(threadName: string, action: any) {
@ -106,12 +105,12 @@ export default class GraphApi extends BaseApi<StoreState> {
const resource = makeResource(`~${window.ship}`, name);
return this.viewAction('graph-create', {
"create": {
'create': {
resource,
title,
description,
associated,
"module": mod,
'module': mod,
mark: moduleToMark(mod)
}
});
@ -127,12 +126,12 @@ export default class GraphApi extends BaseApi<StoreState> {
const resource = makeResource(`~${window.ship}`, name);
return this.viewAction('graph-create', {
"create": {
'create': {
resource,
title,
description,
associated: { policy },
"module": mod,
'module': mod,
mark: moduleToMark(mod)
}
});
@ -148,9 +147,9 @@ export default class GraphApi extends BaseApi<StoreState> {
return this.viewAction('graph-join', {
join: {
resource,
ship,
ship
}
}).then(res => {
}).then((res) => {
this.joiningGraphs.delete(rid);
return res;
});
@ -159,7 +158,7 @@ export default class GraphApi extends BaseApi<StoreState> {
deleteGraph(name: string) {
const resource = makeResource(`~${window.ship}`, name);
return this.viewAction('graph-delete', {
"delete": {
'delete': {
resource
}
});
@ -168,7 +167,7 @@ export default class GraphApi extends BaseApi<StoreState> {
leaveGraph(ship: Patp, name: string) {
const resource = makeResource(ship, name);
return this.viewAction('graph-leave', {
"leave": {
'leave': {
resource
}
});
@ -192,6 +191,7 @@ export default class GraphApi extends BaseApi<StoreState> {
});
}
addGraph(ship: Patp, name: string, graph: any, mark: any) {
return this.storeAction({
'add-graph': {
@ -203,7 +203,7 @@ export default class GraphApi extends BaseApi<StoreState> {
}
addPost(ship: Patp, name: string, post: Post) {
let nodes = {};
const nodes = {};
nodes[post.index] = {
post,
children: null
@ -212,7 +212,7 @@ export default class GraphApi extends BaseApi<StoreState> {
}
addNode(ship: Patp, name: string, node: Object) {
let nodes = {};
const nodes = {};
nodes[node.post.index] = node;
return this.addNodes(ship, name, nodes);
@ -226,12 +226,37 @@ export default class GraphApi extends BaseApi<StoreState> {
}
};
const promise = this.hookAction(ship, action);
const pendingPromise = this.spider(
'graph-update',
'graph-view-action',
'graph-add-nodes',
action
);
markPending(action['add-nodes'].nodes);
action['add-nodes'].resource.ship = action['add-nodes'].resource.ship.slice(1);
console.log(action);
this.store.handleEvent({ data: { 'graph-update': action } });
return promise;
action['add-nodes'].resource.ship =
action['add-nodes'].resource.ship.slice(1);
this.store.handleEvent({ data: {
'graph-update': action
} });
return pendingPromise;
/* TODO: stop lying to our users about pending states
return pendingPromise.then((pendingHashes) => {
for (let index in action['add-nodes'].nodes) {
action['add-nodes'].nodes[index].post.hash =
pendingHashes['pending-indices'][index] || null;
}
this.store.handleEvent({ data: {
'graph-update': {
'pending-indices': pendingHashes['pending-indices'],
...action
}
} });
});
*/
}
removeNodes(ship: Patp, name: string, indices: string[]) {
@ -300,7 +325,6 @@ export default class GraphApi extends BaseApi<StoreState> {
this.store.handleEvent({ data });
}
getGraphSubset(ship: string, resource: string, start: string, end: string) {
return this.scry<any>(
'graph-store',

View File

@ -1,14 +1,14 @@
import BaseApi from './base';
import { StoreState } from '../store/type';
import { Path, Patp, Enc } from '~/types/noun';
import { Path, Patp, Enc } from '@urbit/api';
import {
GroupAction,
GroupPolicy,
Resource,
Tag,
GroupPolicyDiff,
} from '~/types/group-update';
import {makeResource} from '../lib/group';
GroupPolicyDiff
} from '@urbit/api/groups';
import { makeResource } from '../lib/group';
export default class GroupsApi extends BaseApi<StoreState> {
remove(resource: Resource, ships: Patp[]) {
@ -38,7 +38,7 @@ export default class GroupsApi extends BaseApi<StoreState> {
join(ship: string, name: string) {
const resource = makeResource(ship, name);
return this.viewAction({ join: { resource, ship }});
return this.viewAction({ join: { resource, ship } });
}
create(name: string, policy: Enc<GroupPolicy>, title: string, description: string) {
@ -76,7 +76,6 @@ export default class GroupsApi extends BaseApi<StoreState> {
description
}
});
}
private proxyAction(action: GroupAction) {
@ -93,6 +92,5 @@ export default class GroupsApi extends BaseApi<StoreState> {
private viewAction(action: any) {
return this.action('group-view', 'group-view-action', action);
}
}

View File

@ -1,24 +1,23 @@
import BaseApi from "./base";
import { StoreState } from "../store/type";
import { dateToDa, decToUd } from "../lib/util";
import {NotifIndex, IndexedNotification, Association, GraphNotifDescription} from "~/types";
import BaseApi from './base';
import { StoreState } from '../store/type';
import { dateToDa, decToUd } from '../lib/util';
import { NotifIndex, IndexedNotification, Association, GraphNotifDescription } from '@urbit/api';
import { BigInteger } from 'big-integer';
import {getParentIndex} from "../lib/notification";
import { getParentIndex } from '../lib/notification';
export class HarkApi extends BaseApi<StoreState> {
private harkAction(action: any): Promise<any> {
return this.action("hark-store", "hark-action", action);
return this.action('hark-store', 'hark-action', action);
}
private graphHookAction(action: any) {
return this.action("hark-graph-hook", "hark-graph-hook-action", action);
return this.action('hark-graph-hook', 'hark-graph-hook-action', action);
}
private groupHookAction(action: any) {
return this.action("hark-group-hook", "hark-group-hook-action", action);
return this.action('hark-group-hook', 'hark-group-hook-action', action);
}
private actOnNotification(frond: string, intTime: BigInteger, index: NotifIndex) {
const time = decToUd(intTime.toString());
return this.harkAction({
@ -74,12 +73,10 @@ export class HarkApi extends BaseApi<StoreState> {
module: association.metadata.module,
description,
index: parent
} },
} }
});
}
markEachAsRead(association: Association, parent: string, child: string, description: GraphNotifDescription, mod: string) {
return this.harkAction({
'read-each': {
@ -116,7 +113,7 @@ export class HarkApi extends BaseApi<StoreState> {
mute(notif: IndexedNotification) {
if('graph' in notif.index && 'graph' in notif.notification.contents) {
const { index } = notif;
const parentIndex = getParentIndex(index.graph, notif.notification.contents.graph)
const parentIndex = getParentIndex(index.graph, notif.notification.contents.graph);
if(!parentIndex) {
return Promise.resolve();
}
@ -132,7 +129,7 @@ export class HarkApi extends BaseApi<StoreState> {
unmute(notif: IndexedNotification) {
if('graph' in notif.index && 'graph' in notif.notification.contents) {
const { index } = notif;
const parentIndex = getParentIndex(index.graph, notif.notification.contents.graph)
const parentIndex = getParentIndex(index.graph, notif.notification.contents.graph);
if(!parentIndex) {
return Promise.resolve();
}
@ -147,7 +144,7 @@ export class HarkApi extends BaseApi<StoreState> {
ignoreGroup(group: string) {
return this.groupHookAction({
ignore: group
})
});
}
ignoreGraph(graph: string, index: string) {
@ -156,13 +153,13 @@ export class HarkApi extends BaseApi<StoreState> {
graph,
index
}
})
});
}
listenGroup(group: string) {
return this.groupHookAction({
listen: group
})
});
}
listenGraph(graph: string, index: string) {
@ -171,7 +168,7 @@ export class HarkApi extends BaseApi<StoreState> {
graph,
index
}
})
});
}
async getMore(): Promise<boolean> {
@ -183,16 +180,16 @@ export class HarkApi extends BaseApi<StoreState> {
async getSubset(offset:number, count:number, isArchive: boolean) {
const where = isArchive ? 'archive' : 'inbox';
const data = await this.scry("hark-store", `/recent/${where}/${offset}/${count}`);
const data = await this.scry('hark-store', `/recent/${where}/${offset}/${count}`);
this.store.handleEvent({ data });
}
async getTimeSubset(start?: Date, end?: Date) {
const s = start ? dateToDa(start) : "-";
const e = end ? dateToDa(end) : "-";
const result = await this.scry("hark-hook", `/recent/${s}/${e}`);
const s = start ? dateToDa(start) : '-';
const e = end ? dateToDa(end) : '-';
const result = await this.scry('hark-hook', `/recent/${s}/${e}`);
this.store.handleEvent({
data: result,
data: result
});
}
}

View File

@ -1,6 +1,6 @@
import BaseApi from "./base";
import { StoreState } from "../store/type";
import { Serial, Path } from "~/types/noun";
import BaseApi from './base';
import { StoreState } from '../store/type';
import { Serial, Path } from '@urbit/api';
export default class InviteApi extends BaseApi<StoreState> {
accept(app: string, uid: Serial) {

View File

@ -2,7 +2,7 @@ import BaseApi from './base';
import { StoreState } from '../store/type';
export default class LaunchApi extends BaseApi<StoreState> {
add(name: string, tile = { basic : { title: '', linkedUrl: '', iconUrl: '' }}) {
add(name: string, tile = { basic : { title: '', linkedUrl: '', iconUrl: '' } }) {
return this.launchAction({ add: { name, tile } });
}
@ -15,7 +15,7 @@ export default class LaunchApi extends BaseApi<StoreState> {
}
changeIsShown(name: string, isShown = true) {
return this.launchAction({ 'change-is-shown': { name, isShown }});
return this.launchAction({ 'change-is-shown': { name, isShown } });
}
weather(location: string) {

Some files were not shown because too many files have changed in this diff Show More