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: on:
push: push:
branches: branches:
- 'master' - 'release/*'
jobs: jobs:
merge-to-next-js: merge-release-to-ops:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: "Merge master to release/next-js" name: "Merge to ops-tlon"
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: devmasx/merge-branch@v1.3.1 - uses: devmasx/merge-branch@v1.3.1
with: with:
type: now type: now
target_branch: release/next-js target_branch: ops-tlon
github_token: ${{ secrets.JANEWAY_BOT_TOKEN }} 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 version https://git-lfs.github.com/spec/v1
oid sha256:9433e0a7f1edbdcc6c8ac3e70c9516061d35218e5a1dc3192b2189dfb28cdc88 oid sha256:24e674adc2bc225cbf522da9ebbb6f1ca0364730392be4e59fbbd65b5028efa5
size 9539470 size 9283548

View File

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

View File

@ -593,10 +593,10 @@
%& (ship p.lane) %& (ship p.lane)
:: ::
%| %|
?~ l=((soft ,[=@tas =@if =@ud]) (cue p.lane)) %- tape
s+(scot %x p.lane) =/ ip=@if (end [0 32] p.lane)
=, u.l =/ pt=@ud (cut 0 [32 16] p.lane)
(tape "%{(trip tas)}, {(scow %if if)}, {(scow %ud ud)}") "{(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>)) =/ mime-type=@t (rsh 3 (crip <p.u.data>))
:: Should maybe inspect to see how long cache should hold :: 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 ++ lowercase

View File

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

View File

@ -63,31 +63,110 @@
=* mark i.t.wire =* mark i.t.wire
:_ this :_ this
(build-permissions mark i.t.t.wire %next)^~ (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 ++ on-fail on-fail:def
:: ++ transform-proxy-update
++ should-proxy-update |= vas=vase
|= =vase ^- (unit vase)
^- ? =/ =update:store !<(update:store vas)
=/ =update:store !<(update:store vase)
=* rid resource.q.update =* rid resource.q.update
=. p.update now.bowl
?- -.q.update ?- -.q.update
%add-graph %.n %add-nodes
%remove-graph %.n ?. (is-allowed-add:hc rid nodes.q.update)
%add-nodes (is-allowed-add:hc resource.q.update nodes.q.update) ~
%remove-nodes (is-allowed-remove:hc resource.q.update indices.q.update) =/ mark (get-mark:gra rid)
%add-signatures %.n ?~ mark `vas
%remove-signatures %.n |^
%archive-graph %.n =/ transform
%unarchive-graph %.n !< $-([index:store post:store atom ?] [index:store post:store])
%add-tag %.n %. !>(*indexed-post:store)
%remove-tag %.n .^(tube:clay (scry:hc %cc %home /[u.mark]/transform-add-nodes))
%keys %.n =/ [* result=(list [index:store node:store])]
%tags %.n %+ roll
%tag-queries %.n (flatten-node-map ~(tap by nodes.q.update))
%run-updates %.n (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 ++ resource-for-update resource-for-update:gra
:: ::
++ initial-watch ++ initial-watch
@ -111,7 +190,7 @@
|= =vase |= =vase
^- [(list card) agent] ^- [(list card) agent]
=/ =update:store !<(update:store vase) =/ =update:store !<(update:store vase)
?+ -.q.update [~ this] ?+ -.q.update [~ this]
%add-graph %add-graph
?~ mark.q.update `this ?~ mark.q.update `this
=* mark u.mark.q.update =* mark u.mark.q.update
@ -119,6 +198,7 @@
:_ this(marks (~(put in marks) mark)) :_ this(marks (~(put in marks) mark))
:~ (build-permissions:hc mark %add %sing) :~ (build-permissions:hc mark %add %sing)
(build-permissions:hc mark %remove %sing) (build-permissions:hc mark %remove %sing)
(build-transform-add:hc mark %sing)
== ==
:: ::
%remove-graph %remove-graph
@ -133,19 +213,14 @@
|_ =bowl:gall |_ =bowl:gall
+* grp ~(. group bowl) +* grp ~(. group bowl)
met ~(. mdl bowl) met ~(. mdl bowl)
gra ~(. graph bowl) gra ~(. graph bowl)
::
++ scry ++ scry
|= [care=@t desk=@t =path] |= [care=@t desk=@t =path]
%+ weld %+ weld
/[care]/(scot %p our.bowl)/[desk]/(scot %da now.bowl) /[care]/(scot %p our.bowl)/[desk]/(scot %da now.bowl)
path path
:: ::
++ scry-mark
|= =resource:res
.^ (unit mark)
(scry %gx %graph-store /graph-mark/(scot %p entity.resource)/[name.resource]/noun)
==
::
++ perm-mark-name ++ perm-mark-name
|= perm=@t |= perm=@t
^- @t ^- @t
@ -216,6 +291,8 @@
%- some %- some
%+ levy ~(tap by nodes) %+ levy ~(tap by nodes)
|= [=index:store =node:store] |= [=index:store =node:store]
?. =(author.post.node src.bowl)
%.n
=/ =permissions:store =/ =permissions:store
%^ add-mark resource vip %^ add-mark resource vip
(node-to-indexed-post node) (node-to-indexed-post node)
@ -262,5 +339,13 @@
=/ =mood:clay [%c da+now.bowl /[mark]/(perm-mark-name kind)] =/ =mood:clay [%c da+now.bowl /[mark]/(perm-mark-name kind)]
=/ =rave:clay ?:(?=(%sing mode) [mode mood] [mode mood]) =/ =rave:clay ?:(?=(%sing mode) [mode mood] [mode mood])
[%pass wire %arvo %c %warp our.bowl %home `rave] [%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 ?~ t.index
=* p post.node =* p post.node
?~ hash.p node(signatures.post *signatures:store)
=/ =validated-portion:store =/ =validated-portion:store
[parent-hash author.p time-sent.p contents.p] [parent-hash author.p time-sent.p contents.p]
=/ =hash:store `@ux`(sham validated-portion) =/ =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 of post does not match calculated hash"
?> =(hash u.hash.p) ?> =(hash u.hash.p)
~| "signatures do not match the calculated hash"
?> (are-signatures-valid:sigs our.bowl signatures.p hash now.bowl)
node node
:: recurse children :: recurse children
:: ::

View File

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

View File

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

View File

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

Binary file not shown.

View File

@ -24,6 +24,6 @@
<div id="portal-root"></div> <div id="portal-root"></div>
<script src="/~landscape/js/channel.js"></script> <script src="/~landscape/js/channel.js"></script>
<script src="/~landscape/js/session.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> </body>
</html> </html>

View File

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

View File

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

View File

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

View File

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

View File

@ -21,7 +21,7 @@
|^ :- %kiln-merge |^ :- %kiln-merge
^- $@(~ [syd=desk her=ship sud=desk cas=case gem=?(germ %auto)]) ^- $@(~ [syd=desk her=ship sud=desk cas=case gem=?(germ %auto)])
?- arg ?- 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]) =+(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]) =/ groups=(list [local=? resource:re members=@ud])
%+ murn %+ murn
%~ tap in %~ tap in
%~ key by (scry (set resource:re) %y %group-store /groups)
dir:(scry arch %y %group-store /groups) |= r=resource:re
|= i=@ta
=/ r=resource:re (de-path:re (stab i))
=/ g=(unit group:gr) =/ g=(unit group:gr)
%+ scry (unit group:gr) %+ scry (unit group:gr)
[%x %group-store [%groups (snoc (en-path:re r) %noun)]] [%x %group-store [%groups (snoc (en-path:re r) %noun)]]
@ -59,18 +57,28 @@
%~ tap by %~ tap by
%+ scry associations:md %+ scry associations:md
[%x %metadata-store [%group (snoc (en-path:re r) %noun)]] [%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 ::NOTE we only count graphs for now
?. &(=(%graph app-name.m) =(our creator)) ~ ?. &(=(%graph app-name.m) =(our creator.metadatum)) ~
`[module (de-path:re app-path.m)] `[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 :: count activity per channel
:: ::
=/ activity=(list [resource:re members=@ud (list [resource:re mod=term week=@ud authors=@ud])]) =/ activity=(list [resource:re members=@ud (list [resource:re mod=term week=@ud authors=@ud])])
%+ turn crowds %+ turn crowds
|= [g=resource:re m=@ud] |= [g=resource:re m=@ud]
:+ g m :+ g m
%+ turn (~(got by channels) g) %+ murn (~(got by channels) g)
|= [m=term r=resource:re] |= [m=term r=resource:re]
?. (~(has in real) r) ~
%- some
:+ r m :+ r m
::NOTE graph-store doesn't use the full resource-style path here! ::NOTE graph-store doesn't use the full resource-style path here!
=/ upd=update:ga =/ 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 /+ resource, group-store
^? ^?
=< [sur .] =< [sur .]
@ -17,6 +17,7 @@
leave+leave leave+leave
groupify+groupify groupify+groupify
eval+so eval+so
pending-indices+pending-indices
::invite+invite ::invite+invite
== ==
:: ::
@ -51,6 +52,9 @@
:~ resource+(un dejs:resource) :~ resource+(un dejs:resource)
to+(uf ~ (mu dejs:resource)) to+(uf ~ (mu dejs:resource))
== ==
::
++ pending-indices (op hex (su ;~(pfix fas (more fas dem))))
::
++ invite !! ++ invite !!
:: ::
++ associated ++ 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 resources.q.update
:: ::
++ tap-deep ++ tap-deep
|= =graph:store |= [=index:store =graph:store]
^- (list [index:store node:store]) ^- (list [index:store node:store])
=| =index:store %+ roll (tap:orm:store graph)
=/ nodes=(list [atom node:store]) |= $: [=atom =node:store]
(tap:orm:store graph) lis=(list [index:store node:store])
|- =* tap-nodes $ ==
^- (list [index:store node:store]) =/ child-index (snoc index atom)
%- zing =/ childless-node node(children [%empty ~])
%+ turn ?: ?=(%empty -.children.node)
nodes (snoc lis [child-index childless-node])
|= [=atom =node:store] %+ weld
^- (list [index:store node:store]) (snoc lis [child-index childless-node])
%+ welp (tap-deep child-index p.children.node)
^- (list [index:store node:store]) ::
[(snoc index atom) node]~ ++ got-deep
?. ?=(%graph -.children.node) |= [=graph:store =index:store]
~ ^- node:store
%_ tap-nodes =/ ind index
index (snoc index atom) ?> ?=(^ index)
nodes (tap:orm:store p.children.node) =/ =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 ++ get-mark

View File

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

View File

@ -5,75 +5,59 @@
++ pile-rule ++ pile-rule
|= pax=path |= pax=path
%- full %- full
%+ ifix [gay gay] %+ ifix
%+ cook |=(pile +<) :_ gay
;~ pfix
:: parse optional /? and ignore :: parse optional /? and ignore
:: ::
;~ pose ;~(plug gay (punt ;~(plug fas wut gap dem gap)))
(cold ~ ;~(plug fas wut gap dem gap)) |^
(easy ~) ;~ 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 %+ rune tar
;~ pose ;~ (glue gap)
;~ sfix sym
%+ cook |=((list (list taut)) (zing +<)) ;~(pfix cen sym)
%+ more gap ;~(pfix fas (more fas urs:ab))
;~ 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))
== ==
::
%+ 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 ++ taut-rule
%+ cook |=(taut +<) %+ cook |=(taut +<)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@
=, html =, html
|_ own=manx |_ own=manx
:: ::
++ grad %mime ++ grad %noun
++ grow :: convert to ++ grow :: convert to
|% |%
++ hymn ;html:(head body:"+{own}") :: convert to %hymn ++ 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 ++ notification-kind
?+ index.p.i ~ ?+ 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 ++ grab
|% |%

View File

@ -26,9 +26,22 @@
:: ::
++ notification-kind ++ notification-kind
?+ index.p.i ~ ?+ index.p.i ~
[@ ~] `[%link 0 %each %.y] [@ ~] `[%link [0 1] %each %children]
[@ @ %1 ~] `[%comment 1 %count %.n] [@ @ %1 ~] `[%comment [1 2] %count %siblings]
[@ @ @ ~] `[%edit-comment 1 %none %.n] [@ @ @ ~] `[%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 ++ grab

View File

@ -25,10 +25,31 @@
:: ::
++ notification-kind ++ notification-kind
?+ index.p.i ~ ?+ index.p.i ~
[@ %1 %1 ~] `[%note 0 %each %.n] [@ %1 %1 ~] `[%note [0 1] %each %children]
[@ %1 @ ~] `[%edit-note 0 %none %.n] [@ %1 @ ~] `[%edit-note [0 1] %none %none]
[@ %2 @ %1 ~] `[%comment 1 %count %.n] [@ %2 @ %1 ~] `[%comment [1 3] %count %siblings]
[@ %2 @ @ ~] `[%edit-comment 1 %none %.n] [@ %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 ++ grab

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,7 +15,7 @@
++ mime ++ mime
|= (pair mite octs) |= (pair mite octs)
=+ o=(pair ,* ,*) :: ,*) =+ 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 =/ convert
|= ova=(list o) |= ova=(list o)
^- (list unix-event) ^- (list unix-event)
@ -30,7 +30,7 @@
:: =/ boot-ova (convert boot-ova) :: =/ boot-ova (convert boot-ova)
=/ kernel-ova (convert kernel-ova) =/ kernel-ova (convert kernel-ova)
=/ userspace-ova (convert userspace-ova) =/ userspace-ova (convert userspace-ova)
[boot-ova kernel-ova userspace-ova] [%pill nam boot-ova kernel-ova userspace-ova]
-- --
++ grad %mime ++ grad %mime
-- --

View File

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

View File

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

View File

@ -6,7 +6,7 @@
=, html =, html
|_ own=manx |_ own=manx
:: ::
++ grad %mime ++ grad %noun
++ grow :: convert to ++ grow :: convert to
|% |%
++ hymn ;html:(head body:"+{own}") :: convert to %hymn ++ 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)] [%groupify rid=resource to=(unit resource)]
[%forward rid=resource =update:store] [%forward rid=resource =update:store]
[%eval =cord] [%eval =cord]
[%pending-indices pending=(map hash:store index:store)]
== ==
-- --

View File

@ -1,6 +1,17 @@
/- *resource, graph-store, post /- *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 +$ action
$% $%
[?(%listen %ignore) graph=resource =index:post] [?(%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) +$ settings (map key bucket)
+$ bucket (map key val) +$ bucket (map key val)
+$ key term +$ key term
+$ val +$ val
$~ [%n 0]
$% [%s p=@t] $% [%s p=@t]
[%b p=?] [%b p=?]
[%n p=@] [%n p=@]
[%a p=(list val)]
== ==
+$ event +$ event
$% [%put-bucket =key =bucket] $% [%put-bucket =key =bucket]

View File

@ -796,7 +796,7 @@
$: face=(unit term) $: face=(unit term)
file-path=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 +$ case :: ship desk case spur
$% [%da p=@da] :: date $% [%da p=@da] :: date
[%tas p=@tas] :: label [%tas p=@tas] :: label
@ -928,12 +928,16 @@
:: /- sur-file :: surface imports from /sur :: /- sur-file :: surface imports from /sur
:: /+ lib-file :: library imports from /lib :: /+ lib-file :: library imports from /lib
:: /= face /path :: imports built hoon file at path :: /= 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 :: /* face %mark /path :: unbuilt file imports, as mark
:: ::
+$ pile +$ pile
$: sur=(list taut) $: sur=(list taut)
lib=(list taut) lib=(list taut)
raw=(list [face=term =path]) raw=(list [face=term =path])
maz=(list [face=term =mark])
caz=(list [face=term =mars])
bar=(list [face=term =mark =path]) bar=(list [face=term =mark =path])
=hoon =hoon
== ==
@ -942,9 +946,25 @@
+$ taut [face=(unit term) pax=term] +$ taut [face=(unit term) pax=term]
:: $mars: mark conversion request :: $mars: mark conversion request
:: $tube: mark conversion gate :: $tube: mark conversion gate
:: $nave: typed mark core
:: ::
+$ mars [a=mark b=mark] +$ mars [a=mark b=mark]
+$ tube $-(vase vase) +$ 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: processed mark core
:: ::
+$ dais +$ dais
@ -959,7 +979,6 @@
*(unit vase) *(unit vase)
++ pact |~(diff=vase sam) ++ pact |~(diff=vase sam)
++ vale |~(noun sam) ++ vale |~(noun sam)
++ volt |~(noun sam)
-- --
:: ::
++ get-fit ++ get-fit

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,6 +6,9 @@
=/ m (strand ,vase) =/ m (strand ,vase)
^- form:m ^- form:m
=+ !<([~ pax=path] arg) =+ !<([~ pax=path] arg)
?^ bem=(de-beam pax) ?~ bem=(de-beam pax)
(build-file:strandio u.bem) (strand-fail:strand %path-not-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 /+ strandio, resource
=> =>
|% |%
@ -28,11 +29,11 @@
:: ::
++ scry-metadatum ++ scry-metadatum
|= rid=resource |= rid=resource
=/ m (strand ,metadata) =/ m (strand ,metadatum:met)
^- form:m ^- form:m
=/ enc-path=@t (scot %t (spat (en-path:resource rid))) =/ enc-path=@t (scot %t (spat (en-path:resource rid)))
;< umeta=(unit metadata) bind:m ;< umeta=(unit metadatum:met) bind:m
%+ scry:strandio (unit metadata) %+ scry:strandio (unit metadatum:met)
%+ weld /gx/metadata-store/metadata %+ weld /gx/metadata-store/metadata
/[enc-path]/graph/[enc-path]/noun /[enc-path]/graph/[enc-path]/noun
?> ?=(^ umeta) ?> ?=(^ umeta)
@ -48,24 +49,25 @@
;< =group bind:m (scry-group rid.action) ;< =group bind:m (scry-group rid.action)
?. hidden.group ?. hidden.group
(strand-fail:strandio %bad-request ~) (strand-fail:strandio %bad-request ~)
;< =metadata bind:m (scry-metadatum rid.action) ;< =metadatum:met bind:m (scry-metadatum rid.action)
?~ to.action ?~ to.action
;< ~ bind:m ;< ~ bind:m
%+ poke-our %contact-view %+ poke-our %contact-view
:- %contact-view-action :- %contact-view-action
!>([%groupify rid.action title.metadata description.metadata]) !>([%groupify rid.action title.metadatum description.metadatum])
(pure:m !>(~)) (pure:m !>(~))
;< new=^group bind:m (scry-group u.to.action) ;< new=^group bind:m (scry-group u.to.action)
?< hidden.new ?< 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 ;< ~ bind:m
%+ poke-our %metadata-store %+ 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 ;< ~ bind:m
(poke-our %group-store %group-update !>([%remove-group rid.action ~])) (poke-our %group-store %group-update !>([%remove-group rid.action ~]))
(pure:m !>(~)) (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 /+ strandio, resource, graph-view
=> =>
|% |%
@ -23,17 +23,22 @@
:: ::
:: Setup metadata :: Setup metadata
:: ::
=/ =metadata =/ =metadatum:met
%* . *metadata %* . *metadatum:met
title title title title
description description description description
date-created now.bowl date-created now.bowl
creator our.bowl creator our.bowl
module module 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 ;< ~ 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 !>(~)) (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)) ~ ?. =(%hoon (rear p)) ~
(some [[-.i.bez p] ~]) (some [[-.i.bez p] ~])
loop(bez t.bez, fiz (~(gas in fiz) foz)) 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) =/ xup=path (snip s.i.bez)
;< hov=? bind:m (check-for-file:strandio i.bez(s (snoc xup %hoon))) ;< hov=? bind:m (check-for-file:strandio i.bez(s (snoc xup %hoon)))
?. hov ?. hov
@ -107,16 +111,23 @@
=/ paz=(list path) =/ paz=(list path)
(tail !<([~ (list path)] arg)) (tail !<([~ (list path)] arg))
=/ bez=(list beam) =/ 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=(set [=beam test=(unit term)]) bind:m (find-test-files bez)
=> .(fiz (sort ~(tap in fiz) aor)) => .(fiz (sort ~(tap in fiz) aor))
=| test-arms=(map path (list test-arm)) =| test-arms=(map path (list test-arm))
=| build-ok=?
|- ^- form:m |- ^- form:m
=* gather-tests $ =* gather-tests $
?^ fiz ?^ fiz
~> %slog.0^leaf+"test: building {(spud s.beam.i.fiz)}" ;< cor=(unit vase) bind:m (build-file:strandio beam.i.fiz)
;< cor=vase bind:m (build-file:strandio beam.i.fiz) ?~ cor
=/ arms=(list test-arm) (get-test-arms 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 ?=(^ test.i.fiz)
|- ^+ arms |- ^+ arms
?~ arms ~|(no-test-arm+i.fiz !!) ?~ arms ~|(no-test-arm+i.fiz !!)
@ -127,7 +138,7 @@
gather-tests(fiz t.fiz) gather-tests(fiz t.fiz)
%- pure:m !> ^= ok %- pure:m !> ^= ok
%+ roll (resolve-test-paths test-arms) %+ roll (resolve-test-paths test-arms)
|= [[=path =test-func] ok=_`?`%&] |= [[=path =test-func] ok=_build-ok]
^+ ok ^+ ok
=/ res (run-test path test-func) =/ res (run-test path test-func)
%- (slog (flop tang.res)) %- (slog (flop tang.res))

View File

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

View File

@ -1,9 +1,15 @@
/+ *test /+ *test
/= clay-raw /sys/vane/clay /= clay-raw /sys/vane/clay
/* hello-gen %hoon /gen/hello/hoon /* gen-hello %hoon /gen/hello/hoon
/* strandio-lib %hoon /lib/strandio/hoon /* lib-cram %hoon /lib/cram/hoon
/* strand-lib %hoon /lib/strand/hoon /* lib-strandio %hoon /lib/strandio/hoon
/* spider-sur %hoon /sur/spider/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 =, format
@ -14,32 +20,48 @@
:: ::
|% |%
++ test-parse-pile ^- tang ++ test-parse-pile ^- tang
=/ src "."
%+ expect-eq %+ expect-eq
!> ^- pile:fusion !> ^- pile:fusion
:* ~ ~ ~ ~ :* ~ ~ ~ ~ ~ ~
tssg+[%dbug [/sur/foo/hoon [[1 1] [1 2]]] [%cnts ~[[%.y 1]] ~]]~ 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 ++ test-parse-multiline-faslus ^- tang
=/ src =/ src
""" """
:: :: :: ::
:::: /hoon/hood/app :: ::
:: :: ::
/? 310 :: zuse version /? 310 :: zuse version
::
/- *sole /- *sole
::
/+ sole :: libraries /+ 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 /+ hood-helm, hood-kiln, hood-drum, hood-write
:: :: :: ::
. .
""" """
%+ expect-eq %+ expect-eq
@ -52,34 +74,21 @@
[`%hood-drum %hood-drum] [`%hood-drum %hood-drum]
[`%hood-write %hood-write] [`%hood-write %hood-write]
== ==
raw=~ bar=~ raw=~ maz=~ caz=~ bar=~
hoon=tssg+[p:(need q:(tall:(vang & /app/hood/hoon) [17 1] "."))]~ 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 ++ test-cycle ^- tang
=/ source=@t =/ source=@t '/+ self\0a.'
'''
/+ 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=~
== == ==
%- expect-fail %- expect-fail
|. |.
=/ ford =/ ford
%: ford:fusion %: ford:fusion
bud bud
ankh *ankh:clay
deletes=~ deletes=~
changes=~ changes=(my [/lib/self/hoon &+hoon+source]~)
file-store=~ file-store=~
*ford-cache:fusion *ford-cache:fusion
== ==
@ -89,22 +98,122 @@
%- expect-fail %- expect-fail
|. (parse-pile:(ford):fusion /sur/foo/hoon "[") |. (parse-pile:(ford):fusion /sur/foo/hoon "[")
:: ::
++ test-hello-gen ^- tang ++ test-mar-mime ^- 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=~
== == ==
=/ ford =/ ford
%: ford:fusion %: ford:fusion
bud bud
ankh *ankh:clay
deletes=~ 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=~ file-store=~
*ford-cache:fusion *ford-cache:fusion
== ==
@ -116,37 +225,21 @@
:: ::
%+ expect-eq %+ expect-eq
!> (~(gas in *(set path)) /gen/hello/hoon ~) !> (~(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 ++ test-lib-strandio ^- 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=~
== == ==
=/ ford =/ ford
%: ford:fusion %: ford:fusion
bud bud
ankh *ankh:clay
deletes=~ deletes=~
changes=~ ^= changes
%- my
:~ [/lib/strand/hoon &+hoon+lib-strand]
[/lib/strandio/hoon &+hoon+lib-strandio]
[/sur/spider/hoon &+hoon+sur-spider]
==
file-store=~ file-store=~
*ford-cache:fusion *ford-cache:fusion
== ==
@ -161,7 +254,7 @@
/lib/strand/hoon /lib/strand/hoon
/sur/spider/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 :: |utilities: helper functions for testing

View File

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

View File

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

View File

@ -129,6 +129,30 @@
!> -.b !> -.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 ++ test-ordered-map-uni ^- tang
:: ::
=/ a=(tree [@ud @tas]) (gas:atom-map ~ (scag 4 test-items)) =/ 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 = { module.exports = {
"env": env, extends: "@urbit"
"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
}
]
};

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

@ -1,8 +1,7 @@
import BaseApi from './base'; import BaseApi from './base';
import { StoreState } from '../store/type'; import { StoreState } from '../store/type';
import { Patp, Path, Enc } from '~/types/noun'; import { Patp } from '@urbit/api';
import { Contact, ContactEdit } from '~/types/contact-update'; import { ContactEdit } from '@urbit/api/contacts';
import { GroupPolicy, Resource } from '~/types/group-update';
export default class ContactsApi extends BaseApi<StoreState> { export default class ContactsApi extends BaseApi<StoreState> {
add(ship: Patp, contact: any) { add(ship: Patp, contact: any) {
@ -31,7 +30,7 @@ export default class ContactsApi extends BaseApi<StoreState> {
ship, ship,
'edit-field': editField, 'edit-field': editField,
timestamp: Date.now() timestamp: Date.now()
}, }
}); });
} }
@ -62,7 +61,7 @@ export default class ContactsApi extends BaseApi<StoreState> {
return this.action( return this.action(
'contact-push-hook', 'contact-push-hook',
'contact-share', 'contact-share',
{ share: recipient }, { share: recipient }
); );
} }
@ -85,7 +84,7 @@ export default class ContactsApi extends BaseApi<StoreState> {
} }
private storeAction(action: any): Promise<any> { 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) { 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 BaseApi from './base';
import { StoreState } from '../store/type'; import { StoreState } from '../store/type';
import GlobalStore from '../store/store'; import GlobalStore from '../store/store';
@ -10,7 +10,8 @@ import GroupsApi from './groups';
import LaunchApi from './launch'; import LaunchApi from './launch';
import GraphApi from './graph'; import GraphApi from './graph';
import S3Api from './s3'; import S3Api from './s3';
import {HarkApi} from './hark'; import GcpApi from './gcp';
import { HarkApi } from './hark';
import SettingsApi from './settings'; import SettingsApi from './settings';
import TermApi from './term'; import TermApi from './term';
@ -21,6 +22,7 @@ export default class GlobalApi extends BaseApi<StoreState> {
contacts = new ContactsApi(this.ship, this.channel, this.store); contacts = new ContactsApi(this.ship, this.channel, this.store);
groups = new GroupsApi(this.ship, this.channel, this.store); groups = new GroupsApi(this.ship, this.channel, this.store);
launch = new LaunchApi(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); s3 = new S3Api(this.ship, this.channel, this.store);
graph = new GraphApi(this.ship, this.channel, this.store); graph = new GraphApi(this.ship, this.channel, this.store);
hark = new HarkApi(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 BaseApi from './base';
import { StoreState } from '../store/type'; import { StoreState } from '../store/type';
import { Patp, Path, PatpNoSig } from '~/types/noun'; import { Patp, Path } from '@urbit/api';
import _ from 'lodash'; import _ from 'lodash';
import {makeResource, resourceFromPath} from '../lib/group'; import { makeResource, resourceFromPath } from '../lib/group';
import {GroupPolicy, Enc, Post, NodeMap, Content, Resource} from '~/types'; import { GroupPolicy, Enc, Post, Content } from '@urbit/api';
import { numToUd, unixToDa, decToUd, deSig, resourceAsPath } from '~/logic/lib/util'; import { numToUd, unixToDa, decToUd, deSig, resourceAsPath } from '~/logic/lib/util';
export const createBlankNodeWithChildPost = ( export const createBlankNodeWithChildPost = (
parentIndex: string = '', parentIndex = '',
childIndex: string = '', childIndex = '',
contents: Content[] contents: Content[]
) => { ) => {
const date = unixToDa(Date.now()).toString(); const date = unixToDa(Date.now()).toString();
@ -37,11 +37,11 @@ export const createBlankNodeWithChildPost = (
signatures: [] signatures: []
}, },
children: childGraph children: childGraph
}; };
}; };
function markPending(nodes: any) { function markPending(nodes: any) {
_.forEach(nodes, node => { _.forEach(nodes, (node) => {
node.post.author = deSig(node.post.author); node.post.author = deSig(node.post.author);
node.post.pending = true; node.post.pending = true;
markPending(node.children || {}); markPending(node.children || {});
@ -50,8 +50,8 @@ function markPending(nodes: any) {
export const createPost = ( export const createPost = (
contents: Content[], contents: Content[],
parentIndex: string = '', parentIndex = '',
childIndex:string = 'DATE_PLACEHOLDER' childIndex = 'DATE_PLACEHOLDER'
) => { ) => {
if (childIndex === 'DATE_PLACEHOLDER') { if (childIndex === 'DATE_PLACEHOLDER') {
childIndex = unixToDa(Date.now()).toString(); childIndex = unixToDa(Date.now()).toString();
@ -80,11 +80,10 @@ function moduleToMark(mod: string): string | undefined {
} }
export default class GraphApi extends BaseApi<StoreState> { export default class GraphApi extends BaseApi<StoreState> {
joiningGraphs = new Set<string>(); joiningGraphs = new Set<string>();
private storeAction(action: any): Promise<any> { 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) { private viewAction(threadName: string, action: any) {
@ -106,12 +105,12 @@ export default class GraphApi extends BaseApi<StoreState> {
const resource = makeResource(`~${window.ship}`, name); const resource = makeResource(`~${window.ship}`, name);
return this.viewAction('graph-create', { return this.viewAction('graph-create', {
"create": { 'create': {
resource, resource,
title, title,
description, description,
associated, associated,
"module": mod, 'module': mod,
mark: moduleToMark(mod) mark: moduleToMark(mod)
} }
}); });
@ -127,12 +126,12 @@ export default class GraphApi extends BaseApi<StoreState> {
const resource = makeResource(`~${window.ship}`, name); const resource = makeResource(`~${window.ship}`, name);
return this.viewAction('graph-create', { return this.viewAction('graph-create', {
"create": { 'create': {
resource, resource,
title, title,
description, description,
associated: { policy }, associated: { policy },
"module": mod, 'module': mod,
mark: moduleToMark(mod) mark: moduleToMark(mod)
} }
}); });
@ -148,9 +147,9 @@ export default class GraphApi extends BaseApi<StoreState> {
return this.viewAction('graph-join', { return this.viewAction('graph-join', {
join: { join: {
resource, resource,
ship, ship
} }
}).then(res => { }).then((res) => {
this.joiningGraphs.delete(rid); this.joiningGraphs.delete(rid);
return res; return res;
}); });
@ -159,7 +158,7 @@ export default class GraphApi extends BaseApi<StoreState> {
deleteGraph(name: string) { deleteGraph(name: string) {
const resource = makeResource(`~${window.ship}`, name); const resource = makeResource(`~${window.ship}`, name);
return this.viewAction('graph-delete', { return this.viewAction('graph-delete', {
"delete": { 'delete': {
resource resource
} }
}); });
@ -168,7 +167,7 @@ export default class GraphApi extends BaseApi<StoreState> {
leaveGraph(ship: Patp, name: string) { leaveGraph(ship: Patp, name: string) {
const resource = makeResource(ship, name); const resource = makeResource(ship, name);
return this.viewAction('graph-leave', { return this.viewAction('graph-leave', {
"leave": { 'leave': {
resource resource
} }
}); });
@ -192,6 +191,7 @@ export default class GraphApi extends BaseApi<StoreState> {
}); });
} }
addGraph(ship: Patp, name: string, graph: any, mark: any) { addGraph(ship: Patp, name: string, graph: any, mark: any) {
return this.storeAction({ return this.storeAction({
'add-graph': { 'add-graph': {
@ -203,7 +203,7 @@ export default class GraphApi extends BaseApi<StoreState> {
} }
addPost(ship: Patp, name: string, post: Post) { addPost(ship: Patp, name: string, post: Post) {
let nodes = {}; const nodes = {};
nodes[post.index] = { nodes[post.index] = {
post, post,
children: null children: null
@ -212,7 +212,7 @@ export default class GraphApi extends BaseApi<StoreState> {
} }
addNode(ship: Patp, name: string, node: Object) { addNode(ship: Patp, name: string, node: Object) {
let nodes = {}; const nodes = {};
nodes[node.post.index] = node; nodes[node.post.index] = node;
return this.addNodes(ship, name, nodes); 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); markPending(action['add-nodes'].nodes);
action['add-nodes'].resource.ship = action['add-nodes'].resource.ship.slice(1); action['add-nodes'].resource.ship =
console.log(action); action['add-nodes'].resource.ship.slice(1);
this.store.handleEvent({ data: { 'graph-update': action } });
return promise; 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[]) { removeNodes(ship: Patp, name: string, indices: string[]) {
@ -300,7 +325,6 @@ export default class GraphApi extends BaseApi<StoreState> {
this.store.handleEvent({ data }); this.store.handleEvent({ data });
} }
getGraphSubset(ship: string, resource: string, start: string, end: string) { getGraphSubset(ship: string, resource: string, start: string, end: string) {
return this.scry<any>( return this.scry<any>(
'graph-store', 'graph-store',

View File

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

View File

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

View File

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

View File

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

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