mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-18 12:22:10 +03:00
wip
This commit is contained in:
parent
c72c187edd
commit
7205625abf
3
.husky/post-checkout
Executable file
3
.husky/post-checkout
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-checkout.\n"; exit 2; }
|
||||
git lfs post-checkout "$@"
|
3
.husky/post-commit
Executable file
3
.husky/post-commit
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-commit.\n"; exit 2; }
|
||||
git lfs post-commit "$@"
|
3
.husky/post-merge
Executable file
3
.husky/post-merge
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-merge.\n"; exit 2; }
|
||||
git lfs post-merge "$@"
|
3
.husky/pre-push
Executable file
3
.husky/pre-push
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push.\n"; exit 2; }
|
||||
git lfs pre-push "$@"
|
8
pkg/arvo/gen/hood/keen.hoon
Normal file
8
pkg/arvo/gen/hood/keen.hoon
Normal file
@ -0,0 +1,8 @@
|
||||
:- %say
|
||||
|= [^ [=ship pax=$@(~ [=path ~])] ~]
|
||||
=/ =path
|
||||
?~ pax /cz/(scot %p ship)/kids/1/sys
|
||||
?> ?=([@ *] path.pax)
|
||||
=, pax
|
||||
[i.path (scot %p ship) t.path]
|
||||
[%helm-pass %a %keen path]
|
@ -284,6 +284,53 @@
|
||||
[1 relayed=.?(origin)]
|
||||
==
|
||||
(mix header (lsh 5 body))
|
||||
::
|
||||
++ decode-request
|
||||
|= =hoot
|
||||
^- twit
|
||||
:- sig=(cut 3 [0 64] hoot)
|
||||
-:(decode-request-info (rsh 3^64 hoot))
|
||||
::
|
||||
++ decode-request-info
|
||||
|= =hoot
|
||||
^- [=peep =purr]
|
||||
=+ num=(cut 3 [0 4] hoot)
|
||||
=+ len=(cut 3 [4 2] hoot)
|
||||
=+ pat=(cut 3 [6 len] hoot)
|
||||
:- [(stab pat) num]
|
||||
:: if there is data remaining, it's the response
|
||||
(rsh [3 (add 6 len)] hoot)
|
||||
::
|
||||
++ decode-response-packet
|
||||
|= =purr
|
||||
=; =rawr
|
||||
~? !=(wid.rawr (met 3 dat.rawr)) [%fine %unexpected-dat-size]
|
||||
rawr
|
||||
:* sig=(cut 3 [0 64] purr)
|
||||
siz=(cut 3 [64 4] purr)
|
||||
wid=(cut 3 [68 2] purr)
|
||||
dat=(rsh 3^70 purr)
|
||||
==
|
||||
::
|
||||
++ verify-response-packet
|
||||
|= rawr
|
||||
!!
|
||||
::
|
||||
++ decode-response-msg
|
||||
|= partial-fine ::TODO maybe take @ instead
|
||||
^- roar
|
||||
=/ mess=@
|
||||
%+ rep 13
|
||||
%+ turn (gulf 1 num-fragments)
|
||||
|= num=@ud
|
||||
=/ frag=byts (~(got by fragments) num)
|
||||
dat.frag
|
||||
=+ sig=(end 3^64 mess)
|
||||
:- sig
|
||||
~| [%fine %response-not-cask]
|
||||
;;((cask) (cue (rsh 3^64 mess)))
|
||||
::
|
||||
|
||||
:: +decode-packet: deserialize packet from bytestream or crash
|
||||
::
|
||||
++ decode-packet
|
||||
@ -483,6 +530,7 @@
|
||||
:: 0b11: comet -- 16 bytes
|
||||
::
|
||||
+$ rank ?(%0b0 %0b1 %0b10 %0b11)
|
||||
+$ byuts [wid=@ud dat=@ux]
|
||||
::
|
||||
+| %kinetics
|
||||
:: $channel: combined sender and receiver identifying data
|
||||
@ -609,6 +657,26 @@
|
||||
part=(map path partial-fine)
|
||||
::TODO re-send request timers?
|
||||
==
|
||||
+$ twit :: signed request
|
||||
$: signature=@
|
||||
peep
|
||||
==
|
||||
::
|
||||
+$ peep :: request data
|
||||
$: =path
|
||||
num=@ud
|
||||
==
|
||||
::
|
||||
+$ rawr :: response packet ::TODO meow
|
||||
$: sig=@
|
||||
siz=@ud
|
||||
byts
|
||||
==
|
||||
::
|
||||
+$ roar :: response message
|
||||
$: sig=@
|
||||
dat=(cask)
|
||||
==
|
||||
:: $partial-fine: partial remote scry response
|
||||
::
|
||||
+$ partial-fine
|
||||
@ -1155,16 +1223,18 @@
|
||||
::
|
||||
=/ =path
|
||||
[i.t.t.tyl (scot %p our) t.t.t.tyl]
|
||||
=* pax t.t.tyl
|
||||
?~ nom=(de-omen path) ~
|
||||
:: we only support scrying into clay,
|
||||
:: and only if the data is fully public.
|
||||
::
|
||||
?. =(%c (end 3 (snag 0 path))) ~
|
||||
=+ pem=(rof lyc (need (de-omen %cp (slag 1 path))))
|
||||
?> ?=(^ pem)
|
||||
?> ?=(^ u.pem)
|
||||
=+ per=!<([r=dict:clay w=dict:clay] q.u.u.pem)
|
||||
?> =([%black ~ ~] rul.r.per)
|
||||
:: ?. =(%c (end 3 (snag 0 path))) ~
|
||||
:: =/ perm-omen (need (de-omen %cp (slag 1 path)))
|
||||
:: =+ pem=(rof lyc perm-omen)
|
||||
:: ?> ?=(^ pem)
|
||||
:: ?> ?=(^ u.pem)
|
||||
:: =+ per=!<([r=dict:clay w=dict:clay] q.u.u.pem)
|
||||
:: ?> =([%black ~ ~] rul.r.per)
|
||||
=+ res=(rof lyc u.nom)
|
||||
::TODO suggests we need to factor differently
|
||||
=+ ven=(per-event [now 0v0 rof] *duct ames-state)
|
||||
@ -2458,7 +2528,8 @@
|
||||
^+ event-core
|
||||
?^ dud
|
||||
::TODO handle
|
||||
~& [%fine %done-goofed u.dud]
|
||||
~& [%fine %done-goofed mote.u.dud]
|
||||
%- (slog tang.u.dud)
|
||||
event-core
|
||||
::NOTE we only send requests to ships we know,
|
||||
:: so we should only get responses from ships we know.
|
||||
@ -2473,6 +2544,7 @@
|
||||
(handle-response [from life.peer lane] peep rawr)
|
||||
--
|
||||
|%
|
||||
<<<<<<< HEAD
|
||||
+$ twit :: signed request
|
||||
$: signature=@
|
||||
peep
|
||||
@ -2508,7 +2580,7 @@
|
||||
^- byts
|
||||
?> (lth num (bex 32))
|
||||
=+ (spit path)
|
||||
:- :(add 32 16 wid)
|
||||
:- :(add 4 2 wid)
|
||||
%+ can 3
|
||||
:~ 4^num :: fragment number
|
||||
2^wid :: path size
|
||||
@ -2544,7 +2616,12 @@
|
||||
:: prepend a signature and split the data into 1024-byte fragments
|
||||
::
|
||||
=/ frag=(list @)
|
||||
<<<<<<< HEAD
|
||||
=/ sig=@ (full:keys path (fall data ~))
|
||||
=======
|
||||
::TODO should also sign the request path
|
||||
=/ sig=@ ::(full:keys path (fall data ~))
|
||||
(fil 5 16 0xdead.beef)
|
||||
?~ data [sig]~
|
||||
%+ rip 13 ::NOTE 1024 bytes
|
||||
(cat 3 sig (jam u.data)) ::TODO should include life
|
||||
@ -2565,7 +2642,8 @@
|
||||
wid^dat :: response data fragment
|
||||
==
|
||||
=/ sig=byts
|
||||
64^(sign:keys (can 3 req bod ~))
|
||||
64^(fil 5 16 0xcafe.face)
|
||||
:: 64^(fil (sign:keys (can 3 req bod ~))
|
||||
(can 3 req sig bod ~)
|
||||
::
|
||||
++ keys
|
||||
@ -2611,18 +2689,16 @@
|
||||
|= [who=ship lyf=life pax=path sig=@ dat=$@(~ (cask))]
|
||||
(veri who lyf sig (mess who lyf pax dat))
|
||||
--
|
||||
::
|
||||
:: TODO: should not crash,
|
||||
:: improve routing?
|
||||
++ get-lane
|
||||
|= =ship
|
||||
^- lane:ames
|
||||
=; lanes
|
||||
::TODO should we send to all lanes?
|
||||
?^ lanes i.lanes
|
||||
~&(%fine-lane-stub &+~zod) ::TODO
|
||||
!< (list lane:ames)
|
||||
=< q %- need %- need
|
||||
=/ =path /peers/(scot %p ship)/forward-lane
|
||||
=/ =peer-state
|
||||
(got-peer-state ship)
|
||||
lane:(need route.peer-state)
|
||||
::TODO get from state
|
||||
<<<<<<< HEAD
|
||||
(rof `[our ~ ~] [%ames %x] [our %$ da+now] path)
|
||||
::
|
||||
++ decode-request
|
||||
@ -2681,6 +2757,7 @@
|
||||
|= [[from=ship =life] =path sig=@ data=$@(~ (cask))]
|
||||
^+ event-core
|
||||
?> (meri:keys from life path sig data)
|
||||
~& got-response/path
|
||||
=. event-core
|
||||
%- emil
|
||||
%+ turn ~(tap in (~(get ju want.state) path))
|
||||
@ -2692,19 +2769,24 @@
|
||||
++ handle-response
|
||||
|= [[from=ship =life =lane:ames] =peep =rawr]
|
||||
^+ event-core
|
||||
?. (~(has by part.state) path.peep)
|
||||
?> ?=([@ *] path.peep)
|
||||
=/ =path [i.path.peep (scot %p from) t.path.peep]
|
||||
?: =(0 siz.rawr)
|
||||
?> =(~ dat.rawr)
|
||||
(process-response path.peep ~)
|
||||
?. (~(has by part.state) path)
|
||||
:: we did not initiate this request, or it's been cancelled
|
||||
::
|
||||
!!
|
||||
=/ partial=partial-fine
|
||||
(~(got by part.state) path.peep)
|
||||
(~(got by part.state) path)
|
||||
=. partial
|
||||
?: (~(has by fragments.partial) num.peep)
|
||||
partial
|
||||
=, partial
|
||||
:+ ~| [%fine %response-size-changed have=num-fragments new=siz.rawr]
|
||||
?> |(=(0 num-fragments) =(num-fragments siz.rawr))
|
||||
num-fragments
|
||||
siz.rawr
|
||||
+(num-received)
|
||||
?> (veri:keys from life [sig dat]:rawr)
|
||||
(~(put by fragments) num.peep [wid dat]:rawr)
|
||||
@ -2713,10 +2795,10 @@
|
||||
:: we have all the parts now, construct the full response
|
||||
::
|
||||
=/ =roar (decode-response-msg partial)
|
||||
(process-response [from life] path.peep [sig dat]:roar)
|
||||
(process-response [from life] path [sig dat]:roar)
|
||||
:: otherwise, store the part, and send out the next request
|
||||
::
|
||||
=. part.state (~(put by part.state) path.peep partial)
|
||||
=. part.state (~(put by part.state) path partial)
|
||||
=/ next-num=@ud
|
||||
=/ next=@ud +(num.peep)
|
||||
:: we should receive responses in order, but in case we don't...
|
||||
|
@ -89,6 +89,11 @@
|
||||
%+ snag index
|
||||
(skim moves is-move-send)
|
||||
::
|
||||
++ scry
|
||||
|= [vane=_nec car=term bem=beam]
|
||||
=/ vane-core (vane)
|
||||
(scry:vane-core ~ car bem)
|
||||
::
|
||||
++ call
|
||||
|= [vane=_nec =duct =task:ames]
|
||||
^- [moves=(list move:ames) _nec]
|
||||
@ -118,7 +123,7 @@
|
||||
content=0xdead.beef
|
||||
==
|
||||
::
|
||||
=/ encoded (encode-packet:ames packet)
|
||||
=/ encoded (encode-packet:ames & packet)
|
||||
=/ decoded (decode-packet:ames encoded)
|
||||
::
|
||||
%+ expect-eq
|
||||
@ -135,7 +140,7 @@
|
||||
content=0xdead.beef
|
||||
==
|
||||
::
|
||||
=/ encoded (encode-packet:ames packet)
|
||||
=/ encoded (encode-packet:ames & packet)
|
||||
=/ decoded (decode-packet:ames encoded)
|
||||
::
|
||||
%+ expect-eq
|
||||
@ -191,7 +196,7 @@
|
||||
rcvr-life=3
|
||||
==
|
||||
::
|
||||
=/ =blob:ames (encode-packet:ames packet)
|
||||
=/ =blob:ames (encode-packet:ames & packet)
|
||||
=^ moves1 bud (call bud ~[//unix] %hear lane-foo blob)
|
||||
=^ moves2 bud
|
||||
=/ =point:ames
|
||||
@ -236,7 +241,7 @@
|
||||
=/ packet
|
||||
~! ames
|
||||
(encode-open-packet:ames open-packet crypto-core.ames-state.comet)
|
||||
=/ blob (encode-packet:ames packet)
|
||||
=/ blob (encode-packet:ames & packet)
|
||||
::
|
||||
=^ moves0 bud (call bud ~[//unix] %hear lane-foo blob)
|
||||
::
|
||||
@ -255,7 +260,7 @@
|
||||
sndr-life=1
|
||||
rcvr-life=3
|
||||
==
|
||||
=/ blob (encode-packet:ames packet)
|
||||
=/ blob (encode-packet:ames & packet)
|
||||
=^ moves1 bud (call bud ~[//unix] %hear lane-foo blob)
|
||||
::
|
||||
;: weld
|
||||
@ -330,4 +335,56 @@
|
||||
%+ expect-eq
|
||||
!> [~[/g/talk] %give %done `error]
|
||||
!> (snag 1 `(list move:ames)`moves5)
|
||||
::
|
||||
++ test-fine-request
|
||||
^- tang
|
||||
=/ want=path /cz/~bud/kids/1/sys
|
||||
=/ net=path /cz/kids/1/sys
|
||||
=^ moves1 nec (call nec ~[/g/talk] %keen want)
|
||||
=/ req=hoot:ames
|
||||
%+ snag 0
|
||||
%+ murn ;;((list move:ames) moves1)
|
||||
|= =move:ames
|
||||
^- (unit hoot:ames)
|
||||
?. ?=(%give -.card.move) ~
|
||||
?. ?=(%send -.p.card.move) ~
|
||||
`;;(@uxhoot blob.p.card.move)
|
||||
=/ [is-ames=? =packet:ames] (decode-packet:ames `@ux`req)
|
||||
?> ?=(%| is-ames)
|
||||
=/ twit
|
||||
(decode-request:ames `@ux`content.packet)
|
||||
~& twit
|
||||
(expect-eq !>(1) !>(1))
|
||||
::
|
||||
++ test-fine-response
|
||||
^- tang
|
||||
=/ want=path /cz/~bud/kids/1/sys
|
||||
=/ net=path /cz/kids/1/sys
|
||||
=/ =beam [[~bud %$ da+now:bud] (welp /fine/message net)]
|
||||
=/ [=mark =vase] (need (need (scry bud %x beam)))
|
||||
=+ !<(=song:ames vase)
|
||||
=/ partial
|
||||
%- ~(gas by *(map @ud byts))
|
||||
^- (list [@ud byts])
|
||||
%- head
|
||||
%^ spin song 1
|
||||
|= [blob=@ux num=@ud]
|
||||
^- [[_num byts] _num]
|
||||
:_ +(num)
|
||||
=/ [is-ames=? =packet:ames] (decode-packet:ames `@ux`blob)
|
||||
?> ?=(%| is-ames)
|
||||
=/ [=peep:ames =purr:ames] (decode-request-info:ames `@ux`content.packet)
|
||||
=/ rawr (decode-response-packet:ames `@ux`purr)
|
||||
~& rawr-sig/`@ux`sig.rawr
|
||||
~& rawr-siz/`@ux`siz.rawr
|
||||
~& rawr-wid/`@ux`wid.rawr
|
||||
~& rawr-dat/`@ux`dat.rawr
|
||||
:- num
|
||||
[wid dat]:rawr
|
||||
=/ num-frag=@ud ~(wyt by partial)
|
||||
=/ =roar:ames
|
||||
(decode-response-msg:ames num-frag num-frag partial)
|
||||
~& roar
|
||||
~! .
|
||||
(expect-eq !>(1) !>(1))
|
||||
--
|
||||
|
2
pkg/npm/api/tmp/contacts/index.d.ts
vendored
Normal file
2
pkg/npm/api/tmp/contacts/index.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './types';
|
||||
export * from './lib';
|
3
pkg/npm/api/tmp/contacts/index.js
Normal file
3
pkg/npm/api/tmp/contacts/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
export * from './types';
|
||||
export * from './lib';
|
||||
//# sourceMappingURL=index.js.map
|
1
pkg/npm/api/tmp/contacts/index.js.map
Normal file
1
pkg/npm/api/tmp/contacts/index.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../contacts/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC"}
|
26
pkg/npm/api/tmp/contacts/lib.d.ts
vendored
Normal file
26
pkg/npm/api/tmp/contacts/lib.d.ts
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
import { Patp, Poke, Scry } from '../lib';
|
||||
import { Contact, ContactUpdateAdd, ContactUpdateEdit, ContactUpdateRemove, ContactEditField, ContactShare, ContactUpdate, ContactUpdateAllowShips, ContactUpdateAllowGroup, ContactUpdateSetPublic } from './types';
|
||||
export declare const CONTACT_UPDATE_VERSION = 0;
|
||||
declare const storeAction: <T extends ContactUpdate>(data: T, version?: number) => Poke<T>;
|
||||
export { storeAction as contactStoreAction };
|
||||
export declare const addContact: (ship: Patp, contact: Contact) => Poke<ContactUpdateAdd>;
|
||||
export declare const removeContact: (ship: Patp) => Poke<ContactUpdateRemove>;
|
||||
export declare const share: (recipient: Patp, version?: number) => Poke<ContactShare>;
|
||||
export declare const editContact: (ship: Patp, editField: ContactEditField) => Poke<ContactUpdateEdit>;
|
||||
export declare const allowShips: (ships: Patp[]) => Poke<ContactUpdateAllowShips>;
|
||||
export declare const allowGroup: (ship: string, name: string) => Poke<ContactUpdateAllowGroup>;
|
||||
export declare const setPublic: (setPublic: any) => Poke<ContactUpdateSetPublic>;
|
||||
export declare const retrieve: (ship: string) => {
|
||||
app: string;
|
||||
mark: string;
|
||||
json: {
|
||||
add: {
|
||||
resource: {
|
||||
ship: string;
|
||||
name: string;
|
||||
};
|
||||
ship: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
export declare const fetchIsAllowed: (entity: string, name: string, ship: string, personal: boolean) => Scry;
|
64
pkg/npm/api/tmp/contacts/lib.js
Normal file
64
pkg/npm/api/tmp/contacts/lib.js
Normal file
@ -0,0 +1,64 @@
|
||||
export const CONTACT_UPDATE_VERSION = 0;
|
||||
const storeAction = (data, version = CONTACT_UPDATE_VERSION) => ({
|
||||
app: 'contact-store',
|
||||
mark: `contact-update-${version}`,
|
||||
json: data
|
||||
});
|
||||
export { storeAction as contactStoreAction };
|
||||
export const addContact = (ship, contact) => {
|
||||
contact['last-updated'] = Date.now();
|
||||
return storeAction({
|
||||
add: { ship, contact }
|
||||
});
|
||||
};
|
||||
export const removeContact = (ship) => storeAction({
|
||||
remove: { ship }
|
||||
});
|
||||
export const share = (recipient, version = CONTACT_UPDATE_VERSION) => ({
|
||||
app: 'contact-push-hook',
|
||||
mark: 'contact-share',
|
||||
json: { share: recipient }
|
||||
});
|
||||
export const editContact = (ship, editField) => storeAction({
|
||||
edit: {
|
||||
ship,
|
||||
'edit-field': editField,
|
||||
timestamp: Date.now()
|
||||
}
|
||||
});
|
||||
export const allowShips = (ships) => storeAction({
|
||||
allow: {
|
||||
ships
|
||||
}
|
||||
});
|
||||
export const allowGroup = (ship, name) => storeAction({
|
||||
allow: {
|
||||
group: { ship, name }
|
||||
}
|
||||
});
|
||||
export const setPublic = (setPublic) => {
|
||||
return storeAction({
|
||||
'set-public': setPublic
|
||||
});
|
||||
};
|
||||
export const retrieve = (ship) => {
|
||||
const resource = { ship, name: '' };
|
||||
return {
|
||||
app: 'contact-pull-hook',
|
||||
mark: 'pull-hook-action',
|
||||
json: {
|
||||
add: {
|
||||
resource,
|
||||
ship
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
export const fetchIsAllowed = (entity, name, ship, personal) => {
|
||||
const isPersonal = personal ? 'true' : 'false';
|
||||
return {
|
||||
app: 'contact-store',
|
||||
path: `/is-allowed/${entity}/${name}/${ship}/${isPersonal}`
|
||||
};
|
||||
};
|
||||
//# sourceMappingURL=lib.js.map
|
1
pkg/npm/api/tmp/contacts/lib.js.map
Normal file
1
pkg/npm/api/tmp/contacts/lib.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../contacts/lib.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC,MAAM,WAAW,GAAG,CAA0B,IAAO,EAAE,UAAkB,sBAAsB,EAAW,EAAE,CAAC,CAAC;IAC5G,GAAG,EAAE,eAAe;IACpB,IAAI,EAAE,kBAAkB,OAAO,EAAE;IACjC,IAAI,EAAE,IAAI;CACX,CAAC,CAAC;AAEH,OAAO,EAAE,WAAW,IAAI,kBAAkB,EAAE,CAAC;AAE7C,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAU,EAAE,OAAgB,EAA0B,EAAE;IACjF,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAErC,OAAO,WAAW,CAAC;QACjB,GAAG,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;KACvB,CAAC,CAAC;A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AAE;YACJ,GAAG,EAAE;gBACH,QAAQ;gBACR,IAAI;aACL;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,MAAc,EACd,IAAY,EACZ,IAAY,EACZ,QAAiB,EACX,EAAE;IACR,MAAM,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAC/C,OAAO;QACL,GAAG,EAAE,eAAe;QACpB,IAAI,EAAE,eAAe,MAAM,IAAI,IAAI,IAAI,IAAI,IAAI,UAAU,EAAE;KAC5D,CAAC;AACJ,CAAC,CAAC"}
|
61
pkg/npm/api/tmp/contacts/types.d.ts
vendored
Normal file
61
pkg/npm/api/tmp/contacts/types.d.ts
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
import { Path, Patp } from '../lib';
|
||||
import { Resource } from '../groups';
|
||||
export declare type ContactUpdate = ContactUpdateAdd | ContactUpdateRemove | ContactUpdateEdit | ContactUpdateInitial | ContactUpdateAllowGroup | ContactUpdateAllowShips | ContactUpdateSetPublic;
|
||||
export interface ContactUpdateAdd {
|
||||
add: {
|
||||
ship: Patp;
|
||||
contact: Contact;
|
||||
};
|
||||
}
|
||||
export interface ContactUpdateRemove {
|
||||
remove: {
|
||||
ship: Patp;
|
||||
};
|
||||
}
|
||||
export interface ContactUpdateEdit {
|
||||
edit: {
|
||||
ship: Patp;
|
||||
'edit-field': ContactEditField;
|
||||
timestamp: number;
|
||||
};
|
||||
}
|
||||
export interface ContactUpdateAllowShips {
|
||||
allow: {
|
||||
ships: Patp[];
|
||||
};
|
||||
}
|
||||
export interface ContactUpdateAllowGroup {
|
||||
allow: {
|
||||
group: Resource;
|
||||
};
|
||||
}
|
||||
export interface ContactUpdateSetPublic {
|
||||
'set-public': boolean;
|
||||
}
|
||||
export interface ContactShare {
|
||||
share: Patp;
|
||||
}
|
||||
export interface ContactUpdateInitial {
|
||||
initial: Rolodex;
|
||||
}
|
||||
export declare type Rolodex = {
|
||||
[p in Patp]: Contact;
|
||||
};
|
||||
export declare type Contacts = Rolodex;
|
||||
export interface Contact {
|
||||
nickname: string;
|
||||
bio: string;
|
||||
status: string;
|
||||
color: string;
|
||||
avatar: string | null;
|
||||
cover: string | null;
|
||||
groups: Path[];
|
||||
'last-updated': number;
|
||||
}
|
||||
declare type ContactKeys = keyof Contact;
|
||||
export declare type ContactEditFieldPrim = Exclude<ContactKeys, 'groups' | 'last-updated'>;
|
||||
export declare type ContactEditField = Partial<Pick<Contact, ContactEditFieldPrim>> & {
|
||||
'add-group'?: Resource;
|
||||
'remove-group'?: Resource;
|
||||
};
|
||||
export {};
|
2
pkg/npm/api/tmp/contacts/types.js
Normal file
2
pkg/npm/api/tmp/contacts/types.js
Normal file
@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=types.js.map
|
1
pkg/npm/api/tmp/contacts/types.js.map
Normal file
1
pkg/npm/api/tmp/contacts/types.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../contacts/types.ts"],"names":[],"mappings":""}
|
2
pkg/npm/api/tmp/docket/index.d.ts
vendored
Normal file
2
pkg/npm/api/tmp/docket/index.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './lib';
|
||||
export * from './types';
|
3
pkg/npm/api/tmp/docket/index.js
Normal file
3
pkg/npm/api/tmp/docket/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
export * from './lib';
|
||||
export * from './types';
|
||||
//# sourceMappingURL=index.js.map
|
1
pkg/npm/api/tmp/docket/index.js.map
Normal file
1
pkg/npm/api/tmp/docket/index.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../docket/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC"}
|
15
pkg/npm/api/tmp/docket/lib.d.ts
vendored
Normal file
15
pkg/npm/api/tmp/docket/lib.d.ts
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
import { Poke, Scry } from '../lib';
|
||||
import { Chad } from './types';
|
||||
export declare function chadIsRunning(chad: Chad): boolean;
|
||||
export declare const scryCharges: Scry;
|
||||
export declare const scryDockets: Scry;
|
||||
export declare const scryTreaties: Scry;
|
||||
export declare const scryDefaultAlly: Scry;
|
||||
export declare const scryAllies: Scry;
|
||||
export declare const scryAllyTreaties: (ship: string) => Scry;
|
||||
/**
|
||||
* Uninstall a desk, and remove docket
|
||||
*/
|
||||
export declare function docketUninstall(desk: string): Poke<string>;
|
||||
export declare function docketInstall(ship: string, desk: string): Poke<any>;
|
||||
export declare function allyShip(ship: string): Poke<any>;
|
54
pkg/npm/api/tmp/docket/lib.js
Normal file
54
pkg/npm/api/tmp/docket/lib.js
Normal file
@ -0,0 +1,54 @@
|
||||
export function chadIsRunning(chad) {
|
||||
return 'glob' in chad || 'site' in chad;
|
||||
}
|
||||
export const scryCharges = {
|
||||
app: 'docket',
|
||||
path: '/charges'
|
||||
};
|
||||
export const scryDockets = {
|
||||
app: 'docket',
|
||||
path: '/dockets'
|
||||
};
|
||||
export const scryTreaties = {
|
||||
app: 'treaty',
|
||||
path: '/treaties'
|
||||
};
|
||||
export const scryDefaultAlly = {
|
||||
app: 'treaty',
|
||||
path: '/default-ally'
|
||||
};
|
||||
export const scryAllies = {
|
||||
app: 'treaty',
|
||||
path: '/allies'
|
||||
};
|
||||
export const scryAllyTreaties = (ship) => ({
|
||||
app: 'treaty',
|
||||
path: `/treaties/${ship}`
|
||||
});
|
||||
/**
|
||||
* Uninstall a desk, and remove docket
|
||||
*/
|
||||
export function docketUninstall(desk) {
|
||||
return {
|
||||
app: 'docket',
|
||||
mark: 'docket-uninstall',
|
||||
json: desk
|
||||
};
|
||||
}
|
||||
export function docketInstall(ship, desk) {
|
||||
return {
|
||||
app: 'docket',
|
||||
mark: 'docket-install',
|
||||
json: `${ship}/${desk}`
|
||||
};
|
||||
}
|
||||
export function allyShip(ship) {
|
||||
return {
|
||||
app: 'treaty',
|
||||
mark: 'ally-update-0',
|
||||
json: {
|
||||
add: ship
|
||||
}
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=lib.js.map
|
1
pkg/npm/api/tmp/docket/lib.js.map
Normal file
1
pkg/npm/api/tmp/docket/lib.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../docket/lib.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,aAAa,CAAC,IAAU;IACtC,OAAO,MAAM,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,CAAC;AAC1C,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAS;IAC/B,GAAG,EAAE,QAAQ;IACb,IAAI,EAAE,UAAU;CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAS;IAC/B,GAAG,EAAE,QAAQ;IACb,IAAI,EAAE,UAAU;CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAS;IAChC,GAAG,EAAE,QAAQ;IACb,IAAI,EAAE,WAAW;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAS;IACnC,GAAG,EAAE,QAAQ;IACb,IAAI,EAAE,eAAe;CACtB,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAS;IAC9B,GAAG,EAAE,QAAQ;IACb,IAAI,EAAE,SAAS;CAChB,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAQ,EAAE,CAAC,CAAC;IACvD,GAAG,EAAE,QAAQ;IACb,IAAI,EAAE,aAAa,IAAI,EAAE;CAC1B,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO;QACL,GAAG,EAAE,QAAQ;QACb,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,IAAI;KACX,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,IAAY;IACtD,OAAO;QACL,GAAG,EAAE,QAAQ;QACb,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,GAAG,IAAI,IAAI,IAAI,EAAE;KACxB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,OAAO;QACL,GAAG,EAAE,QAAQ;QACb,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE;YACJ,GAAG,EAAE,IAAI;SACV;KACF,CAAC;AACJ,CAAC"}
|
106
pkg/npm/api/tmp/docket/types.d.ts
vendored
Normal file
106
pkg/npm/api/tmp/docket/types.d.ts
vendored
Normal file
@ -0,0 +1,106 @@
|
||||
import { Cass } from '../hood';
|
||||
export declare type DeskStatus = 'active' | 'suspended';
|
||||
export declare type DocketHref = DocketHrefSite | DocketHrefGlob;
|
||||
export interface DocketHrefGlob {
|
||||
glob: {
|
||||
base: string;
|
||||
};
|
||||
}
|
||||
export interface DocketHrefSite {
|
||||
site: string;
|
||||
}
|
||||
export interface Docket {
|
||||
title: string;
|
||||
info?: string;
|
||||
color: string;
|
||||
href: DocketHref;
|
||||
website: string;
|
||||
license: string;
|
||||
version: string;
|
||||
image?: string;
|
||||
}
|
||||
export interface Charge extends Docket {
|
||||
chad: Chad;
|
||||
}
|
||||
export declare type Chad = HungChad | GlobChad | SiteChad | InstallChad | SuspendChad;
|
||||
export interface HungChad {
|
||||
hung: string;
|
||||
}
|
||||
export interface GlobChad {
|
||||
glob: null;
|
||||
}
|
||||
export interface SiteChad {
|
||||
site: null;
|
||||
}
|
||||
export interface InstallChad {
|
||||
install: null;
|
||||
}
|
||||
export interface SuspendChad {
|
||||
suspend: null;
|
||||
}
|
||||
export interface Treaty extends Docket {
|
||||
ship: string;
|
||||
desk: string;
|
||||
cass: Cass;
|
||||
hash: string;
|
||||
}
|
||||
export interface Charges {
|
||||
[desk: string]: Charge;
|
||||
}
|
||||
export interface Treaties {
|
||||
[ref: string]: Treaty;
|
||||
}
|
||||
export declare type Charter = string[];
|
||||
export interface Allies {
|
||||
[ship: string]: Charter;
|
||||
}
|
||||
export interface Provider {
|
||||
shipName: string;
|
||||
nickname?: string;
|
||||
status?: string;
|
||||
}
|
||||
export declare type ChargeUpdate = ChargeUpdateInitial | ChargeUpdateAdd | ChargeUpdateDel;
|
||||
export interface ChargeUpdateInitial {
|
||||
initial: {
|
||||
[desk: string]: Charge;
|
||||
};
|
||||
}
|
||||
export interface ChargeUpdateAdd {
|
||||
'add-charge': {
|
||||
desk: string;
|
||||
charge: Charge;
|
||||
};
|
||||
}
|
||||
export interface ChargeUpdateDel {
|
||||
'del-charge': string;
|
||||
}
|
||||
export declare type AllyUpdate = AllyUpdateIni | AllyUpdateAdd | AllyUpdateDel | AllyUpdateNew;
|
||||
export interface AllyUpdateIni {
|
||||
ini: {
|
||||
[ship: string]: string[];
|
||||
};
|
||||
}
|
||||
export interface AllyUpdateAdd {
|
||||
add: string;
|
||||
}
|
||||
export interface AllyUpdateDel {
|
||||
del: string;
|
||||
}
|
||||
export interface AllyUpdateNew {
|
||||
new: {
|
||||
ship: string;
|
||||
alliance: string[];
|
||||
};
|
||||
}
|
||||
export declare type TreatyUpdate = TreatyUpdateIni | TreatyUpdateAdd | TreatyUpdateDel;
|
||||
export interface TreatyUpdateIni {
|
||||
ini: {
|
||||
[foreignDesk: string]: Treaty;
|
||||
};
|
||||
}
|
||||
export interface TreatyUpdateAdd {
|
||||
add: Treaty;
|
||||
}
|
||||
export interface TreatyUpdateDel {
|
||||
del: string;
|
||||
}
|
2
pkg/npm/api/tmp/docket/types.js
Normal file
2
pkg/npm/api/tmp/docket/types.js
Normal file
@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=types.js.map
|
1
pkg/npm/api/tmp/docket/types.js.map
Normal file
1
pkg/npm/api/tmp/docket/types.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../docket/types.ts"],"names":[],"mappings":""}
|
2
pkg/npm/api/tmp/graph/index.d.ts
vendored
Normal file
2
pkg/npm/api/tmp/graph/index.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './lib';
|
||||
export * from './types';
|
3
pkg/npm/api/tmp/graph/index.js
Normal file
3
pkg/npm/api/tmp/graph/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
export * from './lib';
|
||||
export * from './types';
|
||||
//# sourceMappingURL=index.js.map
|
1
pkg/npm/api/tmp/graph/index.js.map
Normal file
1
pkg/npm/api/tmp/graph/index.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../graph/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC"}
|
148
pkg/npm/api/tmp/graph/lib.d.ts
vendored
Normal file
148
pkg/npm/api/tmp/graph/lib.d.ts
vendored
Normal file
@ -0,0 +1,148 @@
|
||||
import { GroupPolicy, Resource } from '../groups';
|
||||
import { Scry } from '../lib';
|
||||
import { Enc, Path, Patp, PatpNoSig, Poke, Thread } from '../lib/types';
|
||||
import { Content, GraphNodePoke, Post } from './types';
|
||||
export declare const GRAPH_UPDATE_VERSION = 3;
|
||||
export declare const createBlankNodeWithChildPost: (ship: PatpNoSig, parentIndex: string, childIndex: string, contents: Content[]) => GraphNodePoke;
|
||||
export declare const markPending: (nodes: any) => any;
|
||||
export declare const createPost: (ship: PatpNoSig, contents: Content[], parentIndex?: string, childIndex?: string) => Post;
|
||||
declare const storeAction: <T>(data: T, version?: number) => Poke<T>;
|
||||
export { storeAction as graphStoreAction };
|
||||
declare const viewAction: <T>(threadName: string, action: T) => Thread<T>;
|
||||
export { viewAction as graphViewAction };
|
||||
declare const hookAction: <T>(data: T, version?: number) => Poke<T>;
|
||||
export { hookAction as graphHookAction };
|
||||
export declare const createManagedGraph: (ship: PatpNoSig, name: string, title: string, description: string, group: Path, mod: string) => Thread<any>;
|
||||
export declare const createUnmanagedGraph: (ship: PatpNoSig, name: string, title: string, description: string, policy: Enc<GroupPolicy>, mod: string) => Thread<any>;
|
||||
export declare const joinGraph: (ship: Patp, name: string) => Thread<any>;
|
||||
export declare const deleteGraph: (ship: PatpNoSig, name: string) => Thread<any>;
|
||||
export declare const leaveGraph: (ship: Patp, name: string) => Thread<any>;
|
||||
export declare const groupifyGraph: (ship: Patp, name: string, toPath?: string) => Thread<any>;
|
||||
export declare const evalCord: (cord: string) => Thread<any>;
|
||||
export declare const addGraph: (ship: Patp, name: string, graph: any, mark: any) => Poke<any>;
|
||||
export declare const addNodes: (ship: Patp, name: string, nodes: Object) => Thread<any>;
|
||||
export declare const addPost: (ship: Patp, name: string, post: Post) => Thread<any>;
|
||||
export declare const addNode: (ship: Patp, name: string, node: GraphNodePoke) => Thread<any>;
|
||||
export declare const createGroupFeed: (group: Resource, vip?: any) => Thread<any>;
|
||||
export declare const disableGroupFeed: (group: Resource) => Thread<any>;
|
||||
/**
|
||||
* Set dm-hook to screen new DMs or not
|
||||
*
|
||||
*/
|
||||
export declare const setScreen: (screen: boolean) => Poke<any>;
|
||||
/**
|
||||
* Accept a pending DM request
|
||||
*
|
||||
* @param ship the ship to accept
|
||||
*/
|
||||
export declare const acceptDm: (ship: string) => Poke<{
|
||||
accept: string;
|
||||
}>;
|
||||
/**
|
||||
* Decline a pending DM request
|
||||
*
|
||||
* @param ship the ship to accept
|
||||
*/
|
||||
export declare const declineDm: (ship: string) => Poke<{
|
||||
decline: string;
|
||||
}>;
|
||||
/**
|
||||
* Remove posts from a set of indices
|
||||
*
|
||||
*/
|
||||
export declare const removePosts: (ship: Patp, name: string, indices: string[]) => Poke<any>;
|
||||
/**
|
||||
* Remove a DM message from our inbox
|
||||
*
|
||||
* @remarks
|
||||
* This does not remove the message from the recipients inbox
|
||||
*/
|
||||
export declare const removeDmMessage: (our: Patp, index: string) => Poke<any>;
|
||||
/**
|
||||
* Send a DM to a ship
|
||||
*
|
||||
* @param our sender
|
||||
* @param ship recipient
|
||||
* @param contents contents of message
|
||||
*/
|
||||
export declare const addDmMessage: (our: PatpNoSig, ship: Patp, contents: Content[]) => Poke<any>;
|
||||
/**
|
||||
* Fetch newest (larger keys) nodes in a graph under some index
|
||||
*
|
||||
* @param ship ship of graph
|
||||
* @param name name of graph
|
||||
* @param count number of nodes to load
|
||||
* @param index index to query
|
||||
*/
|
||||
export declare const getNewest: (ship: string, name: string, count: number, index?: string) => Scry;
|
||||
/**
|
||||
* Fetch nodes in a graph that are older (key is smaller) and direct
|
||||
* siblings of some index
|
||||
*
|
||||
* @param ship ship of graph
|
||||
* @param name name of graph
|
||||
* @param count number of nodes to load
|
||||
* @param index index to query
|
||||
*/
|
||||
export declare const getOlderSiblings: (ship: string, name: string, count: number, index: string) => Scry;
|
||||
/**
|
||||
* Fetch nodes in a graph that are younger (key is larger) and direct
|
||||
* siblings of some index
|
||||
*
|
||||
* @param ship ship of graph
|
||||
* @param name name of graph
|
||||
* @param count number of nodes to load
|
||||
* @param index index to query
|
||||
*/
|
||||
export declare const getYoungerSiblings: (ship: string, name: string, count: number, index: string) => Scry;
|
||||
/**
|
||||
* Fetch all nodes in a graph under some index, without loading children
|
||||
*
|
||||
* @param ship ship of graph
|
||||
* @param name name of graph
|
||||
* @param index index to query
|
||||
*/
|
||||
export declare const getShallowChildren: (ship: string, name: string, index?: string) => {
|
||||
app: string;
|
||||
path: string;
|
||||
};
|
||||
/**
|
||||
* Fetch newest nodes in a graph as a flat map, including children,
|
||||
* optionally starting at a specified key
|
||||
*
|
||||
* @param ship ship of graph
|
||||
* @param name name of graph
|
||||
* @param count number of nodes to load
|
||||
* @param start key to start at
|
||||
*
|
||||
*/
|
||||
export declare const getDeepOlderThan: (ship: string, name: string, count: number, start?: string) => {
|
||||
app: string;
|
||||
path: string;
|
||||
};
|
||||
/**
|
||||
* Fetch a flat map of a nodes ancestors and firstborn children
|
||||
*
|
||||
* @param ship ship of graph
|
||||
* @param name name of graph
|
||||
* @param index index to query
|
||||
*
|
||||
*/
|
||||
export declare const getFirstborn: (ship: string, name: string, index: string) => Scry;
|
||||
/**
|
||||
* Fetch a single node, and all it's children
|
||||
*
|
||||
* @param ship ship of graph
|
||||
* @param name name of graph
|
||||
* @param index index to query
|
||||
*
|
||||
*/
|
||||
export declare const getNode: (ship: string, name: string, index: string) => Scry;
|
||||
/**
|
||||
* Fetch entire graph
|
||||
*
|
||||
* @param ship ship of graph
|
||||
* @param name name of graph
|
||||
*
|
||||
*/
|
||||
export declare const getGraph: (ship: string, name: string) => Scry;
|
380
pkg/npm/api/tmp/graph/lib.js
Normal file
380
pkg/npm/api/tmp/graph/lib.js
Normal file
@ -0,0 +1,380 @@
|
||||
import { makeResource, resourceFromPath } from '../groups';
|
||||
import { decToUd, deSig, unixToDa } from '../lib';
|
||||
import { patp2dec } from 'urbit-ob';
|
||||
export const GRAPH_UPDATE_VERSION = 3;
|
||||
export const createBlankNodeWithChildPost = (ship, parentIndex = '', childIndex = '', contents) => {
|
||||
const date = unixToDa(Date.now()).toString();
|
||||
const nodeIndex = parentIndex + '/' + date;
|
||||
const childGraph = {};
|
||||
childGraph[childIndex] = {
|
||||
post: {
|
||||
author: `~${ship}`,
|
||||
index: nodeIndex + '/' + childIndex,
|
||||
'time-sent': Date.now(),
|
||||
contents,
|
||||
hash: null,
|
||||
signatures: []
|
||||
},
|
||||
children: null
|
||||
};
|
||||
return {
|
||||
post: {
|
||||
author: `~${ship}`,
|
||||
index: nodeIndex,
|
||||
'time-sent': Date.now(),
|
||||
contents: [],
|
||||
hash: null,
|
||||
signatures: []
|
||||
},
|
||||
children: childGraph
|
||||
};
|
||||
};
|
||||
export const markPending = (nodes) => {
|
||||
Object.keys(nodes).forEach((key) => {
|
||||
nodes[key].post.author = deSig(nodes[key].post.author);
|
||||
nodes[key].post.pending = true;
|
||||
if (nodes[key].children) {
|
||||
nodes[key].children = markPending(nodes[key].children);
|
||||
}
|
||||
});
|
||||
return nodes;
|
||||
};
|
||||
export const createPost = (ship, contents, parentIndex = '', childIndex = 'DATE_PLACEHOLDER') => {
|
||||
if (childIndex === 'DATE_PLACEHOLDER') {
|
||||
childIndex = unixToDa(Date.now()).toString();
|
||||
}
|
||||
return {
|
||||
author: `~${ship}`,
|
||||
index: parentIndex + '/' + childIndex,
|
||||
'time-sent': Date.now(),
|
||||
contents,
|
||||
hash: null,
|
||||
signatures: []
|
||||
};
|
||||
};
|
||||
function moduleToMark(mod) {
|
||||
if (mod === 'link') {
|
||||
return 'graph-validator-link';
|
||||
}
|
||||
if (mod === 'publish') {
|
||||
return 'graph-validator-publish';
|
||||
}
|
||||
if (mod === 'chat') {
|
||||
return 'graph-validator-chat';
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
const storeAction = (data, version = GRAPH_UPDATE_VERSION) => ({
|
||||
app: 'graph-store',
|
||||
mark: `graph-update-${version}`,
|
||||
json: data
|
||||
});
|
||||
export { storeAction as graphStoreAction };
|
||||
const viewAction = (threadName, action) => ({
|
||||
inputMark: 'graph-view-action',
|
||||
outputMark: 'json',
|
||||
threadName,
|
||||
body: action
|
||||
});
|
||||
export { viewAction as graphViewAction };
|
||||
const hookAction = (data, version = GRAPH_UPDATE_VERSION) => ({
|
||||
app: 'graph-push-hook',
|
||||
mark: `graph-update-${version}`,
|
||||
json: data
|
||||
});
|
||||
const dmAction = (data) => ({
|
||||
app: 'dm-hook',
|
||||
mark: 'dm-hook-action',
|
||||
json: data
|
||||
});
|
||||
export { hookAction as graphHookAction };
|
||||
export const createManagedGraph = (ship, name, title, description, group, mod) => {
|
||||
const associated = { group: resourceFromPath(group) };
|
||||
const resource = makeResource(`~${ship}`, name);
|
||||
return viewAction('graph-create', {
|
||||
create: {
|
||||
resource,
|
||||
title,
|
||||
description,
|
||||
associated,
|
||||
module: mod,
|
||||
mark: moduleToMark(mod)
|
||||
}
|
||||
});
|
||||
};
|
||||
export const createUnmanagedGraph = (ship, name, title, description, policy, mod) => viewAction('graph-create', {
|
||||
create: {
|
||||
resource: makeResource(`~${ship}`, name),
|
||||
title,
|
||||
description,
|
||||
associated: { policy },
|
||||
module: mod,
|
||||
mark: moduleToMark(mod)
|
||||
}
|
||||
});
|
||||
export const joinGraph = (ship, name) => viewAction('graph-join', {
|
||||
join: {
|
||||
resource: makeResource(ship, name),
|
||||
ship
|
||||
}
|
||||
});
|
||||
export const deleteGraph = (ship, name) => viewAction('graph-delete', {
|
||||
'delete': {
|
||||
resource: makeResource(`~${ship}`, name)
|
||||
}
|
||||
});
|
||||
export const leaveGraph = (ship, name) => viewAction('graph-leave', {
|
||||
'leave': {
|
||||
resource: makeResource(ship, name)
|
||||
}
|
||||
});
|
||||
export const groupifyGraph = (ship, name, toPath) => {
|
||||
const resource = makeResource(ship, name);
|
||||
const to = toPath && resourceFromPath(toPath);
|
||||
return viewAction('graph-groupify', {
|
||||
groupify: {
|
||||
resource,
|
||||
to
|
||||
}
|
||||
});
|
||||
};
|
||||
export const evalCord = (cord) => {
|
||||
return ({
|
||||
inputMark: 'graph-view-action',
|
||||
outputMark: 'tang',
|
||||
threadName: 'graph-eval',
|
||||
body: {
|
||||
eval: cord
|
||||
}
|
||||
});
|
||||
};
|
||||
export const addGraph = (ship, name, graph, mark) => {
|
||||
return storeAction({
|
||||
'add-graph': {
|
||||
resource: { ship, name },
|
||||
graph,
|
||||
mark
|
||||
}
|
||||
});
|
||||
};
|
||||
export const addNodes = (ship, name, nodes) => ({
|
||||
inputMark: `graph-update-${GRAPH_UPDATE_VERSION}`,
|
||||
outputMark: 'graph-view-action',
|
||||
threadName: 'graph-add-nodes',
|
||||
body: {
|
||||
'add-nodes': {
|
||||
resource: { ship, name },
|
||||
nodes
|
||||
}
|
||||
}
|
||||
});
|
||||
export const addPost = (ship, name, post) => {
|
||||
const nodes = {};
|
||||
nodes[post.index] = {
|
||||
post,
|
||||
children: null
|
||||
};
|
||||
return addNodes(ship, name, nodes);
|
||||
};
|
||||
export const addNode = (ship, name, node) => {
|
||||
const nodes = {};
|
||||
nodes[node.post.index] = node;
|
||||
return addNodes(ship, name, nodes);
|
||||
};
|
||||
export const createGroupFeed = (group, vip = '') => ({
|
||||
inputMark: 'graph-view-action',
|
||||
outputMark: 'resource',
|
||||
threadName: 'graph-create-group-feed',
|
||||
body: {
|
||||
'create-group-feed': {
|
||||
resource: group,
|
||||
vip
|
||||
}
|
||||
}
|
||||
});
|
||||
export const disableGroupFeed = (group) => ({
|
||||
inputMark: 'graph-view-action',
|
||||
outputMark: 'json',
|
||||
threadName: 'graph-disable-group-feed',
|
||||
body: {
|
||||
'disable-group-feed': {
|
||||
resource: group
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Set dm-hook to screen new DMs or not
|
||||
*
|
||||
*/
|
||||
export const setScreen = (screen) => dmAction({ screen });
|
||||
/**
|
||||
* Accept a pending DM request
|
||||
*
|
||||
* @param ship the ship to accept
|
||||
*/
|
||||
export const acceptDm = (ship) => dmAction({
|
||||
accept: ship
|
||||
});
|
||||
/**
|
||||
* Decline a pending DM request
|
||||
*
|
||||
* @param ship the ship to accept
|
||||
*/
|
||||
export const declineDm = (ship) => dmAction({
|
||||
decline: ship
|
||||
});
|
||||
/**
|
||||
* Remove posts from a set of indices
|
||||
*
|
||||
*/
|
||||
export const removePosts = (ship, name, indices) => hookAction({
|
||||
'remove-posts': {
|
||||
resource: { ship, name },
|
||||
indices
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Remove a DM message from our inbox
|
||||
*
|
||||
* @remarks
|
||||
* This does not remove the message from the recipients inbox
|
||||
*/
|
||||
export const removeDmMessage = (our, index) => ({
|
||||
app: 'graph-store',
|
||||
mark: `graph-update-${GRAPH_UPDATE_VERSION}`,
|
||||
json: {
|
||||
'remove-posts': {
|
||||
resource: { ship: our, name: 'dm-inbox' },
|
||||
indices: [index]
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Send a DM to a ship
|
||||
*
|
||||
* @param our sender
|
||||
* @param ship recipient
|
||||
* @param contents contents of message
|
||||
*/
|
||||
export const addDmMessage = (our, ship, contents) => {
|
||||
const post = createPost(our, contents, `/${patp2dec(ship)}`);
|
||||
const node = {
|
||||
post,
|
||||
children: null
|
||||
};
|
||||
return {
|
||||
app: 'dm-hook',
|
||||
mark: `graph-update-${GRAPH_UPDATE_VERSION}`,
|
||||
json: {
|
||||
'add-nodes': {
|
||||
resource: { ship: `~${our}`, name: 'dm-inbox' },
|
||||
nodes: {
|
||||
[post.index]: node
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
const encodeIndex = (idx) => idx.split('/').map(decToUd).join('/');
|
||||
/**
|
||||
* Fetch newest (larger keys) nodes in a graph under some index
|
||||
*
|
||||
* @param ship ship of graph
|
||||
* @param name name of graph
|
||||
* @param count number of nodes to load
|
||||
* @param index index to query
|
||||
*/
|
||||
export const getNewest = (ship, name, count, index = '') => ({
|
||||
app: 'graph-store',
|
||||
path: `/graph/${ship}/${name}/node/siblings` +
|
||||
`/newest/lone/${count}${encodeIndex(index)}`
|
||||
});
|
||||
/**
|
||||
* Fetch nodes in a graph that are older (key is smaller) and direct
|
||||
* siblings of some index
|
||||
*
|
||||
* @param ship ship of graph
|
||||
* @param name name of graph
|
||||
* @param count number of nodes to load
|
||||
* @param index index to query
|
||||
*/
|
||||
export const getOlderSiblings = (ship, name, count, index) => ({
|
||||
app: 'graph-store',
|
||||
path: `/graph/${ship}/${name}/node/siblings/older/lone/${count}${encodeIndex(index)}`
|
||||
});
|
||||
/**
|
||||
* Fetch nodes in a graph that are younger (key is larger) and direct
|
||||
* siblings of some index
|
||||
*
|
||||
* @param ship ship of graph
|
||||
* @param name name of graph
|
||||
* @param count number of nodes to load
|
||||
* @param index index to query
|
||||
*/
|
||||
export const getYoungerSiblings = (ship, name, count, index) => ({
|
||||
app: 'graph-store',
|
||||
path: `/graph/${ship}/${name}/node/siblings/newer/lone/${count}${encodeIndex(index)}`
|
||||
});
|
||||
/**
|
||||
* Fetch all nodes in a graph under some index, without loading children
|
||||
*
|
||||
* @param ship ship of graph
|
||||
* @param name name of graph
|
||||
* @param index index to query
|
||||
*/
|
||||
export const getShallowChildren = (ship, name, index = '') => ({
|
||||
app: 'graph-store',
|
||||
path: `/graph/${ship}/${name}/node/children/lone/~/~${encodeIndex(index)}`
|
||||
});
|
||||
/**
|
||||
* Fetch newest nodes in a graph as a flat map, including children,
|
||||
* optionally starting at a specified key
|
||||
*
|
||||
* @param ship ship of graph
|
||||
* @param name name of graph
|
||||
* @param count number of nodes to load
|
||||
* @param start key to start at
|
||||
*
|
||||
*/
|
||||
export const getDeepOlderThan = (ship, name, count, start = '') => ({
|
||||
app: 'graph-store',
|
||||
path: `/graph/${ship}/${name}/node/siblings` +
|
||||
`/${start.length > 0 ? 'older' : 'newest'}` +
|
||||
`/kith/${count}${encodeIndex(start)}`
|
||||
});
|
||||
/**
|
||||
* Fetch a flat map of a nodes ancestors and firstborn children
|
||||
*
|
||||
* @param ship ship of graph
|
||||
* @param name name of graph
|
||||
* @param index index to query
|
||||
*
|
||||
*/
|
||||
export const getFirstborn = (ship, name, index) => ({
|
||||
app: 'graph-store',
|
||||
path: `/graph/${ship}/${name}/node/firstborn${encodeIndex(index)}`
|
||||
});
|
||||
/**
|
||||
* Fetch a single node, and all it's children
|
||||
*
|
||||
* @param ship ship of graph
|
||||
* @param name name of graph
|
||||
* @param index index to query
|
||||
*
|
||||
*/
|
||||
export const getNode = (ship, name, index) => ({
|
||||
app: 'graph-store',
|
||||
path: `/graph/${ship}/${name}/node/index/kith${encodeIndex(index)}`
|
||||
});
|
||||
/**
|
||||
* Fetch entire graph
|
||||
*
|
||||
* @param ship ship of graph
|
||||
* @param name name of graph
|
||||
*
|
||||
*/
|
||||
export const getGraph = (ship, name) => ({
|
||||
app: 'graph-store',
|
||||
path: `/graph/${ship}/${name}`
|
||||
});
|
||||
//# sourceMappingURL=lib.js.map
|
1
pkg/npm/api/tmp/graph/lib.js.map
Normal file
1
pkg/npm/api/tmp/graph/lib.js.map
Normal file
File diff suppressed because one or more lines are too long
76
pkg/npm/api/tmp/graph/types.d.ts
vendored
Normal file
76
pkg/npm/api/tmp/graph/types.d.ts
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
import { Patp } from '../lib';
|
||||
import { BigIntOrderedMap } from '../lib/BigIntOrderedMap';
|
||||
import { BigIntArrayOrderedMap } from '../lib/BigIntArrayOrderedMap';
|
||||
export interface TextContent {
|
||||
text: string;
|
||||
}
|
||||
export interface UrlContent {
|
||||
url: string;
|
||||
}
|
||||
export interface CodeContent {
|
||||
code: {
|
||||
expression: string;
|
||||
output: string[] | undefined;
|
||||
};
|
||||
}
|
||||
export interface ReferenceContent {
|
||||
reference: AppReference | GraphReference | GroupReference;
|
||||
}
|
||||
export interface GraphReference {
|
||||
graph: {
|
||||
graph: string;
|
||||
group: string;
|
||||
index: string;
|
||||
};
|
||||
}
|
||||
export interface GroupReference {
|
||||
group: string;
|
||||
}
|
||||
export interface AppReference {
|
||||
app: {
|
||||
ship: string;
|
||||
desk: string;
|
||||
path: string;
|
||||
};
|
||||
}
|
||||
export interface MentionContent {
|
||||
mention: string;
|
||||
}
|
||||
export declare type Content = TextContent | UrlContent | CodeContent | ReferenceContent | MentionContent;
|
||||
export interface Post {
|
||||
author: Patp;
|
||||
contents: Content[];
|
||||
hash: string | null;
|
||||
index: string;
|
||||
pending?: boolean;
|
||||
signatures: string[];
|
||||
'time-sent': number;
|
||||
}
|
||||
export interface GraphNodePoke {
|
||||
post: Post;
|
||||
children: GraphChildrenPoke | null;
|
||||
}
|
||||
export interface GraphChildrenPoke {
|
||||
[k: string]: GraphNodePoke;
|
||||
}
|
||||
export interface GraphNode {
|
||||
children: Graph | null;
|
||||
post: Post;
|
||||
}
|
||||
export interface FlatGraphNode {
|
||||
children: null;
|
||||
post: Post;
|
||||
}
|
||||
export declare type Graph = BigIntOrderedMap<GraphNode>;
|
||||
export declare type Graphs = {
|
||||
[rid: string]: Graph;
|
||||
};
|
||||
export declare type FlatGraph = BigIntArrayOrderedMap<FlatGraphNode>;
|
||||
export declare type FlatGraphs = {
|
||||
[rid: string]: FlatGraph;
|
||||
};
|
||||
export declare type ThreadGraphs = {
|
||||
[rid: string]: {
|
||||
[index: string]: FlatGraph;
|
||||
};
|
||||
};
|
2
pkg/npm/api/tmp/graph/types.js
Normal file
2
pkg/npm/api/tmp/graph/types.js
Normal file
@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=types.js.map
|
1
pkg/npm/api/tmp/graph/types.js.map
Normal file
1
pkg/npm/api/tmp/graph/types.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../graph/types.ts"],"names":[],"mappings":""}
|
2
pkg/npm/api/tmp/groups/index.d.ts
vendored
Normal file
2
pkg/npm/api/tmp/groups/index.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './types';
|
||||
export * from './lib';
|
3
pkg/npm/api/tmp/groups/index.js
Normal file
3
pkg/npm/api/tmp/groups/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
export * from './types';
|
||||
export * from './lib';
|
||||
//# sourceMappingURL=index.js.map
|
1
pkg/npm/api/tmp/groups/index.js.map
Normal file
1
pkg/npm/api/tmp/groups/index.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../groups/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC"}
|
40
pkg/npm/api/tmp/groups/lib.d.ts
vendored
Normal file
40
pkg/npm/api/tmp/groups/lib.d.ts
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
import { Enc, Path, Patp, PatpNoSig, Poke, Thread } from '../lib/types';
|
||||
import { Group, GroupPolicy, GroupPolicyDiff, GroupUpdateAddMembers, GroupUpdateAddTag, GroupUpdateChangePolicy, GroupUpdateRemoveGroup, GroupUpdateRemoveMembers, GroupUpdateRemoveTag, Resource, RoleTags, Tag } from './types';
|
||||
import { GroupUpdate } from './update';
|
||||
export declare const GROUP_UPDATE_VERSION = 0;
|
||||
export declare const proxyAction: <T>(data: T, version?: number) => Poke<T>;
|
||||
declare const storeAction: <T extends GroupUpdate>(data: T, version?: number) => Poke<T>;
|
||||
export { storeAction as groupStoreAction };
|
||||
declare const viewAction: <T>(data: T) => Poke<T>;
|
||||
export { viewAction as groupViewAction };
|
||||
export declare const viewThread: <T>(thread: string, action: T) => Thread<T>;
|
||||
export declare const removeMembers: (resource: Resource, ships: PatpNoSig[]) => Poke<GroupUpdateRemoveMembers>;
|
||||
export declare const addTag: (resource: Resource, tag: Tag, ships: Patp[]) => Poke<GroupUpdateAddTag>;
|
||||
export declare const removeTag: (tag: Tag, resource: Resource, ships: PatpNoSig[]) => Poke<GroupUpdateRemoveTag>;
|
||||
export declare const addMembers: (resource: Resource, ships: PatpNoSig[]) => Poke<GroupUpdateAddMembers>;
|
||||
export declare const removeGroup: (resource: Resource) => Poke<GroupUpdateRemoveGroup>;
|
||||
export declare const changePolicy: (resource: Resource, diff: Enc<GroupPolicyDiff>) => Poke<Enc<GroupUpdateChangePolicy>>;
|
||||
export declare const makeResource: (ship: string, name: string) => {
|
||||
ship: string;
|
||||
name: string;
|
||||
};
|
||||
export declare const join: (ship: string, name: string, app: "groups" | "graph", autojoin: boolean, share: boolean) => Poke<any>;
|
||||
export declare const createGroup: (name: string, policy: Enc<GroupPolicy>, title: string, description: string) => Thread<any>;
|
||||
export declare const deleteGroup: (ship: string, name: string) => Thread<any>;
|
||||
export declare const leaveGroup: (ship: string, name: string) => Thread<any>;
|
||||
export declare const invite: (ship: string, name: string, ships: Patp[], description: string) => Thread<any>;
|
||||
export declare const abortJoin: (resource: string) => Poke<any>;
|
||||
export declare const roleTags: string[];
|
||||
export declare const groupBunts: {
|
||||
group: () => Group;
|
||||
policy: () => GroupPolicy;
|
||||
};
|
||||
export declare const joinError: readonly ["no-perms", "strange", "abort"];
|
||||
export declare const joinResult: readonly ["done", "no-perms", "strange", "abort"];
|
||||
export declare const joinLoad: readonly ["start", "added", "metadata"];
|
||||
export declare const joinProgress: readonly ["start", "added", "metadata", "done", "no-perms", "strange", "abort"];
|
||||
export declare const roleForShip: (group: Group, ship: PatpNoSig) => RoleTags | undefined;
|
||||
export declare const resourceFromPath: (path: Path) => Resource;
|
||||
export declare const isWriter: (group: Group, resource: string, ship: string) => boolean;
|
||||
export declare const isHost: (resource: string, ship: string) => boolean;
|
||||
export declare const isChannelAdmin: (group: Group, resource: string, ship: string) => boolean;
|
139
pkg/npm/api/tmp/groups/lib.js
Normal file
139
pkg/npm/api/tmp/groups/lib.js
Normal file
@ -0,0 +1,139 @@
|
||||
export const GROUP_UPDATE_VERSION = 0;
|
||||
export const proxyAction = (data, version = GROUP_UPDATE_VERSION) => ({
|
||||
app: 'group-push-hook',
|
||||
mark: `group-update-${version}`,
|
||||
json: data
|
||||
});
|
||||
const storeAction = (data, version = GROUP_UPDATE_VERSION) => ({
|
||||
app: 'group-store',
|
||||
mark: `group-update-${version}`,
|
||||
json: data
|
||||
});
|
||||
export { storeAction as groupStoreAction };
|
||||
const viewAction = (data) => ({
|
||||
app: 'group-view',
|
||||
mark: 'group-view-action',
|
||||
json: data
|
||||
});
|
||||
export { viewAction as groupViewAction };
|
||||
export const viewThread = (thread, action) => ({
|
||||
inputMark: 'group-view-action',
|
||||
outputMark: 'json',
|
||||
threadName: thread,
|
||||
body: action
|
||||
});
|
||||
export const removeMembers = (resource, ships) => proxyAction({
|
||||
removeMembers: {
|
||||
resource,
|
||||
ships
|
||||
}
|
||||
});
|
||||
export const addTag = (resource, tag, ships) => proxyAction({
|
||||
addTag: {
|
||||
resource,
|
||||
tag,
|
||||
ships
|
||||
}
|
||||
});
|
||||
export const removeTag = (tag, resource, ships) => proxyAction({
|
||||
removeTag: {
|
||||
tag,
|
||||
resource,
|
||||
ships
|
||||
}
|
||||
});
|
||||
export const addMembers = (resource, ships) => proxyAction({
|
||||
addMembers: {
|
||||
resource,
|
||||
ships
|
||||
}
|
||||
});
|
||||
export const removeGroup = (resource) => storeAction({
|
||||
removeGroup: {
|
||||
resource
|
||||
}
|
||||
});
|
||||
export const changePolicy = (resource, diff) => proxyAction({
|
||||
changePolicy: {
|
||||
resource,
|
||||
diff
|
||||
}
|
||||
});
|
||||
export const makeResource = (ship, name) => {
|
||||
return { ship, name };
|
||||
};
|
||||
export const join = (ship, name, app, autojoin, share) => viewAction({
|
||||
join: {
|
||||
resource: makeResource(ship, name),
|
||||
ship,
|
||||
shareContact: share || false,
|
||||
app,
|
||||
autojoin
|
||||
}
|
||||
});
|
||||
export const createGroup = (name, policy, title, description) => viewThread('group-create', {
|
||||
create: {
|
||||
name,
|
||||
policy,
|
||||
title,
|
||||
description
|
||||
}
|
||||
});
|
||||
export const deleteGroup = (ship, name) => viewThread('group-delete', {
|
||||
remove: makeResource(ship, name)
|
||||
});
|
||||
export const leaveGroup = (ship, name) => viewThread('group-leave', {
|
||||
leave: makeResource(ship, name)
|
||||
});
|
||||
export const invite = (ship, name, ships, description) => viewThread('group-invite', {
|
||||
invite: {
|
||||
resource: makeResource(ship, name),
|
||||
ships,
|
||||
description
|
||||
}
|
||||
});
|
||||
export const abortJoin = (resource) => viewAction({
|
||||
abort: resource
|
||||
});
|
||||
export const roleTags = ['janitor', 'moderator', 'admin'];
|
||||
// TODO make this type better?
|
||||
export const groupBunts = {
|
||||
group: () => ({ members: new Set(), tags: { role: {} }, hidden: false, policy: groupBunts.policy() }),
|
||||
policy: () => ({ open: { banned: new Set(), banRanks: new Set() } })
|
||||
};
|
||||
export const joinError = ['no-perms', 'strange', 'abort'];
|
||||
export const joinResult = ['done', ...joinError];
|
||||
export const joinLoad = ['start', 'added', 'metadata'];
|
||||
export const joinProgress = [...joinLoad, ...joinResult];
|
||||
export const roleForShip = (group, ship) => {
|
||||
return roleTags.reduce((currRole, role) => {
|
||||
const roleShips = group?.tags?.role?.[role];
|
||||
return roleShips && roleShips.has(ship) ? role : currRole;
|
||||
}, undefined);
|
||||
};
|
||||
export const resourceFromPath = (path) => {
|
||||
const [, , ship, name] = path.split('/');
|
||||
return { ship, name };
|
||||
};
|
||||
export const isWriter = (group, resource, ship) => {
|
||||
const graph = group.tags?.graph;
|
||||
const writers = graph && graph[resource]?.writers;
|
||||
const admins = group?.tags?.role?.admin ?? new Set();
|
||||
if (typeof writers === 'undefined') {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return writers.has(ship) || admins.has(ship);
|
||||
}
|
||||
};
|
||||
export const isHost = (resource, ship) => {
|
||||
const [, , host] = resource.split('/');
|
||||
return ship === host;
|
||||
};
|
||||
export const isChannelAdmin = (group, resource, ship) => {
|
||||
const role = roleForShip(group, ship.slice(1));
|
||||
return (isHost(resource, ship) ||
|
||||
role === 'admin' ||
|
||||
role === 'moderator');
|
||||
};
|
||||
//# sourceMappingURL=lib.js.map
|
1
pkg/npm/api/tmp/groups/lib.js.map
Normal file
1
pkg/npm/api/tmp/groups/lib.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../groups/lib.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAEtC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAI,IAAO,EAAE,UAAkB,oBAAoB,EAAW,EAAE,CAAC,CAAC;IAC3F,GAAG,EAAE,iBAAiB;IACtB,IAAI,EAAE,gBAAgB,OAAO,EAAE;IAC/B,IAAI,EAAE,IAAI;CACX,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,CAAwB,IAAO,EAAE,UAAkB,oBAAoB,EAAW,EAAE,CAAC,CAAC;IACxG,GAAG,EAAE,aAAa;IAClB,IAAI,EAAE,gBAAgB,OAAO,EAAE;IAC/B,IAAI,EAAE,IAAI;CACX,CAAC,CAAC;AAEH,OAAO,EAAE,WAAW,IAAI,gBAAgB,EAAE,CAAC;AAE3C,MAAM,UAAU,GAAG,CAAI,IAAO,EAAW,EAAE,CAAC,CAAC;IAC3C,GAAG,EAAE,YAAY;IACjB,IAAI,EAAE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IACX,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAE/C,OAAO,CACL,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC;QACtB,IAAI,KAAK,OAAO;QAChB,IAAI,KAAK,WAAW,CACrB,CAAC;AACJ,CAAC,CAAC"}
|
2
pkg/npm/api/tmp/groups/types.d.ts
vendored
Normal file
2
pkg/npm/api/tmp/groups/types.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './update';
|
||||
export * from './view';
|
3
pkg/npm/api/tmp/groups/types.js
Normal file
3
pkg/npm/api/tmp/groups/types.js
Normal file
@ -0,0 +1,3 @@
|
||||
export * from './update';
|
||||
export * from './view';
|
||||
//# sourceMappingURL=types.js.map
|
1
pkg/npm/api/tmp/groups/types.js.map
Normal file
1
pkg/npm/api/tmp/groups/types.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../groups/types.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
133
pkg/npm/api/tmp/groups/update.d.ts
vendored
Normal file
133
pkg/npm/api/tmp/groups/update.d.ts
vendored
Normal file
@ -0,0 +1,133 @@
|
||||
import { PatpNoSig, Path, ShipRank, Enc } from '../lib';
|
||||
import { roleTags } from './index';
|
||||
export declare type RoleTags = typeof roleTags[number];
|
||||
interface RoleTag {
|
||||
tag: 'admin' | 'moderator' | 'janitor';
|
||||
}
|
||||
interface AppTag {
|
||||
app: string;
|
||||
resource: string;
|
||||
tag: string;
|
||||
}
|
||||
export declare type Tag = AppTag | RoleTag;
|
||||
export interface InvitePolicy {
|
||||
invite: {
|
||||
pending: Set<PatpNoSig>;
|
||||
};
|
||||
}
|
||||
export interface OpenPolicy {
|
||||
open: {
|
||||
banned: Set<PatpNoSig>;
|
||||
banRanks: Set<ShipRank>;
|
||||
};
|
||||
}
|
||||
export interface Resource {
|
||||
name: string;
|
||||
ship: PatpNoSig;
|
||||
}
|
||||
export declare type OpenPolicyDiff = AllowRanksDiff | BanRanksDiff | AllowShipsDiff | BanShipsDiff;
|
||||
export interface AllowRanksDiff {
|
||||
allowRanks: ShipRank[];
|
||||
}
|
||||
export interface BanRanksDiff {
|
||||
banRanks: ShipRank[];
|
||||
}
|
||||
export interface AllowShipsDiff {
|
||||
allowShips: PatpNoSig[];
|
||||
}
|
||||
export interface BanShipsDiff {
|
||||
banShips: PatpNoSig[];
|
||||
}
|
||||
export declare type InvitePolicyDiff = AddInvitesDiff | RemoveInvitesDiff;
|
||||
export interface AddInvitesDiff {
|
||||
addInvites: PatpNoSig[];
|
||||
}
|
||||
export interface RemoveInvitesDiff {
|
||||
removeInvites: PatpNoSig[];
|
||||
}
|
||||
export interface ReplacePolicyDiff {
|
||||
replace: GroupPolicy;
|
||||
}
|
||||
export declare type GroupPolicyDiff = {
|
||||
open: OpenPolicyDiff;
|
||||
} | {
|
||||
invite: InvitePolicyDiff;
|
||||
} | ReplacePolicyDiff;
|
||||
export declare type GroupPolicy = OpenPolicy | InvitePolicy;
|
||||
export interface TaggedShips {
|
||||
[tag: string]: Set<PatpNoSig>;
|
||||
}
|
||||
export interface Tags {
|
||||
role: TaggedShips;
|
||||
[app: string]: TaggedShips;
|
||||
}
|
||||
export interface Group {
|
||||
members: Set<PatpNoSig>;
|
||||
tags: Tags;
|
||||
policy: GroupPolicy;
|
||||
hidden: boolean;
|
||||
}
|
||||
export declare type Groups = {
|
||||
[p in Path]: Group;
|
||||
};
|
||||
export interface GroupUpdateInitial {
|
||||
initial: Enc<Groups>;
|
||||
}
|
||||
export interface GroupUpdateAddGroup {
|
||||
addGroup: {
|
||||
resource: Resource;
|
||||
policy: Enc<GroupPolicy>;
|
||||
hidden: boolean;
|
||||
};
|
||||
}
|
||||
export interface GroupUpdateAddMembers {
|
||||
addMembers: {
|
||||
ships: PatpNoSig[];
|
||||
resource: Resource;
|
||||
};
|
||||
}
|
||||
export interface GroupUpdateRemoveMembers {
|
||||
removeMembers: {
|
||||
ships: PatpNoSig[];
|
||||
resource: Resource;
|
||||
};
|
||||
}
|
||||
export interface GroupUpdateAddTag {
|
||||
addTag: {
|
||||
tag: Tag;
|
||||
resource: Resource;
|
||||
ships: PatpNoSig[];
|
||||
};
|
||||
}
|
||||
export interface GroupUpdateRemoveTag {
|
||||
removeTag: {
|
||||
tag: Tag;
|
||||
resource: Resource;
|
||||
ships: PatpNoSig[];
|
||||
};
|
||||
}
|
||||
export interface GroupUpdateChangePolicy {
|
||||
changePolicy: {
|
||||
resource: Resource;
|
||||
diff: GroupPolicyDiff;
|
||||
};
|
||||
}
|
||||
export interface GroupUpdateRemoveGroup {
|
||||
removeGroup: {
|
||||
resource: Resource;
|
||||
};
|
||||
}
|
||||
export interface GroupUpdateExpose {
|
||||
expose: {
|
||||
resource: Resource;
|
||||
};
|
||||
}
|
||||
export interface GroupUpdateInitialGroup {
|
||||
initialGroup: {
|
||||
resource: Resource;
|
||||
group: Enc<Group>;
|
||||
};
|
||||
}
|
||||
export declare type GroupUpdate = GroupUpdateInitial | GroupUpdateAddGroup | GroupUpdateAddMembers | GroupUpdateRemoveMembers | GroupUpdateAddTag | GroupUpdateRemoveTag | GroupUpdateChangePolicy | GroupUpdateRemoveGroup | GroupUpdateExpose | GroupUpdateInitialGroup;
|
||||
export declare type GroupAction = Omit<GroupUpdate, 'initialGroup' | 'initial'>;
|
||||
export {};
|
2
pkg/npm/api/tmp/groups/update.js
Normal file
2
pkg/npm/api/tmp/groups/update.js
Normal file
@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=update.js.map
|
1
pkg/npm/api/tmp/groups/update.js.map
Normal file
1
pkg/npm/api/tmp/groups/update.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../groups/update.ts"],"names":[],"mappings":""}
|
24
pkg/npm/api/tmp/groups/view.d.ts
vendored
Normal file
24
pkg/npm/api/tmp/groups/view.d.ts
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
import { joinError, joinProgress, joinResult } from ".";
|
||||
import { Patp } from "../lib";
|
||||
export declare type JoinError = typeof joinError[number];
|
||||
export declare type JoinResult = typeof joinResult[number];
|
||||
export declare type JoinProgress = typeof joinProgress[number];
|
||||
export interface JoinRequest {
|
||||
/**
|
||||
* Whether to display the join request or not
|
||||
*/
|
||||
hidden: boolean;
|
||||
/**
|
||||
* Timestamp of when the request started
|
||||
*/
|
||||
started: number;
|
||||
ship: Patp;
|
||||
progress: JoinProgress;
|
||||
shareContact: boolean;
|
||||
autojoin: boolean;
|
||||
app: 'graph' | 'groups';
|
||||
invite: string[];
|
||||
}
|
||||
export interface JoinRequests {
|
||||
[rid: string]: JoinRequest;
|
||||
}
|
2
pkg/npm/api/tmp/groups/view.js
Normal file
2
pkg/npm/api/tmp/groups/view.js
Normal file
@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=view.js.map
|
1
pkg/npm/api/tmp/groups/view.js.map
Normal file
1
pkg/npm/api/tmp/groups/view.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../groups/view.ts"],"names":[],"mappings":""}
|
2
pkg/npm/api/tmp/hark/index.d.ts
vendored
Normal file
2
pkg/npm/api/tmp/hark/index.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './types';
|
||||
export * from './lib';
|
3
pkg/npm/api/tmp/hark/index.js
Normal file
3
pkg/npm/api/tmp/hark/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
export * from './types';
|
||||
export * from './lib';
|
||||
//# sourceMappingURL=index.js.map
|
1
pkg/npm/api/tmp/hark/index.js.map
Normal file
1
pkg/npm/api/tmp/hark/index.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../hark/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC"}
|
46
pkg/npm/api/tmp/hark/lib.d.ts
vendored
Normal file
46
pkg/npm/api/tmp/hark/lib.d.ts
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
import { BigInteger } from 'big-integer';
|
||||
import { Poke } from '../lib/types';
|
||||
import { HarkBin, HarkBinId, HarkLid, HarkPlace } from './types';
|
||||
export declare const harkAction: <T>(data: T) => Poke<T>;
|
||||
declare const graphHookAction: <T>(data: T) => Poke<T>;
|
||||
export { graphHookAction as harkGraphHookAction };
|
||||
declare const groupHookAction: <T>(data: T) => Poke<T>;
|
||||
export { groupHookAction as harkGroupHookAction };
|
||||
export declare const actOnNotification: (frond: string, intTime: BigInteger, bin: HarkBin) => Poke<unknown>;
|
||||
export declare const setMentions: (mentions: boolean) => Poke<unknown>;
|
||||
export declare const setWatchOnSelf: (watchSelf: boolean) => Poke<unknown>;
|
||||
export declare const setDoNotDisturb: (dnd: boolean) => Poke<unknown>;
|
||||
export declare const archive: (bin: HarkBin, lid: HarkLid) => Poke<unknown>;
|
||||
export declare const opened: Poke<{
|
||||
opened: any;
|
||||
}>;
|
||||
export declare const markCountAsRead: (place: HarkPlace) => Poke<unknown>;
|
||||
export declare const markEachAsRead: (place: HarkPlace, path: string) => Poke<unknown>;
|
||||
export declare const seen: () => Poke<{
|
||||
seen: any;
|
||||
}>;
|
||||
export declare const readAll: Poke<{
|
||||
'read-all': any;
|
||||
}>;
|
||||
export declare const archiveAll: Poke<{
|
||||
'archive-all': any;
|
||||
}>;
|
||||
export declare const ignoreGroup: (group: string) => Poke<unknown>;
|
||||
export declare const ignoreGraph: (graph: string, index: string) => Poke<unknown>;
|
||||
export declare const listenGroup: (group: string) => Poke<unknown>;
|
||||
export declare const listenGraph: (graph: string, index: string) => Poke<unknown>;
|
||||
/**
|
||||
* Read all graphs belonging to a particular group
|
||||
*/
|
||||
export declare const readGroup: (group: string) => Poke<{
|
||||
'read-group': string;
|
||||
}>;
|
||||
/**
|
||||
* Read all unreads in a graph
|
||||
*/
|
||||
export declare const readGraph: (graph: string) => Poke<{
|
||||
'read-graph': string;
|
||||
}>;
|
||||
export declare function harkBinToId(bin: HarkBin): HarkBinId;
|
||||
export declare function harkBinEq(a: HarkBin, b: HarkBin): boolean;
|
||||
export declare function harkLidToId(lid: HarkLid): string;
|
100
pkg/npm/api/tmp/hark/lib.js
Normal file
100
pkg/npm/api/tmp/hark/lib.js
Normal file
@ -0,0 +1,100 @@
|
||||
import { decToUd } from '../lib';
|
||||
export const harkAction = (data) => ({
|
||||
app: 'hark-store',
|
||||
mark: 'hark-action',
|
||||
json: data
|
||||
});
|
||||
const graphHookAction = (data) => ({
|
||||
app: 'hark-graph-hook',
|
||||
mark: 'hark-graph-hook-action',
|
||||
json: data
|
||||
});
|
||||
export { graphHookAction as harkGraphHookAction };
|
||||
const groupHookAction = (data) => ({
|
||||
app: 'hark-group-hook',
|
||||
mark: 'hark-group-hook-action',
|
||||
json: data
|
||||
});
|
||||
export { groupHookAction as harkGroupHookAction };
|
||||
export const actOnNotification = (frond, intTime, bin) => harkAction({
|
||||
[frond]: {
|
||||
time: decToUd(intTime.toString()),
|
||||
bin
|
||||
}
|
||||
});
|
||||
export const setMentions = (mentions) => graphHookAction({
|
||||
'set-mentions': mentions
|
||||
});
|
||||
export const setWatchOnSelf = (watchSelf) => graphHookAction({
|
||||
'set-watch-on-self': watchSelf
|
||||
});
|
||||
export const setDoNotDisturb = (dnd) => harkAction({
|
||||
'set-dnd': dnd
|
||||
});
|
||||
export const archive = (bin, lid) => harkAction({
|
||||
archive: {
|
||||
lid,
|
||||
bin
|
||||
}
|
||||
});
|
||||
export const opened = harkAction({
|
||||
opened: null
|
||||
});
|
||||
export const markCountAsRead = (place) => harkAction({
|
||||
'read-count': place
|
||||
});
|
||||
export const markEachAsRead = (place, path) => harkAction({
|
||||
'read-each': {
|
||||
place,
|
||||
path
|
||||
}
|
||||
});
|
||||
export const seen = () => harkAction({ seen: null });
|
||||
export const readAll = harkAction({ 'read-all': null });
|
||||
export const archiveAll = harkAction({ 'archive-all': null });
|
||||
export const ignoreGroup = (group) => groupHookAction({
|
||||
ignore: group
|
||||
});
|
||||
export const ignoreGraph = (graph, index) => graphHookAction({
|
||||
ignore: {
|
||||
graph,
|
||||
index
|
||||
}
|
||||
});
|
||||
export const listenGroup = (group) => groupHookAction({
|
||||
listen: group
|
||||
});
|
||||
export const listenGraph = (graph, index) => graphHookAction({
|
||||
listen: {
|
||||
graph,
|
||||
index
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Read all graphs belonging to a particular group
|
||||
*/
|
||||
export const readGroup = (group) => harkAction({
|
||||
'read-group': group
|
||||
});
|
||||
/**
|
||||
* Read all unreads in a graph
|
||||
*/
|
||||
export const readGraph = (graph) => harkAction({
|
||||
'read-graph': graph
|
||||
});
|
||||
export function harkBinToId(bin) {
|
||||
const { place, path } = bin;
|
||||
return `${place.desk}${place.path}${path}`;
|
||||
}
|
||||
export function harkBinEq(a, b) {
|
||||
return (a.place.path === b.place.path &&
|
||||
a.place.desk === b.place.desk &&
|
||||
a.path === b.path);
|
||||
}
|
||||
export function harkLidToId(lid) {
|
||||
if ('time' in lid) {
|
||||
return `archive-${lid.time}`;
|
||||
}
|
||||
return Object.keys(lid)[0];
|
||||
}
|
||||
//# sourceMappingURL=lib.js.map
|
1
pkg/npm/api/tmp/hark/lib.js.map
Normal file
1
pkg/npm/api/tmp/hark/lib.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../hark/lib.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAI,IAAO,EAAW,EAAE,CAAC,CAAC;IAClD,GAAG,EAAE,YAAY;IACjB,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,IAAI;CACX,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG,CAAI,IAAO,EAAW,EA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MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,EAAE,CACzC,UAAU,CAAC;IACT,YAAY,EAAE,KAAK;CACpB,CAAC,CAAC;AAEL,MAAM,UAAU,WAAW,CAAC,GAAY;IACtC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC;IAC5B,OAAO,GAAG,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,GAAG,IAAI,EAAE,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,CAAU,EAAE,CAAU;IAC9C,OAAO,CACL,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI;QAC7B,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI;QAC7B,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAClB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAY;IACtC,IAAG,MAAM,IAAI,GAAG,EAAE;QAChB,OAAO,WAAW,GAAG,CAAC,IAAI,EAAE,CAAC;KAC9B;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7B,CAAC"}
|
55
pkg/npm/api/tmp/hark/types.d.ts
vendored
Normal file
55
pkg/npm/api/tmp/hark/types.d.ts
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
export interface HarkStats {
|
||||
count: number;
|
||||
each: string[];
|
||||
last: number;
|
||||
}
|
||||
export interface Timebox {
|
||||
[binId: string]: Notification;
|
||||
}
|
||||
export declare type HarkContent = {
|
||||
ship: string;
|
||||
} | {
|
||||
text: string;
|
||||
};
|
||||
export interface HarkBody {
|
||||
title: HarkContent[];
|
||||
time: string;
|
||||
content: HarkContent[];
|
||||
link: string;
|
||||
binned: string;
|
||||
}
|
||||
export interface HarkPlace {
|
||||
desk: string;
|
||||
path: string;
|
||||
}
|
||||
export interface HarkBin {
|
||||
path: string;
|
||||
place: HarkPlace;
|
||||
}
|
||||
export declare type HarkLid = {
|
||||
unseen: null;
|
||||
} | {
|
||||
seen: null;
|
||||
} | {
|
||||
time: string;
|
||||
};
|
||||
export declare type HarkBinId = string;
|
||||
export interface Notification {
|
||||
bin: HarkBin;
|
||||
time: number;
|
||||
body: HarkBody[];
|
||||
}
|
||||
export interface NotificationGraphConfig {
|
||||
watchOnSelf: boolean;
|
||||
mentions: boolean;
|
||||
watching: WatchedIndex[];
|
||||
}
|
||||
export interface Unreads {
|
||||
[path: string]: HarkStats;
|
||||
}
|
||||
interface WatchedIndex {
|
||||
graph: string;
|
||||
index: string;
|
||||
}
|
||||
export declare type GroupNotificationsConfig = string[];
|
||||
export {};
|
2
pkg/npm/api/tmp/hark/types.js
Normal file
2
pkg/npm/api/tmp/hark/types.js
Normal file
@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=types.js.map
|
1
pkg/npm/api/tmp/hark/types.js.map
Normal file
1
pkg/npm/api/tmp/hark/types.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../hark/types.ts"],"names":[],"mappings":""}
|
2
pkg/npm/api/tmp/hood/index.d.ts
vendored
Normal file
2
pkg/npm/api/tmp/hood/index.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './lib';
|
||||
export * from './types';
|
3
pkg/npm/api/tmp/hood/index.js
Normal file
3
pkg/npm/api/tmp/hood/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
export * from './lib';
|
||||
export * from './types';
|
||||
//# sourceMappingURL=index.js.map
|
1
pkg/npm/api/tmp/hood/index.js.map
Normal file
1
pkg/npm/api/tmp/hood/index.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../hood/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC"}
|
34
pkg/npm/api/tmp/hood/lib.d.ts
vendored
Normal file
34
pkg/npm/api/tmp/hood/lib.d.ts
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
import { Poke, Scry } from '../lib';
|
||||
import { Vats, Vat } from './types';
|
||||
export declare const getVats: Scry;
|
||||
/**
|
||||
* Install a foreign desk
|
||||
*/
|
||||
export declare function kilnInstall(ship: string, desk: string, local?: string): Poke<any>;
|
||||
/**
|
||||
* Uninstall a desk
|
||||
*/
|
||||
export declare function kilnUninstall(desk: string): Poke<any>;
|
||||
export declare function kilnSuspend(desk: string): Poke<any>;
|
||||
export declare function kilnRevive(desk: string): Poke<any>;
|
||||
export declare function kilnBump(force?: boolean, except?: string[]): {
|
||||
app: string;
|
||||
mark: string;
|
||||
json: {
|
||||
force: boolean;
|
||||
except: string[];
|
||||
};
|
||||
};
|
||||
export declare function kilnPause(desk: string): {
|
||||
app: string;
|
||||
mark: string;
|
||||
json: string;
|
||||
};
|
||||
export declare function kilnResume(desk: string): {
|
||||
app: string;
|
||||
mark: string;
|
||||
json: string;
|
||||
};
|
||||
export declare const scryLag: Scry;
|
||||
export declare function getBlockers(vats: Vats): string[];
|
||||
export declare function getVatPublisher(vat: Vat): string | undefined;
|
97
pkg/npm/api/tmp/hood/lib.js
Normal file
97
pkg/npm/api/tmp/hood/lib.js
Normal file
@ -0,0 +1,97 @@
|
||||
export const getVats = {
|
||||
app: 'hood',
|
||||
path: '/kiln/vats'
|
||||
};
|
||||
/**
|
||||
* Install a foreign desk
|
||||
*/
|
||||
export function kilnInstall(ship, desk, local) {
|
||||
return {
|
||||
app: 'hood',
|
||||
mark: 'kiln-install',
|
||||
json: {
|
||||
ship,
|
||||
desk,
|
||||
local: local || desk
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Uninstall a desk
|
||||
*/
|
||||
export function kilnUninstall(desk) {
|
||||
return {
|
||||
app: 'hood',
|
||||
mark: 'kiln-uninstall',
|
||||
json: desk
|
||||
};
|
||||
}
|
||||
export function kilnSuspend(desk) {
|
||||
return {
|
||||
app: 'hood',
|
||||
mark: 'kiln-suspend',
|
||||
json: desk
|
||||
};
|
||||
}
|
||||
export function kilnRevive(desk) {
|
||||
return {
|
||||
app: 'hood',
|
||||
mark: 'kiln-revive',
|
||||
json: desk
|
||||
};
|
||||
}
|
||||
export function kilnBump(force = false, except = []) {
|
||||
return {
|
||||
app: 'hood',
|
||||
mark: 'kiln-bump',
|
||||
json: {
|
||||
force,
|
||||
except
|
||||
}
|
||||
};
|
||||
}
|
||||
export function kilnPause(desk) {
|
||||
return {
|
||||
app: 'hood',
|
||||
mark: 'kiln-pause',
|
||||
json: desk
|
||||
};
|
||||
}
|
||||
export function kilnResume(desk) {
|
||||
return {
|
||||
app: 'hood',
|
||||
mark: 'kiln-resume',
|
||||
json: desk
|
||||
};
|
||||
}
|
||||
export const scryLag = ({ app: 'hood', path: '/kiln/lag' });
|
||||
export function getBlockers(vats) {
|
||||
const blockers = [];
|
||||
const base = vats?.base;
|
||||
if (!base) {
|
||||
return blockers;
|
||||
}
|
||||
const blockedOn = base.arak.rail?.next?.[0]?.weft?.kelvin;
|
||||
if (!blockedOn) {
|
||||
return blockers;
|
||||
}
|
||||
Object.entries(vats)
|
||||
.filter(([desk]) => desk !== 'base')
|
||||
.forEach(([desk, vat]) => {
|
||||
// assuming only %zuse
|
||||
const woofs = vat.arak.rail?.next || [];
|
||||
const kelvins = woofs.map(n => n.weft.kelvin);
|
||||
if (!(kelvins.includes(blockedOn))) {
|
||||
blockers.push(desk);
|
||||
}
|
||||
});
|
||||
return blockers;
|
||||
}
|
||||
export function getVatPublisher(vat) {
|
||||
if (vat.arak.rail) {
|
||||
const { rail } = vat.arak;
|
||||
return (rail?.publisher || rail?.ship || undefined);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
//# sourceMappingURL=lib.js.map
|
1
pkg/npm/api/tmp/hood/lib.js.map
Normal file
1
pkg/npm/api/tmp/hood/lib.js.map
Normal file
@ -0,0 +1 @@
|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,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC;QAC1B,OAAO,CAAC,IAAI,EAAE,SAAS,IAAI,IAAI,EAAE,IAAI,IAAI,SAAS,CAAC,CAAC;KACrD;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
145
pkg/npm/api/tmp/hood/types.d.ts
vendored
Normal file
145
pkg/npm/api/tmp/hood/types.d.ts
vendored
Normal file
@ -0,0 +1,145 @@
|
||||
/**
|
||||
* A pending commit, awaiting a future kelvin version
|
||||
*/
|
||||
interface Woof {
|
||||
aeon: number;
|
||||
weft: Weft;
|
||||
}
|
||||
interface Rein {
|
||||
/**
|
||||
* Agents not in manifest that should be running
|
||||
*/
|
||||
add: string[];
|
||||
/**
|
||||
* Agents in manifest that should not be running
|
||||
*/
|
||||
sub: string[];
|
||||
}
|
||||
export interface Rail {
|
||||
/**
|
||||
* Original publisher of desk, if available
|
||||
*/
|
||||
publisher: string | null;
|
||||
/**
|
||||
* Ship of foreign vat
|
||||
*/
|
||||
ship: string;
|
||||
/**
|
||||
* Desk of foreign vat
|
||||
*/
|
||||
desk: string;
|
||||
/**
|
||||
* Aeon (version number) that we currently have synced
|
||||
*/
|
||||
aeon: number;
|
||||
next: Woof[];
|
||||
paused: boolean;
|
||||
}
|
||||
/**
|
||||
* A tracker of a foreign {@link Vat}
|
||||
*
|
||||
*/
|
||||
export interface Arak {
|
||||
rein: Rein;
|
||||
rail: Rail | null;
|
||||
}
|
||||
/**
|
||||
* A component's kelvin version
|
||||
*/
|
||||
export interface Weft {
|
||||
/**
|
||||
* Name of the component
|
||||
*
|
||||
* @remarks
|
||||
* Usually %zuse, %hoon, or %lull
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Kelvin version
|
||||
*
|
||||
*/
|
||||
kelvin: number;
|
||||
}
|
||||
export interface KilnDiffBlock {
|
||||
block: {
|
||||
desk: string;
|
||||
arak: Arak;
|
||||
weft: Weft;
|
||||
blockers: string[];
|
||||
};
|
||||
}
|
||||
export interface KilnDiffReset {
|
||||
reset: {
|
||||
desk: string;
|
||||
arak: Arak;
|
||||
};
|
||||
}
|
||||
export interface KilnDiffMerge {
|
||||
merge: {
|
||||
desk: string;
|
||||
arak: Arak;
|
||||
};
|
||||
}
|
||||
export interface KilnDiffMergeSunk {
|
||||
'merge-sunk': {
|
||||
desk: string;
|
||||
arak: Arak;
|
||||
tang: string;
|
||||
};
|
||||
}
|
||||
export interface KilnDiffMergeFail {
|
||||
'merge-fail': {
|
||||
desk: string;
|
||||
arak: Arak;
|
||||
tang: string;
|
||||
};
|
||||
}
|
||||
export declare type KilnDiff = KilnDiffBlock | KilnDiffReset | KilnDiffMerge | KilnDiffMergeSunk | KilnDiffMergeFail;
|
||||
/**
|
||||
* Cases for revision
|
||||
*
|
||||
*/
|
||||
export interface Cass {
|
||||
/**
|
||||
* Revision number
|
||||
*/
|
||||
ud: number;
|
||||
/**
|
||||
* Timestamp of revision, as stringifed `@da`
|
||||
*
|
||||
* @remarks
|
||||
* If \@da is outside valid positive unix timestamp, value will be zero
|
||||
*/
|
||||
da: string;
|
||||
}
|
||||
/**
|
||||
* A local desk installation
|
||||
*/
|
||||
export interface Vat {
|
||||
/**
|
||||
* Desk that this Vat describes
|
||||
*/
|
||||
desk: string;
|
||||
/**
|
||||
* Hash of the desk, rendered as `@uv`
|
||||
*
|
||||
* @remarks
|
||||
* Equivalent to
|
||||
* ```hoon
|
||||
* .^(@uv %cz /=desk=)
|
||||
* ```
|
||||
*/
|
||||
hash: string;
|
||||
/**
|
||||
* Current revision
|
||||
*/
|
||||
cass: Cass;
|
||||
/**
|
||||
* Foreign sync
|
||||
*/
|
||||
arak: Arak;
|
||||
}
|
||||
export interface Vats {
|
||||
[desk: string]: Vat;
|
||||
}
|
||||
export {};
|
2
pkg/npm/api/tmp/hood/types.js
Normal file
2
pkg/npm/api/tmp/hood/types.js
Normal file
@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=types.js.map
|
1
pkg/npm/api/tmp/hood/types.js.map
Normal file
1
pkg/npm/api/tmp/hood/types.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../hood/types.ts"],"names":[],"mappings":""}
|
22
pkg/npm/api/tmp/index.d.ts
vendored
Normal file
22
pkg/npm/api/tmp/index.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
export * from './contacts';
|
||||
export * as contacts from './contacts';
|
||||
export * from './graph';
|
||||
export * as graph from './graph';
|
||||
export * from './groups';
|
||||
export * as groups from './groups';
|
||||
export * from './hark';
|
||||
export * as hark from './hark';
|
||||
export * from './invite';
|
||||
export * from './metadata';
|
||||
export * as metadata from './metadata';
|
||||
export * from './settings';
|
||||
export * as settings from './settings';
|
||||
export * from './s3';
|
||||
export * as s3 from './s3';
|
||||
export * from './lib';
|
||||
export * from './lib/BigIntOrderedMap';
|
||||
export * from './lib/BigIntArrayOrderedMap';
|
||||
export * as hood from './hood';
|
||||
export * from './hood';
|
||||
export * as docket from './docket';
|
||||
export * from './docket';
|
25
pkg/npm/api/tmp/index.js
Normal file
25
pkg/npm/api/tmp/index.js
Normal file
@ -0,0 +1,25 @@
|
||||
export * from './contacts';
|
||||
export * as contacts from './contacts';
|
||||
export * from './graph';
|
||||
export * as graph from './graph';
|
||||
export * from './groups';
|
||||
export * as groups from './groups';
|
||||
export * from './hark';
|
||||
export * as hark from './hark';
|
||||
export * from './invite';
|
||||
// this conflicts with /groups/lib invite
|
||||
// export * as invite from './invite';
|
||||
export * from './metadata';
|
||||
export * as metadata from './metadata';
|
||||
export * from './settings';
|
||||
export * as settings from './settings';
|
||||
export * from './s3';
|
||||
export * as s3 from './s3';
|
||||
export * from './lib';
|
||||
export * from './lib/BigIntOrderedMap';
|
||||
export * from './lib/BigIntArrayOrderedMap';
|
||||
export * as hood from './hood';
|
||||
export * from './hood';
|
||||
export * as docket from './docket';
|
||||
export * from './docket';
|
||||
//# sourceMappingURL=index.js.map
|
1
pkg/npm/api/tmp/index.js.map
Normal file
1
pkg/npm/api/tmp/index.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,cAAc,SAAS,CAAC;AACxB,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,cAAc,QAAQ,CAAC;AACvB,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,yCAAyC;AACzC,sCAAsC;AACtC,cAAc,YAAY,CAAC;AAC3B,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,cAAc,MAAM,CAAC;AACrB,OAAO,KAAK,EAAE,MAAM,MAAM,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,cAAc,UAAU,CAAC"}
|
2
pkg/npm/api/tmp/invite/index.d.ts
vendored
Normal file
2
pkg/npm/api/tmp/invite/index.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './types';
|
||||
export * from './lib';
|
3
pkg/npm/api/tmp/invite/index.js
Normal file
3
pkg/npm/api/tmp/invite/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
export * from './types';
|
||||
export * from './lib';
|
||||
//# sourceMappingURL=index.js.map
|
1
pkg/npm/api/tmp/invite/index.js.map
Normal file
1
pkg/npm/api/tmp/invite/index.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../invite/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC"}
|
5
pkg/npm/api/tmp/invite/lib.d.ts
vendored
Normal file
5
pkg/npm/api/tmp/invite/lib.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import { Poke, Serial } from "../lib";
|
||||
import { InviteUpdate, InviteUpdateAccept, InviteUpdateDecline } from "./types";
|
||||
export declare const inviteAction: <T extends InviteUpdate>(data: T) => Poke<T>;
|
||||
export declare const accept: (app: string, uid: Serial) => Poke<InviteUpdateAccept>;
|
||||
export declare const decline: (app: string, uid: Serial) => Poke<InviteUpdateDecline>;
|
18
pkg/npm/api/tmp/invite/lib.js
Normal file
18
pkg/npm/api/tmp/invite/lib.js
Normal file
@ -0,0 +1,18 @@
|
||||
export const inviteAction = (data) => ({
|
||||
app: 'invite-store',
|
||||
mark: 'invite-action',
|
||||
json: data
|
||||
});
|
||||
export const accept = (app, uid) => inviteAction({
|
||||
accept: {
|
||||
term: app,
|
||||
uid
|
||||
}
|
||||
});
|
||||
export const decline = (app, uid) => inviteAction({
|
||||
decline: {
|
||||
term: app,
|
||||
uid
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=lib.js.map
|
1
pkg/npm/api/tmp/invite/lib.js.map
Normal file
1
pkg/npm/api/tmp/invite/lib.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../invite/lib.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAyB,IAAO,EAAW,EAAE,CAAC,CAAC;IACzE,GAAG,EAAE,cAAc;IACnB,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,IAAI;CACX,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,GAAW,EACX,GAAW,EACe,EAAE,CAAC,YAAY,CAAC;IAC1C,MAAM,EAAE;QACN,IAAI,EAAE,GAAG;QACT,GAAG;KACJ;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,GAAW,EACX,GAAW,EACgB,EAAE,CAAC,YAAY,CAAC;IAC3C,OAAO,EAAE;QACP,IAAI,EAAE,GAAG;QACT,GAAG;KACJ;CACF,CAAC,CAAC"}
|
54
pkg/npm/api/tmp/invite/types.d.ts
vendored
Normal file
54
pkg/npm/api/tmp/invite/types.d.ts
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
import { Serial, PatpNoSig, Path } from '../lib';
|
||||
import { Resource } from "../groups";
|
||||
export declare type InviteUpdate = InviteUpdateInitial | InviteUpdateCreate | InviteUpdateDelete | InviteUpdateInvite | InviteUpdateAccept | InviteUpdateAccepted | InviteUpdateDecline;
|
||||
export interface InviteUpdateAccept {
|
||||
accept: {
|
||||
term: string;
|
||||
uid: Serial;
|
||||
};
|
||||
}
|
||||
export interface InviteUpdateInitial {
|
||||
initial: Invites;
|
||||
}
|
||||
export interface InviteUpdateCreate {
|
||||
create: {
|
||||
term: string;
|
||||
};
|
||||
}
|
||||
export interface InviteUpdateDelete {
|
||||
delete: {
|
||||
term: string;
|
||||
};
|
||||
}
|
||||
export interface InviteUpdateInvite {
|
||||
invite: {
|
||||
term: string;
|
||||
uid: Serial;
|
||||
invite: Invite;
|
||||
};
|
||||
}
|
||||
export interface InviteUpdateAccepted {
|
||||
accepted: {
|
||||
term: string;
|
||||
uid: Serial;
|
||||
};
|
||||
}
|
||||
export interface InviteUpdateDecline {
|
||||
decline: {
|
||||
term: string;
|
||||
uid: Serial;
|
||||
};
|
||||
}
|
||||
export declare type Invites = {
|
||||
[p in Path]: AppInvites;
|
||||
};
|
||||
export declare type AppInvites = {
|
||||
[s in Serial]: Invite;
|
||||
};
|
||||
export interface Invite {
|
||||
app: string;
|
||||
recipient: PatpNoSig;
|
||||
resource: Resource;
|
||||
ship: PatpNoSig;
|
||||
text: string;
|
||||
}
|
2
pkg/npm/api/tmp/invite/types.js
Normal file
2
pkg/npm/api/tmp/invite/types.js
Normal file
@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=types.js.map
|
1
pkg/npm/api/tmp/invite/types.js.map
Normal file
1
pkg/npm/api/tmp/invite/types.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../invite/types.ts"],"names":[],"mappings":""}
|
24
pkg/npm/api/tmp/lib/BigIntArrayOrderedMap.d.ts
vendored
Normal file
24
pkg/npm/api/tmp/lib/BigIntArrayOrderedMap.d.ts
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
import { immerable } from 'immer';
|
||||
import bigInt, { BigInteger } from 'big-integer';
|
||||
export declare function stringToArr(str: string): bigInt.BigInteger[];
|
||||
export declare function arrToString(arr: BigInteger[]): string;
|
||||
export declare function sortBigIntArr(a: BigInteger[], b: BigInteger[]): number;
|
||||
export declare class BigIntArrayOrderedMap<V> implements Iterable<[BigInteger[], V]> {
|
||||
root: Record<string, V>;
|
||||
cachedIter: [BigInteger[], V][] | null;
|
||||
[immerable]: boolean;
|
||||
reversed: boolean;
|
||||
constructor(items?: [BigInteger[], V][], reversed?: boolean);
|
||||
get size(): number;
|
||||
get(key: BigInteger[]): V;
|
||||
gas(items: [BigInteger[], V][]): this;
|
||||
set(key: BigInteger[], value: V): this;
|
||||
clear(): this;
|
||||
has(key: BigInteger[]): boolean;
|
||||
delete(key: BigInteger[]): this;
|
||||
[Symbol.iterator](): IterableIterator<[BigInteger[], V]>;
|
||||
peekLargest(): [bigInt.BigInteger[], V];
|
||||
peekSmallest(): [bigInt.BigInteger[], V];
|
||||
keys(): bigInt.BigInteger[][];
|
||||
generateCachedIter(): [bigInt.BigInteger[], V][];
|
||||
}
|
131
pkg/npm/api/tmp/lib/BigIntArrayOrderedMap.js
Normal file
131
pkg/npm/api/tmp/lib/BigIntArrayOrderedMap.js
Normal file
@ -0,0 +1,131 @@
|
||||
import produce, { immerable, castDraft, setAutoFreeze, enablePatches } from 'immer';
|
||||
import bigInt from 'big-integer';
|
||||
setAutoFreeze(false);
|
||||
enablePatches();
|
||||
export function stringToArr(str) {
|
||||
return str.split('/').slice(1).map((ind) => {
|
||||
return bigInt(ind);
|
||||
});
|
||||
}
|
||||
export function arrToString(arr) {
|
||||
let string = '';
|
||||
arr.forEach((key) => {
|
||||
string = string + `/${key.toString()}`;
|
||||
});
|
||||
return string;
|
||||
}
|
||||
function sorted(a, b, reversed = false) {
|
||||
const getSort = sortBigIntArr(a, b);
|
||||
if (reversed) {
|
||||
return getSort * -1;
|
||||
}
|
||||
else {
|
||||
return getSort;
|
||||
}
|
||||
}
|
||||
export function sortBigIntArr(a, b) {
|
||||
const aLen = a.length;
|
||||
const bLen = b.length;
|
||||
const aCop = a.slice(0);
|
||||
const bCop = b.slice(0);
|
||||
aCop.reverse();
|
||||
bCop.reverse();
|
||||
let i = 0;
|
||||
while (i < aLen && i < bLen) {
|
||||
if (aCop[i].lt(bCop[i])) {
|
||||
return 1;
|
||||
}
|
||||
else if (aCop[i].gt(bCop[i])) {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return bLen - aLen;
|
||||
}
|
||||
export class BigIntArrayOrderedMap {
|
||||
root = {};
|
||||
cachedIter = null;
|
||||
[immerable] = true;
|
||||
reversed = false;
|
||||
constructor(items = [], reversed = false) {
|
||||
items.forEach(([key, val]) => {
|
||||
this.set(key, val);
|
||||
});
|
||||
this.reversed = reversed;
|
||||
}
|
||||
get size() {
|
||||
return Object.keys(this.root).length;
|
||||
}
|
||||
get(key) {
|
||||
return this.root[arrToString(key)] ?? null;
|
||||
}
|
||||
gas(items) {
|
||||
return produce(this, (draft) => {
|
||||
items.forEach(([key, value]) => {
|
||||
draft.root[arrToString(key)] = castDraft(value);
|
||||
});
|
||||
draft.generateCachedIter();
|
||||
}, (patches) => {
|
||||
// console.log(`gassed with ${JSON.stringify(patches, null, 2)}`);
|
||||
});
|
||||
}
|
||||
set(key, value) {
|
||||
return produce(this, (draft) => {
|
||||
draft.root[arrToString(key)] = castDraft(value);
|
||||
draft.cachedIter = null;
|
||||
});
|
||||
}
|
||||
clear() {
|
||||
return produce(this, (draft) => {
|
||||
draft.cachedIter = [];
|
||||
draft.root = {};
|
||||
});
|
||||
}
|
||||
has(key) {
|
||||
return arrToString(key) in this.root;
|
||||
}
|
||||
delete(key) {
|
||||
const result = produce(this, (draft) => {
|
||||
delete draft.root[arrToString(key)];
|
||||
draft.cachedIter = null;
|
||||
});
|
||||
return result;
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
let idx = 0;
|
||||
const result = this.generateCachedIter();
|
||||
return {
|
||||
[Symbol.iterator]: this[Symbol.iterator],
|
||||
next: () => {
|
||||
if (idx < result.length) {
|
||||
return { value: result[idx++], done: false };
|
||||
}
|
||||
return { done: true, value: null };
|
||||
}
|
||||
};
|
||||
}
|
||||
peekLargest() {
|
||||
const sorted = Array.from(this);
|
||||
return sorted[0];
|
||||
}
|
||||
peekSmallest() {
|
||||
const sorted = Array.from(this);
|
||||
return sorted[sorted.length - 1];
|
||||
}
|
||||
keys() {
|
||||
return Array.from(this).map(([k, v]) => k);
|
||||
}
|
||||
generateCachedIter() {
|
||||
if (this.cachedIter) {
|
||||
return [...this.cachedIter];
|
||||
}
|
||||
const result = Object.keys(this.root).map((key) => {
|
||||
return [stringToArr(key), this.root[key]];
|
||||
}).sort(([a], [b]) => sorted(a, b, this.reversed));
|
||||
this.cachedIter = result;
|
||||
return [...result];
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=BigIntArrayOrderedMap.js.map
|
1
pkg/npm/api/tmp/lib/BigIntArrayOrderedMap.js.map
Normal file
1
pkg/npm/api/tmp/lib/BigIntArrayOrderedMap.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"BigIntArrayOrderedMap.js","sourceRoot":"","sources":["../../lib/BigIntArrayOrderedMap.ts"],"names":[],"mapp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CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QACnD,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;QACzB,OAAO,CAAC,GAAG,MAAM,CAAC,CAAC;IACrB,CAAC;CACF"}
|
20
pkg/npm/api/tmp/lib/BigIntOrderedMap.d.ts
vendored
Normal file
20
pkg/npm/api/tmp/lib/BigIntOrderedMap.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
import { immerable } from 'immer';
|
||||
import bigInt, { BigInteger } from 'big-integer';
|
||||
export declare class BigIntOrderedMap<V> implements Iterable<[BigInteger, V]> {
|
||||
root: Record<string, V>;
|
||||
cachedIter: [BigInteger, V][] | null;
|
||||
[immerable]: boolean;
|
||||
constructor(items?: [BigInteger, V][]);
|
||||
get size(): number;
|
||||
get(key: BigInteger): V;
|
||||
gas(items: [BigInteger, V][]): this;
|
||||
set(key: BigInteger, value: V): this;
|
||||
clear(): this;
|
||||
has(key: BigInteger): boolean;
|
||||
delete(key: BigInteger): this;
|
||||
[Symbol.iterator](): IterableIterator<[BigInteger, V]>;
|
||||
peekLargest(): [bigInt.BigInteger, V];
|
||||
peekSmallest(): [bigInt.BigInteger, V];
|
||||
keys(): bigInt.BigInteger[];
|
||||
generateCachedIter(): [bigInt.BigInteger, V][];
|
||||
}
|
102
pkg/npm/api/tmp/lib/BigIntOrderedMap.js
Normal file
102
pkg/npm/api/tmp/lib/BigIntOrderedMap.js
Normal file
@ -0,0 +1,102 @@
|
||||
import produce, { immerable, castDraft, setAutoFreeze, enablePatches } from 'immer';
|
||||
import bigInt from 'big-integer';
|
||||
setAutoFreeze(false);
|
||||
enablePatches();
|
||||
function sortBigInt(a, b) {
|
||||
if (a.lt(b)) {
|
||||
return 1;
|
||||
}
|
||||
else if (a.eq(b)) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
export class BigIntOrderedMap {
|
||||
root = {};
|
||||
cachedIter = null;
|
||||
[immerable] = true;
|
||||
constructor(items = []) {
|
||||
items.forEach(([key, val]) => {
|
||||
this.set(key, val);
|
||||
});
|
||||
}
|
||||
get size() {
|
||||
if (this.cachedIter) {
|
||||
return this.cachedIter.length;
|
||||
}
|
||||
return this.generateCachedIter().length;
|
||||
}
|
||||
get(key) {
|
||||
return this.root[key.toString()] ?? null;
|
||||
}
|
||||
gas(items) {
|
||||
return produce(this, (draft) => {
|
||||
items.forEach(([key, value]) => {
|
||||
draft.root[key.toString()] = castDraft(value);
|
||||
});
|
||||
draft.cachedIter = null;
|
||||
}, (patches) => {
|
||||
// console.log(`gassed with ${JSON.stringify(patches, null, 2)}`);
|
||||
});
|
||||
}
|
||||
set(key, value) {
|
||||
return produce(this, (draft) => {
|
||||
draft.root[key.toString()] = castDraft(value);
|
||||
draft.cachedIter = null;
|
||||
});
|
||||
}
|
||||
clear() {
|
||||
return produce(this, (draft) => {
|
||||
draft.cachedIter = [];
|
||||
draft.root = {};
|
||||
});
|
||||
}
|
||||
has(key) {
|
||||
return key.toString() in this.root;
|
||||
}
|
||||
delete(key) {
|
||||
const result = produce(this, (draft) => {
|
||||
delete draft.root[key.toString()];
|
||||
draft.cachedIter = null;
|
||||
});
|
||||
return result;
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
let idx = 0;
|
||||
const result = this.generateCachedIter();
|
||||
return {
|
||||
[Symbol.iterator]: this[Symbol.iterator],
|
||||
next: () => {
|
||||
if (idx < result.length) {
|
||||
return { value: result[idx++], done: false };
|
||||
}
|
||||
return { done: true, value: null };
|
||||
}
|
||||
};
|
||||
}
|
||||
peekLargest() {
|
||||
const sorted = Array.from(this);
|
||||
return sorted[0];
|
||||
}
|
||||
peekSmallest() {
|
||||
const sorted = Array.from(this);
|
||||
return sorted[sorted.length - 1];
|
||||
}
|
||||
keys() {
|
||||
return Array.from(this).map(([k, v]) => k);
|
||||
}
|
||||
generateCachedIter() {
|
||||
if (this.cachedIter) {
|
||||
return [...this.cachedIter];
|
||||
}
|
||||
const result = Object.keys(this.root).map((key) => {
|
||||
const num = bigInt(key);
|
||||
return [num, this.root[key]];
|
||||
}).sort(([a], [b]) => sortBigInt(a, b));
|
||||
this.cachedIter = result;
|
||||
return [...result];
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=BigIntOrderedMap.js.map
|
1
pkg/npm/api/tmp/lib/BigIntOrderedMap.js.map
Normal file
1
pkg/npm/api/tmp/lib/BigIntOrderedMap.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"BigIntOrderedMap.js","sourceRoot":"","sources":["../../lib/BigIntOrderedMap.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACpF,OAAO,MAAsB,MAAM,aAAa,CAAC;AAEjD,aAAa,CAAC,KAAK,CAAC,CAAC;AAErB,aAAa,EAAE,CAAC;AAEhB,SAAS,UAAU,CAAC,CAAa,EAAE,CAAa;IAC9C,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;QACX,OAAO,CAAC,CAAC;KACV;SAAM,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;QAClB,OAAO,CAAC,CAAC;KACV;SAAM;QACL,OAAO,CAAC,CAAC,CAAC;KACX;AACH,CAAC;AACD,MAAM,OAAO,gBAAgB;IAC3B,IAAI,GAAsB,EAAE,CAAA;IAC5B,UAAU,GAA6B,IAAI,CAAC;IAC5C,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IAEnB,YAAY,QAA2B,EAAE;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE;YAC3B,IAAI,CAAC,GAAG,CAAC,GAAG,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AAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED,kBAAkB;QAChB,IAAG,IAAI,CAAC,UAAU,EAAE;YAClB,OAAO,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;SAC7B;QACD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YAChD,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YACxB,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAoB,CAAC;QAClD,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,CAAC;QACvC,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;QACzB,OAAO,CAAC,GAAG,MAAM,CAAC,CAAC;IACrB,CAAC;CACF"}
|
2
pkg/npm/api/tmp/lib/index.d.ts
vendored
Normal file
2
pkg/npm/api/tmp/lib/index.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './lib';
|
||||
export * from './types';
|
3
pkg/npm/api/tmp/lib/index.js
Normal file
3
pkg/npm/api/tmp/lib/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
export * from './lib';
|
||||
export * from './types';
|
||||
//# sourceMappingURL=index.js.map
|
1
pkg/npm/api/tmp/lib/index.js.map
Normal file
1
pkg/npm/api/tmp/lib/index.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC"}
|
33
pkg/npm/api/tmp/lib/lib.d.ts
vendored
Normal file
33
pkg/npm/api/tmp/lib/lib.d.ts
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
import { BigInteger } from "big-integer";
|
||||
import { Resource } from "../groups/types";
|
||||
import { Post, GraphNode } from "../graph/types";
|
||||
/**
|
||||
* Given a bigint representing an urbit date, returns a unix timestamp.
|
||||
*
|
||||
* @param {BigInteger} da The urbit date
|
||||
*
|
||||
* @return {number} The unix timestamp
|
||||
*/
|
||||
export declare function daToUnix(da: BigInteger): number;
|
||||
/**
|
||||
* Given a unix timestamp, returns a bigint representing an urbit date
|
||||
*
|
||||
* @param {number} unix The unix timestamp
|
||||
*
|
||||
* @return {BigInteger} The urbit date
|
||||
*/
|
||||
export declare function unixToDa(unix: number): BigInteger;
|
||||
export declare function makePatDa(patda: string): BigInteger;
|
||||
export declare function udToDec(ud: string): string;
|
||||
export declare function decToUd(str: string): string;
|
||||
export declare function resourceAsPath(resource: Resource): string;
|
||||
export declare function uuid(): string;
|
||||
export declare function daToDate(st: string): Date;
|
||||
export declare function dateToDa(d: Date, mil?: boolean): string;
|
||||
export declare function deSig(ship: string): string | null;
|
||||
export declare function cite(ship: string): string;
|
||||
export declare function uxToHex(ux: string): string;
|
||||
export declare const hexToUx: (hex: string) => string;
|
||||
export declare function stringToTa(str: string): string;
|
||||
export declare const buntPost: () => Post;
|
||||
export declare function makeNodeMap(posts: Post[]): Record<string, GraphNode>;
|
207
pkg/npm/api/tmp/lib/lib.js
Normal file
207
pkg/npm/api/tmp/lib/lib.js
Normal file
@ -0,0 +1,207 @@
|
||||
import bigInt from "big-integer";
|
||||
const DA_UNIX_EPOCH = bigInt("170141184475152167957503069145530368000"); // `@ud` ~1970.1.1
|
||||
const DA_SECOND = bigInt("18446744073709551616"); // `@ud` ~s1
|
||||
function chunk(arr, size) {
|
||||
let chunk = [];
|
||||
let newArray = [chunk];
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
if (chunk.length < size) {
|
||||
chunk.push(arr[i]);
|
||||
}
|
||||
else {
|
||||
chunk = [arr[i]];
|
||||
newArray.push(chunk);
|
||||
}
|
||||
}
|
||||
return newArray;
|
||||
}
|
||||
function dropWhile(arr, pred) {
|
||||
const newArray = arr.slice();
|
||||
for (const item of arr) {
|
||||
if (pred(item)) {
|
||||
newArray.shift();
|
||||
}
|
||||
else {
|
||||
return newArray;
|
||||
}
|
||||
}
|
||||
return newArray;
|
||||
}
|
||||
/**
|
||||
* Given a bigint representing an urbit date, returns a unix timestamp.
|
||||
*
|
||||
* @param {BigInteger} da The urbit date
|
||||
*
|
||||
* @return {number} The unix timestamp
|
||||
*/
|
||||
export function daToUnix(da) {
|
||||
// ported from +time:enjs:format in hoon.hoon
|
||||
const offset = DA_SECOND.divide(bigInt(2000));
|
||||
const epochAdjusted = offset.add(da.subtract(DA_UNIX_EPOCH));
|
||||
return Math.round(epochAdjusted.multiply(bigInt(1000)).divide(DA_SECOND).toJSNumber());
|
||||
}
|
||||
/**
|
||||
* Given a unix timestamp, returns a bigint representing an urbit date
|
||||
*
|
||||
* @param {number} unix The unix timestamp
|
||||
*
|
||||
* @return {BigInteger} The urbit date
|
||||
*/
|
||||
export function unixToDa(unix) {
|
||||
const timeSinceEpoch = bigInt(unix).multiply(DA_SECOND).divide(bigInt(1000));
|
||||
return DA_UNIX_EPOCH.add(timeSinceEpoch);
|
||||
}
|
||||
export function makePatDa(patda) {
|
||||
return bigInt(udToDec(patda));
|
||||
}
|
||||
export function udToDec(ud) {
|
||||
return ud.replace(/\./g, "");
|
||||
}
|
||||
export function decToUd(str) {
|
||||
const transform = chunk(str.split('').reverse(), 3)
|
||||
.map(group => group.reverse().join(''))
|
||||
.reverse()
|
||||
.join('.');
|
||||
return transform.replace(/^[0\.]+/g, '');
|
||||
}
|
||||
export function resourceAsPath(resource) {
|
||||
const { name, ship } = resource;
|
||||
return `/ship/~${ship}/${name}`;
|
||||
}
|
||||
export function uuid() {
|
||||
let str = "0v";
|
||||
str += Math.ceil(Math.random() * 8) + ".";
|
||||
for (let i = 0; i < 5; i++) {
|
||||
let _str = Math.ceil(Math.random() * 10000000).toString(32);
|
||||
_str = ("00000" + _str).substr(-5, 5);
|
||||
str += _str + ".";
|
||||
}
|
||||
return str.slice(0, -1);
|
||||
}
|
||||
/*
|
||||
Goes from:
|
||||
~2018.7.17..23.15.09..5be5 // urbit @da
|
||||
To:
|
||||
(javascript Date object)
|
||||
*/
|
||||
export function daToDate(st) {
|
||||
const dub = function (n) {
|
||||
return parseInt(n) < 10 ? "0" + parseInt(n) : n.toString();
|
||||
};
|
||||
const da = st.split("..");
|
||||
const bigEnd = da[0].split(".");
|
||||
const lilEnd = da[1].split(".");
|
||||
const ds = `${bigEnd[0].slice(1)}-${dub(bigEnd[1])}-${dub(bigEnd[2])}T${dub(lilEnd[0])}:${dub(lilEnd[1])}:${dub(lilEnd[2])}Z`;
|
||||
return new Date(ds);
|
||||
}
|
||||
/*
|
||||
Goes from:
|
||||
(javascript Date object)
|
||||
To:
|
||||
~2018.7.17..23.15.09..5be5 // urbit @da
|
||||
*/
|
||||
export function dateToDa(d, mil = false) {
|
||||
const fil = function (n) {
|
||||
return n >= 10 ? n : "0" + n;
|
||||
};
|
||||
return (`~${d.getUTCFullYear()}.` +
|
||||
`${d.getUTCMonth() + 1}.` +
|
||||
`${fil(d.getUTCDate())}..` +
|
||||
`${fil(d.getUTCHours())}.` +
|
||||
`${fil(d.getUTCMinutes())}.` +
|
||||
`${fil(d.getUTCSeconds())}` +
|
||||
`${mil ? "..0000" : ""}`);
|
||||
}
|
||||
export function deSig(ship) {
|
||||
if (!ship) {
|
||||
return null;
|
||||
}
|
||||
return ship.replace("~", "");
|
||||
}
|
||||
// trim patps to match dojo, chat-cli
|
||||
export function cite(ship) {
|
||||
let patp = ship, shortened = '';
|
||||
if (patp === null || patp === '') {
|
||||
return null;
|
||||
}
|
||||
if (patp.startsWith('~')) {
|
||||
patp = patp.substr(1);
|
||||
}
|
||||
// comet
|
||||
if (patp.length === 56) {
|
||||
shortened = '~' + patp.slice(0, 6) + '_' + patp.slice(50, 56);
|
||||
return shortened;
|
||||
}
|
||||
// moon
|
||||
if (patp.length === 27) {
|
||||
shortened = '~' + patp.slice(14, 20) + '^' + patp.slice(21, 27);
|
||||
return shortened;
|
||||
}
|
||||
return `~${patp}`;
|
||||
}
|
||||
export function uxToHex(ux) {
|
||||
if (ux.length > 2 && ux.substr(0, 2) === '0x') {
|
||||
const value = ux.substr(2).replace('.', '').padStart(6, '0');
|
||||
return value;
|
||||
}
|
||||
const value = ux.replace('.', '').padStart(6, '0');
|
||||
return value;
|
||||
}
|
||||
export const hexToUx = (hex) => {
|
||||
const nonZeroChars = dropWhile(hex.split(''), y => y === '0');
|
||||
const ux = chunk(nonZeroChars.reverse(), 4).map(x => {
|
||||
return x.reverse().join('');
|
||||
}).reverse().join('.') || '0';
|
||||
return `0x${ux}`;
|
||||
};
|
||||
// encode the string into @ta-safe format, using logic from +wood.
|
||||
// for example, 'some Chars!' becomes '~.some.~43.hars~21.'
|
||||
//
|
||||
export function stringToTa(str) {
|
||||
let out = "";
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
const char = str[i];
|
||||
let add = "";
|
||||
switch (char) {
|
||||
case " ":
|
||||
add = ".";
|
||||
break;
|
||||
case ".":
|
||||
add = "~.";
|
||||
break;
|
||||
case "~":
|
||||
add = "~~";
|
||||
break;
|
||||
default:
|
||||
const charCode = str.charCodeAt(i);
|
||||
if ((charCode >= 97 && charCode <= 122) || // a-z
|
||||
(charCode >= 48 && charCode <= 57) || // 0-9
|
||||
char === "-") {
|
||||
add = char;
|
||||
}
|
||||
else {
|
||||
// TODO behavior for unicode doesn't match +wood's,
|
||||
// but we can probably get away with that for now.
|
||||
add = "~" + charCode.toString(16) + ".";
|
||||
}
|
||||
}
|
||||
out = out + add;
|
||||
}
|
||||
return "~." + out;
|
||||
}
|
||||
export const buntPost = () => ({
|
||||
author: '',
|
||||
contents: [],
|
||||
hash: null,
|
||||
index: '',
|
||||
signatures: [],
|
||||
'time-sent': 0
|
||||
});
|
||||
export function makeNodeMap(posts) {
|
||||
const nodes = {};
|
||||
posts.forEach((p) => {
|
||||
nodes[String(p.index)] = { children: null, post: p };
|
||||
});
|
||||
return nodes;
|
||||
}
|
||||
//# sourceMappingURL=lib.js.map
|
1
pkg/npm/api/tmp/lib/lib.js.map
Normal file
1
pkg/npm/api/tmp/lib/lib.js.map
Normal file
File diff suppressed because one or more lines are too long
42
pkg/npm/api/tmp/lib/types.d.ts
vendored
Normal file
42
pkg/npm/api/tmp/lib/types.d.ts
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Martian embassy
|
||||
*/
|
||||
import { BigIntOrderedMap } from "./BigIntOrderedMap";
|
||||
export declare type Path = string;
|
||||
export declare type Patp = string;
|
||||
export declare type PatpNoSig = string;
|
||||
export declare type Serial = string;
|
||||
export declare type Jug<K, V> = Map<K, Set<V>>;
|
||||
export declare type AppName = 'chat' | 'link' | 'contacts' | 'publish' | 'graph' | 'groups';
|
||||
export declare type ShipRank = 'czar' | 'king' | 'duke' | 'earl' | 'pawn';
|
||||
export declare type Action = 'poke' | 'subscribe' | 'ack' | 'unsubscribe' | 'delete';
|
||||
export declare type SetElement<S> = S extends Set<(infer T)> ? T : never;
|
||||
export declare type MapKey<M> = M extends Map<(infer K), any> ? K : never;
|
||||
export declare type MapValue<M> = M extends Map<any, (infer V)> ? V : never;
|
||||
/**
|
||||
* Turns sets into arrays and maps into objects so we can send them over the wire
|
||||
*/
|
||||
export declare type Enc<S> = S extends Set<any> ? Enc<SetElement<S>>[] : S extends Map<string, any> ? {
|
||||
[s: string]: Enc<MapValue<S>>;
|
||||
} : S extends object ? {
|
||||
[K in keyof S]: Enc<S[K]>;
|
||||
} : S extends BigIntOrderedMap<infer T> ? {
|
||||
[index: string]: T;
|
||||
} : S;
|
||||
export declare type Mark = string;
|
||||
export interface Poke<Action> {
|
||||
ship?: string;
|
||||
app: string;
|
||||
mark: Mark;
|
||||
json: Action;
|
||||
}
|
||||
export interface Scry {
|
||||
app: string;
|
||||
path: string;
|
||||
}
|
||||
export interface Thread<Action> {
|
||||
inputMark: string;
|
||||
outputMark: string;
|
||||
threadName: string;
|
||||
body: Action;
|
||||
}
|
5
pkg/npm/api/tmp/lib/types.js
Normal file
5
pkg/npm/api/tmp/lib/types.js
Normal file
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* Martian embassy
|
||||
*/
|
||||
export {};
|
||||
//# sourceMappingURL=types.js.map
|
1
pkg/npm/api/tmp/lib/types.js.map
Normal file
1
pkg/npm/api/tmp/lib/types.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../lib/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
2
pkg/npm/api/tmp/metadata/index.d.ts
vendored
Normal file
2
pkg/npm/api/tmp/metadata/index.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './types';
|
||||
export * from './lib';
|
3
pkg/npm/api/tmp/metadata/index.js
Normal file
3
pkg/npm/api/tmp/metadata/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
export * from './types';
|
||||
export * from './lib';
|
||||
//# sourceMappingURL=index.js.map
|
1
pkg/npm/api/tmp/metadata/index.js.map
Normal file
1
pkg/npm/api/tmp/metadata/index.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../metadata/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC"}
|
15
pkg/npm/api/tmp/metadata/lib.d.ts
vendored
Normal file
15
pkg/npm/api/tmp/metadata/lib.d.ts
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
import { Path, Poke, PatpNoSig } from '../lib';
|
||||
import { MdAppName, Association, Metadata, MetadataUpdate, MetadataUpdateAdd, MetadataUpdateRemove, MetadataEditField, MetadataUpdateEdit } from './types';
|
||||
export declare const METADATA_UPDATE_VERSION = 2;
|
||||
export declare const metadataAction: <T extends MetadataUpdate>(data: T, version?: number) => Poke<T>;
|
||||
export declare const add: (ship: PatpNoSig, appName: MdAppName, resource: Path, group: Path, title: string, description: string, dateCreated: string, color: string, moduleName: string) => Poke<MetadataUpdateAdd>;
|
||||
export { add as metadataAdd };
|
||||
export declare const remove: (appName: MdAppName, resource: string, group: string) => Poke<MetadataUpdateRemove>;
|
||||
export { remove as metadataRemove };
|
||||
export declare const edit: (association: Association, edit: MetadataEditField) => Poke<MetadataUpdateEdit>;
|
||||
export { edit as metadataEdit };
|
||||
/**
|
||||
* @deprecated use {@link edit} instead
|
||||
*/
|
||||
export declare const update: (association: Association, newMetadata: Partial<Metadata>) => Poke<MetadataUpdateAdd>;
|
||||
export { update as metadataUpdate };
|
69
pkg/npm/api/tmp/metadata/lib.js
Normal file
69
pkg/npm/api/tmp/metadata/lib.js
Normal file
@ -0,0 +1,69 @@
|
||||
import { uxToHex } from '../lib';
|
||||
export const METADATA_UPDATE_VERSION = 2;
|
||||
export const metadataAction = (data, version = METADATA_UPDATE_VERSION) => ({
|
||||
app: 'metadata-push-hook',
|
||||
mark: `metadata-update-${version}`,
|
||||
json: data
|
||||
});
|
||||
export const add = (ship, appName, resource, group, title, description, dateCreated, color, moduleName) => metadataAction({
|
||||
add: {
|
||||
group,
|
||||
resource: {
|
||||
resource,
|
||||
'app-name': appName
|
||||
},
|
||||
metadata: {
|
||||
title,
|
||||
description,
|
||||
color,
|
||||
'date-created': dateCreated,
|
||||
creator: `~${ship}`,
|
||||
config: { graph: moduleName },
|
||||
picture: '',
|
||||
hidden: false,
|
||||
preview: false,
|
||||
vip: ''
|
||||
}
|
||||
}
|
||||
});
|
||||
export { add as metadataAdd };
|
||||
export const remove = (appName, resource, group) => metadataAction({
|
||||
remove: {
|
||||
group,
|
||||
resource: {
|
||||
resource,
|
||||
'app-name': appName
|
||||
}
|
||||
}
|
||||
});
|
||||
export { remove as metadataRemove };
|
||||
export const edit = (association, edit) => metadataAction({
|
||||
edit: {
|
||||
group: association.group,
|
||||
resource: {
|
||||
resource: association.resource,
|
||||
'app-name': association['app-name']
|
||||
},
|
||||
edit
|
||||
}
|
||||
});
|
||||
export { edit as metadataEdit };
|
||||
/**
|
||||
* @deprecated use {@link edit} instead
|
||||
*/
|
||||
export const update = (association, newMetadata) => {
|
||||
const metadata = { ...association.metadata, ...newMetadata };
|
||||
metadata.color = uxToHex(metadata.color);
|
||||
return metadataAction({
|
||||
add: {
|
||||
group: association.group,
|
||||
resource: {
|
||||
resource: association.resource,
|
||||
'app-name': association['app-name']
|
||||
},
|
||||
metadata
|
||||
}
|
||||
});
|
||||
};
|
||||
export { update as metadataUpdate };
|
||||
//# sourceMappingURL=lib.js.map
|
1
pkg/npm/api/tmp/metadata/lib.js.map
Normal file
1
pkg/npm/api/tmp/metadata/lib.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../metadata/lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,OAAO,EAAa,MAAM,QAAQ,CAAC;AAGxD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAEzC,MAAM,CAAC,MAAM,cAAc,GAAG,CAA2B,IAAO,EAAE,UAAkB,uBAAuB,EAAW,EAAE,CAAC,CAAC;IACxH,GAAG,EAAE,oBAAoB;IACzB,IAAI,EAAE,mBAAmB,OAAO,EAAE;IAClC,IAAI,EAAE,IAAI;CACX,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,GAAG,GAAG,CACjB,IAAe,EACf,OAAkB,EAClB,QAAc,EACd,KAAW,EACX,KAAa,EACb,WAAmB,EACnB,WAAmB,EACnB,KAAa,EACb,UAAkB,EACO,EAAE,CAAC,cAAc,CAAC;IAC3C,GAAG,EAAE;QACH,KAAK;QACL,QAAQ,EAAE;YACR,QAAQ;YACR,UAAU,EAAE,OAAO;SACpB;QACD,QAAQ,EAAE;YACR,KAAK;YACL,WAAW;YACX,KAAK;YACL,cAAc,EAAE,WAAW;YAC3B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gBAC9B,UAAU,EAAE,WAAW,CAAC,UAAU,CAAC;aACpC;YACD,QAAQ;SACT;KACF,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,CAAC"}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user