@welshman/app 0.0.2 → 0.0.4
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 +24 -11
- package/build/src/collection.cjs.map +1 -1
- package/build/src/collection.mjs +24 -11
- package/build/src/collection.mjs.map +1 -1
- package/build/src/context.cjs +38 -0
- package/build/src/context.cjs.map +1 -0
- package/build/src/context.d.ts +30 -0
- package/build/src/context.mjs +33 -0
- package/build/src/context.mjs.map +1 -0
- package/build/src/core.cjs +30 -8
- package/build/src/core.cjs.map +1 -1
- package/build/src/core.d.ts +7 -9
- package/build/src/core.mjs +31 -8
- package/build/src/core.mjs.map +1 -1
- package/build/src/follows.cjs +3 -7
- package/build/src/follows.cjs.map +1 -1
- package/build/src/follows.d.ts +1 -1
- package/build/src/follows.mjs +4 -8
- package/build/src/follows.mjs.map +1 -1
- package/build/src/handles.cjs +56 -14
- package/build/src/handles.cjs.map +1 -1
- package/build/src/handles.d.ts +10 -2
- package/build/src/handles.mjs +55 -15
- package/build/src/handles.mjs.map +1 -1
- package/build/src/index.cjs +2 -8
- package/build/src/index.cjs.map +1 -1
- package/build/src/index.d.ts +2 -0
- package/build/src/index.mjs +2 -8
- package/build/src/index.mjs.map +1 -1
- package/build/src/mutes.cjs +3 -7
- package/build/src/mutes.cjs.map +1 -1
- package/build/src/mutes.d.ts +1 -1
- package/build/src/mutes.mjs +4 -8
- package/build/src/mutes.mjs.map +1 -1
- package/build/src/profiles.cjs +11 -11
- package/build/src/profiles.cjs.map +1 -1
- package/build/src/profiles.d.ts +5 -6
- package/build/src/profiles.mjs +14 -14
- package/build/src/profiles.mjs.map +1 -1
- package/build/src/relaySelections.cjs +14 -8
- package/build/src/relaySelections.cjs.map +1 -1
- package/build/src/relaySelections.d.ts +10 -4
- package/build/src/relaySelections.mjs +13 -8
- package/build/src/relaySelections.mjs.map +1 -1
- package/build/src/relays.cjs +22 -28
- package/build/src/relays.cjs.map +1 -1
- package/build/src/relays.d.ts +1 -1
- package/build/src/relays.mjs +23 -29
- package/build/src/relays.mjs.map +1 -1
- package/build/src/router.cjs +375 -0
- package/build/src/router.cjs.map +1 -0
- package/build/src/router.d.ts +197 -0
- package/build/src/router.mjs +355 -0
- package/build/src/router.mjs.map +1 -0
- package/build/src/session.cjs +3 -4
- package/build/src/session.cjs.map +1 -1
- package/build/src/session.mjs +4 -5
- package/build/src/session.mjs.map +1 -1
- package/build/src/storage.cjs +23 -13
- package/build/src/storage.cjs.map +1 -1
- package/build/src/storage.d.ts +26 -2
- package/build/src/storage.mjs +24 -14
- package/build/src/storage.mjs.map +1 -1
- package/build/src/zappers.cjs +37 -16
- package/build/src/zappers.cjs.map +1 -1
- package/build/src/zappers.d.ts +4 -3
- package/build/src/zappers.mjs +37 -17
- package/build/src/zappers.mjs.map +1 -1
- package/package.json +6 -6
package/build/src/handles.d.ts
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
/// <reference types="svelte" />
|
|
2
|
+
import { type SubscribeRequest } from "@welshman/net";
|
|
2
3
|
export type Handle = {
|
|
3
4
|
nip05: string;
|
|
4
5
|
pubkey?: string;
|
|
5
6
|
nip46?: string[];
|
|
6
7
|
relays?: string[];
|
|
7
8
|
};
|
|
9
|
+
export declare const NIP05_REGEX: RegExp;
|
|
10
|
+
export declare function queryProfile(nip05: string): Promise<{
|
|
11
|
+
nip05: string;
|
|
12
|
+
pubkey: any;
|
|
13
|
+
nip46: any;
|
|
14
|
+
relays: any;
|
|
15
|
+
} | undefined>;
|
|
8
16
|
export declare const handles: import("svelte/store").Writable<Handle[]> & {
|
|
9
17
|
get: () => Handle[];
|
|
10
18
|
};
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const fetchHandles: (handles: string[]) => Map<string, Handle>;
|
|
19
|
+
export declare const fetchHandles: (nip05s: string[]) => Promise<Map<string, Handle>>;
|
|
13
20
|
export declare const handlesByNip05: import("svelte/store").Readable<Map<string, Handle>> & {
|
|
14
21
|
get: () => Map<string, Handle>;
|
|
15
22
|
}, deriveHandle: (key: import("@welshman/lib").Maybe<string>) => import("svelte/store").Readable<Handle | undefined>, loadHandle: (key: string) => Promise<Handle | undefined>;
|
|
23
|
+
export declare const deriveHandleForPubkey: (pubkey: string, request?: Partial<SubscribeRequest>) => import("svelte/store").Readable<Handle | undefined>;
|
|
16
24
|
export declare const displayHandle: (handle: Handle) => string;
|
package/build/src/handles.mjs
CHANGED
|
@@ -1,20 +1,49 @@
|
|
|
1
1
|
import { writable, derived } from 'svelte/store';
|
|
2
2
|
import { withGetter } from '@welshman/store';
|
|
3
|
-
import {
|
|
4
|
-
import { env } from "./core.mjs";
|
|
3
|
+
import { ctx, tryCatch, fetchJson, uniq, batcher, postJson, last } from '@welshman/lib';
|
|
5
4
|
import { collection } from "./collection.mjs";
|
|
6
|
-
import {
|
|
7
|
-
export const
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
import { deriveProfile } from "./profiles.mjs";
|
|
6
|
+
export const NIP05_REGEX = /^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/;
|
|
7
|
+
export async function queryProfile(nip05) {
|
|
8
|
+
const match = nip05.match(NIP05_REGEX);
|
|
9
|
+
if (!match)
|
|
10
|
+
return undefined;
|
|
11
|
+
const [_, name = '_', domain] = match;
|
|
12
|
+
try {
|
|
13
|
+
const { names, relays = {}, nip46 = {} } = await fetchJson(`https://${domain}/.well-known/nostr.json?name=${name}`);
|
|
14
|
+
const pubkey = names[name];
|
|
15
|
+
if (!pubkey) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
nip05,
|
|
20
|
+
pubkey,
|
|
21
|
+
nip46: nip46[pubkey],
|
|
22
|
+
relays: relays[pubkey],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
catch (_e) {
|
|
26
|
+
return undefined;
|
|
13
27
|
}
|
|
14
|
-
|
|
28
|
+
}
|
|
29
|
+
export const handles = withGetter(writable([]));
|
|
30
|
+
export const fetchHandles = async (nip05s) => {
|
|
31
|
+
const base = ctx.app.dufflepudUrl;
|
|
15
32
|
const handlesByNip05 = new Map();
|
|
16
|
-
|
|
17
|
-
|
|
33
|
+
// Use dufflepud if we it's set up to protect user privacy, otherwise fetch directly
|
|
34
|
+
if (base) {
|
|
35
|
+
const res = await tryCatch(async () => await postJson(`${base}/handle/info`, { handles: nip05s }));
|
|
36
|
+
for (const { handle: nip05, info } of (res === null || res === void 0 ? void 0 : res.data) || []) {
|
|
37
|
+
handlesByNip05.set(nip05, info);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
const results = await Promise.all(nip05s.map(async (nip05) => ({ nip05, info: await tryCatch(async () => await queryProfile(nip05)) })));
|
|
42
|
+
for (const { nip05, info } of results) {
|
|
43
|
+
if (info) {
|
|
44
|
+
handlesByNip05.set(nip05, info);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
18
47
|
}
|
|
19
48
|
return handlesByNip05;
|
|
20
49
|
};
|
|
@@ -26,12 +55,23 @@ export const { indexStore: handlesByNip05, deriveItem: deriveHandle, loadItem: l
|
|
|
26
55
|
const fresh = await fetchHandles(uniq(nip05s));
|
|
27
56
|
const stale = handlesByNip05.get();
|
|
28
57
|
const items = nip05s.map(nip05 => {
|
|
29
|
-
const
|
|
30
|
-
|
|
58
|
+
const newHandle = fresh.get(nip05);
|
|
59
|
+
const oldHandle = stale.get(nip05);
|
|
60
|
+
if (newHandle) {
|
|
61
|
+
stale.set(nip05, { ...newHandle, nip05 });
|
|
62
|
+
}
|
|
63
|
+
return { ...oldHandle, ...newHandle, nip05 };
|
|
31
64
|
});
|
|
32
|
-
handles.
|
|
65
|
+
handles.set(Array.from(stale.values()));
|
|
33
66
|
return items;
|
|
34
67
|
}),
|
|
35
68
|
});
|
|
69
|
+
export const deriveHandleForPubkey = (pubkey, request = {}) => derived([handlesByNip05, deriveProfile(pubkey, request)], ([$handlesByNip05, $profile]) => {
|
|
70
|
+
if (!($profile === null || $profile === void 0 ? void 0 : $profile.nip05)) {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
loadHandle($profile.nip05);
|
|
74
|
+
return $handlesByNip05.get($profile.nip05);
|
|
75
|
+
});
|
|
36
76
|
export const displayHandle = (handle) => handle.nip05.startsWith("_@") ? last(handle.nip05.split("@")) : handle.nip05;
|
|
37
77
|
//# sourceMappingURL=handles.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handles.mjs","sourceRoot":"","sources":["../../src/handles.ts"],"names":[],"mappings":"OAAO,EAAC,QAAQ,EAAE,OAAO,EAAC,MAAM,cAAc;OACvC,EAAC,UAAU,EAAC,MAAM,iBAAiB;
|
|
1
|
+
{"version":3,"file":"handles.mjs","sourceRoot":"","sources":["../../src/handles.ts"],"names":[],"mappings":"OAAO,EAAC,QAAQ,EAAE,OAAO,EAAC,MAAM,cAAc;OACvC,EAAC,UAAU,EAAC,MAAM,iBAAiB;OAEnC,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,CA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K,CAAA;IACd,CAAC,CAAC;CACH,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAAc,EAAE,UAAqC,EAAE,EAAE,EAAE,CAC/F,OAAO,CACL,CAAC,cAAc,EAAE,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAChD,CAAC,CAAC,eAAe,EAAE,QAAQ,CAAC,EAAE,EAAE;IAC9B,IAAI,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,KAAK,CAAA,EAAE;QACpB,OAAO,SAAS,CAAA;KACjB;IAED,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAE1B,OAAO,eAAe,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AAC5C,CAAC,CACF,CAAA;AAEH,MAAM,CAAC,MAAM,aAAa,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
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./context.cjs"), exports);
|
|
17
18
|
__exportStar(require("./core.cjs"), exports);
|
|
18
19
|
__exportStar(require("./collection.cjs"), exports);
|
|
19
20
|
__exportStar(require("./freshness.cjs"), exports);
|
|
@@ -24,18 +25,11 @@ __exportStar(require("./plaintext.cjs"), exports);
|
|
|
24
25
|
__exportStar(require("./profiles.cjs"), exports);
|
|
25
26
|
__exportStar(require("./relays.cjs"), exports);
|
|
26
27
|
__exportStar(require("./relaySelections.cjs"), exports);
|
|
28
|
+
__exportStar(require("./router.cjs"), exports);
|
|
27
29
|
__exportStar(require("./session.cjs"), exports);
|
|
28
30
|
__exportStar(require("./storage.cjs"), exports);
|
|
29
31
|
__exportStar(require("./thunk.cjs"), exports);
|
|
30
32
|
__exportStar(require("./topics.cjs"), exports);
|
|
31
33
|
__exportStar(require("./util.cjs"), exports);
|
|
32
34
|
__exportStar(require("./zappers.cjs"), exports);
|
|
33
|
-
const net_1 = require("@welshman/net");
|
|
34
|
-
const core_1 = require("./core.cjs");
|
|
35
|
-
const session_1 = require("./session.cjs");
|
|
36
|
-
Object.assign(net_1.NetworkContext, {
|
|
37
|
-
onAuth: session_1.onAuth,
|
|
38
|
-
onEvent: (url, event) => core_1.tracker.track(event.id, url),
|
|
39
|
-
isDeleted: (url, event) => core_1.repository.isDeleted(event),
|
|
40
|
-
});
|
|
41
35
|
//# sourceMappingURL=index.cjs.map
|
package/build/src/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAAsB;AACtB,mDAA4B;AAC5B,kDAA2B;AAC3B,gDAAyB;AACzB,gDAAyB;AACzB,8CAAuB;AACvB,kDAA2B;AAC3B,iDAA0B;AAC1B,+CAAwB;AACxB,wDAAiC;AACjC,gDAAyB;AACzB,gDAAyB;AACzB,8CAAuB;AACvB,+CAAwB;AACxB,6CAAsB;AACtB,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,gDAAyB;AACzB,gDAAyB;AACzB,8CAAuB;AACvB,+CAAwB;AACxB,6CAAsB;AACtB,gDAAyB"}
|
package/build/src/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './context';
|
|
1
2
|
export * from './core';
|
|
2
3
|
export * from './collection';
|
|
3
4
|
export * from './freshness';
|
|
@@ -8,6 +9,7 @@ export * from './plaintext';
|
|
|
8
9
|
export * from './profiles';
|
|
9
10
|
export * from './relays';
|
|
10
11
|
export * from './relaySelections';
|
|
12
|
+
export * from './router';
|
|
11
13
|
export * from './session';
|
|
12
14
|
export * from './storage';
|
|
13
15
|
export * from './thunk';
|
package/build/src/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from "./context.mjs";
|
|
1
2
|
export * from "./core.mjs";
|
|
2
3
|
export * from "./collection.mjs";
|
|
3
4
|
export * from "./freshness.mjs";
|
|
@@ -8,18 +9,11 @@ export * from "./plaintext.mjs";
|
|
|
8
9
|
export * from "./profiles.mjs";
|
|
9
10
|
export * from "./relays.mjs";
|
|
10
11
|
export * from "./relaySelections.mjs";
|
|
12
|
+
export * from "./router.mjs";
|
|
11
13
|
export * from "./session.mjs";
|
|
12
14
|
export * from "./storage.mjs";
|
|
13
15
|
export * from "./thunk.mjs";
|
|
14
16
|
export * from "./topics.mjs";
|
|
15
17
|
export * from "./util.mjs";
|
|
16
18
|
export * from "./zappers.mjs";
|
|
17
|
-
import { NetworkContext } from "@welshman/net";
|
|
18
|
-
import { tracker, repository } from "./core.mjs";
|
|
19
|
-
import { onAuth } from "./session.mjs";
|
|
20
|
-
Object.assign(NetworkContext, {
|
|
21
|
-
onAuth,
|
|
22
|
-
onEvent: (url, event) => tracker.track(event.id, url),
|
|
23
|
-
isDeleted: (url, event) => repository.isDeleted(event),
|
|
24
|
-
});
|
|
25
19
|
//# sourceMappingURL=index.mjs.map
|
package/build/src/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":""}
|
package/build/src/mutes.cjs
CHANGED
|
@@ -19,13 +19,9 @@ _a = (0, collection_1.collection)({
|
|
|
19
19
|
name: "mutes",
|
|
20
20
|
store: exports.mutes,
|
|
21
21
|
getKey: mute => mute.event.pubkey,
|
|
22
|
-
load: async (pubkey,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
...request,
|
|
26
|
-
relays: [...relays, ...hints],
|
|
27
|
-
filters: [{ kinds: [util_1.MUTES], authors: [pubkey] }],
|
|
28
|
-
});
|
|
22
|
+
load: async (pubkey, request = {}) => {
|
|
23
|
+
await (0, relaySelections_1.loadRelaySelections)(pubkey, request);
|
|
24
|
+
await (0, core_1.load)({ ...request, filters: [{ kinds: [util_1.MUTES], authors: [pubkey] }] });
|
|
29
25
|
},
|
|
30
26
|
}), exports.mutesByPubkey = _a.indexStore, exports.deriveMutes = _a.deriveItem, exports.loadMutes = _a.loadItem;
|
|
31
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,yCAAgE;AAGhE,2CAA8D;AAC9D,qCAAuC;AACvC,iDAAuC;AACvC,+CAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"mutes.cjs","sourceRoot":"","sources":["../../src/mutes.ts"],"names":[],"mappings":";;;;AAAA,yCAAgE;AAGhE,2CAA8D;AAC9D,qCAAuC;AACvC,iDAAuC;AACvC,+CAA2C;AAC3C,2DAAqD;AAExC,QAAA,KAAK,GAAG,IAAA,kBAAU,EAC7B,IAAA,0BAAkB,EAAgB,iBAAU,EAAE;IAC5C,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,CACH,CAAA;AAEY,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,UAAqC,EAAE,EAAE,EAAE;QACtE,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
|
@@ -6,4 +6,4 @@ export declare const mutes: import("svelte/store").Readable<PublishedList[]> & {
|
|
|
6
6
|
};
|
|
7
7
|
export declare const mutesByPubkey: import("svelte/store").Readable<Map<string, PublishedList>> & {
|
|
8
8
|
get: () => Map<string, PublishedList>;
|
|
9
|
-
}, deriveMutes: (key: import("@welshman/lib").Maybe<string>,
|
|
9
|
+
}, deriveMutes: (key: import("@welshman/lib").Maybe<string>, request?: Partial<SubscribeRequest> | undefined) => import("svelte/store").Readable<PublishedList | undefined>, loadMutes: (key: string, request?: Partial<SubscribeRequest> | undefined) => Promise<PublishedList | undefined>;
|
package/build/src/mutes.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { deriveEventsMapped, withGetter } 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
|
-
import {
|
|
6
|
+
import { loadRelaySelections } from "./relaySelections.mjs";
|
|
7
7
|
export const mutes = withGetter(deriveEventsMapped(repository, {
|
|
8
8
|
filters: [{ kinds: [MUTES] }],
|
|
9
9
|
itemToEvent: item => item.event,
|
|
@@ -15,13 +15,9 @@ export const { indexStore: mutesByPubkey, deriveItem: deriveMutes, loadItem: loa
|
|
|
15
15
|
name: "mutes",
|
|
16
16
|
store: mutes,
|
|
17
17
|
getKey: mute => mute.event.pubkey,
|
|
18
|
-
load: async (pubkey,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
...request,
|
|
22
|
-
relays: [...relays, ...hints],
|
|
23
|
-
filters: [{ kinds: [MUTES], authors: [pubkey] }],
|
|
24
|
-
});
|
|
18
|
+
load: async (pubkey, request = {}) => {
|
|
19
|
+
await loadRelaySelections(pubkey, request);
|
|
20
|
+
await load({ ...request, filters: [{ kinds: [MUTES], authors: [pubkey] }] });
|
|
25
21
|
},
|
|
26
22
|
});
|
|
27
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,gBAAgB,EAAE,QAAQ,EAAC,MAAM,gBAAgB;OAGzD,EAAC,kBAAkB,EAAE,UAAU,EAAC,MAAM,iBAAiB;OACvD,EAAC,UAAU,EAAE,IAAI,EAAC;OAClB,EAAC,UAAU,EAAC;OACZ,EAAC,eAAe,EAAC;OACjB,EAAC,
|
|
1
|
+
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AC;CACF,CAAC,CAAA"}
|
package/build/src/profiles.cjs
CHANGED
|
@@ -9,22 +9,18 @@ const core_1 = require("./core.cjs");
|
|
|
9
9
|
const util_2 = require("./util.cjs");
|
|
10
10
|
const collection_1 = require("./collection.cjs");
|
|
11
11
|
const relaySelections_1 = require("./relaySelections.cjs");
|
|
12
|
-
exports.profiles = (0, store_2.deriveEventsMapped)(core_1.repository, {
|
|
12
|
+
exports.profiles = (0, store_2.withGetter)((0, store_2.deriveEventsMapped)(core_1.repository, {
|
|
13
13
|
filters: [{ kinds: [util_1.PROFILE] }],
|
|
14
14
|
eventToItem: util_1.readProfile,
|
|
15
15
|
itemToEvent: item => item.event,
|
|
16
|
-
});
|
|
16
|
+
}));
|
|
17
17
|
_a = (0, collection_1.collection)({
|
|
18
18
|
name: "profiles",
|
|
19
19
|
store: exports.profiles,
|
|
20
20
|
getKey: profile => profile.event.pubkey,
|
|
21
|
-
load: async (pubkey,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
...request,
|
|
25
|
-
relays: [...relays, ...hints],
|
|
26
|
-
filters: [{ kinds: [util_1.PROFILE], authors: [pubkey] }],
|
|
27
|
-
});
|
|
21
|
+
load: async (pubkey, request = {}) => {
|
|
22
|
+
await (0, relaySelections_1.loadRelaySelections)(pubkey, request);
|
|
23
|
+
await (0, core_1.load)({ ...request, filters: [{ kinds: [util_1.PROFILE], authors: [pubkey] }] });
|
|
28
24
|
},
|
|
29
25
|
}), exports.profilesByPubkey = _a.indexStore, exports.deriveProfile = _a.deriveItem, exports.loadProfile = _a.loadItem;
|
|
30
26
|
exports.profileSearch = (0, store_1.derived)(exports.profiles, $profiles => (0, util_2.createSearch)($profiles, {
|
|
@@ -33,8 +29,12 @@ exports.profileSearch = (0, store_1.derived)(exports.profiles, $profiles => (0,
|
|
|
33
29
|
keys: ["name", "display_name", { name: "about", weight: 0.3 }],
|
|
34
30
|
},
|
|
35
31
|
}));
|
|
36
|
-
const displayProfileByPubkey = (pubkey) =>
|
|
32
|
+
const displayProfileByPubkey = (pubkey) => pubkey
|
|
33
|
+
? (0, util_1.displayProfile)(exports.profilesByPubkey.get().get(pubkey), (0, util_1.displayPubkey)(pubkey))
|
|
34
|
+
: "";
|
|
37
35
|
exports.displayProfileByPubkey = displayProfileByPubkey;
|
|
38
|
-
const deriveProfileDisplay = (pubkey) =>
|
|
36
|
+
const deriveProfileDisplay = (pubkey) => pubkey
|
|
37
|
+
? (0, store_1.derived)((0, exports.deriveProfile)(pubkey), $profile => (0, util_1.displayProfile)($profile, (0, util_1.displayPubkey)(pubkey)))
|
|
38
|
+
: (0, store_1.readable)("");
|
|
39
39
|
exports.deriveProfileDisplay = deriveProfileDisplay;
|
|
40
40
|
//# sourceMappingURL=profiles.cjs.map
|
|
@@ -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,qCAAmC;AACnC,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,UAAqC,EAAE,EA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AA,oBAAoB,wBAGf"}
|
package/build/src/profiles.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/// <reference types="svelte" />
|
|
2
2
|
import { type SubscribeRequest } from "@welshman/net";
|
|
3
3
|
import { type PublishedProfile } from "@welshman/util";
|
|
4
|
-
export declare const profiles: {
|
|
5
|
-
|
|
6
|
-
subscribe: (sub: import("svelte/store").Subscriber<PublishedProfile[]>) => () => void;
|
|
4
|
+
export declare const profiles: import("svelte/store").Readable<PublishedProfile[]> & {
|
|
5
|
+
get: () => PublishedProfile[];
|
|
7
6
|
};
|
|
8
7
|
export declare const profilesByPubkey: import("svelte/store").Readable<Map<string, PublishedProfile>> & {
|
|
9
8
|
get: () => Map<string, PublishedProfile>;
|
|
10
|
-
}, deriveProfile: (key: import("@welshman/lib").Maybe<string>,
|
|
9
|
+
}, deriveProfile: (key: import("@welshman/lib").Maybe<string>, request?: Partial<SubscribeRequest> | undefined) => import("svelte/store").Readable<PublishedProfile | undefined>, loadProfile: (key: string, request?: Partial<SubscribeRequest> | undefined) => Promise<PublishedProfile | undefined>;
|
|
11
10
|
export declare const profileSearch: import("svelte/store").Readable<import("./util").Search<string, PublishedProfile>>;
|
|
12
|
-
export declare const displayProfileByPubkey: (pubkey: string) => string;
|
|
13
|
-
export declare const deriveProfileDisplay: (pubkey: string) => import("svelte/store").Readable<string>;
|
|
11
|
+
export declare const displayProfileByPubkey: (pubkey: string | undefined) => string;
|
|
12
|
+
export declare const deriveProfileDisplay: (pubkey: string | undefined) => import("svelte/store").Readable<string>;
|
package/build/src/profiles.mjs
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
import { derived } from 'svelte/store';
|
|
1
|
+
import { derived, readable } from 'svelte/store';
|
|
2
2
|
import { readProfile, displayProfile, displayPubkey, PROFILE } from '@welshman/util';
|
|
3
|
-
import { deriveEventsMapped } from '@welshman/store';
|
|
3
|
+
import { deriveEventsMapped, withGetter } from '@welshman/store';
|
|
4
4
|
import { repository, load } from "./core.mjs";
|
|
5
5
|
import { createSearch } from "./util.mjs";
|
|
6
6
|
import { collection } from "./collection.mjs";
|
|
7
|
-
import {
|
|
8
|
-
export const profiles = deriveEventsMapped(repository, {
|
|
7
|
+
import { loadRelaySelections } from "./relaySelections.mjs";
|
|
8
|
+
export const profiles = withGetter(deriveEventsMapped(repository, {
|
|
9
9
|
filters: [{ kinds: [PROFILE] }],
|
|
10
10
|
eventToItem: readProfile,
|
|
11
11
|
itemToEvent: item => item.event,
|
|
12
|
-
});
|
|
12
|
+
}));
|
|
13
13
|
export const { indexStore: profilesByPubkey, deriveItem: deriveProfile, loadItem: loadProfile, } = collection({
|
|
14
14
|
name: "profiles",
|
|
15
15
|
store: profiles,
|
|
16
16
|
getKey: profile => profile.event.pubkey,
|
|
17
|
-
load: async (pubkey,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
...request,
|
|
21
|
-
relays: [...relays, ...hints],
|
|
22
|
-
filters: [{ kinds: [PROFILE], authors: [pubkey] }],
|
|
23
|
-
});
|
|
17
|
+
load: async (pubkey, request = {}) => {
|
|
18
|
+
await loadRelaySelections(pubkey, request);
|
|
19
|
+
await load({ ...request, filters: [{ kinds: [PROFILE], authors: [pubkey] }] });
|
|
24
20
|
},
|
|
25
21
|
});
|
|
26
22
|
export const profileSearch = derived(profiles, $profiles => createSearch($profiles, {
|
|
@@ -29,6 +25,10 @@ export const profileSearch = derived(profiles, $profiles => createSearch($profil
|
|
|
29
25
|
keys: ["name", "display_name", { name: "about", weight: 0.3 }],
|
|
30
26
|
},
|
|
31
27
|
}));
|
|
32
|
-
export const displayProfileByPubkey = (pubkey) =>
|
|
33
|
-
|
|
28
|
+
export const displayProfileByPubkey = (pubkey) => pubkey
|
|
29
|
+
? displayProfile(profilesByPubkey.get().get(pubkey), displayPubkey(pubkey))
|
|
30
|
+
: "";
|
|
31
|
+
export const deriveProfileDisplay = (pubkey) => pubkey
|
|
32
|
+
? derived(deriveProfile(pubkey), $profile => displayProfile($profile, displayPubkey(pubkey)))
|
|
33
|
+
: readable("");
|
|
34
34
|
//# sourceMappingURL=profiles.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiles.mjs","sourceRoot":"","sources":["../../src/profiles.ts"],"names":[],"mappings":"OAAO,EAAC,OAAO,EAAC,MAAM,cAAc;
|
|
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,YAAY,EAAC;OACd,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;IACvC,IAAI,EAAE,KAAK,EAAE,MAAc,EAAE,UAAqC,EAAE,EAAE,EAAE;QACtE,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;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,CACzD,YAAY,CAAC,SAAS,EAAE;IACtB,QAAQ,EAAE,CAAC,OAAyB,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM;IAC7D,WAAW,EAAE;QACX,IAAI,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,EAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAC,CAAC;KAC7D;CACF,CAAC,CACH,CAAA;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,MAA0B,EAAE,EAAE,CACnE,MAAM;IACJ,CAAC,CAAC,cAAc,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC3E,CAAC,CAAC,EAAE,CAAA;AAER,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAA0B,EAAE,EAAE,CACjE,MAAM;IACJ,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7F,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
2
|
+
var _a, _b;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.loadRelaySelections = exports.deriveRelaySelections = exports.relaySelectionsByPubkey = exports.relaySelections = exports.getWriteRelayUrls = exports.getReadRelayUrls = void 0;
|
|
4
|
+
exports.loadInboxRelaySelections = exports.deriveInboxRelaySelections = exports.inboxRelaySelectionsByPubkey = exports.inboxRelaySelections = exports.loadRelaySelections = exports.deriveRelaySelections = exports.relaySelectionsByPubkey = exports.relaySelections = exports.getWriteRelayUrls = exports.getReadRelayUrls = exports.getRelayUrls = 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 getRelayUrls = (event) => (0, util_1.getRelayTags)((event === null || event === void 0 ? void 0 : event.tags) || [])
|
|
10
|
+
.map((t) => (0, util_1.normalizeRelayUrl)(t[1]));
|
|
11
|
+
exports.getRelayUrls = getRelayUrls;
|
|
9
12
|
const getReadRelayUrls = (event) => (0, util_1.getRelayTags)((event === null || event === void 0 ? void 0 : event.tags) || [])
|
|
10
13
|
.filter((t) => !t[2] || t[2] === "read")
|
|
11
14
|
.map((t) => (0, util_1.normalizeRelayUrl)(t[1]));
|
|
@@ -14,15 +17,18 @@ const getWriteRelayUrls = (event) => (0, util_1.getRelayTags)((event === null ||
|
|
|
14
17
|
.filter((t) => !t[2] || t[2] === "write")
|
|
15
18
|
.map((t) => (0, util_1.normalizeRelayUrl)(t[1]));
|
|
16
19
|
exports.getWriteRelayUrls = getWriteRelayUrls;
|
|
17
|
-
exports.relaySelections = (0, store_1.deriveEvents)(core_1.repository, { filters: [{ kinds: [util_1.RELAYS] }] });
|
|
20
|
+
exports.relaySelections = (0, store_1.withGetter)((0, store_1.deriveEvents)(core_1.repository, { filters: [{ kinds: [util_1.RELAYS] }] }));
|
|
18
21
|
_a = (0, collection_1.collection)({
|
|
19
22
|
name: "relaySelections",
|
|
20
23
|
store: exports.relaySelections,
|
|
21
24
|
getKey: relaySelections => relaySelections.pubkey,
|
|
22
|
-
load: (pubkey,
|
|
23
|
-
...request,
|
|
24
|
-
relays,
|
|
25
|
-
filters: [{ kinds: [util_1.RELAYS], authors: [pubkey] }],
|
|
26
|
-
}),
|
|
25
|
+
load: (pubkey, request = {}) => (0, core_1.load)({ ...request, filters: [{ kinds: [util_1.RELAYS], authors: [pubkey] }] }),
|
|
27
26
|
}), exports.relaySelectionsByPubkey = _a.indexStore, exports.deriveRelaySelections = _a.deriveItem, exports.loadRelaySelections = _a.loadItem;
|
|
27
|
+
exports.inboxRelaySelections = (0, store_1.withGetter)((0, store_1.deriveEvents)(core_1.repository, { filters: [{ kinds: [util_1.RELAYS] }] }));
|
|
28
|
+
_b = (0, collection_1.collection)({
|
|
29
|
+
name: "inboxRelaySelections",
|
|
30
|
+
store: exports.inboxRelaySelections,
|
|
31
|
+
getKey: inboxRelaySelections => inboxRelaySelections.pubkey,
|
|
32
|
+
load: (pubkey, request = {}) => (0, core_1.load)({ ...request, filters: [{ kinds: [util_1.INBOX_RELAYS], authors: [pubkey] }] }),
|
|
33
|
+
}), exports.inboxRelaySelectionsByPubkey = _b.indexStore, exports.deriveInboxRelaySelections = _b.deriveItem, exports.loadInboxRelaySelections = _b.loadItem;
|
|
28
34
|
//# 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,yCAAuG;AAEvG,2CAAwD;AACxD,qCAAuC;AACvC,iDAAuC;AAEhC,MAAM,YAAY,GAAG,CAAC,KAAoB,EAAY,EAAE,CAC7D,IAAA,mBAAY,EAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,KAAI,EAAE,CAAC;KAC5B,GAAG,CAAC,CAAC,CAAW,EAAE,EAAE,CAAC,IAAA,wBAAiB,EAAC,CAAC,CAAC,CAAC,C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AqC,EAAE,EAAE,EAAE,CAChE,IAAA,WAAI,EAAC,EAAC,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC,EAAC,KAAK,EAAE,CAAC,aAAM,CAAC,EAAE,OAAO,EAAE,CAAC,MAAM,CAAC,EAAC,CAAC,EAAC,CAAC;CACtE,CAAC,EATY,+BAAuB,kBACvB,6BAAqB,kBACvB,2BAAmB,eAO7B;AAEW,QAAA,oBAAoB,GAAG,IAAA,kBAAU,EAAC,IAAA,oBAAY,EAAC,iBAAU,EAAE,EAAC,OAAO,EAAE,CAAC,EAAC,KAAK,EAAE,CAAC,aAAM,CAAC,EAAC,CAAC,EAAC,CAAC,CAAC,CAAA;AAE3F,KAIT,IAAA,uBAAU,EAAC;IACb,IAAI,EAAE,sBAAsB;IAC5B,KAAK,EAAE,4BAAoB;IAC3B,MAAM,EAAE,oBAAoB,CAAC,EAAE,CAAC,oBAAoB,CAAC,MAAM;IAC3D,IAAI,EAAE,CAAC,MAAc,EAAE,UAAqC,EAAE,EAAE,EAAE,CAChE,IAAA,WAAI,EAAC,EAAC,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC,EAAC,KAAK,EAAE,CAAC,mBAAY,CAAC,EAAE,OAAO,EAAE,CAAC,MAAM,CAAC,EAAC,CAAC,EAAC,CAAC;CAC5E,CAAC,EATY,oCAA4B,kBAC5B,kCAA0B,kBAC5B,gCAAwB,eAOlC"}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
/// <reference types="svelte" />
|
|
2
2
|
import { type TrustedEvent } from '@welshman/util';
|
|
3
3
|
import { type SubscribeRequest } from "@welshman/net";
|
|
4
|
+
export declare const getRelayUrls: (event?: TrustedEvent) => string[];
|
|
4
5
|
export declare const getReadRelayUrls: (event?: TrustedEvent) => string[];
|
|
5
6
|
export declare const getWriteRelayUrls: (event?: TrustedEvent) => string[];
|
|
6
|
-
export declare const relaySelections: {
|
|
7
|
-
|
|
8
|
-
subscribe: (sub: import("svelte/store").Subscriber<TrustedEvent[]>) => () => void;
|
|
7
|
+
export declare const relaySelections: import("svelte/store").Readable<TrustedEvent[]> & {
|
|
8
|
+
get: () => TrustedEvent[];
|
|
9
9
|
};
|
|
10
10
|
export declare const relaySelectionsByPubkey: import("svelte/store").Readable<Map<string, TrustedEvent>> & {
|
|
11
11
|
get: () => Map<string, TrustedEvent>;
|
|
12
|
-
}, deriveRelaySelections: (key: import("@welshman/lib").Maybe<string>,
|
|
12
|
+
}, deriveRelaySelections: (key: import("@welshman/lib").Maybe<string>, request?: Partial<SubscribeRequest> | undefined) => import("svelte/store").Readable<TrustedEvent | undefined>, loadRelaySelections: (key: string, request?: Partial<SubscribeRequest> | undefined) => Promise<TrustedEvent | undefined>;
|
|
13
|
+
export declare const inboxRelaySelections: import("svelte/store").Readable<TrustedEvent[]> & {
|
|
14
|
+
get: () => TrustedEvent[];
|
|
15
|
+
};
|
|
16
|
+
export declare const inboxRelaySelectionsByPubkey: import("svelte/store").Readable<Map<string, TrustedEvent>> & {
|
|
17
|
+
get: () => Map<string, TrustedEvent>;
|
|
18
|
+
}, deriveInboxRelaySelections: (key: import("@welshman/lib").Maybe<string>, request?: Partial<SubscribeRequest> | undefined) => import("svelte/store").Readable<TrustedEvent | undefined>, loadInboxRelaySelections: (key: string, request?: Partial<SubscribeRequest> | undefined) => Promise<TrustedEvent | undefined>;
|
|
@@ -1,22 +1,27 @@
|
|
|
1
|
-
import { RELAYS, getRelayTags, normalizeRelayUrl } from '@welshman/util';
|
|
2
|
-
import { deriveEvents } from '@welshman/store';
|
|
1
|
+
import { INBOX_RELAYS, RELAYS, getRelayTags, normalizeRelayUrl } from '@welshman/util';
|
|
2
|
+
import { deriveEvents, withGetter } from '@welshman/store';
|
|
3
3
|
import { load, repository } from "./core.mjs";
|
|
4
4
|
import { collection } from "./collection.mjs";
|
|
5
|
+
export const getRelayUrls = (event) => getRelayTags((event === null || event === void 0 ? void 0 : event.tags) || [])
|
|
6
|
+
.map((t) => normalizeRelayUrl(t[1]));
|
|
5
7
|
export const getReadRelayUrls = (event) => getRelayTags((event === null || event === void 0 ? void 0 : event.tags) || [])
|
|
6
8
|
.filter((t) => !t[2] || t[2] === "read")
|
|
7
9
|
.map((t) => normalizeRelayUrl(t[1]));
|
|
8
10
|
export const getWriteRelayUrls = (event) => getRelayTags((event === null || event === void 0 ? void 0 : event.tags) || [])
|
|
9
11
|
.filter((t) => !t[2] || t[2] === "write")
|
|
10
12
|
.map((t) => normalizeRelayUrl(t[1]));
|
|
11
|
-
export const relaySelections = deriveEvents(repository, { filters: [{ kinds: [RELAYS] }] });
|
|
13
|
+
export const relaySelections = withGetter(deriveEvents(repository, { filters: [{ kinds: [RELAYS] }] }));
|
|
12
14
|
export const { indexStore: relaySelectionsByPubkey, deriveItem: deriveRelaySelections, loadItem: loadRelaySelections, } = collection({
|
|
13
15
|
name: "relaySelections",
|
|
14
16
|
store: relaySelections,
|
|
15
17
|
getKey: relaySelections => relaySelections.pubkey,
|
|
16
|
-
load: (pubkey,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
load: (pubkey, request = {}) => load({ ...request, filters: [{ kinds: [RELAYS], authors: [pubkey] }] }),
|
|
19
|
+
});
|
|
20
|
+
export const inboxRelaySelections = withGetter(deriveEvents(repository, { filters: [{ kinds: [RELAYS] }] }));
|
|
21
|
+
export const { indexStore: inboxRelaySelectionsByPubkey, deriveItem: deriveInboxRelaySelections, loadItem: loadInboxRelaySelections, } = collection({
|
|
22
|
+
name: "inboxRelaySelections",
|
|
23
|
+
store: inboxRelaySelections,
|
|
24
|
+
getKey: inboxRelaySelections => inboxRelaySelections.pubkey,
|
|
25
|
+
load: (pubkey, request = {}) => load({ ...request, filters: [{ kinds: [INBOX_RELAYS], authors: [pubkey] }] }),
|
|
21
26
|
});
|
|
22
27
|
//# sourceMappingURL=relaySelections.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relaySelections.mjs","sourceRoot":"","sources":["../../src/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