@welshman/store 0.8.16 → 0.9.0-pre2
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/lib/src/Tools.d.ts +13 -0
- package/dist/lib/src/Tools.d.ts.map +1 -1
- package/dist/lib/src/Tools.js +30 -1
- package/dist/lib/src/Tools.js.map +1 -1
- package/dist/net/src/adapter.d.ts +2 -2
- package/dist/net/src/adapter.d.ts.map +1 -1
- package/dist/net/src/adapter.js +8 -4
- package/dist/net/src/adapter.js.map +1 -1
- package/dist/net/src/auth.d.ts +1 -1
- package/dist/net/src/auth.d.ts.map +1 -1
- package/dist/net/src/auth.js +3 -3
- package/dist/net/src/auth.js.map +1 -1
- package/dist/net/src/context.d.ts +4 -7
- package/dist/net/src/context.d.ts.map +1 -1
- package/dist/net/src/context.js +1 -9
- package/dist/net/src/context.js.map +1 -1
- package/dist/net/src/message.d.ts +1 -1
- package/dist/net/src/message.d.ts.map +1 -1
- package/dist/net/src/message.js +1 -1
- package/dist/net/src/message.js.map +1 -1
- package/dist/net/src/pool.d.ts +1 -8
- package/dist/net/src/pool.d.ts.map +1 -1
- package/dist/net/src/pool.js +2 -18
- package/dist/net/src/pool.js.map +1 -1
- package/dist/net/src/repository.d.ts +4 -2
- package/dist/net/src/repository.d.ts.map +1 -1
- package/dist/net/src/repository.js +55 -21
- package/dist/net/src/repository.js.map +1 -1
- package/dist/net/src/request.d.ts +2 -3
- package/dist/net/src/request.d.ts.map +1 -1
- package/dist/net/src/request.js +4 -7
- package/dist/net/src/request.js.map +1 -1
- package/dist/net/src/wrapManager.d.ts +1 -0
- package/dist/net/src/wrapManager.d.ts.map +1 -1
- package/dist/net/src/wrapManager.js +5 -1
- package/dist/net/src/wrapManager.js.map +1 -1
- package/dist/store/src/repository.d.ts +17 -0
- package/dist/store/src/repository.d.ts.map +1 -1
- package/dist/store/src/repository.js +144 -0
- package/dist/store/src/repository.js.map +1 -1
- package/dist/util/src/Events.d.ts +0 -12
- package/dist/util/src/Events.d.ts.map +1 -1
- package/dist/util/src/Events.js +3 -25
- package/dist/util/src/Events.js.map +1 -1
- package/dist/util/src/Handles.d.ts +15 -0
- package/dist/util/src/Handles.d.ts.map +1 -0
- package/dist/util/src/Handles.js +25 -0
- package/dist/util/src/Handles.js.map +1 -0
- package/dist/util/src/Kinds.d.ts +6 -1
- package/dist/util/src/Kinds.d.ts.map +1 -1
- package/dist/util/src/Kinds.js +8 -2
- package/dist/util/src/Kinds.js.map +1 -1
- package/dist/util/src/Lightning.d.ts +6 -0
- package/dist/util/src/Lightning.d.ts.map +1 -0
- package/dist/util/src/Lightning.js +59 -0
- package/dist/util/src/Lightning.js.map +1 -0
- package/dist/util/src/Nip86.d.ts +75 -25
- package/dist/util/src/Nip86.d.ts.map +1 -1
- package/dist/util/src/Nip86.js +169 -24
- package/dist/util/src/Nip86.js.map +1 -1
- package/dist/util/src/Pow.js +2 -2
- package/dist/util/src/Pow.js.map +1 -1
- package/dist/util/src/Pubkey.d.ts.map +1 -1
- package/dist/util/src/Pubkey.js +2 -1
- package/dist/util/src/Pubkey.js.map +1 -1
- package/dist/util/src/Relay.d.ts +0 -29
- package/dist/util/src/Relay.d.ts.map +1 -1
- package/dist/util/src/Relay.js +0 -10
- package/dist/util/src/Relay.js.map +1 -1
- package/dist/util/src/RelaySelection.d.ts +101 -0
- package/dist/util/src/RelaySelection.d.ts.map +1 -0
- package/dist/util/src/RelaySelection.js +98 -0
- package/dist/util/src/RelaySelection.js.map +1 -0
- package/dist/util/src/Tags.d.ts +16 -35
- package/dist/util/src/Tags.d.ts.map +1 -1
- package/dist/util/src/Tags.js +23 -74
- package/dist/util/src/Tags.js.map +1 -1
- package/dist/util/src/Topics.d.ts +2 -0
- package/dist/util/src/Topics.d.ts.map +1 -0
- package/dist/util/src/Topics.js +2 -0
- package/dist/util/src/Topics.js.map +1 -0
- package/dist/util/src/index.d.ts +3 -6
- package/dist/util/src/index.d.ts.map +1 -1
- package/dist/util/src/index.js +3 -6
- package/dist/util/src/index.js.map +1 -1
- package/package.json +7 -7
- package/dist/util/src/Encryptable.d.ts +0 -34
- package/dist/util/src/Encryptable.d.ts.map +0 -1
- package/dist/util/src/Encryptable.js +0 -52
- package/dist/util/src/Encryptable.js.map +0 -1
- package/dist/util/src/Handler.d.ts +0 -17
- package/dist/util/src/Handler.d.ts.map +0 -1
- package/dist/util/src/Handler.js +0 -33
- package/dist/util/src/Handler.js.map +0 -1
- package/dist/util/src/List.d.ts +0 -42
- package/dist/util/src/List.d.ts.map +0 -1
- package/dist/util/src/List.js +0 -86
- package/dist/util/src/List.js.map +0 -1
- package/dist/util/src/Profile.d.ts +0 -26
- package/dist/util/src/Profile.d.ts.map +0 -1
- package/dist/util/src/Profile.js +0 -50
- package/dist/util/src/Profile.js.map +0 -1
- package/dist/util/src/Room.d.ts +0 -63
- package/dist/util/src/Room.d.ts.map +0 -1
- package/dist/util/src/Room.js +0 -94
- package/dist/util/src/Room.js.map +0 -1
- package/dist/util/src/Zaps.d.ts +0 -55
- package/dist/util/src/Zaps.d.ts.map +0 -1
- package/dist/util/src/Zaps.js +0 -135
- package/dist/util/src/Zaps.js.map +0 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { add, inc, take, sortBy, shuffle, first, uniq } from "@welshman/lib";
|
|
2
|
+
import { isRelayUrl, isOnionUrl, isLocalUrl, normalizeRelayUrl } from "./Relay.js";
|
|
3
|
+
// DSL constructors ----------------------------------------------------------
|
|
4
|
+
const sel = (route, weight = 1) => ({ route, weight });
|
|
5
|
+
export const inbox = (pubkey, weight = 1) => sel({ type: "pubkeyInbox", pubkey }, weight);
|
|
6
|
+
export const outbox = (pubkey, weight = 1) => sel({ type: "pubkeyOutbox", pubkey }, weight);
|
|
7
|
+
export const messaging = (pubkey, weight = 1) => sel({ type: "pubkeyMessaging", pubkey }, weight);
|
|
8
|
+
export const userInbox = (weight = 1) => sel({ type: "userInbox" }, weight);
|
|
9
|
+
export const userOutbox = (weight = 1) => sel({ type: "userOutbox" }, weight);
|
|
10
|
+
export const userMessaging = (weight = 1) => sel({ type: "userMessaging" }, weight);
|
|
11
|
+
export const eventInbox = (ref, weight = 1) => sel({ type: "eventInbox", ref }, weight);
|
|
12
|
+
export const eventOutbox = (ref, weight = 1) => sel({ type: "eventOutbox", ref }, weight);
|
|
13
|
+
// Relays the given event was found on (its tracker relays plus any ref hints).
|
|
14
|
+
export const seen = (ref, weight = 1) => sel({ type: "seen", ref }, weight);
|
|
15
|
+
export const relay = (url, weight = 1) => sel({ type: "relay", url }, weight);
|
|
16
|
+
export const relays = (urls, weight = 1) => urls.map(url => relay(url, weight));
|
|
17
|
+
// Inbox selections for a set of pubkeys (mentions/recipients).
|
|
18
|
+
export const inboxes = (pubkeys, weight = 1) => uniq(pubkeys).map(pubkey => inbox(pubkey, weight));
|
|
19
|
+
export const indexers = (weight = 1) => sel({ type: "index" }, weight);
|
|
20
|
+
export const searchRelays = (weight = 1) => sel({ type: "search" }, weight);
|
|
21
|
+
export const makeSelection = (relays, weight = 1) => ({
|
|
22
|
+
relays: relays.filter(isRelayUrl).map(normalizeRelayUrl),
|
|
23
|
+
weight,
|
|
24
|
+
});
|
|
25
|
+
export const addNoFallbacks = (count, limit) => 0;
|
|
26
|
+
export const addMinimalFallbacks = (count, limit) => (count > 0 ? 0 : 1);
|
|
27
|
+
export const addMaximalFallbacks = (count, limit) => limit - count;
|
|
28
|
+
export class RelayScenario {
|
|
29
|
+
selections;
|
|
30
|
+
options;
|
|
31
|
+
constructor(selections, options = {}) {
|
|
32
|
+
this.selections = selections;
|
|
33
|
+
this.options = options;
|
|
34
|
+
}
|
|
35
|
+
clone = (options) => new RelayScenario(this.selections, { ...this.options, ...options });
|
|
36
|
+
limit = (limit) => this.clone({ limit });
|
|
37
|
+
policy = (policy) => this.clone({ policy });
|
|
38
|
+
allowLocal = (allowLocal) => this.clone({ allowLocal });
|
|
39
|
+
allowOnion = (allowOnion) => this.clone({ allowOnion });
|
|
40
|
+
allowInsecure = (allowInsecure) => this.clone({ allowInsecure });
|
|
41
|
+
getLimit = () => this.options.limit || 3;
|
|
42
|
+
getPolicy = () => this.options.policy || addNoFallbacks;
|
|
43
|
+
getUrls = () => {
|
|
44
|
+
const limit = this.getLimit();
|
|
45
|
+
const fallbackPolicy = this.getPolicy();
|
|
46
|
+
const relayWeights = new Map();
|
|
47
|
+
const { getRelayQuality, getDefaultRelays, allowOnion, allowLocal, allowInsecure } = this.options;
|
|
48
|
+
for (const { weight, relays } of this.selections) {
|
|
49
|
+
for (const relay of relays) {
|
|
50
|
+
if (!isRelayUrl(relay))
|
|
51
|
+
continue;
|
|
52
|
+
if (!allowOnion && isOnionUrl(relay))
|
|
53
|
+
continue;
|
|
54
|
+
if (!allowLocal && isLocalUrl(relay))
|
|
55
|
+
continue;
|
|
56
|
+
if (!allowInsecure && relay.startsWith("ws://") && !isOnionUrl(relay))
|
|
57
|
+
continue;
|
|
58
|
+
relayWeights.set(relay, add(weight, relayWeights.get(relay)));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const scoreRelay = (relay) => {
|
|
62
|
+
const weight = relayWeights.get(relay);
|
|
63
|
+
const quality = getRelayQuality ? getRelayQuality(relay) : 1;
|
|
64
|
+
// Log the weight, since it's a straight count which ends up over-weighting
|
|
65
|
+
// hubs. Also add some random noise so that we'll occasionally pick lower
|
|
66
|
+
// quality/less popular relays.
|
|
67
|
+
return -(quality * inc(Math.log(weight)) * Math.random());
|
|
68
|
+
};
|
|
69
|
+
const relays = take(limit, sortBy(scoreRelay, Array.from(relayWeights.keys()).filter(scoreRelay)));
|
|
70
|
+
const fallbacksNeeded = fallbackPolicy(relays.length, limit);
|
|
71
|
+
const allFallbackRelays = getDefaultRelays?.() || [];
|
|
72
|
+
const fallbackRelays = shuffle(allFallbackRelays).slice(0, fallbacksNeeded);
|
|
73
|
+
for (const fallbackRelay of fallbackRelays) {
|
|
74
|
+
relays.push(fallbackRelay);
|
|
75
|
+
}
|
|
76
|
+
return relays;
|
|
77
|
+
};
|
|
78
|
+
getUrl = () => first(this.getUrls());
|
|
79
|
+
}
|
|
80
|
+
export class Resolver {
|
|
81
|
+
routeResolver;
|
|
82
|
+
options;
|
|
83
|
+
constructor(routeResolver, options = {}) {
|
|
84
|
+
this.routeResolver = routeResolver;
|
|
85
|
+
this.options = options;
|
|
86
|
+
}
|
|
87
|
+
async scenario(selections) {
|
|
88
|
+
const resolved = await Promise.all(selections.map(async ({ route, weight }) => makeSelection(await this.routeResolver(route), weight)));
|
|
89
|
+
return new RelayScenario(resolved, this.options);
|
|
90
|
+
}
|
|
91
|
+
async relays(selections) {
|
|
92
|
+
return (await this.scenario(selections)).getUrls();
|
|
93
|
+
}
|
|
94
|
+
async relay(selections) {
|
|
95
|
+
return (await this.scenario(selections)).getUrl();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=RelaySelection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RelaySelection.js","sourceRoot":"","sources":["../../../../util/src/RelaySelection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAC,MAAM,eAAe,CAAA;AAE1E,OAAO,EAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAC,MAAM,YAAY,CAAA;AAkDhF,8EAA8E;AAE9E,MAAM,GAAG,GAAG,CAAC,KAAiB,EAAE,MAAM,GAAG,CAAC,EAAkB,EAAE,CAAC,CAAC,EAAC,KAAK,EAAE,MAAM,EAAC,CAAC,CAAA;AAEhF,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,MAAc,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAC,EAAE,MAAM,CAAC,CAAA;AAE/F,MAAM,CAAC,MAAM,MAAM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AAC,OAAO,CAAC,CAAA;IAClD,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,UAA4B;QACvC,OAAO,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,EAAE,CAAA;IACpD,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,UAA4B;QACtC,OAAO,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,EAAE,CAAA;IACnD,CAAC;CACF"}
|
package/dist/util/src/Tags.d.ts
CHANGED
|
@@ -1,37 +1,18 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare const getEventTags: (tags: string[][]) => string[][];
|
|
6
|
-
export declare const getEventTagValues: (tags: string[][]) => string[];
|
|
7
|
-
export declare const getAddressTags: (tags: string[][]) => string[][];
|
|
8
|
-
export declare const getAddressTagValues: (tags: string[][]) => string[];
|
|
9
|
-
export declare const getPubkeyTags: (tags: string[][]) => string[][];
|
|
10
|
-
export declare const getPubkeyTagValues: (tags: string[][]) => string[];
|
|
11
|
-
export declare const getTopicTags: (tags: string[][]) => string[][];
|
|
12
|
-
export declare const getTopicTagValues: (tags: string[][]) => string[];
|
|
13
|
-
export declare const getRelayTags: (tags: string[][]) => string[][];
|
|
14
|
-
export declare const getRelayTagValues: (tags: string[][]) => string[];
|
|
15
|
-
export declare const getGroupTags: (tags: string[][]) => string[][];
|
|
16
|
-
export declare const getGroupTagValues: (tags: string[][]) => string[];
|
|
17
|
-
export declare const getKindTags: (tags: string[][]) => string[][];
|
|
18
|
-
export declare const getKindTagValues: (tags: string[][]) => number[];
|
|
19
|
-
export declare const getCommentTags: (tags: string[][]) => {
|
|
20
|
-
roots: string[][];
|
|
21
|
-
replies: string[][];
|
|
1
|
+
export type TagSpec<T = string> = {
|
|
2
|
+
keys: string[];
|
|
3
|
+
matchValue?: (value: string) => boolean;
|
|
4
|
+
normalizeValue?: (value: string) => T;
|
|
22
5
|
};
|
|
23
|
-
export declare const
|
|
24
|
-
export declare const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export declare const
|
|
30
|
-
export declare const
|
|
31
|
-
export declare const
|
|
32
|
-
export declare const
|
|
33
|
-
export declare const
|
|
34
|
-
export declare const
|
|
35
|
-
export declare const tagsFromIMeta: (imeta: string[]) => string[][];
|
|
36
|
-
export declare const tagger: (name: string) => (value: string, ...args: unknown[]) => string[];
|
|
6
|
+
export declare const tagSpec: <T = string>(keys: string | string[], matchValue?: (value: string) => boolean, normalizeValue?: (value: string) => T) => TagSpec<T>;
|
|
7
|
+
export declare const hexTags: (keys: string | string[]) => TagSpec<string>;
|
|
8
|
+
export declare const kindTags: (keys: string | string[]) => TagSpec<number | undefined>;
|
|
9
|
+
export declare const topicTags: (keys: string | string[]) => TagSpec<string>;
|
|
10
|
+
export declare const addressTags: (keys: string | string[]) => TagSpec<string>;
|
|
11
|
+
export declare const relayTags: (keys: string | string[]) => TagSpec<string>;
|
|
12
|
+
export declare const tagMatcher: (spec: TagSpec<any>) => (tag: string[]) => boolean;
|
|
13
|
+
export declare const matchTags: <T>(spec: TagSpec<T>, tags: string[][]) => string[][];
|
|
14
|
+
export declare const matchTag: <T>(spec: TagSpec<T>, tags: string[][]) => string[] | undefined;
|
|
15
|
+
export declare const tagValueExtractor: <T>(spec: TagSpec<T>) => (tag: string[]) => T;
|
|
16
|
+
export declare const tagValues: <T>(spec: TagSpec<T>, tags: string[][]) => NonNullable<T>[];
|
|
17
|
+
export declare const tagValue: <T>(spec: TagSpec<T>, tags: string[][]) => T | undefined;
|
|
37
18
|
//# sourceMappingURL=Tags.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tags.d.ts","sourceRoot":"","sources":["../../../../util/src/Tags.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Tags.d.ts","sourceRoot":"","sources":["../../../../util/src/T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AAM,OAAO,CAAC,CAAC,CAAC,MACnB,KAAK,MAAM,EAAE,KAAG,CACkD,CAAA;AAErE,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,MAAM,EAAE,EAAE,KAAG,WAAW,CAAC,CAAC,CAAC,EACX,CAAA;AAErE,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,MAAM,EAAE,EAAE,KAAG,CAAC,GAAG,SAIpE,CAAA"}
|
package/dist/util/src/Tags.js
CHANGED
|
@@ -1,79 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ensurePlural, isHex32, removeUndefined } from "@welshman/lib";
|
|
2
2
|
import { isRelayUrl } from "./Relay.js";
|
|
3
3
|
import { Address } from "./Address.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { isKind, normalizeKind } from "./Kinds.js";
|
|
5
|
+
import { normalizeTopic } from "./Topics.js";
|
|
6
|
+
// prettier-ignore
|
|
7
|
+
export const tagSpec = (keys, matchValue, normalizeValue) => ({ keys: ensurePlural(keys), matchValue, normalizeValue });
|
|
8
|
+
export const hexTags = (keys) => tagSpec(keys, isHex32);
|
|
9
|
+
export const kindTags = (keys) => tagSpec(keys, isKind, normalizeKind);
|
|
10
|
+
export const topicTags = (keys) => tagSpec(keys, undefined, normalizeTopic);
|
|
11
|
+
export const addressTags = (keys) => tagSpec(keys, value => Address.isAddress(value));
|
|
12
|
+
export const relayTags = (keys) => tagSpec(keys, isRelayUrl);
|
|
13
|
+
export const tagMatcher = (spec) => (tag) => {
|
|
14
|
+
if (!spec.keys.includes(tag[0]))
|
|
15
|
+
return false;
|
|
16
|
+
if (spec.matchValue && (!tag[1] || !spec.matchValue(tag[1])))
|
|
17
|
+
return false;
|
|
18
|
+
return true;
|
|
7
19
|
};
|
|
8
|
-
export const
|
|
9
|
-
|
|
10
|
-
|
|
20
|
+
export const matchTags = (spec, tags) => tags.filter(tagMatcher(spec));
|
|
21
|
+
export const matchTag = (spec, tags) => tags.find(tagMatcher(spec));
|
|
22
|
+
export const tagValueExtractor = (spec) => (tag) => (spec.normalizeValue ? spec.normalizeValue(tag[1]) : tag[1]);
|
|
23
|
+
export const tagValues = (spec, tags) => removeUndefined(matchTags(spec, tags).map(tagValueExtractor(spec)));
|
|
24
|
+
export const tagValue = (spec, tags) => {
|
|
25
|
+
const tag = matchTag(spec, tags);
|
|
26
|
+
return tag ? tagValueExtractor(spec)(tag) : undefined;
|
|
11
27
|
};
|
|
12
|
-
export const getTagValues = (types, tags) => getTags(types, tags).map(nth(1));
|
|
13
|
-
export const getTagValue = (types, tags) => getTag(types, tags)?.[1];
|
|
14
|
-
export const getEventTags = (tags) => tags.filter(t => ["e"].includes(t[0]) && t[1].length === 64);
|
|
15
|
-
export const getEventTagValues = (tags) => getEventTags(tags).map(nth(1));
|
|
16
|
-
export const getAddressTags = (tags) => tags.filter(t => ["a"].includes(t[0]) && Address.isAddress(t[1]));
|
|
17
|
-
export const getAddressTagValues = (tags) => getAddressTags(tags).map(nth(1));
|
|
18
|
-
export const getPubkeyTags = (tags) => tags.filter(t => ["p"].includes(t[0]) && t[1].length === 64);
|
|
19
|
-
export const getPubkeyTagValues = (tags) => getPubkeyTags(tags).map(nth(1));
|
|
20
|
-
export const getTopicTags = (tags) => tags.filter(nthEq(0, "t"));
|
|
21
|
-
export const getTopicTagValues = (tags) => getTopicTags(tags).map(t => t[1].replace(/^#/, ""));
|
|
22
|
-
export const getRelayTags = (tags) => tags.filter(t => ["r", "relay"].includes(t[0]) && isRelayUrl(t[1] || ""));
|
|
23
|
-
export const getRelayTagValues = (tags) => getRelayTags(tags).map(nth(1));
|
|
24
|
-
export const getGroupTags = (tags) => tags.filter(t => ["h", "group"].includes(t[0]) && t[1] && isRelayUrl(t[2] || ""));
|
|
25
|
-
export const getGroupTagValues = (tags) => getGroupTags(tags).map(nth(1));
|
|
26
|
-
export const getKindTags = (tags) => tags.filter(t => ["k"].includes(t[0]) && t[1].match(/^\d+$/));
|
|
27
|
-
export const getKindTagValues = (tags) => getKindTags(tags).map(t => parseInt(t[1]));
|
|
28
|
-
export const getCommentTags = (tags) => {
|
|
29
|
-
const roots = tags.filter(t => ["A", "E", "P", "K"].includes(t[0]));
|
|
30
|
-
const replies = tags.filter(t => ["a", "e", "p", "k"].includes(t[0]));
|
|
31
|
-
return { roots, replies };
|
|
32
|
-
};
|
|
33
|
-
export const getCommentTagValues = (tags) => mapVals(tags => tags.filter(t => ["a", "e"].includes(t[0].toLowerCase())).map(nth(1)), getCommentTags(tags));
|
|
34
|
-
export const getReplyTags = (tags) => {
|
|
35
|
-
const validTags = tags.filter(t => ["a", "e", "q"].includes(t[0]));
|
|
36
|
-
const mentionTags = validTags.filter(nthEq(0, "q"));
|
|
37
|
-
const roots = [];
|
|
38
|
-
const replies = [];
|
|
39
|
-
const mentions = [];
|
|
40
|
-
const dispatchTags = (thisTags) => thisTags.forEach((t, i) => {
|
|
41
|
-
if (t[3] === "root") {
|
|
42
|
-
if (validTags.filter(nthEq(3, "reply")).length === 0) {
|
|
43
|
-
replies.push(t);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
roots.push(t);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
else if (t[3] === "reply") {
|
|
50
|
-
replies.push(t);
|
|
51
|
-
}
|
|
52
|
-
else if (t[3] === "mention") {
|
|
53
|
-
mentions.push(t);
|
|
54
|
-
}
|
|
55
|
-
else if (i === thisTags.length - 1) {
|
|
56
|
-
replies.push(t);
|
|
57
|
-
}
|
|
58
|
-
else if (i === 0) {
|
|
59
|
-
roots.push(t);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
mentions.push(t);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
// Add different types separately so positional logic works
|
|
66
|
-
dispatchTags(validTags.filter(nthEq(0, "e")));
|
|
67
|
-
dispatchTags(validTags.filter(nthEq(0, "a")).filter(t => Boolean(t[3])));
|
|
68
|
-
mentionTags.forEach((t) => mentions.push(t));
|
|
69
|
-
return { roots, replies, mentions };
|
|
70
|
-
};
|
|
71
|
-
export const getReplyTagValues = (tags) => mapVals(tags => tags.map(nth(1)), getReplyTags(tags));
|
|
72
|
-
export const getEmojiTags = (name, tags) => tags.filter(spec(["emoji", name]));
|
|
73
|
-
export const getEmojiTag = (name, tags) => first(getEmojiTags(name, tags));
|
|
74
|
-
export const getEmojiTagUrls = (name, tags) => getEmojiTags(name, tags).map(nth(2));
|
|
75
|
-
export const getEmojiTagUrl = (name, tags) => first(getEmojiTagUrls(name, tags));
|
|
76
|
-
export const uniqTags = (tags) => uniqBy(t => t.slice(0, 2).join(":"), tags);
|
|
77
|
-
export const tagsFromIMeta = (imeta) => imeta.map((m) => m.split(" "));
|
|
78
|
-
export const tagger = (name) => (value, ...args) => [name, value];
|
|
79
28
|
//# sourceMappingURL=Tags.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tags.js","sourceRoot":"","sources":["../../../../util/src/Tags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"Tags.js","sourceRoot":"","sources":["../../../../util/src/Tags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,OAAO,EAAE,eAAe,EAAC,MAAM,eAAe,CAAA;AACpE,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AACrC,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAA;AACpC,OAAO,EAAC,MAAM,EAAE,aAAa,EAAC,MAAM,YAAY,CAAA;AAChD,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAA;AAQ1C,kBAAkB;AAClB,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,IAAuB,EACvB,UAAuC,EACvC,cAAqC,EACzB,EAAE,CAAC,CAAC,EAAC,IAAI,EAAE,YAAY,CAAC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C,CAAA;AAEjG,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAI,IAAgB,EAAE,IAAgB,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAA;AAE9F,MAAM,CAAC,MAAM,iBAAiB,GAC5B,CAAI,IAAgB,EAAE,EAAE,CACxB,CAAC,GAAa,EAAK,EAAE,CACnB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAM,CAAA;AAErE,MAAM,CAAC,MAAM,SAAS,GAAG,CAAI,IAAgB,EAAE,IAAgB,EAAoB,EAAE,CACnF,eAAe,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAErE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAI,IAAgB,EAAE,IAAgB,EAAiB,EAAE;IAC/E,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IAEhC,OAAO,GAAG,CAAC,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AACvD,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Topics.d.ts","sourceRoot":"","sources":["../../../../util/src/Topics.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,GAAI,GAAG,MAAM,WAAwB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Topics.js","sourceRoot":"","sources":["../../../../util/src/Topics.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA"}
|
package/dist/util/src/index.d.ts
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
export * from "./Address.js";
|
|
2
2
|
export * from "./Blossom.js";
|
|
3
|
-
export * from "./Encryptable.js";
|
|
4
3
|
export * from "./Events.js";
|
|
5
4
|
export * from "./Filters.js";
|
|
6
|
-
export * from "./
|
|
5
|
+
export * from "./Handles.js";
|
|
7
6
|
export * from "./Keys.js";
|
|
8
7
|
export * from "./Kinds.js";
|
|
9
8
|
export * from "./Links.js";
|
|
10
|
-
export * from "./List.js";
|
|
11
9
|
export * from "./Nip42.js";
|
|
12
10
|
export * from "./Nip86.js";
|
|
13
11
|
export * from "./Nip98.js";
|
|
14
12
|
export * from "./Pow.js";
|
|
15
|
-
export * from "./Profile.js";
|
|
16
13
|
export * from "./Pubkey.js";
|
|
17
14
|
export * from "./Relay.js";
|
|
18
|
-
export * from "./
|
|
15
|
+
export * from "./RelaySelection.js";
|
|
19
16
|
export * from "./Tags.js";
|
|
20
17
|
export * from "./Wallet.js";
|
|
21
|
-
export * from "./
|
|
18
|
+
export * from "./Lightning.js";
|
|
22
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../util/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../util/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,qBAAqB,CAAA;AACnC,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA"}
|
package/dist/util/src/index.js
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
export * from "./Address.js";
|
|
2
2
|
export * from "./Blossom.js";
|
|
3
|
-
export * from "./Encryptable.js";
|
|
4
3
|
export * from "./Events.js";
|
|
5
4
|
export * from "./Filters.js";
|
|
6
|
-
export * from "./
|
|
5
|
+
export * from "./Handles.js";
|
|
7
6
|
export * from "./Keys.js";
|
|
8
7
|
export * from "./Kinds.js";
|
|
9
8
|
export * from "./Links.js";
|
|
10
|
-
export * from "./List.js";
|
|
11
9
|
export * from "./Nip42.js";
|
|
12
10
|
export * from "./Nip86.js";
|
|
13
11
|
export * from "./Nip98.js";
|
|
14
12
|
export * from "./Pow.js";
|
|
15
|
-
export * from "./Profile.js";
|
|
16
13
|
export * from "./Pubkey.js";
|
|
17
14
|
export * from "./Relay.js";
|
|
18
|
-
export * from "./
|
|
15
|
+
export * from "./RelaySelection.js";
|
|
19
16
|
export * from "./Tags.js";
|
|
20
17
|
export * from "./Wallet.js";
|
|
21
|
-
export * from "./
|
|
18
|
+
export * from "./Lightning.js";
|
|
22
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../util/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../util/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,qBAAqB,CAAA;AACnC,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@welshman/store",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0-pre2",
|
|
4
4
|
"author": "hodlbod",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A collection of utilities based on svelte/store for use with welshman",
|
|
@@ -15,17 +15,17 @@
|
|
|
15
15
|
],
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"svelte": "^4.0.0 || ^5.0.0",
|
|
18
|
-
"@welshman/
|
|
19
|
-
"@welshman/
|
|
20
|
-
"@welshman/util": "0.
|
|
18
|
+
"@welshman/net": "0.9.0-pre2",
|
|
19
|
+
"@welshman/lib": "0.9.0-pre2",
|
|
20
|
+
"@welshman/util": "0.9.0-pre2"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"rimraf": "~6.0.0",
|
|
24
24
|
"typescript": "~5.8.0",
|
|
25
25
|
"svelte": "^5.39.12",
|
|
26
|
-
"@welshman/net": "0.
|
|
27
|
-
"@welshman/
|
|
28
|
-
"@welshman/
|
|
26
|
+
"@welshman/net": "0.9.0-pre2",
|
|
27
|
+
"@welshman/lib": "0.9.0-pre2",
|
|
28
|
+
"@welshman/util": "0.9.0-pre2"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "pnpm run clean && pnpm run compile --force",
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { EventContent, TrustedEvent, EventTemplate } from "./Events.js";
|
|
2
|
-
export type Encrypt = (x: string) => Promise<string>;
|
|
3
|
-
export type EncryptableUpdates = Partial<EventContent>;
|
|
4
|
-
export type DecryptedEvent = TrustedEvent & {
|
|
5
|
-
plaintext: EncryptableUpdates;
|
|
6
|
-
};
|
|
7
|
-
export declare const asDecryptedEvent: (event: TrustedEvent, plaintext?: EncryptableUpdates) => DecryptedEvent;
|
|
8
|
-
/**
|
|
9
|
-
* Represents an encryptable event with optional updates.
|
|
10
|
-
*/
|
|
11
|
-
export declare class Encryptable<T extends EventTemplate> {
|
|
12
|
-
readonly event: Partial<T>;
|
|
13
|
-
readonly updates: EncryptableUpdates;
|
|
14
|
-
/**
|
|
15
|
-
* Creates an instance of Encryptable.
|
|
16
|
-
* @param event - An EventTemplate with optional tags and content.
|
|
17
|
-
* @param updates - Plaintext updates to be applied to the event content.
|
|
18
|
-
* @example
|
|
19
|
-
* Here's an example which enables updating a private mute list:
|
|
20
|
-
* ```
|
|
21
|
-
* const event = {kind: 10000, content: "", tags: []} // An event, only kind is required
|
|
22
|
-
* const encryptable = new Encryptable(event, {content: JSON.stringify([["e", "bad word"]])})
|
|
23
|
-
* const eventTemplate = await encryptable.reconcile(myEncryptFunction)
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
constructor(event: Partial<T>, updates: EncryptableUpdates);
|
|
27
|
-
/**
|
|
28
|
-
* Encrypts plaintext updates and merges them into the event template.
|
|
29
|
-
* @param encrypt - The encryption function to be used.
|
|
30
|
-
* @returns A promise that resolves to the reconciled and encrypted event.
|
|
31
|
-
*/
|
|
32
|
-
reconcile(encrypt: Encrypt): Promise<T>;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=Encryptable.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Encryptable.d.ts","sourceRoot":"","sources":["../../../../util/src/Encryptable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,YAAY,EAAE,aAAa,EAAC,MAAM,aAAa,CAAA;AAE1E,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;AAEpD,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;AAEtD,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG;IAC1C,SAAS,EAAE,kBAAkB,CAAA;CAC9B,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,OAAO,YAAY,EAAE,YAAW,kBAAuB,KAC3D,cAAc,CAAA;AAE3C;;GAEG;AACH,qBAAa,WAAW,CAAC,CAAC,SAAS,aAAa;IAc5C,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,kBAAkB;IAdtC;;;;;;;;;;;OAWG;gBAEQ,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,EACjB,OAAO,EAAE,kBAAkB;IAGtC;;;;OAIG;IACG,SAAS,CAAC,OAAO,EAAE,OAAO;CA4BjC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
export const asDecryptedEvent = (event, plaintext = {}) => ({ ...event, plaintext });
|
|
2
|
-
/**
|
|
3
|
-
* Represents an encryptable event with optional updates.
|
|
4
|
-
*/
|
|
5
|
-
export class Encryptable {
|
|
6
|
-
event;
|
|
7
|
-
updates;
|
|
8
|
-
/**
|
|
9
|
-
* Creates an instance of Encryptable.
|
|
10
|
-
* @param event - An EventTemplate with optional tags and content.
|
|
11
|
-
* @param updates - Plaintext updates to be applied to the event content.
|
|
12
|
-
* @example
|
|
13
|
-
* Here's an example which enables updating a private mute list:
|
|
14
|
-
* ```
|
|
15
|
-
* const event = {kind: 10000, content: "", tags: []} // An event, only kind is required
|
|
16
|
-
* const encryptable = new Encryptable(event, {content: JSON.stringify([["e", "bad word"]])})
|
|
17
|
-
* const eventTemplate = await encryptable.reconcile(myEncryptFunction)
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
constructor(event, updates) {
|
|
21
|
-
this.event = event;
|
|
22
|
-
this.updates = updates;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Encrypts plaintext updates and merges them into the event template.
|
|
26
|
-
* @param encrypt - The encryption function to be used.
|
|
27
|
-
* @returns A promise that resolves to the reconciled and encrypted event.
|
|
28
|
-
*/
|
|
29
|
-
async reconcile(encrypt) {
|
|
30
|
-
const encryptContent = () => {
|
|
31
|
-
if (!this.updates.content)
|
|
32
|
-
return undefined;
|
|
33
|
-
return encrypt(this.updates.content);
|
|
34
|
-
};
|
|
35
|
-
const encryptTags = () => {
|
|
36
|
-
if (!this.updates.tags)
|
|
37
|
-
return undefined;
|
|
38
|
-
return Promise.all(this.updates.tags.map(async (tag) => {
|
|
39
|
-
tag[1] = await encrypt(tag[1]);
|
|
40
|
-
return tag;
|
|
41
|
-
}));
|
|
42
|
-
};
|
|
43
|
-
const [content, tags] = await Promise.all([encryptContent(), encryptTags()]);
|
|
44
|
-
// Updates are optional. If not provided, fall back to the event's content and tags.
|
|
45
|
-
return {
|
|
46
|
-
...this.event,
|
|
47
|
-
tags: tags || this.event.tags || [],
|
|
48
|
-
content: content || this.event.content || "",
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=Encryptable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Encryptable.js","sourceRoot":"","sources":["../../../../util/src/Encryptable.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAmB,EAAE,YAAgC,EAAE,EAAE,EAAE,CAC1F,CAAC,EAAC,GAAG,KAAK,EAAE,SAAS,EAAC,CAAmB,CAAA;AAE3C;;GAEG;AACH,MAAM,OAA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|
3
|
-
kind: number;
|
|
4
|
-
name: string;
|
|
5
|
-
about: string;
|
|
6
|
-
image: string;
|
|
7
|
-
identifier: string;
|
|
8
|
-
event: TrustedEvent;
|
|
9
|
-
website?: string;
|
|
10
|
-
lud16?: string;
|
|
11
|
-
nip05?: string;
|
|
12
|
-
};
|
|
13
|
-
export declare const readHandlers: (event: TrustedEvent) => Handler[];
|
|
14
|
-
export declare const getHandlerKey: (handler: Handler) => string;
|
|
15
|
-
export declare const displayHandler: (handler?: Handler, fallback?: string) => string;
|
|
16
|
-
export declare const getHandlerAddress: (event: TrustedEvent) => string | undefined;
|
|
17
|
-
//# sourceMappingURL=Handler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Handler.d.ts","sourceRoot":"","sources":["../../../../util/src/Handler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,aAAa,CAAA;AAE7C,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,YAAY,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,OAAO,YAAY,cAuB/C,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,SAAS,OAAO,WAAmD,CAAA;AAEjG,eAAO,MAAM,cAAc,GAAI,UAAU,OAAO,EAAE,iBAAa,WAA8B,CAAA;AAE7F,eAAO,MAAM,iBAAiB,GAAI,OAAO,YAAY,uBAKpD,CAAA"}
|
package/dist/util/src/Handler.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { fromPairs, last, first, parseJson } from "@welshman/lib";
|
|
2
|
-
import { getAddress } from "./Address.js";
|
|
3
|
-
import { getAddressTags, getKindTagValues } from "./Tags.js";
|
|
4
|
-
export const readHandlers = (event) => {
|
|
5
|
-
const { d: identifier } = fromPairs(event.tags);
|
|
6
|
-
const meta = parseJson(event.content);
|
|
7
|
-
const normalizedMeta = {
|
|
8
|
-
name: meta?.name || meta?.display_name || "",
|
|
9
|
-
image: meta?.image || meta?.picture || "",
|
|
10
|
-
about: meta?.about || "",
|
|
11
|
-
website: meta?.website || "",
|
|
12
|
-
lud16: meta?.lud16 || "",
|
|
13
|
-
nip05: meta?.nip05 || "",
|
|
14
|
-
};
|
|
15
|
-
// If our meta is missing important stuff, don't bother showing it
|
|
16
|
-
if (!normalizedMeta.name || !normalizedMeta.image) {
|
|
17
|
-
return [];
|
|
18
|
-
}
|
|
19
|
-
return getKindTagValues(event.tags).map(kind => ({
|
|
20
|
-
...normalizedMeta,
|
|
21
|
-
kind,
|
|
22
|
-
identifier,
|
|
23
|
-
event,
|
|
24
|
-
}));
|
|
25
|
-
};
|
|
26
|
-
export const getHandlerKey = (handler) => `${handler.kind}:${getAddress(handler.event)}`;
|
|
27
|
-
export const displayHandler = (handler, fallback = "") => handler?.name || fallback;
|
|
28
|
-
export const getHandlerAddress = (event) => {
|
|
29
|
-
const tags = getAddressTags(event.tags);
|
|
30
|
-
const tag = tags.find(t => last(t) === "web") || first(tags);
|
|
31
|
-
return tag?.[1];
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=Handler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Handler.js","sourceRoot":"","sources":["../../../../util/src/Handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAC,MAAM,eAAe,CAAA;AAC/D,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AACvC,OAAO,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAA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