@welshman/app 0.0.9 → 0.0.11
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/build/src/collection.cjs +4 -5
- package/build/src/collection.cjs.map +1 -1
- package/build/src/collection.d.ts +0 -1
- package/build/src/collection.mjs +4 -5
- package/build/src/collection.mjs.map +1 -1
- package/build/src/follows.cjs +4 -9
- package/build/src/follows.cjs.map +1 -1
- package/build/src/follows.d.ts +0 -1
- package/build/src/follows.mjs +5 -9
- package/build/src/follows.mjs.map +1 -1
- package/build/src/handles.cjs +1 -2
- package/build/src/handles.cjs.map +1 -1
- package/build/src/handles.d.ts +1 -1
- package/build/src/handles.mjs +1 -2
- package/build/src/handles.mjs.map +1 -1
- package/build/src/index.cjs +1 -0
- package/build/src/index.cjs.map +1 -1
- package/build/src/index.d.ts +1 -0
- package/build/src/index.mjs +1 -0
- package/build/src/mutes.cjs +3 -5
- package/build/src/mutes.cjs.map +1 -1
- package/build/src/mutes.d.ts +0 -1
- package/build/src/mutes.mjs +4 -5
- package/build/src/mutes.mjs.map +1 -1
- package/build/src/profiles.cjs +1 -25
- package/build/src/profiles.cjs.map +1 -1
- package/build/src/profiles.d.ts +0 -3
- package/build/src/profiles.mjs +0 -24
- package/build/src/profiles.mjs.map +1 -1
- package/build/src/relaySelections.cjs +18 -10
- package/build/src/relaySelections.cjs.map +1 -1
- package/build/src/relaySelections.d.ts +9 -9
- package/build/src/relaySelections.mjs +20 -12
- package/build/src/relaySelections.mjs.map +1 -1
- package/build/src/relays.cjs +4 -9
- package/build/src/relays.cjs.map +1 -1
- package/build/src/relays.d.ts +0 -1
- package/build/src/relays.mjs +3 -8
- package/build/src/relays.mjs.map +1 -1
- package/build/src/router.cjs +14 -2
- package/build/src/router.cjs.map +1 -1
- package/build/src/router.d.ts +2 -0
- package/build/src/router.mjs +14 -3
- package/build/src/router.mjs.map +1 -1
- package/build/src/search.cjs +84 -0
- package/build/src/search.cjs.map +1 -0
- package/build/src/search.d.ts +24 -0
- package/build/src/search.mjs +77 -0
- package/build/src/search.mjs.map +1 -0
- package/build/src/sync.cjs +21 -15
- package/build/src/sync.cjs.map +1 -1
- package/build/src/sync.d.ts +3 -3
- package/build/src/sync.mjs +21 -15
- package/build/src/sync.mjs.map +1 -1
- package/build/src/tags.cjs +2 -2
- package/build/src/tags.cjs.map +1 -1
- package/build/src/tags.mjs +2 -2
- package/build/src/tags.mjs.map +1 -1
- package/build/src/thunk.cjs +6 -1
- package/build/src/thunk.cjs.map +1 -1
- package/build/src/thunk.mjs +6 -1
- package/build/src/thunk.mjs.map +1 -1
- package/build/src/topics.cjs +3 -9
- package/build/src/topics.cjs.map +1 -1
- package/build/src/topics.d.ts +0 -2
- package/build/src/topics.mjs +0 -6
- package/build/src/topics.mjs.map +1 -1
- package/build/src/user.d.ts +2 -2
- package/build/src/util.cjs +1 -26
- package/build/src/util.cjs.map +1 -1
- package/build/src/util.d.ts +0 -15
- package/build/src/util.mjs +1 -22
- package/build/src/util.mjs.map +1 -1
- package/build/src/wot.cjs +12 -8
- package/build/src/wot.cjs.map +1 -1
- package/build/src/wot.d.ts +2 -0
- package/build/src/wot.mjs +7 -5
- package/build/src/wot.mjs.map +1 -1
- package/build/src/zappers.cjs +1 -2
- package/build/src/zappers.cjs.map +1 -1
- package/build/src/zappers.d.ts +1 -1
- package/build/src/zappers.mjs +1 -2
- package/build/src/zappers.mjs.map +1 -1
- package/package.json +6 -6
package/build/src/collection.cjs
CHANGED
|
@@ -7,11 +7,10 @@ const store_2 = require("@welshman/store");
|
|
|
7
7
|
const freshness_1 = require("./freshness.cjs");
|
|
8
8
|
const collection = ({ name, store, getKey, load, }) => {
|
|
9
9
|
const indexStore = (0, store_2.withGetter)((0, store_1.derived)(store, $items => (0, lib_1.indexBy)(getKey, $items)));
|
|
10
|
-
const getItem = (key) => indexStore.get().get(key);
|
|
11
10
|
const pending = new Map();
|
|
12
11
|
const loadAttempts = new Map();
|
|
13
12
|
const loadItem = async (key, ...args) => {
|
|
14
|
-
const stale =
|
|
13
|
+
const stale = indexStore.get().get(key);
|
|
15
14
|
const freshness = (0, freshness_1.getFreshness)(name, key);
|
|
16
15
|
// If we have an item, reload if it's stale
|
|
17
16
|
if (stale && freshness > (0, lib_1.now)() - 3600) {
|
|
@@ -19,7 +18,7 @@ const collection = ({ name, store, getKey, load, }) => {
|
|
|
19
18
|
}
|
|
20
19
|
// If we already are loading, await and return
|
|
21
20
|
if (pending.has(key)) {
|
|
22
|
-
return pending.get(key).then(() =>
|
|
21
|
+
return pending.get(key).then(() => indexStore.get().get(key));
|
|
23
22
|
}
|
|
24
23
|
const attempt = loadAttempts.get(key) || 0;
|
|
25
24
|
// Use exponential backoff to throttle attempts
|
|
@@ -32,7 +31,7 @@ const collection = ({ name, store, getKey, load, }) => {
|
|
|
32
31
|
pending.set(key, promise);
|
|
33
32
|
await promise;
|
|
34
33
|
pending.delete(key);
|
|
35
|
-
const fresh =
|
|
34
|
+
const fresh = indexStore.get().get(key);
|
|
36
35
|
if (fresh) {
|
|
37
36
|
loadAttempts.delete(key);
|
|
38
37
|
}
|
|
@@ -47,7 +46,7 @@ const collection = ({ name, store, getKey, load, }) => {
|
|
|
47
46
|
loadItem(key, ...args);
|
|
48
47
|
return (0, store_1.derived)(indexStore, $index => $index.get(key));
|
|
49
48
|
};
|
|
50
|
-
return { indexStore, deriveItem, loadItem
|
|
49
|
+
return { indexStore, deriveItem, loadItem };
|
|
51
50
|
};
|
|
52
51
|
exports.collection = collection;
|
|
53
52
|
//# sourceMappingURL=collection.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.cjs","sourceRoot":"","sources":["../../src/collection.ts"],"names":[],"mappings":";;;AAAA,wCAA6D;AAC7D,uCAAsD;AACtD,2CAA0C;AAC1C,+CAA+D;AAExD,MAAM,UAAU,GAAG,CAA4B,EACpD,IAAI,EACJ,KAAK,EACL,MAAM,EACN,IAAI,GAML,EAAE,EAAE;IACH,MA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U,EAAE,QAAQ,EAAC,CAAA;AAC3C,CAAC,CAAA;AAtEY,QAAA,UAAU,cAsEtB"}
|
|
@@ -10,5 +10,4 @@ export declare const collection: <T, LoadArgs extends any[]>({ name, store, getK
|
|
|
10
10
|
indexStore: import("@welshman/store").ReadableWithGetter<Map<string, T>>;
|
|
11
11
|
deriveItem: (key: Maybe<string>, ...args: LoadArgs) => Readable<T | undefined>;
|
|
12
12
|
loadItem: (key: string, ...args: LoadArgs) => Promise<T | undefined>;
|
|
13
|
-
getItem: (key: string) => T | undefined;
|
|
14
13
|
};
|
package/build/src/collection.mjs
CHANGED
|
@@ -4,11 +4,10 @@ import { withGetter } from '@welshman/store';
|
|
|
4
4
|
import { getFreshness, setFreshnessThrottled } from "./freshness.mjs";
|
|
5
5
|
export const collection = ({ name, store, getKey, load, }) => {
|
|
6
6
|
const indexStore = withGetter(derived(store, $items => indexBy(getKey, $items)));
|
|
7
|
-
const getItem = (key) => indexStore.get().get(key);
|
|
8
7
|
const pending = new Map();
|
|
9
8
|
const loadAttempts = new Map();
|
|
10
9
|
const loadItem = async (key, ...args) => {
|
|
11
|
-
const stale =
|
|
10
|
+
const stale = indexStore.get().get(key);
|
|
12
11
|
const freshness = getFreshness(name, key);
|
|
13
12
|
// If we have an item, reload if it's stale
|
|
14
13
|
if (stale && freshness > now() - 3600) {
|
|
@@ -16,7 +15,7 @@ export const collection = ({ name, store, getKey, load, }) => {
|
|
|
16
15
|
}
|
|
17
16
|
// If we already are loading, await and return
|
|
18
17
|
if (pending.has(key)) {
|
|
19
|
-
return pending.get(key).then(() =>
|
|
18
|
+
return pending.get(key).then(() => indexStore.get().get(key));
|
|
20
19
|
}
|
|
21
20
|
const attempt = loadAttempts.get(key) || 0;
|
|
22
21
|
// Use exponential backoff to throttle attempts
|
|
@@ -29,7 +28,7 @@ export const collection = ({ name, store, getKey, load, }) => {
|
|
|
29
28
|
pending.set(key, promise);
|
|
30
29
|
await promise;
|
|
31
30
|
pending.delete(key);
|
|
32
|
-
const fresh =
|
|
31
|
+
const fresh = indexStore.get().get(key);
|
|
33
32
|
if (fresh) {
|
|
34
33
|
loadAttempts.delete(key);
|
|
35
34
|
}
|
|
@@ -44,6 +43,6 @@ export const collection = ({ name, store, getKey, load, }) => {
|
|
|
44
43
|
loadItem(key, ...args);
|
|
45
44
|
return derived(indexStore, $index => $index.get(key));
|
|
46
45
|
};
|
|
47
|
-
return { indexStore, deriveItem, loadItem
|
|
46
|
+
return { indexStore, deriveItem, loadItem };
|
|
48
47
|
};
|
|
49
48
|
//# sourceMappingURL=collection.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.mjs","sourceRoot":"","sources":["../../src/collection.ts"],"names":[],"mappings":"OAAO,EAAC,QAAQ,EAAE,OAAO,EAAgB,MAAM,cAAc;OACtD,EAAC,OAAO,EAAc,GAAG,EAAC,MAAM,eAAe;OAC/C,EAAC,UAAU,EAAC,MAAM,iBAAiB;OACnC,EAAC,YAAY,EAAE,qBAAqB,EAAC;AAE5C,MAAM,CAAC,MAAM,UAAU,GAAG,CAA4B,EACpD,IAAI,EACJ,KAAK,EACL,MAAM,EACN,IAAI,GAML,EAAE,EAAE;IACH,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAA;IAChF,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"collection.mjs","sourceRoot":"","sources":["../../src/collection.ts"],"names":[],"mappings":"OAAO,EAAC,QAAQ,EAAE,OAAO,EAAgB,MAAM,cAAc;OACtD,EAAC,OAAO,EAAc,GAAG,EAAC,MAAM,eAAe;OAC/C,EAAC,UAAU,EAAC,MAAM,iBAAiB;OACnC,EAAC,YAAY,EAAE,qBAAqB,EAAC;AAE5C,MAAM,CAAC,MAAM,UAAU,GAAG,CAA4B,EACpD,IAAI,EACJ,KAAK,EACL,MAAM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AAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;QAElC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QAEzB,MAAM,OAAO,CAAA;QAEb,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAEnB,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAEvC,IAAI,KAAK,EAAE;YACT,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;SACzB;QAED,OAAO,KAAK,CAAA;IACd,CAAC,CAAA;IAED,MAAM,UAAU,GAAG,CAAC,GAAkB,EAAE,GAAG,IAAc,EAAE,EAAE;QAC3D,IAAI,CAAC,GAAG,EAAE;YACR,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAA;SAC3B;QAED,sFAAsF;QACtF,oCAAoC;QACpC,QAAQ,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;QAEtB,OAAO,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;IACvD,CAAC,CAAA;IAED,OAAO,EAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAC,CAAA;AAC3C,CAAC,CAAA"}
|
package/build/src/follows.cjs
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.loadFollows = exports.deriveFollows = exports.followsByPubkey = exports.follows = void 0;
|
|
5
5
|
const util_1 = require("@welshman/util");
|
|
6
6
|
const store_1 = require("@welshman/store");
|
|
7
7
|
const core_1 = require("./core.cjs");
|
|
8
8
|
const collection_1 = require("./collection.cjs");
|
|
9
|
-
const plaintext_1 = require("./plaintext.cjs");
|
|
10
9
|
const relaySelections_1 = require("./relaySelections.cjs");
|
|
11
|
-
exports.follows = (0, store_1.
|
|
10
|
+
exports.follows = (0, store_1.deriveEventsMapped)(core_1.repository, {
|
|
12
11
|
filters: [{ kinds: [util_1.FOLLOWS] }],
|
|
13
12
|
itemToEvent: item => item.event,
|
|
14
|
-
eventToItem:
|
|
15
|
-
|
|
16
|
-
})),
|
|
17
|
-
}));
|
|
13
|
+
eventToItem: (event) => (0, util_1.readList)((0, util_1.asDecryptedEvent)(event)),
|
|
14
|
+
});
|
|
18
15
|
_a = (0, collection_1.collection)({
|
|
19
16
|
name: "follows",
|
|
20
17
|
store: exports.follows,
|
|
@@ -24,6 +21,4 @@ _a = (0, collection_1.collection)({
|
|
|
24
21
|
await (0, core_1.load)({ ...request, filters: [{ kinds: [util_1.FOLLOWS], authors: [pubkey] }] });
|
|
25
22
|
},
|
|
26
23
|
}), exports.followsByPubkey = _a.indexStore, exports.deriveFollows = _a.deriveItem, exports.loadFollows = _a.loadItem;
|
|
27
|
-
const getFollows = (pubkey) => (0, util_1.getListValues)("p", exports.followsByPubkey.get().get(pubkey));
|
|
28
|
-
exports.getFollows = getFollows;
|
|
29
24
|
//# sourceMappingURL=follows.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"follows.cjs","sourceRoot":"","sources":["../../src/follows.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"follows.cjs","sourceRoot":"","sources":["../../src/follows.ts"],"names":[],"mappings":";;;;AAAA,yCAAkE;AAGlE,2CAAkD;AAClD,qCAAuC;AACvC,iDAAuC;AACvC,2DAAqD;AAExC,QAAA,OAAO,GAAG,IAAA,0BAAkB,EAAgB,iBAAU,EAAE;IACnE,OAAO,EAAE,CAAC,EAAC,KAAK,EAAE,CAAC,cAAO,CAAC,EAAC,CAAC;IAC7B,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK;IAC/B,WAAW,EAAE,CAAC,KAAmB,EAAE,EAAE,CACnC,IAAA,eAAQ,EAAC,IAAA,uBAAgB,EAAC,KAAK,CAAC,CAAC;CACpC,CAAC,CAAA;AAEW,KAIT,IAAA,uBAAU,EAAC;IACb,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,eAAO;IACd,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM;IACvC,IAAI,EAAE,KAAK,EAAE,MAAc,EAAE,UAAiD,EAAE,EAAE,EAAE;QAClF,MAAM,IAAA,qCAAmB,EAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC1C,MAAM,IAAA,WAAI,EAAC,EAAC,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC,EAAC,KAAK,EAAE,CAAC,cAAO,CAAC,EAAE,OAAO,EAAE,CAAC,MAAM,CAAC,EAAC,CAAC,EAAC,CAAC,CAAA;IAC5E,CAAC;CACF,CAAC,EAXY,uBAAe,kBACf,qBAAa,kBACf,mBAAW,eASrB"}
|
package/build/src/follows.d.ts
CHANGED
|
@@ -3,4 +3,3 @@ import { type PublishedList } from '@welshman/util';
|
|
|
3
3
|
import { type SubscribeRequestWithHandlers } from "@welshman/net";
|
|
4
4
|
export declare const follows: import("@welshman/store").WritableWithGetter<PublishedList[]>;
|
|
5
5
|
export declare const followsByPubkey: import("@welshman/store").ReadableWithGetter<Map<string, PublishedList>>, deriveFollows: (key: import("@welshman/lib").Maybe<string>, request?: Partial<SubscribeRequestWithHandlers> | undefined) => import("svelte/store").Readable<PublishedList | undefined>, loadFollows: (key: string, request?: Partial<SubscribeRequestWithHandlers> | undefined) => Promise<PublishedList | undefined>;
|
|
6
|
-
export declare const getFollows: (pubkey: string) => string[];
|
package/build/src/follows.mjs
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import { FOLLOWS,
|
|
2
|
-
import { deriveEventsMapped
|
|
1
|
+
import { FOLLOWS, asDecryptedEvent, readList } from '@welshman/util';
|
|
2
|
+
import { deriveEventsMapped } from '@welshman/store';
|
|
3
3
|
import { repository, load } from "./core.mjs";
|
|
4
4
|
import { collection } from "./collection.mjs";
|
|
5
|
-
import { ensurePlaintext } from "./plaintext.mjs";
|
|
6
5
|
import { loadRelaySelections } from "./relaySelections.mjs";
|
|
7
|
-
export const follows =
|
|
6
|
+
export const follows = deriveEventsMapped(repository, {
|
|
8
7
|
filters: [{ kinds: [FOLLOWS] }],
|
|
9
8
|
itemToEvent: item => item.event,
|
|
10
|
-
eventToItem:
|
|
11
|
-
|
|
12
|
-
})),
|
|
13
|
-
}));
|
|
9
|
+
eventToItem: (event) => readList(asDecryptedEvent(event)),
|
|
10
|
+
});
|
|
14
11
|
export const { indexStore: followsByPubkey, deriveItem: deriveFollows, loadItem: loadFollows, } = collection({
|
|
15
12
|
name: "follows",
|
|
16
13
|
store: follows,
|
|
@@ -20,5 +17,4 @@ export const { indexStore: followsByPubkey, deriveItem: deriveFollows, loadItem:
|
|
|
20
17
|
await load({ ...request, filters: [{ kinds: [FOLLOWS], authors: [pubkey] }] });
|
|
21
18
|
},
|
|
22
19
|
});
|
|
23
|
-
export const getFollows = (pubkey) => getListValues("p", followsByPubkey.get().get(pubkey));
|
|
24
20
|
//# sourceMappingURL=follows.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"follows.mjs","sourceRoot":"","sources":["../../src/follows.ts"],"names":[],"mappings":"OAAO,EAAC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"follows.mjs","sourceRoot":"","sources":["../../src/follows.ts"],"names":[],"mappings":"OAAO,EAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAC,MAAM,gBAAgB;OAG3D,EAAC,kBAAkB,EAAC,MAAM,iBAAiB;OAC3C,EAAC,UAAU,EAAE,IAAI,EAAC;OAClB,EAAC,UAAU,EAAC;OACZ,EAAC,mBAAmB,EAAC;AAE5B,MAAM,CAAC,MAAM,OAAO,GAAG,kBAAkB,CAAgB,UAAU,EAAE;IACnE,OAAO,EAAE,CAAC,EAAC,KAAK,EAAE,CAAC,OAAO,CAAC,EAAC,CAAC;IAC7B,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK;IAC/B,WAAW,EAAE,CAAC,KAAmB,EAAE,EAAE,CACnC,QAAQ,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;CACpC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,EACX,UAAU,EAAE,eAAe,EAC3B,UAAU,EAAE,aAAa,EACzB,QAAQ,EAAE,WAAW,GACtB,GAAG,UAAU,CAAC;IACb,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM;IACvC,IAAI,EAAE,KAAK,EAAE,MAAc,EAAE,UAAiD,EAAE,EAAE,EAAE;QAClF,MAAM,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC1C,MAAM,IAAI,CAAC,EAAC,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC,EAAC,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,MAAM,CAAC,EAAC,CAAC,EAAC,CAAC,CAAA;IAC5E,CAAC;CACF,CAAC,CAAA"}
|
package/build/src/handles.cjs
CHANGED
|
@@ -3,7 +3,6 @@ var _a;
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.displayHandle = exports.deriveHandleForPubkey = exports.loadHandle = exports.deriveHandle = exports.handlesByNip05 = exports.fetchHandles = exports.handles = exports.queryProfile = exports.NIP05_REGEX = void 0;
|
|
5
5
|
const store_1 = require("svelte/store");
|
|
6
|
-
const store_2 = require("@welshman/store");
|
|
7
6
|
const lib_1 = require("@welshman/lib");
|
|
8
7
|
const collection_1 = require("./collection.cjs");
|
|
9
8
|
const profiles_1 = require("./profiles.cjs");
|
|
@@ -31,7 +30,7 @@ async function queryProfile(nip05) {
|
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
exports.queryProfile = queryProfile;
|
|
34
|
-
exports.handles = (0,
|
|
33
|
+
exports.handles = (0, store_1.writable)([]);
|
|
35
34
|
const fetchHandles = async (nip05s) => {
|
|
36
35
|
const base = lib_1.ctx.app.dufflepudUrl;
|
|
37
36
|
const handlesByNip05 = new Map();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handles.cjs","sourceRoot":"","sources":["../../src/handles.ts"],"names":[],"mappings":";;;;AAAA,wCAA8C;
|
|
1
|
+
{"version":3,"file":"handles.cjs","sourceRoot":"","sources":["../../src/handles.ts"],"names":[],"mappings":";;;;AAAA,wCAA8C;AAE9C,uCAAqF;AACrF,iDAAuC;AACvC,6CAAwC;AAS3B,QAAA,WAAW,GAAG,yCAAyC,CAAA;AAE7D,KAAK,UAAU,YAAY,CAAC,KAAa;IAC9C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,mBAAW,CAAC,CAAA;IAEtC,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAA;IAE5B,MAAM,CAAC,CAAC,EAAE,IAAI,GAAG,GAAG,EAAE,MAAM,CAAC,GAAG,KAAK,CAAA;IAErC,IAAI;QACF,MAAM,EAAC,KAAK,EAAE,MAAM,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,EAAC,GAAG,MAAM,IAAA,eAAS,EAAC,WAAW,MAAM,gCAAgC,IAAI,EAAE,CAAC,CAAA;QAEjH,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;QAE1B,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,SAAS,CAAA;SACjB;QAED,OAAO;YACL,KAAK;YACL,MAAM;YACN,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC;YACpB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;SACvB,CAAA;KACF;IAAC,OAAO,EAAE,EAAE;QACX,OAAO,SAAS,CAAA;KACjB;AACH,CA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qBAAqB,yBAY/B;AAEI,MAAM,aAAa,GAAG,CAAC,MAAc,EAAE,EAAE,CAC9C,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAA,UAAI,EAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAA;AADjE,QAAA,aAAa,iBACoD"}
|
package/build/src/handles.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare function queryProfile(nip05: string): Promise<{
|
|
|
13
13
|
nip46: any;
|
|
14
14
|
relays: any;
|
|
15
15
|
} | undefined>;
|
|
16
|
-
export declare const handles: import("
|
|
16
|
+
export declare const handles: import("svelte/store").Writable<Handle[]>;
|
|
17
17
|
export declare const fetchHandles: (nip05s: string[]) => Promise<Map<string, Handle>>;
|
|
18
18
|
export declare const handlesByNip05: import("@welshman/store").ReadableWithGetter<Map<string, Handle>>, deriveHandle: (key: import("@welshman/lib").Maybe<string>) => import("svelte/store").Readable<Handle | undefined>, loadHandle: (key: string) => Promise<Handle | undefined>;
|
|
19
19
|
export declare const deriveHandleForPubkey: (pubkey: string, request?: Partial<SubscribeRequestWithHandlers>) => import("svelte/store").Readable<Handle | undefined>;
|
package/build/src/handles.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { writable, derived } from 'svelte/store';
|
|
2
|
-
import { withGetter } from '@welshman/store';
|
|
3
2
|
import { ctx, tryCatch, fetchJson, uniq, batcher, postJson, last } from '@welshman/lib';
|
|
4
3
|
import { collection } from "./collection.mjs";
|
|
5
4
|
import { deriveProfile } from "./profiles.mjs";
|
|
@@ -26,7 +25,7 @@ export async function queryProfile(nip05) {
|
|
|
26
25
|
return undefined;
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
|
-
export const handles =
|
|
28
|
+
export const handles = writable([]);
|
|
30
29
|
export const fetchHandles = async (nip05s) => {
|
|
31
30
|
const base = ctx.app.dufflepudUrl;
|
|
32
31
|
const handlesByNip05 = new Map();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handles.mjs","sourceRoot":"","sources":["../../src/handles.ts"],"names":[],"mappings":"OAAO,EAAC,QAAQ,EAAE,OAAO,EAAC,MAAM,cAAc;
|
|
1
|
+
{"version":3,"file":"handles.mjs","sourceRoot":"","sources":["../../src/handles.ts"],"names":[],"mappings":"OAAO,EAAC,QAAQ,EAAE,OAAO,EAAC,MAAM,cAAc;OAEvC,EAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAC,MAAM,eAAe;OAC9E,EAAC,UAAU,EAAC;OACZ,EAAC,aAAa,EAAC;AAStB,MAAM,CAAC,MAAM,WAAW,GAAG,yCAAyC,CAAA;AAEpE,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,KAAa;IAC9C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;IAEtC,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAA;IAE5B,MAAM,CAAC,CAAC,EAAE,IAAI,GAAG,GAAG,EAAE,MAAM,CAAC,GAAG,KAAK,CAAA;IAErC,IAAI;QACF,MAAM,EAAC,KAAK,EAAE,MAAM,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,EAAC,GAAG,MAAM,SAAS,CAAC,WAAW,MAAM,gCAAgC,IAAI,EAAE,CAAC,CAAA;QAEjH,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;QAE1B,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,SAAS,CAAA;SACjB;QAED,OAAO;YACL,KAAK;YACL,MAAM;YACN,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC;YACpB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;SACvB,CAAA;KACF;IAAC,OAAO,EAAE,EAAE;QACX,OAAO,SAAS,CAA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a,GAAG,CAAC,MAAc,EAAE,EAAE,CAC9C,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAA"}
|
package/build/src/index.cjs
CHANGED
|
@@ -26,6 +26,7 @@ __exportStar(require("./profiles.cjs"), exports);
|
|
|
26
26
|
__exportStar(require("./relays.cjs"), exports);
|
|
27
27
|
__exportStar(require("./relaySelections.cjs"), exports);
|
|
28
28
|
__exportStar(require("./router.cjs"), exports);
|
|
29
|
+
__exportStar(require("./search.cjs"), exports);
|
|
29
30
|
__exportStar(require("./session.cjs"), exports);
|
|
30
31
|
__exportStar(require("./storage.cjs"), exports);
|
|
31
32
|
__exportStar(require("./sync.cjs"), exports);
|
package/build/src/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAAyB;AACzB,6CAAsB;AACtB,mDAA4B;AAC5B,kDAA2B;AAC3B,gDAAyB;AACzB,gDAAyB;AACzB,8CAAuB;AACvB,kDAA2B;AAC3B,iDAA0B;AAC1B,+CAAwB;AACxB,wDAAiC;AACjC,+CAAwB;AACxB,gDAAyB;AACzB,gDAAyB;AACzB,6CAAsB;AACtB,6CAAsB;AACtB,8CAAuB;AACvB,+CAAwB;AACxB,6CAAsB;AACtB,6CAAsB;AACtB,4CAAqB;AACrB,gDAAyB"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAAyB;AACzB,6CAAsB;AACtB,mDAA4B;AAC5B,kDAA2B;AAC3B,gDAAyB;AACzB,gDAAyB;AACzB,8CAAuB;AACvB,kDAA2B;AAC3B,iDAA0B;AAC1B,+CAAwB;AACxB,wDAAiC;AACjC,+CAAwB;AACxB,+CAAwB;AACxB,gDAAyB;AACzB,gDAAyB;AACzB,6CAAsB;AACtB,6CAAsB;AACtB,8CAAuB;AACvB,+CAAwB;AACxB,6CAAsB;AACtB,6CAAsB;AACtB,4CAAqB;AACrB,gDAAyB"}
|
package/build/src/index.d.ts
CHANGED
package/build/src/index.mjs
CHANGED
|
@@ -10,6 +10,7 @@ export * from "./profiles.mjs";
|
|
|
10
10
|
export * from "./relays.mjs";
|
|
11
11
|
export * from "./relaySelections.mjs";
|
|
12
12
|
export * from "./router.mjs";
|
|
13
|
+
export * from "./search.mjs";
|
|
13
14
|
export * from "./session.mjs";
|
|
14
15
|
export * from "./storage.mjs";
|
|
15
16
|
export * from "./sync.mjs";
|
package/build/src/mutes.cjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.loadMutes = exports.deriveMutes = exports.mutesByPubkey = exports.mutes = void 0;
|
|
5
5
|
const util_1 = require("@welshman/util");
|
|
6
6
|
const store_1 = require("@welshman/store");
|
|
7
7
|
const core_1 = require("./core.cjs");
|
|
8
8
|
const collection_1 = require("./collection.cjs");
|
|
9
9
|
const plaintext_1 = require("./plaintext.cjs");
|
|
10
10
|
const relaySelections_1 = require("./relaySelections.cjs");
|
|
11
|
-
exports.mutes = (0, store_1.
|
|
11
|
+
exports.mutes = (0, store_1.deriveEventsMapped)(core_1.repository, {
|
|
12
12
|
filters: [{ kinds: [util_1.MUTES] }],
|
|
13
13
|
itemToEvent: item => item.event,
|
|
14
14
|
eventToItem: async (event) => (0, util_1.readList)((0, util_1.asDecryptedEvent)(event, {
|
|
15
15
|
content: await (0, plaintext_1.ensurePlaintext)(event),
|
|
16
16
|
})),
|
|
17
|
-
})
|
|
17
|
+
});
|
|
18
18
|
_a = (0, collection_1.collection)({
|
|
19
19
|
name: "mutes",
|
|
20
20
|
store: exports.mutes,
|
|
@@ -24,6 +24,4 @@ _a = (0, collection_1.collection)({
|
|
|
24
24
|
await (0, core_1.load)({ ...request, filters: [{ kinds: [util_1.MUTES], authors: [pubkey] }] });
|
|
25
25
|
},
|
|
26
26
|
}), exports.mutesByPubkey = _a.indexStore, exports.deriveMutes = _a.deriveItem, exports.loadMutes = _a.loadItem;
|
|
27
|
-
const getMutes = (pubkey) => (0, util_1.getListValues)("p", exports.mutesByPubkey.get().get(pubkey));
|
|
28
|
-
exports.getMutes = getMutes;
|
|
29
27
|
//# sourceMappingURL=mutes.cjs.map
|
package/build/src/mutes.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutes.cjs","sourceRoot":"","sources":["../../src/mutes.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"mutes.cjs","sourceRoot":"","sources":["../../src/mutes.ts"],"names":[],"mappings":";;;;AAAA,yCAAgE;AAGhE,2CAAkD;AAClD,qCAAuC;AACvC,iDAAuC;AACvC,+CAA2C;AAC3C,2DAAqD;AAExC,QAAA,KAAK,GAAG,IAAA,0BAAkB,EAAgB,iBAAU,EAAE;IACjE,OAAO,EAAE,CAAC,EAAC,KAAK,EAAE,CAAC,YAAK,CAAC,EAAC,CAAC;IAC3B,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK;IAC/B,WAAW,EAAE,KAAK,EAAE,KAAmB,EAAE,EAAE,CACzC,IAAA,eAAQ,EACN,IAAA,uBAAgB,EAAC,KAAK,EAAE;QACtB,OAAO,EAAE,MAAM,IAAA,2BAAe,EAAC,KAAK,CAAC;KACtC,CAAC,CACH;CACJ,CAAC,CAAA;AAEW,KAIT,IAAA,uBAAU,EAAC;IACb,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,aAAK;IACZ,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM;IACjC,IAAI,EAAE,KAAK,EAAE,MAAc,EAAE,UAAiD,EAAE,EAAE,EAAE;QAClF,MAAM,IAAA,qCAAmB,EAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC1C,MAAM,IAAA,WAAI,EAAC,EAAC,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC,EAAC,KAAK,EAAE,CAAC,YAAK,CAAC,EAAE,OAAO,EAAE,CAAC,MAAM,CAAC,EAAC,CAAC,EAAC,CAAC,CAAA;IAC1E,CAAC;CACF,CAAC,EAXY,qBAAa,kBACb,mBAAW,kBACb,iBAAS,eASnB"}
|
package/build/src/mutes.d.ts
CHANGED
|
@@ -3,4 +3,3 @@ import { type PublishedList } from '@welshman/util';
|
|
|
3
3
|
import { type SubscribeRequestWithHandlers } from "@welshman/net";
|
|
4
4
|
export declare const mutes: import("@welshman/store").WritableWithGetter<PublishedList[]>;
|
|
5
5
|
export declare const mutesByPubkey: import("@welshman/store").ReadableWithGetter<Map<string, PublishedList>>, deriveMutes: (key: import("@welshman/lib").Maybe<string>, request?: Partial<SubscribeRequestWithHandlers> | undefined) => import("svelte/store").Readable<PublishedList | undefined>, loadMutes: (key: string, request?: Partial<SubscribeRequestWithHandlers> | undefined) => Promise<PublishedList | undefined>;
|
|
6
|
-
export declare const getMutes: (pubkey: string) => string[];
|
package/build/src/mutes.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { MUTES,
|
|
2
|
-
import { deriveEventsMapped
|
|
1
|
+
import { MUTES, asDecryptedEvent, readList } from '@welshman/util';
|
|
2
|
+
import { deriveEventsMapped } from '@welshman/store';
|
|
3
3
|
import { repository, load } from "./core.mjs";
|
|
4
4
|
import { collection } from "./collection.mjs";
|
|
5
5
|
import { ensurePlaintext } from "./plaintext.mjs";
|
|
6
6
|
import { loadRelaySelections } from "./relaySelections.mjs";
|
|
7
|
-
export const mutes =
|
|
7
|
+
export const mutes = deriveEventsMapped(repository, {
|
|
8
8
|
filters: [{ kinds: [MUTES] }],
|
|
9
9
|
itemToEvent: item => item.event,
|
|
10
10
|
eventToItem: async (event) => readList(asDecryptedEvent(event, {
|
|
11
11
|
content: await ensurePlaintext(event),
|
|
12
12
|
})),
|
|
13
|
-
})
|
|
13
|
+
});
|
|
14
14
|
export const { indexStore: mutesByPubkey, deriveItem: deriveMutes, loadItem: loadMutes, } = collection({
|
|
15
15
|
name: "mutes",
|
|
16
16
|
store: mutes,
|
|
@@ -20,5 +20,4 @@ export const { indexStore: mutesByPubkey, deriveItem: deriveMutes, loadItem: loa
|
|
|
20
20
|
await load({ ...request, filters: [{ kinds: [MUTES], authors: [pubkey] }] });
|
|
21
21
|
},
|
|
22
22
|
});
|
|
23
|
-
export const getMutes = (pubkey) => getListValues("p", mutesByPubkey.get().get(pubkey));
|
|
24
23
|
//# sourceMappingURL=mutes.mjs.map
|
package/build/src/mutes.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutes.mjs","sourceRoot":"","sources":["../../src/mutes.ts"],"names":[],"mappings":"OAAO,EAAC,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"mutes.mjs","sourceRoot":"","sources":["../../src/mutes.ts"],"names":[],"mappings":"OAAO,EAAC,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAC,MAAM,gBAAgB;OAGzD,EAAC,kBAAkB,EAAC,MAAM,iBAAiB;OAC3C,EAAC,UAAU,EAAE,IAAI,EAAC;OAClB,EAAC,UAAU,EAAC;OACZ,EAAC,eAAe,EAAC;OACjB,EAAC,mBAAmB,EAAC;AAE5B,MAAM,CAAC,MAAM,KAAK,GAAG,kBAAkB,CAAgB,UAAU,EAAE;IACjE,OAAO,EAAE,CAAC,EAAC,KAAK,EAAE,CAAC,KAAK,CAAC,EAAC,CAAC;IAC3B,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK;IAC/B,WAAW,EAAE,KAAK,EAAE,KAAmB,EAAE,EAAE,CACzC,QAAQ,CACN,gBAAgB,CAAC,KAAK,EAAE;QACtB,OAAO,EAAE,MAAM,eAAe,CAAC,KAAK,CAAC;KACtC,CAAC,CACH;CACJ,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,EACX,UAAU,EAAE,aAAa,EACzB,UAAU,EAAE,WAAW,EACvB,QAAQ,EAAE,SAAS,GACpB,GAAG,UAAU,CAAC;IACb,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM;IACjC,IAAI,EAAE,KAAK,EAAE,MAAc,EAAE,UAAiD,EAAE,EAAE,EAAE;QAClF,MAAM,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC1C,MAAM,IAAI,CAAC,EAAC,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC,EAAC,KAAK,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,MAAM,CAAC,EAAC,CAAC,EAAC,CAAC,CAAA;IAC1E,CAAC;CACF,CAAC,CAAA"}
|
package/build/src/profiles.cjs
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.deriveProfileDisplay = exports.displayProfileByPubkey = exports.
|
|
5
|
-
const throttle_debounce_1 = require("throttle-debounce");
|
|
4
|
+
exports.deriveProfileDisplay = exports.displayProfileByPubkey = exports.loadProfile = exports.deriveProfile = exports.profilesByPubkey = exports.profiles = void 0;
|
|
6
5
|
const store_1 = require("svelte/store");
|
|
7
|
-
const lib_1 = require("@welshman/lib");
|
|
8
6
|
const util_1 = require("@welshman/util");
|
|
9
7
|
const store_2 = require("@welshman/store");
|
|
10
8
|
const core_1 = require("./core.cjs");
|
|
11
|
-
const util_2 = require("./util.cjs");
|
|
12
9
|
const collection_1 = require("./collection.cjs");
|
|
13
10
|
const relaySelections_1 = require("./relaySelections.cjs");
|
|
14
|
-
const wot_1 = require("./wot.cjs");
|
|
15
11
|
exports.profiles = (0, store_2.withGetter)((0, store_2.deriveEventsMapped)(core_1.repository, {
|
|
16
12
|
filters: [{ kinds: [util_1.PROFILE] }],
|
|
17
13
|
eventToItem: util_1.readProfile,
|
|
@@ -38,26 +34,6 @@ _a = (0, collection_1.collection)({
|
|
|
38
34
|
await (0, core_1.load)({ ...request, filters });
|
|
39
35
|
},
|
|
40
36
|
}), exports.profilesByPubkey = _a.indexStore, exports.deriveProfile = _a.deriveItem, exports.loadProfile = _a.loadItem;
|
|
41
|
-
exports.searchProfiles = (0, throttle_debounce_1.debounce)(500, (search) => {
|
|
42
|
-
if (search.length > 2) {
|
|
43
|
-
(0, core_1.load)({ filters: [{ kinds: [util_1.PROFILE], search }] });
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
exports.profileSearch = (0, store_1.derived)(exports.profiles, $profiles => (0, util_2.createSearch)($profiles, {
|
|
47
|
-
onSearch: exports.searchProfiles,
|
|
48
|
-
getValue: (profile) => profile.event.pubkey,
|
|
49
|
-
sortFn: ({ score, item }) => {
|
|
50
|
-
if (score && score > 0.1)
|
|
51
|
-
return -score;
|
|
52
|
-
const wotScore = wot_1.wotGraph.get().get(item.event.pubkey) || 0;
|
|
53
|
-
return score ? (0, lib_1.dec)(score) * wotScore : -wotScore;
|
|
54
|
-
},
|
|
55
|
-
fuseOptions: {
|
|
56
|
-
keys: ["name", "display_name", { name: "about", weight: 0.3 }],
|
|
57
|
-
threshold: 0.3,
|
|
58
|
-
shouldSort: false,
|
|
59
|
-
},
|
|
60
|
-
}));
|
|
61
37
|
const displayProfileByPubkey = (pubkey) => pubkey
|
|
62
38
|
? (0, util_1.displayProfile)(exports.profilesByPubkey.get().get(pubkey), (0, util_1.displayPubkey)(pubkey))
|
|
63
39
|
: "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiles.cjs","sourceRoot":"","sources":["../../src/profiles.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"profiles.cjs","sourceRoot":"","sources":["../../src/profiles.ts"],"names":[],"mappings":";;;;AAAA,wCAA8C;AAC9C,yCAAkF;AAGlF,2CAA8D;AAC9D,qCAAuC;AACvC,iDAAuC;AACvC,2DAAqD;AAExC,QAAA,QAAQ,GAAG,IAAA,kBAAU,EAChC,IAAA,0BAAkB,EAAmB,iBAAU,EAAE;IAC/C,OAAO,EAAE,CAAC,EAAC,KAAK,EAAE,CAAC,cAAO,CAAC,EAAC,CAAC;IAC7B,WAAW,EAAE,kBAAW;IACxB,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK;CAChC,CAAC,CACH,CAAA;AAEY,KAIT,IAAA,uBAAU,EAAC;IACb,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,gBAAQ;IACf,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM;IACvC,IAAI,EAAE,KAAK,EAAE,MAAc,EAAE,UAAiD,EAAE,EAAE,EAAE;QAClF,MAAM,OAAO,GAAG,CAAC,EAAC,KAAK,EAAE,CAAC,cAAO,CAAC,EAAE,OAAO,EAAE,CAAC,MAAM,CAAC,EAAC,CAAC,CAAA;QAEvD,qFAAqF;QACrF,mCAAmC;QACnC,IAAA,WAAI,EAAC,EAAC,GAAG,OAAO,EAAE,OAAO,EAAC,CAAC,CAAA;QAE3B,oFAAoF;QACpF,uEAAuE;QACvE,MAAM,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE;YAChC,IAAA,qCAAmB,EAAC,MAAM,EAAE;gBAC1B,OAAO,EAAE,CAAC,KAAmB,EAAE,EAAE;oBAC/B,OAAO,EAAE,CAAA;gBACX,CAAC;aACF,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,MAAM,IAAA,WAAI,EAAC,EAAC,GAAG,OAAO,EAAE,OAAO,EAAC,CAAC,CAAA;IACnC,CAAC;CACF,CAAC,EA1BY,wBAAgB,kBAChB,qBAAa,kBACf,mBAAW,eAwBrB;AAEK,MAAM,sBAAsB,GAAG,CAAC,MAA0B,EAAE,EAAE,CACnE,MAAM;IACJ,CAAC,CAAC,IAAA,qBAAc,EAAC,wBAAgB,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,IAAA,oBAAa,EAAC,MAAM,CAAC,CAAC;IAC3E,CAAC,CAAC,EAAE,CAAA;AAHK,QAAA,sBAAsB,0BAG3B;AAED,MAAM,oBAAoB,GAAG,CAAC,MAA0B,EAAE,EAAE,CACjE,MAAM;IACJ,CAAC,CAAC,IAAA,eAAO,EAAC,IAAA,qBAAa,EAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAA,qBAAc,EAAC,QAAQ,EAAE,IAAA,oBAAa,EAAC,MAAM,CAAC,CAAC,CAAC;IAC7F,CAAC,CAAC,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAA;AAHL,QAAA,oBAAoB,wBAGf"}
|
package/build/src/profiles.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/// <reference types="svelte" />
|
|
2
|
-
import { debounce } from 'throttle-debounce';
|
|
3
2
|
import type { SubscribeRequestWithHandlers } from "@welshman/net";
|
|
4
3
|
import type { PublishedProfile } from "@welshman/util";
|
|
5
4
|
export declare const profiles: import("@welshman/store").WritableWithGetter<PublishedProfile[]>;
|
|
6
5
|
export declare const profilesByPubkey: import("@welshman/store").ReadableWithGetter<Map<string, PublishedProfile>>, deriveProfile: (key: import("@welshman/lib").Maybe<string>, request?: Partial<SubscribeRequestWithHandlers> | undefined) => import("svelte/store").Readable<PublishedProfile | undefined>, loadProfile: (key: string, request?: Partial<SubscribeRequestWithHandlers> | undefined) => Promise<PublishedProfile | undefined>;
|
|
7
|
-
export declare const searchProfiles: debounce<(search: string) => void>;
|
|
8
|
-
export declare const profileSearch: import("svelte/store").Readable<import("./util").Search<string, PublishedProfile>>;
|
|
9
6
|
export declare const displayProfileByPubkey: (pubkey: string | undefined) => string;
|
|
10
7
|
export declare const deriveProfileDisplay: (pubkey: string | undefined) => import("svelte/store").Readable<string>;
|
package/build/src/profiles.mjs
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { debounce } from 'throttle-debounce';
|
|
2
1
|
import { derived, readable } from 'svelte/store';
|
|
3
|
-
import { dec } from '@welshman/lib';
|
|
4
2
|
import { readProfile, displayProfile, displayPubkey, PROFILE } from '@welshman/util';
|
|
5
3
|
import { deriveEventsMapped, withGetter } from '@welshman/store';
|
|
6
4
|
import { repository, load } from "./core.mjs";
|
|
7
|
-
import { createSearch } from "./util.mjs";
|
|
8
5
|
import { collection } from "./collection.mjs";
|
|
9
6
|
import { loadRelaySelections } from "./relaySelections.mjs";
|
|
10
|
-
import { wotGraph } from "./wot.mjs";
|
|
11
7
|
export const profiles = withGetter(deriveEventsMapped(repository, {
|
|
12
8
|
filters: [{ kinds: [PROFILE] }],
|
|
13
9
|
eventToItem: readProfile,
|
|
@@ -34,26 +30,6 @@ export const { indexStore: profilesByPubkey, deriveItem: deriveProfile, loadItem
|
|
|
34
30
|
await load({ ...request, filters });
|
|
35
31
|
},
|
|
36
32
|
});
|
|
37
|
-
export const searchProfiles = debounce(500, (search) => {
|
|
38
|
-
if (search.length > 2) {
|
|
39
|
-
load({ filters: [{ kinds: [PROFILE], search }] });
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
export const profileSearch = derived(profiles, $profiles => createSearch($profiles, {
|
|
43
|
-
onSearch: searchProfiles,
|
|
44
|
-
getValue: (profile) => profile.event.pubkey,
|
|
45
|
-
sortFn: ({ score, item }) => {
|
|
46
|
-
if (score && score > 0.1)
|
|
47
|
-
return -score;
|
|
48
|
-
const wotScore = wotGraph.get().get(item.event.pubkey) || 0;
|
|
49
|
-
return score ? dec(score) * wotScore : -wotScore;
|
|
50
|
-
},
|
|
51
|
-
fuseOptions: {
|
|
52
|
-
keys: ["name", "display_name", { name: "about", weight: 0.3 }],
|
|
53
|
-
threshold: 0.3,
|
|
54
|
-
shouldSort: false,
|
|
55
|
-
},
|
|
56
|
-
}));
|
|
57
33
|
export const displayProfileByPubkey = (pubkey) => pubkey
|
|
58
34
|
? displayProfile(profilesByPubkey.get().get(pubkey), displayPubkey(pubkey))
|
|
59
35
|
: "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiles.mjs","sourceRoot":"","sources":["../../src/profiles.ts"],"names":[],"mappings":"OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"profiles.mjs","sourceRoot":"","sources":["../../src/profiles.ts"],"names":[],"mappings":"OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,cAAc;OACvC,EAAC,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,OAAO,EAAC,MAAM,gBAAgB;OAG3E,EAAC,kBAAkB,EAAE,UAAU,EAAC,MAAM,iBAAiB;OACvD,EAAC,UAAU,EAAE,IAAI,EAAC;OAClB,EAAC,UAAU,EAAC;OACZ,EAAC,mBAAmB,EAAC;AAE5B,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAChC,kBAAkB,CAAmB,UAAU,EAAE;IAC/C,OAAO,EAAE,CAAC,EAAC,KAAK,EAAE,CAAC,OAAO,CAAC,EAAC,CAAC;IAC7B,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK;CAChC,CAAC,CACH,CAAA;AAED,MAAM,CAAC,MAAM,EACX,UAAU,EAAE,gBAAgB,EAC5B,UAAU,EAAE,aAAa,EACzB,QAAQ,EAAE,WAAW,GACtB,GAAG,UAAU,CAAC;IACb,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM;I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boxRelaySelections = exports.deriveInboxRelaySelections = exports.inboxRelaySelectionsByPubkey = exports.inboxRelaySelections = exports.loadRelaySelections = exports.deriveRelaySelections = exports.relaySelectionsByPubkey = exports.relaySelections = exports.getWriteRelayUrls = exports.getReadRelayUrls = exports.getRelayUrls = void 0;
|
|
5
|
+
const lib_1 = require("@welshman/lib");
|
|
5
6
|
const util_1 = require("@welshman/util");
|
|
6
7
|
const store_1 = require("@welshman/store");
|
|
7
8
|
const core_1 = require("./core.cjs");
|
|
8
9
|
const collection_1 = require("./collection.cjs");
|
|
9
|
-
const getRelayUrls = (
|
|
10
|
-
.map((t) => (0, util_1.normalizeRelayUrl)(t[1]));
|
|
10
|
+
const getRelayUrls = (list) => (0, lib_1.uniq)((0, util_1.getRelayTagValues)((0, util_1.getListTags)(list)).map(util_1.normalizeRelayUrl));
|
|
11
11
|
exports.getRelayUrls = getRelayUrls;
|
|
12
|
-
const getReadRelayUrls = (
|
|
12
|
+
const getReadRelayUrls = (list) => (0, lib_1.uniq)((0, util_1.getRelayTags)((0, util_1.getListTags)(list))
|
|
13
13
|
.filter((t) => !t[2] || t[2] === "read")
|
|
14
|
-
.map((t) => (0, util_1.normalizeRelayUrl)(t[1]));
|
|
14
|
+
.map((t) => (0, util_1.normalizeRelayUrl)(t[1])));
|
|
15
15
|
exports.getReadRelayUrls = getReadRelayUrls;
|
|
16
|
-
const getWriteRelayUrls = (
|
|
16
|
+
const getWriteRelayUrls = (list) => (0, lib_1.uniq)((0, util_1.getRelayTags)((0, util_1.getListTags)(list))
|
|
17
17
|
.filter((t) => !t[2] || t[2] === "write")
|
|
18
|
-
.map((t) => (0, util_1.normalizeRelayUrl)(t[1]));
|
|
18
|
+
.map((t) => (0, util_1.normalizeRelayUrl)(t[1])));
|
|
19
19
|
exports.getWriteRelayUrls = getWriteRelayUrls;
|
|
20
|
-
exports.relaySelections = (0, store_1.
|
|
20
|
+
exports.relaySelections = (0, store_1.deriveEventsMapped)(core_1.repository, {
|
|
21
|
+
filters: [{ kinds: [util_1.RELAYS] }],
|
|
22
|
+
itemToEvent: item => item.event,
|
|
23
|
+
eventToItem: (event) => (0, util_1.readList)((0, util_1.asDecryptedEvent)(event)),
|
|
24
|
+
});
|
|
21
25
|
_a = (0, collection_1.collection)({
|
|
22
26
|
name: "relaySelections",
|
|
23
27
|
store: exports.relaySelections,
|
|
24
|
-
getKey: relaySelections => relaySelections.pubkey,
|
|
28
|
+
getKey: relaySelections => relaySelections.event.pubkey,
|
|
25
29
|
load: (pubkey, request = {}) => (0, core_1.load)({ ...request, filters: [{ kinds: [util_1.RELAYS], authors: [pubkey] }] }),
|
|
26
30
|
}), exports.relaySelectionsByPubkey = _a.indexStore, exports.deriveRelaySelections = _a.deriveItem, exports.loadRelaySelections = _a.loadItem;
|
|
27
|
-
exports.inboxRelaySelections = (0, store_1.
|
|
31
|
+
exports.inboxRelaySelections = (0, store_1.deriveEventsMapped)(core_1.repository, {
|
|
32
|
+
filters: [{ kinds: [util_1.INBOX_RELAYS] }],
|
|
33
|
+
itemToEvent: item => item.event,
|
|
34
|
+
eventToItem: (event) => (0, util_1.readList)((0, util_1.asDecryptedEvent)(event)),
|
|
35
|
+
});
|
|
28
36
|
_b = (0, collection_1.collection)({
|
|
29
37
|
name: "inboxRelaySelections",
|
|
30
38
|
store: exports.inboxRelaySelections,
|
|
31
|
-
getKey: inboxRelaySelections => inboxRelaySelections.pubkey,
|
|
39
|
+
getKey: inboxRelaySelections => inboxRelaySelections.event.pubkey,
|
|
32
40
|
load: (pubkey, request = {}) => (0, core_1.load)({ ...request, filters: [{ kinds: [util_1.INBOX_RELAYS], authors: [pubkey] }] }),
|
|
33
41
|
}), exports.inboxRelaySelectionsByPubkey = _b.indexStore, exports.deriveInboxRelaySelections = _b.deriveItem, exports.loadInboxRelaySelections = _b.loadItem;
|
|
34
42
|
//# sourceMappingURL=relaySelections.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relaySelections.cjs","sourceRoot":"","sources":["../../src/relaySelections.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"relaySelections.cjs","sourceRoot":"","sources":["../../src/relaySelections.ts"],"names":[],"mappings":";;;;AAAA,uCAAkC;AAClC,yCAAgJ;AAGhJ,2CAAkD;AAClD,qCAAuC;AACvC,iDAAuC;AAEhC,MAAM,YAAY,GAAG,CAAC,IAAW,EAAY,EAAE,CACpD,IAAA,UAAI,EAAC,IAAA,wBAAiB,EAAC,IAAA,kBAAW,EAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,wBAAiB,CAAC,CAAC,CAAA;AADtD,QAAA,YAAY,gBAC0C;AAE5D,MAAM,gBAAgB,GAAG,CAAC,IAAW,EAAY,EAAE,CACxD,IAAA,UAAI,EACF,IAAA,mBAAY,EAAC,IAAA,kBAAW,EAAC,IAAI,CAAC,CAAC;KAC5B,MAAM,CAAC,CAAC,CAAW,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC;KACjD,GAAG,CAAC,CAAC,CAAW,EAAE,EAAE,CAAC,IAAA,wBAAiB,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CACjD,CAAA;AALU,QAAA,gBAAgB,oBAK1B;AAEI,MAAM,iBAAiB,GAAG,CAAC,IAAW,EAAY,EAAE,CACzD,IAAA,UAAI,EACF,IAAA,mBAAY,EAAC,IAAA,kBAAW,EAAC,IAAI,CAAC,CAAC;KAC5B,MAAM,CAAC,CAAC,CAAW,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC;KAClD,GAAG,CAAC,CAAC,CAAW,EAAE,EAAE,CAAC,IAAA,wBAAiB,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CACjD,CAAA;AALU,QAAA,iBAAiB,qBAK3B;AAEU,QAAA,eAAe,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