@welshman/app 0.6.8 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/src/blossom.d.ts +7 -5
- package/dist/app/src/blossom.d.ts.map +1 -1
- package/dist/app/src/blossom.js +12 -11
- package/dist/app/src/blossom.js.map +1 -1
- package/dist/app/src/commands.d.ts +2 -2
- package/dist/app/src/commands.d.ts.map +1 -1
- package/dist/app/src/commands.js +29 -29
- package/dist/app/src/commands.js.map +1 -1
- package/dist/app/src/core.d.ts +0 -6
- package/dist/app/src/core.d.ts.map +1 -1
- package/dist/app/src/core.js +0 -33
- package/dist/app/src/core.js.map +1 -1
- package/dist/app/src/feeds.d.ts.map +1 -1
- package/dist/app/src/feeds.js +5 -4
- package/dist/app/src/feeds.js.map +1 -1
- package/dist/app/src/follows.d.ts +8 -5
- package/dist/app/src/follows.d.ts.map +1 -1
- package/dist/app/src/follows.js +12 -10
- package/dist/app/src/follows.js.map +1 -1
- package/dist/app/src/handles.d.ts +14 -5
- package/dist/app/src/handles.d.ts.map +1 -1
- package/dist/app/src/handles.js +46 -37
- package/dist/app/src/handles.js.map +1 -1
- package/dist/app/src/index.d.ts +2 -2
- package/dist/app/src/index.d.ts.map +1 -1
- package/dist/app/src/index.js +12 -12
- package/dist/app/src/index.js.map +1 -1
- package/dist/app/src/messagingRelayLists.d.ts +9 -0
- package/dist/app/src/messagingRelayLists.d.ts.map +1 -0
- package/dist/app/src/messagingRelayLists.js +18 -0
- package/dist/app/src/messagingRelayLists.js.map +1 -0
- package/dist/app/src/mutes.d.ts +8 -4
- package/dist/app/src/mutes.d.ts.map +1 -1
- package/dist/app/src/mutes.js +12 -10
- package/dist/app/src/mutes.js.map +1 -1
- package/dist/app/src/pins.d.ts +8 -5
- package/dist/app/src/pins.d.ts.map +1 -1
- package/dist/app/src/pins.js +12 -10
- package/dist/app/src/pins.js.map +1 -1
- package/dist/app/src/profiles.d.ts +9 -6
- package/dist/app/src/profiles.d.ts.map +1 -1
- package/dist/app/src/profiles.js +15 -13
- package/dist/app/src/profiles.js.map +1 -1
- package/dist/app/src/relayLists.d.ts +15 -0
- package/dist/app/src/relayLists.d.ts.map +1 -0
- package/dist/app/src/{relaySelections.js → relayLists.js} +14 -12
- package/dist/app/src/relayLists.js.map +1 -0
- package/dist/app/src/relayStats.d.ts +8 -3
- package/dist/app/src/relayStats.d.ts.map +1 -1
- package/dist/app/src/relayStats.js +16 -10
- package/dist/app/src/relayStats.js.map +1 -1
- package/dist/app/src/relays.d.ts +15 -8
- package/dist/app/src/relays.d.ts.map +1 -1
- package/dist/app/src/relays.js +48 -42
- package/dist/app/src/relays.js.map +1 -1
- package/dist/app/src/search.js +3 -3
- package/dist/app/src/search.js.map +1 -1
- package/dist/app/src/session.d.ts.map +1 -1
- package/dist/app/src/session.js +2 -2
- package/dist/app/src/session.js.map +1 -1
- package/dist/app/src/sync.js +2 -2
- package/dist/app/src/sync.js.map +1 -1
- package/dist/app/src/thunk.d.ts.map +1 -1
- package/dist/app/src/thunk.js +2 -2
- package/dist/app/src/thunk.js.map +1 -1
- package/dist/app/src/topics.d.ts +2 -1
- package/dist/app/src/topics.d.ts.map +1 -1
- package/dist/app/src/topics.js +33 -15
- package/dist/app/src/topics.js.map +1 -1
- package/dist/app/src/user.d.ts +24 -21
- package/dist/app/src/user.d.ts.map +1 -1
- package/dist/app/src/user.js +35 -50
- package/dist/app/src/user.js.map +1 -1
- package/dist/app/src/wot.d.ts +8 -4
- package/dist/app/src/wot.d.ts.map +1 -1
- package/dist/app/src/wot.js +20 -16
- package/dist/app/src/wot.js.map +1 -1
- package/dist/app/src/zappers.d.ts +14 -7
- package/dist/app/src/zappers.d.ts.map +1 -1
- package/dist/app/src/zappers.js +55 -47
- package/dist/app/src/zappers.js.map +1 -1
- package/dist/lib/src/Tools.d.ts +36 -9
- package/dist/lib/src/Tools.d.ts.map +1 -1
- package/dist/lib/src/Tools.js +86 -38
- package/dist/lib/src/Tools.js.map +1 -1
- package/dist/net/src/policy.d.ts.map +1 -1
- package/dist/net/src/policy.js +18 -3
- package/dist/net/src/policy.js.map +1 -1
- package/dist/net/src/repository.js +1 -1
- package/dist/net/src/repository.js.map +1 -1
- package/dist/signer/src/nip59.d.ts.map +1 -1
- package/dist/signer/src/nip59.js +2 -2
- package/dist/signer/src/nip59.js.map +1 -1
- package/dist/signer/src/signers/nip01.d.ts.map +1 -1
- package/dist/signer/src/signers/nip01.js +2 -1
- package/dist/signer/src/signers/nip01.js.map +1 -1
- package/dist/signer/src/signers/nip07.d.ts.map +1 -1
- package/dist/signer/src/signers/nip07.js +2 -1
- package/dist/signer/src/signers/nip07.js.map +1 -1
- package/dist/signer/src/signers/nip46.d.ts +17 -2
- package/dist/signer/src/signers/nip46.d.ts.map +1 -1
- package/dist/signer/src/signers/nip46.js +137 -14
- package/dist/signer/src/signers/nip46.js.map +1 -1
- package/dist/signer/src/signers/nip55.d.ts.map +1 -1
- package/dist/signer/src/signers/nip55.js +2 -1
- package/dist/signer/src/signers/nip55.js.map +1 -1
- package/dist/signer/src/util.d.ts +1 -36
- package/dist/signer/src/util.d.ts.map +1 -1
- package/dist/signer/src/util.js +2 -25
- package/dist/signer/src/util.js.map +1 -1
- package/dist/store/src/index.d.ts +1 -5
- package/dist/store/src/index.d.ts.map +1 -1
- package/dist/store/src/index.js +1 -5
- package/dist/store/src/index.js.map +1 -1
- package/dist/store/src/misc.d.ts +18 -0
- package/dist/store/src/misc.d.ts.map +1 -0
- package/dist/store/src/misc.js +66 -0
- package/dist/store/src/misc.js.map +1 -0
- package/dist/store/src/repository.d.ts +52 -11
- package/dist/store/src/repository.d.ts.map +1 -1
- package/dist/store/src/repository.js +305 -80
- package/dist/store/src/repository.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/util/src/Events.d.ts +2 -0
- package/dist/util/src/Events.d.ts.map +1 -1
- package/dist/util/src/Events.js +3 -1
- package/dist/util/src/Events.js.map +1 -1
- package/dist/util/src/Keys.d.ts +37 -0
- package/dist/util/src/Keys.d.ts.map +1 -0
- package/dist/util/src/Keys.js +26 -0
- package/dist/util/src/Keys.js.map +1 -0
- package/dist/util/src/Kinds.d.ts +8 -1
- package/dist/util/src/Kinds.d.ts.map +1 -1
- package/dist/util/src/Kinds.js +8 -1
- package/dist/util/src/Kinds.js.map +1 -1
- package/dist/util/src/Pow.d.ts +11 -0
- package/dist/util/src/Pow.d.ts.map +1 -0
- package/dist/util/src/Pow.js +127 -0
- package/dist/util/src/Pow.js.map +1 -0
- package/dist/util/src/Relay.d.ts +1 -1
- package/dist/util/src/Relay.d.ts.map +1 -1
- package/dist/util/src/Relay.js +1 -1
- package/dist/util/src/Relay.js.map +1 -1
- package/dist/util/src/Zaps.d.ts.map +1 -1
- package/dist/util/src/Zaps.js +2 -2
- package/dist/util/src/Zaps.js.map +1 -1
- package/dist/util/src/index.d.ts +2 -0
- package/dist/util/src/index.d.ts.map +1 -1
- package/dist/util/src/index.js +2 -0
- package/dist/util/src/index.js.map +1 -1
- package/package.json +8 -8
- package/dist/app/src/inboxRelaySelections.d.ts +0 -6
- package/dist/app/src/inboxRelaySelections.d.ts.map +0 -1
- package/dist/app/src/inboxRelaySelections.js +0 -16
- package/dist/app/src/inboxRelaySelections.js.map +0 -1
- package/dist/app/src/relaySelections.d.ts +0 -11
- package/dist/app/src/relaySelections.d.ts.map +0 -1
- package/dist/app/src/relaySelections.js.map +0 -1
- package/dist/store/src/collection.d.ts +0 -34
- package/dist/store/src/collection.d.ts.map +0 -1
- package/dist/store/src/collection.js +0 -82
- package/dist/store/src/collection.js.map +0 -1
- package/dist/store/src/custom.d.ts +0 -10
- package/dist/store/src/custom.d.ts.map +0 -1
- package/dist/store/src/custom.js +0 -41
- package/dist/store/src/custom.js.map +0 -1
- package/dist/store/src/getter.d.ts +0 -11
- package/dist/store/src/getter.d.ts.map +0 -1
- package/dist/store/src/getter.js +0 -11
- package/dist/store/src/getter.js.map +0 -1
- package/dist/store/src/memoize.d.ts +0 -5
- package/dist/store/src/memoize.d.ts.map +0 -1
- package/dist/store/src/memoize.js +0 -6
- package/dist/store/src/memoize.js.map +0 -1
- package/dist/store/src/throttle.d.ts +0 -3
- package/dist/store/src/throttle.d.ts.map +0 -1
- package/dist/store/src/throttle.js +0 -9
- package/dist/store/src/throttle.js.map +0 -1
package/dist/app/src/user.js
CHANGED
|
@@ -1,61 +1,46 @@
|
|
|
1
1
|
import { derived } from "svelte/store";
|
|
2
|
-
import { withGetter, memoized } from "@welshman/store";
|
|
3
2
|
import { pubkey } from "./session.js";
|
|
4
|
-
import { profilesByPubkey, loadProfile } from "./profiles.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { wotGraph } from "./wot.js";
|
|
12
|
-
export const makeUserData = (
|
|
3
|
+
import { profilesByPubkey, forceLoadProfile, loadProfile } from "./profiles.js";
|
|
4
|
+
import { followListsByPubkey, forceLoadFollowList, loadFollowList } from "./follows.js";
|
|
5
|
+
import { pinListsByPubkey, forceLoadPinList, loadPinList } from "./pins.js";
|
|
6
|
+
import { muteListsByPubkey, forceLoadMuteList, loadMuteList } from "./mutes.js";
|
|
7
|
+
import { blossomServerListsByPubkey, forceLoadBlossomServerList, loadBlossomServerList, } from "./blossom.js";
|
|
8
|
+
import { relayListsByPubkey, forceLoadRelayList, loadRelayList } from "./relayLists.js";
|
|
9
|
+
import { messagingRelayListsByPubkey, forceLoadMessagingRelayList, loadMessagingRelayList, } from "./messagingRelayLists.js";
|
|
10
|
+
import { wotGraph, getWotGraph } from "./wot.js";
|
|
11
|
+
export const makeUserData = (itemsByKey, onDerive) => derived([itemsByKey, pubkey], ([$itemsByKey, $pubkey]) => {
|
|
13
12
|
if (!$pubkey)
|
|
14
13
|
return undefined;
|
|
15
|
-
|
|
16
|
-
return $
|
|
17
|
-
})
|
|
18
|
-
export const makeUserLoader = (loadItem) => async (
|
|
14
|
+
onDerive?.($pubkey);
|
|
15
|
+
return $itemsByKey.get($pubkey);
|
|
16
|
+
});
|
|
17
|
+
export const makeUserLoader = (loadItem) => async (...args) => {
|
|
19
18
|
const $pubkey = pubkey.get();
|
|
20
19
|
if ($pubkey) {
|
|
21
|
-
await loadItem($pubkey,
|
|
20
|
+
await loadItem($pubkey, ...args);
|
|
22
21
|
}
|
|
23
22
|
};
|
|
24
|
-
export const userProfile = makeUserData(
|
|
25
|
-
|
|
26
|
-
loadItem: loadProfile,
|
|
27
|
-
});
|
|
23
|
+
export const userProfile = makeUserData(profilesByPubkey, loadProfile);
|
|
24
|
+
export const forceLoadUserProfile = makeUserLoader(forceLoadProfile);
|
|
28
25
|
export const loadUserProfile = makeUserLoader(loadProfile);
|
|
29
|
-
export const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
export const
|
|
34
|
-
export const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
export const
|
|
39
|
-
export const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
export const
|
|
44
|
-
export const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
export const loadUserRelaySelections = makeUserLoader(loadRelaySelections);
|
|
49
|
-
export const userInboxRelaySelections = makeUserData({
|
|
50
|
-
mapStore: inboxRelaySelectionsByPubkey,
|
|
51
|
-
loadItem: loadInboxRelaySelections,
|
|
52
|
-
});
|
|
53
|
-
export const loadUserInboxRelaySelections = makeUserLoader(loadInboxRelaySelections);
|
|
54
|
-
export const userBlossomServers = makeUserData({
|
|
55
|
-
mapStore: blossomServersByPubkey,
|
|
56
|
-
loadItem: loadBlossomServers,
|
|
57
|
-
});
|
|
58
|
-
export const loadUserBlossomServers = makeUserLoader(loadBlossomServers);
|
|
59
|
-
export const getUserWotScore = (tpk) => wotGraph.get().get(tpk) || 0;
|
|
26
|
+
export const userFollowList = makeUserData(followListsByPubkey, loadFollowList);
|
|
27
|
+
export const forceLoadUserFollowList = makeUserLoader(forceLoadFollowList);
|
|
28
|
+
export const loadUserFollowList = makeUserLoader(loadFollowList);
|
|
29
|
+
export const userMuteList = makeUserData(muteListsByPubkey, loadMuteList);
|
|
30
|
+
export const forceLoadUserMuteList = makeUserLoader(forceLoadMuteList);
|
|
31
|
+
export const loadUserMuteList = makeUserLoader(loadMuteList);
|
|
32
|
+
export const userPinList = makeUserData(pinListsByPubkey, loadPinList);
|
|
33
|
+
export const forceLoadUserPinList = makeUserLoader(forceLoadPinList);
|
|
34
|
+
export const loadUserPinList = makeUserLoader(loadPinList);
|
|
35
|
+
export const userRelayList = makeUserData(relayListsByPubkey, loadRelayList);
|
|
36
|
+
export const forceLoadUserRelayList = makeUserLoader(forceLoadRelayList);
|
|
37
|
+
export const loadUserRelayList = makeUserLoader(loadRelayList);
|
|
38
|
+
export const userMessagingRelayList = makeUserData(messagingRelayListsByPubkey, loadMessagingRelayList);
|
|
39
|
+
export const forceLoadUserMessagingRelayList = makeUserLoader(forceLoadMessagingRelayList);
|
|
40
|
+
export const loadUserMessagingRelayList = makeUserLoader(loadMessagingRelayList);
|
|
41
|
+
export const userBlossomServerList = makeUserData(blossomServerListsByPubkey, loadBlossomServerList);
|
|
42
|
+
export const forceLoadUserBlossomServerList = makeUserLoader(forceLoadBlossomServerList);
|
|
43
|
+
export const loadUserBlossomServerList = makeUserLoader(loadBlossomServerList);
|
|
44
|
+
export const getUserWotScore = (tpk) => getWotGraph().get(tpk) || 0;
|
|
60
45
|
export const deriveUserWotScore = (tpk) => derived(wotGraph, $g => $g.get(tpk) || 0);
|
|
61
46
|
//# sourceMappingURL=user.js.map
|
package/dist/app/src/user.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../../src/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAW,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"user.js","sourceRoot":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AAa,CAAC,CAAA;AAE9D,MAAM,CAAC,MAAM,sBAAsB,GAAG,YAAY,CAChD,2BAA2B,EAC3B,sBAAsB,CACvB,CAAA;AACD,MAAM,CAAC,MAAM,+BAA+B,GAAG,cAAc,CAAC,2BAA2B,CAAC,CAAA;AAC1F,MAAM,CAAC,MAAM,0BAA0B,GAAG,cAAc,CAAC,sBAAsB,CAAC,CAAA;AAEhF,MAAM,CAAC,MAAM,qBAAqB,GAAG,YAAY,CAAC,0BAA0B,EAAE,qBAAqB,CAAC,CAAA;AACpG,MAAM,CAAC,MAAM,8BAA8B,GAAG,cAAc,CAAC,0BAA0B,CAAC,CAAA;AACxF,MAAM,CAAC,MAAM,yBAAyB,GAAG,cAAc,CAAC,qBAAqB,CAAC,CAAA;AAE9E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AAE3E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA"}
|
package/dist/app/src/wot.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
export declare const getFollows: (pubkey: string) => string[];
|
|
2
2
|
export declare const getMutes: (pubkey: string) => string[];
|
|
3
3
|
export declare const getNetwork: (pubkey: string) => string[];
|
|
4
|
-
export declare const followersByPubkey: import("
|
|
5
|
-
export declare const
|
|
4
|
+
export declare const followersByPubkey: import("svelte/store").Readable<Map<string, Set<string>>>;
|
|
5
|
+
export declare const getFollowersByPubkey: () => Map<string, Set<string>>;
|
|
6
|
+
export declare const mutersByPubkey: import("svelte/store").Readable<Map<string, Set<string>>>;
|
|
7
|
+
export declare const getMutersByPubkey: () => Map<string, Set<string>>;
|
|
6
8
|
export declare const getFollowers: (pubkey: string) => string[];
|
|
7
9
|
export declare const getMuters: (pubkey: string) => string[];
|
|
8
10
|
export declare const getFollowsWhoFollow: (pubkey: string, target: string) => string[];
|
|
9
11
|
export declare const getFollowsWhoMute: (pubkey: string, target: string) => string[];
|
|
10
|
-
export declare const wotGraph: import("
|
|
11
|
-
export declare const
|
|
12
|
+
export declare const wotGraph: import("svelte/store").Writable<Map<string, number>>;
|
|
13
|
+
export declare const getWotGraph: () => Map<string, number>;
|
|
14
|
+
export declare const maxWot: import("svelte/store").Readable<number>;
|
|
15
|
+
export declare const getMaxWot: () => number;
|
|
12
16
|
export declare const getWotScore: (pubkey: string, target: string) => number;
|
|
13
17
|
//# sourceMappingURL=wot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wot.d.ts","sourceRoot":"","sources":["../../../src/wot.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"wot.d.ts","sourceRoot":"","sources":["../../../src/wot.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,aAA2D,CAAA;AAEpG,eAAO,MAAM,QAAQ,GAAI,QAAQ,MAAM,aAAyD,CAAA;AAEhG,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,aAaxC,CAAA;AAED,eAAO,MAAM,iBAAiB,2DAU5B,CAAA;AAEF,eAAO,MAAM,oBAAoB,gCAA4B,CAAA;AAE7D,eAAO,MAAM,cAAc,2DAUzB,CAAA;AAEF,eAAO,MAAM,iBAAiB,gCAAyB,CAAA;AAEvD,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,aAAyD,CAAA;AAEpG,eAAO,MAAM,SAAS,GAAI,QAAQ,MAAM,aAAsD,CAAA;AAE9F,eAAO,MAAM,mBAAmB,GAAI,QAAQ,MAAM,EAAE,QAAQ,MAAM,aACM,CAAA;AAExE,eAAO,MAAM,iBAAiB,GAAI,QAAQ,MAAM,EAAE,QAAQ,MAAM,aACM,CAAA;AAEtE,eAAO,MAAM,QAAQ,sDAAsC,CAAA;AAE3D,eAAO,MAAM,WAAW,2BAAmB,CAAA;AAE3C,eAAO,MAAM,MAAM,yCAAwD,CAAA;AAE3E,eAAO,MAAM,SAAS,cAAiB,CAAA;AAwBvC,eAAO,MAAM,WAAW,GAAI,QAAQ,MAAM,EAAE,QAAQ,MAAM,WAKzD,CAAA"}
|
package/dist/app/src/wot.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { derived, writable } from "svelte/store";
|
|
2
2
|
import { max, throttle, addToMapKey, inc, dec } from "@welshman/lib";
|
|
3
3
|
import { getListTags, getPubkeyTagValues } from "@welshman/util";
|
|
4
|
-
import { throttled,
|
|
4
|
+
import { throttled, getter } from "@welshman/store";
|
|
5
5
|
import { pubkey } from "./session.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
export const getFollows = (pubkey) => getPubkeyTagValues(getListTags(
|
|
9
|
-
export const getMutes = (pubkey) => getPubkeyTagValues(getListTags(
|
|
6
|
+
import { followLists, getFollowListsByPubkey, getFollowList } from "./follows.js";
|
|
7
|
+
import { muteLists, getMuteList } from "./mutes.js";
|
|
8
|
+
export const getFollows = (pubkey) => getPubkeyTagValues(getListTags(getFollowList(pubkey)));
|
|
9
|
+
export const getMutes = (pubkey) => getPubkeyTagValues(getListTags(getMuteList(pubkey)));
|
|
10
10
|
export const getNetwork = (pubkey) => {
|
|
11
11
|
const pubkeys = new Set(getFollows(pubkey));
|
|
12
12
|
const network = new Set();
|
|
@@ -19,7 +19,7 @@ export const getNetwork = (pubkey) => {
|
|
|
19
19
|
}
|
|
20
20
|
return Array.from(network);
|
|
21
21
|
};
|
|
22
|
-
export const followersByPubkey =
|
|
22
|
+
export const followersByPubkey = derived(throttled(1000, followLists), lists => {
|
|
23
23
|
const $followersByPubkey = new Map();
|
|
24
24
|
for (const list of lists) {
|
|
25
25
|
for (const pubkey of getPubkeyTagValues(getListTags(list))) {
|
|
@@ -27,8 +27,9 @@ export const followersByPubkey = withGetter(derived(throttled(1000, follows), li
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
return $followersByPubkey;
|
|
30
|
-
})
|
|
31
|
-
export const
|
|
30
|
+
});
|
|
31
|
+
export const getFollowersByPubkey = getter(followersByPubkey);
|
|
32
|
+
export const mutersByPubkey = derived(throttled(1000, muteLists), lists => {
|
|
32
33
|
const $mutersByPubkey = new Map();
|
|
33
34
|
for (const list of lists) {
|
|
34
35
|
for (const pubkey of getPubkeyTagValues(getListTags(list))) {
|
|
@@ -36,17 +37,20 @@ export const mutersByPubkey = withGetter(derived(throttled(1000, mutes), lists =
|
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
return $mutersByPubkey;
|
|
39
|
-
})
|
|
40
|
-
export const
|
|
41
|
-
export const
|
|
40
|
+
});
|
|
41
|
+
export const getMutersByPubkey = getter(mutersByPubkey);
|
|
42
|
+
export const getFollowers = (pubkey) => Array.from(getFollowersByPubkey().get(pubkey) || []);
|
|
43
|
+
export const getMuters = (pubkey) => Array.from(getMutersByPubkey().get(pubkey) || []);
|
|
42
44
|
export const getFollowsWhoFollow = (pubkey, target) => getFollows(pubkey).filter(other => getFollows(other).includes(target));
|
|
43
45
|
export const getFollowsWhoMute = (pubkey, target) => getFollows(pubkey).filter(other => getMutes(other).includes(target));
|
|
44
|
-
export const wotGraph =
|
|
45
|
-
export const
|
|
46
|
+
export const wotGraph = writable(new Map());
|
|
47
|
+
export const getWotGraph = getter(wotGraph);
|
|
48
|
+
export const maxWot = derived(wotGraph, $g => max(Array.from($g.values())));
|
|
49
|
+
export const getMaxWot = getter(maxWot);
|
|
46
50
|
const buildGraph = throttle(1000, () => {
|
|
47
51
|
const $pubkey = pubkey.get();
|
|
48
52
|
const $graph = new Map();
|
|
49
|
-
const $follows = $pubkey ? getFollows($pubkey) :
|
|
53
|
+
const $follows = $pubkey ? getFollows($pubkey) : getFollowListsByPubkey().keys();
|
|
50
54
|
for (const follow of $follows) {
|
|
51
55
|
for (const pubkey of getFollows(follow)) {
|
|
52
56
|
$graph.set(pubkey, inc($graph.get(pubkey)));
|
|
@@ -58,8 +62,8 @@ const buildGraph = throttle(1000, () => {
|
|
|
58
62
|
wotGraph.set($graph);
|
|
59
63
|
});
|
|
60
64
|
pubkey.subscribe(buildGraph);
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
followLists.subscribe(buildGraph);
|
|
66
|
+
muteLists.subscribe(buildGraph);
|
|
63
67
|
export const getWotScore = (pubkey, target) => {
|
|
64
68
|
const follows = pubkey ? getFollowsWhoFollow(pubkey, target) : getFollowers(target);
|
|
65
69
|
const mutes = pubkey ? getFollowsWhoMute(pubkey, target) : getMuters(target);
|
package/dist/app/src/wot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wot.js","sourceRoot":"","sources":["../../../src/wot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,EAAC,MAAM,eAAe,CAAA;AAClE,OAAO,EAAC,WAAW,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAC,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"wot.js","sourceRoot":"","sources":["../../../src/wot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,EAAC,MAAM,eAAe,CAAA;AAClE,OAAO,EAAC,WAAW,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAC,SAAS,EAAE,MAAM,EAAC,MAAM,iBAAiB,CAAA;AACj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QAC7C,CAAC;QAED,KAAK,MAAM,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YACtC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QAC7C,CAAC;IACH,CAAC;IAED,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AACtB,CAAC,CAAC,CAAA;AAEF,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;AAC5B,WAAW,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;AACjC,SAAS,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;AAE/B,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,MAAc,EAAE,EAAE;IAC5D,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;IACnF,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;IAE5E,OAAO,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAA;AACtC,CAAC,CAAA"}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
+
import { Subscriber } from "svelte/store";
|
|
1
2
|
import { Zapper, TrustedEvent, Zap } from "@welshman/util";
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export declare const
|
|
3
|
+
export declare const zappersByLnurl: import("svelte/store").Writable<Map<string, Zapper>>;
|
|
4
|
+
export declare const zappers: import("svelte/store").Readable<Zapper[]>;
|
|
5
|
+
export declare const getZappersByLnurl: () => Map<string, Zapper>;
|
|
6
|
+
export declare const getZapper: (lnurl: string) => Zapper | undefined;
|
|
7
|
+
export declare const zapperSubscribers: Subscriber<Zapper>[];
|
|
8
|
+
export declare const notifyZapper: (zapper: Zapper) => void;
|
|
9
|
+
export declare const onZapper: (sub: (zapper: Zapper) => void) => () => Subscriber<Zapper>[];
|
|
10
|
+
export declare const fetchZapper: (request: string) => Promise<Zapper | undefined>;
|
|
11
|
+
export declare const forceLoadZapper: (key: string, ...args: any[]) => Promise<Zapper | undefined>;
|
|
12
|
+
export declare const loadZapper: (key: string, ...args: any[]) => Promise<import("@welshman/lib").Maybe<Zapper>>;
|
|
13
|
+
export declare const deriveZapper: (key?: string, ...args: any[]) => import("svelte/store").Readable<Zapper | undefined>;
|
|
14
|
+
export declare const loadZapperForPubkey: (pubkey: string, relays?: string[]) => Promise<import("@welshman/lib").Maybe<Zapper>>;
|
|
8
15
|
export declare const deriveZapperForPubkey: (pubkey: string, relays?: string[]) => import("svelte/store").Readable<Zapper | undefined>;
|
|
9
16
|
export declare const getLnUrlsForEvent: (event: TrustedEvent) => Promise<string[]>;
|
|
10
|
-
export declare const getZapperForZap: (zap: TrustedEvent, parent: TrustedEvent) => Promise<Zapper
|
|
17
|
+
export declare const getZapperForZap: (zap: TrustedEvent, parent: TrustedEvent) => Promise<import("@welshman/lib").Maybe<Zapper>>;
|
|
11
18
|
export declare const getValidZap: (zap: TrustedEvent, parent: TrustedEvent) => Promise<Zap | undefined>;
|
|
12
19
|
export declare const getValidZaps: (zaps: TrustedEvent[], parent: TrustedEvent) => Promise<Zap[]>;
|
|
13
20
|
export declare const deriveValidZaps: (zaps: TrustedEvent[], parent: TrustedEvent) => import("svelte/store").Writable<Zap[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zappers.d.ts","sourceRoot":"","sources":["../../../src/zappers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zappers.d.ts","sourceRoot":"","sources":["../../../src/zappers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,UAA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68 +1,76 @@
|
|
|
1
1
|
import { writable, derived } from "svelte/store";
|
|
2
2
|
import { getTagValues, getLnUrl, zapFromEvent } from "@welshman/util";
|
|
3
|
-
import { removeUndefined, fetchJson,
|
|
4
|
-
import {
|
|
3
|
+
import { removeUndefined, fetchJson, bech32ToHex, hexToBech32, tryCatch, batcher, postJson, } from "@welshman/lib";
|
|
4
|
+
import { getter, deriveItems, makeForceLoadItem, makeLoadItem, makeDeriveItem } from "@welshman/store";
|
|
5
5
|
import { deriveProfile, loadProfile } from "./profiles.js";
|
|
6
6
|
import { appContext } from "./context.js";
|
|
7
|
-
export const
|
|
8
|
-
export const
|
|
7
|
+
export const zappersByLnurl = writable(new Map());
|
|
8
|
+
export const zappers = deriveItems(zappersByLnurl);
|
|
9
|
+
export const getZappersByLnurl = getter(zappersByLnurl);
|
|
10
|
+
export const getZapper = (lnurl) => getZappersByLnurl().get(lnurl);
|
|
11
|
+
export const zapperSubscribers = [];
|
|
12
|
+
export const notifyZapper = (zapper) => zapperSubscribers.forEach(sub => sub(zapper));
|
|
13
|
+
export const onZapper = (sub) => {
|
|
14
|
+
zapperSubscribers.push(sub);
|
|
15
|
+
return () => zapperSubscribers.splice(zapperSubscribers.findIndex(s => s === sub), 1);
|
|
16
|
+
};
|
|
17
|
+
export const fetchZapper = batcher(800, async (lnurls) => {
|
|
9
18
|
const base = appContext.dufflepudUrl;
|
|
10
|
-
const
|
|
19
|
+
const result = new Map();
|
|
20
|
+
for (const lnurl of lnurls) {
|
|
21
|
+
if (!lnurl.startsWith("lnurl1")) {
|
|
22
|
+
throw new Error(`Invalid lnurl ${lnurl}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const addZapper = (lnurl, info) => {
|
|
26
|
+
if (info) {
|
|
27
|
+
try {
|
|
28
|
+
result.set(lnurl, { ...info, lnurl });
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
// pass
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
11
35
|
// Use dufflepud if we it's set up to protect user privacy, otherwise fetch directly
|
|
12
36
|
if (base) {
|
|
13
|
-
const hexUrls =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
tryCatch(() => zappersByLnurl.set(hexToBech32("lnurl", lnurl), info));
|
|
18
|
-
}
|
|
37
|
+
const hexUrls = lnurls.map(bech32ToHex);
|
|
38
|
+
const res = await tryCatch(() => postJson(`${base}/zapper/info`, { lnurls: hexUrls }));
|
|
39
|
+
for (const { lnurl, info } of res?.data || []) {
|
|
40
|
+
addZapper(hexToBech32("lnurl", lnurl), info);
|
|
19
41
|
}
|
|
20
42
|
}
|
|
21
43
|
else {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const info = hexUrl ? await tryCatch(async () => await fetchJson(hexUrl)) : undefined;
|
|
25
|
-
return { lnurl, hexUrl, info };
|
|
44
|
+
await Promise.all(lnurls.map(async (lnurl) => {
|
|
45
|
+
addZapper(lnurl, await tryCatch(() => fetchJson(bech32ToHex(lnurl))));
|
|
26
46
|
}));
|
|
27
|
-
for (const { lnurl, info } of results) {
|
|
28
|
-
if (info) {
|
|
29
|
-
zappersByLnurl.set(lnurl, info);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
47
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
store: zappers,
|
|
38
|
-
getKey: (zapper) => zapper.lnurl,
|
|
39
|
-
load: batcher(800, async (lnurls) => {
|
|
40
|
-
const fresh = await fetchZappers(uniq(lnurls));
|
|
41
|
-
const stale = zappersByLnurl.get();
|
|
42
|
-
for (const lnurl of lnurls) {
|
|
43
|
-
const newZapper = fresh.get(lnurl);
|
|
44
|
-
if (newZapper) {
|
|
45
|
-
stale.set(lnurl, { ...newZapper, lnurl });
|
|
48
|
+
if (result.size > 0) {
|
|
49
|
+
zappersByLnurl.update($zappersByLnurl => {
|
|
50
|
+
for (const [lnurl, zapper] of result) {
|
|
51
|
+
$zappersByLnurl.set(lnurl, zapper);
|
|
46
52
|
}
|
|
53
|
+
return $zappersByLnurl;
|
|
54
|
+
});
|
|
55
|
+
for (const zapper of result.values()) {
|
|
56
|
+
notifyZapper(zapper);
|
|
47
57
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}),
|
|
58
|
+
}
|
|
59
|
+
return lnurls.map(lnurl => result.get(lnurl));
|
|
51
60
|
});
|
|
61
|
+
export const forceLoadZapper = makeForceLoadItem(fetchZapper, getZapper);
|
|
62
|
+
export const loadZapper = makeLoadItem(fetchZapper, getZapper);
|
|
63
|
+
export const deriveZapper = makeDeriveItem(zappersByLnurl, loadZapper);
|
|
52
64
|
export const loadZapperForPubkey = async (pubkey, relays = []) => {
|
|
53
65
|
const $profile = await loadProfile(pubkey, relays);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
66
|
+
return $profile?.lnurl ? loadZapper($profile.lnurl) : undefined;
|
|
67
|
+
};
|
|
68
|
+
export const deriveZapperForPubkey = (pubkey, relays = []) => {
|
|
69
|
+
loadZapperForPubkey(pubkey, relays);
|
|
70
|
+
return derived([zappersByLnurl, deriveProfile(pubkey, relays)], ([$zappersByLnurl, $profile]) => {
|
|
71
|
+
return $profile?.lnurl ? $zappersByLnurl.get($profile.lnurl) : undefined;
|
|
72
|
+
});
|
|
58
73
|
};
|
|
59
|
-
export const deriveZapperForPubkey = (pubkey, relays = []) => derived([zappersByLnurl, deriveProfile(pubkey, relays)], ([$zappersByLnurl, $profile]) => {
|
|
60
|
-
if (!$profile?.lnurl) {
|
|
61
|
-
return undefined;
|
|
62
|
-
}
|
|
63
|
-
loadZapper($profile.lnurl);
|
|
64
|
-
return $zappersByLnurl.get($profile.lnurl);
|
|
65
|
-
});
|
|
66
74
|
export const getLnUrlsForEvent = async (event) => {
|
|
67
75
|
const lnurls = removeUndefined(getTagValues("zap", event.tags).map(getLnUrl));
|
|
68
76
|
if (lnurls.length > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zappers.js","sourceRoot":"","sources":["../../../src/zappers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"zappers.js","sourceRoot":"","sources":["../../../src/zappers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAa,MAAM,cAAc,CAAA;AAC1D,OAAO,EAA4B,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC9F,OAAO,EACL,eAAe,EACf,SAAS,EACT,WAAW,EACX,WAAW,EACX,QAAQ,EACR,OAAO,EACP,QAAQ,GACT,MAAM,eAAe,CAAA;AACtB,OAAO,EAAC,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,YAAY,EAAE,cAAc,EAAC,MAAM,iBAAiB,CAAA;AACpG,OAAO,EAAC,aAAa,EAAE,WAAW,EAAC,MAAM,eAAe,CAAA;AACxD,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AAEvC,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,GAAG,EAAkB,CAAC,CAAA;AAEjE,MAAM,CAAC,MAAM,OAAO,GAAG,WAAW,CAAC,cAAc,CAAC,CAAA;AAElD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,cAAc,CAAC,CAAA;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,iBAAiB,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;AAE1E,MAAM,CAAC,MAAM,iBAAiB,GAAyB,EAAE,CAAA;AAEzD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;AAE7F,MAAM,CAAC,MAAM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B,EAAE,MAAoB,EAAE,EAAE;IAC/E,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,MAAM,CAAC,CAAA;IAE9C,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AAC9D,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAE,GAAiB,EAAE,MAAoB,EAAE,EAAE;IAC3E,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IAEjD,OAAO,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AACvD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,IAAoB,EAAE,MAAoB,EAAE,EAAE,CAC/E,eAAe,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;AAE/E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAoB,EAAE,MAAoB,EAAE,EAAE;IAC5E,MAAM,KAAK,GAAG,QAAQ,CAAQ,EAAE,CAAC,CAAA;IAEjC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;QAC1C,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACtB,CAAC,CAAC,CAAA;IAEF,OAAO,KAAK,CAAA;AACd,CAAC,CAAA"}
|
package/dist/lib/src/Tools.d.ts
CHANGED
|
@@ -230,6 +230,13 @@ export declare const concat: <T>(...xs: T[][]) => T[];
|
|
|
230
230
|
* @returns New array with element appended
|
|
231
231
|
*/
|
|
232
232
|
export declare const append: <T>(x: T, xs: Iterable<T>) => T[];
|
|
233
|
+
/**
|
|
234
|
+
* Prepends element to array
|
|
235
|
+
* @param x - Element to prepend
|
|
236
|
+
* @param xs - Array to prepend to
|
|
237
|
+
* @returns New array with element prepended
|
|
238
|
+
*/
|
|
239
|
+
export declare const prepend: <T>(x: T, xs: Iterable<T>) => T[];
|
|
233
240
|
/**
|
|
234
241
|
* Creates union of two arrays
|
|
235
242
|
* @param a - First array
|
|
@@ -313,21 +320,37 @@ export declare const flatten: <T>(xs: (T | T[])[], ...args: unknown[]) => T[];
|
|
|
313
320
|
* @param xs - Array to partition
|
|
314
321
|
* @returns Tuple of [matching, non-matching] arrays
|
|
315
322
|
*/
|
|
316
|
-
export declare const partition: <T>(f: (x: T) => boolean, xs: T
|
|
323
|
+
export declare const partition: <T>(f: (x: T) => boolean, xs: Iterable<T>) => T[][];
|
|
324
|
+
/** Maps any iterable */
|
|
325
|
+
export declare const map: <T, R>(f: (x: T) => R, xs: Iterable<T>) => R[];
|
|
317
326
|
/**
|
|
318
327
|
* Keeps items based on predicate
|
|
319
|
-
* @param f - Whether to
|
|
320
|
-
* @param xs -
|
|
328
|
+
* @param f - Whether to keep an item
|
|
329
|
+
* @param xs - Items to filter
|
|
321
330
|
* @returns Filtered array
|
|
322
331
|
*/
|
|
323
|
-
export declare const filter: <T>(f: (x: T) => any, xs: T
|
|
332
|
+
export declare const filter: <T>(f: (x: T) => any, xs: Iterable<T>) => T[];
|
|
324
333
|
/**
|
|
325
334
|
* Removes items based on predicate
|
|
326
335
|
* @param f - Whether to remove an item from the array
|
|
327
|
-
* @param xs -
|
|
336
|
+
* @param xs - Items to filter
|
|
328
337
|
* @returns Filtered array
|
|
329
338
|
*/
|
|
330
|
-
export declare const reject: <T>(f: (x: T) => any, xs: T
|
|
339
|
+
export declare const reject: <T>(f: (x: T) => any, xs: Iterable<T>) => T[];
|
|
340
|
+
/**
|
|
341
|
+
* Finds a single item based on predicate
|
|
342
|
+
* @param f - Whether an item matches
|
|
343
|
+
* @param xs - Items to filter
|
|
344
|
+
* @returns first matching item
|
|
345
|
+
*/
|
|
346
|
+
export declare const find: <T>(f: (x: T) => any, xs: Iterable<T>) => T | undefined;
|
|
347
|
+
/**
|
|
348
|
+
* Finds a single item based on predicate
|
|
349
|
+
* @param f - Whether an item matches
|
|
350
|
+
* @param xs - Items to filter
|
|
351
|
+
* @returns whether an item matches
|
|
352
|
+
*/
|
|
353
|
+
export declare const some: <T>(f: (x: T) => any, xs: Iterable<T>) => boolean;
|
|
331
354
|
/**
|
|
332
355
|
* Returns array with duplicate elements removed
|
|
333
356
|
* @param xs - Array with possible duplicates
|
|
@@ -340,7 +363,7 @@ export declare const uniq: <T>(xs: T[]) => T[];
|
|
|
340
363
|
* @param xs - Input array
|
|
341
364
|
* @returns Array with elements unique by key
|
|
342
365
|
*/
|
|
343
|
-
export declare const uniqBy: <T>(f: (x: T) => any, xs: T
|
|
366
|
+
export declare const uniqBy: <T>(f: (x: T) => any, xs: Iterable<T>) => T[];
|
|
344
367
|
/**
|
|
345
368
|
* Returns sorted copy of array
|
|
346
369
|
* @param xs - Array to sort
|
|
@@ -353,7 +376,7 @@ export declare const sort: <T>(xs: T[]) => T[];
|
|
|
353
376
|
* @param xs - Array to sort
|
|
354
377
|
* @returns Sorted array
|
|
355
378
|
*/
|
|
356
|
-
export declare const sortBy: <T>(f: (x: T) => any, xs: T
|
|
379
|
+
export declare const sortBy: <T>(f: (x: T) => any, xs: Iterable<T>) => T[];
|
|
357
380
|
/**
|
|
358
381
|
* Groups array elements by key function
|
|
359
382
|
* @param f - Function to generate group key
|
|
@@ -501,6 +524,10 @@ export declare const complement: <T extends unknown[]>(f: (...args: T) => any) =
|
|
|
501
524
|
* @returns Function result or undefined if error
|
|
502
525
|
*/
|
|
503
526
|
export declare const tryCatch: <T>(f: () => T, onError?: (e: Error) => void) => T | undefined;
|
|
527
|
+
/**
|
|
528
|
+
* Throws an error with the given message
|
|
529
|
+
*/
|
|
530
|
+
export declare const thrower: (message: string) => () => never;
|
|
504
531
|
/**
|
|
505
532
|
* Creates function that only executes once
|
|
506
533
|
* @param f - Function to wrap
|
|
@@ -566,7 +593,7 @@ export declare const yieldThread: () => any;
|
|
|
566
593
|
* @param f - Function to throttle
|
|
567
594
|
* @returns Throttled function
|
|
568
595
|
*/
|
|
569
|
-
export declare const throttle: <F extends (...args: any[]) => any>(ms: number, f: F) => F | ((...
|
|
596
|
+
export declare const throttle: <F extends (...args: any[]) => any>(ms: number, f: F) => F | ((...args: Parameters<F>) => void);
|
|
570
597
|
/**
|
|
571
598
|
* Creates throttled function that returns cached value
|
|
572
599
|
* @param ms - Minimum time between updates
|