@welshman/app 0.0.1 → 0.0.3
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 +53 -0
- package/build/src/collection.cjs.map +1 -0
- package/build/src/collection.d.ts +15 -0
- package/build/src/collection.mjs +49 -0
- package/build/src/collection.mjs.map +1 -0
- 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 +54 -0
- package/build/src/core.cjs.map +1 -0
- package/build/src/core.d.ts +14 -0
- package/build/src/core.mjs +49 -0
- package/build/src/core.mjs.map +1 -0
- package/build/src/follows.cjs +27 -0
- package/build/src/follows.cjs.map +1 -0
- package/build/src/follows.d.ts +9 -0
- package/build/src/follows.mjs +23 -0
- package/build/src/follows.mjs.map +1 -0
- package/build/src/freshness.cjs +21 -0
- package/build/src/freshness.cjs.map +1 -0
- package/build/src/freshness.d.ts +8 -0
- package/build/src/freshness.mjs +14 -0
- package/build/src/freshness.mjs.map +1 -0
- package/build/src/handles.cjs +85 -0
- package/build/src/handles.cjs.map +1 -0
- package/build/src/handles.d.ts +24 -0
- package/build/src/handles.mjs +77 -0
- package/build/src/handles.mjs.map +1 -0
- package/build/src/index.cjs +17 -2
- package/build/src/index.cjs.map +1 -1
- package/build/src/index.d.ts +17 -2
- package/build/src/index.mjs +17 -2
- package/build/src/mutes.cjs +27 -0
- package/build/src/mutes.cjs.map +1 -0
- package/build/src/mutes.d.ts +9 -0
- package/build/src/mutes.mjs +23 -0
- package/build/src/mutes.mjs.map +1 -0
- package/build/src/plaintext.cjs +24 -0
- package/build/src/plaintext.cjs.map +1 -0
- package/build/src/plaintext.d.ts +8 -0
- package/build/src/plaintext.mjs +18 -0
- package/build/src/plaintext.mjs.map +1 -0
- package/build/src/profiles.cjs +40 -0
- package/build/src/profiles.cjs.map +1 -0
- package/build/src/profiles.d.ts +12 -0
- package/build/src/profiles.mjs +34 -0
- package/build/src/profiles.mjs.map +1 -0
- package/build/src/relaySelections.cjs +34 -0
- package/build/src/relaySelections.cjs.map +1 -0
- package/build/src/relaySelections.d.ts +18 -0
- package/build/src/relaySelections.mjs +27 -0
- package/build/src/relaySelections.mjs.map +1 -0
- package/build/src/relays.cjs +116 -0
- package/build/src/relays.cjs.map +1 -0
- package/build/src/relays.d.ts +28 -0
- package/build/src/relays.mjs +109 -0
- package/build/src/relays.mjs.map +1 -0
- 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 +27 -19
- package/build/src/session.cjs.map +1 -1
- package/build/src/session.d.ts +13 -1
- package/build/src/session.mjs +23 -19
- package/build/src/session.mjs.map +1 -1
- package/build/src/storage.cjs +101 -0
- package/build/src/storage.cjs.map +1 -0
- package/build/src/storage.d.ts +45 -0
- package/build/src/storage.mjs +92 -0
- package/build/src/storage.mjs.map +1 -0
- package/build/src/thunk.cjs +44 -0
- package/build/src/thunk.cjs.map +1 -0
- package/build/src/thunk.d.ts +37 -0
- package/build/src/thunk.mjs +39 -0
- package/build/src/thunk.mjs.map +1 -0
- package/build/src/topics.cjs +30 -0
- package/build/src/topics.cjs.map +1 -0
- package/build/src/topics.d.ts +10 -0
- package/build/src/topics.mjs +27 -0
- package/build/src/topics.mjs.map +1 -0
- package/build/src/util.cjs +62 -0
- package/build/src/util.cjs.map +1 -0
- package/build/src/util.d.ts +22 -0
- package/build/src/util.mjs +47 -0
- package/build/src/util.mjs.map +1 -0
- package/build/src/zappers.cjs +64 -0
- package/build/src/zappers.cjs.map +1 -0
- package/build/src/zappers.d.ts +11 -0
- package/build/src/zappers.mjs +58 -0
- package/build/src/zappers.mjs.map +1 -0
- package/package.json +10 -4
- package/build/src/relay.cjs +0 -13
- package/build/src/relay.cjs.map +0 -1
- package/build/src/relay.d.ts +0 -6
- package/build/src/relay.mjs +0 -10
- package/build/src/relay.mjs.map +0 -1
- package/build/src/types.cjs +0 -3
- package/build/src/types.cjs.map +0 -1
- package/build/src/types.d.ts +0 -15
- package/build/src/types.mjs +0 -2
- package/build/src/types.mjs.map +0 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.formatTimestampAsTime = exports.formatTimestampAsDate = exports.formatTimestamp = exports.getLocale = exports.createLocalDate = exports.getTimeZone = exports.dateToSeconds = exports.secondsToDate = exports.createSearch = void 0;
|
|
7
|
+
const fuse_js_1 = __importDefault(require("fuse.js"));
|
|
8
|
+
const lib_1 = require("@welshman/lib");
|
|
9
|
+
const createSearch = (options, opts) => {
|
|
10
|
+
const fuse = new fuse_js_1.default(options, { ...opts.fuseOptions, includeScore: true });
|
|
11
|
+
const map = new Map(options.map(item => [opts.getValue(item), item]));
|
|
12
|
+
const search = (term) => {
|
|
13
|
+
let results = term ? fuse.search(term) : options.map(item => ({ item, score: 1 }));
|
|
14
|
+
if (opts.sortFn) {
|
|
15
|
+
results = (0, lib_1.sortBy)(opts.sortFn, results);
|
|
16
|
+
}
|
|
17
|
+
return results.map(result => result.item);
|
|
18
|
+
};
|
|
19
|
+
return {
|
|
20
|
+
options,
|
|
21
|
+
getValue: opts.getValue,
|
|
22
|
+
getOption: (value) => map.get(value),
|
|
23
|
+
searchOptions: (term) => search(term),
|
|
24
|
+
searchValues: (term) => search(term).map(opts.getValue),
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
exports.createSearch = createSearch;
|
|
28
|
+
const secondsToDate = (ts) => new Date(ts * 1000);
|
|
29
|
+
exports.secondsToDate = secondsToDate;
|
|
30
|
+
const dateToSeconds = (date) => Math.round(date.valueOf() / 1000);
|
|
31
|
+
exports.dateToSeconds = dateToSeconds;
|
|
32
|
+
const getTimeZone = () => new Date().toString().match(/GMT[^\s]+/);
|
|
33
|
+
exports.getTimeZone = getTimeZone;
|
|
34
|
+
const createLocalDate = (dateString) => new Date(`${dateString} ${(0, exports.getTimeZone)()}`);
|
|
35
|
+
exports.createLocalDate = createLocalDate;
|
|
36
|
+
const getLocale = () => new Intl.DateTimeFormat().resolvedOptions().locale;
|
|
37
|
+
exports.getLocale = getLocale;
|
|
38
|
+
const formatTimestamp = (ts) => {
|
|
39
|
+
const formatter = new Intl.DateTimeFormat((0, exports.getLocale)(), {
|
|
40
|
+
dateStyle: "short",
|
|
41
|
+
timeStyle: "short",
|
|
42
|
+
});
|
|
43
|
+
return formatter.format((0, exports.secondsToDate)(ts));
|
|
44
|
+
};
|
|
45
|
+
exports.formatTimestamp = formatTimestamp;
|
|
46
|
+
const formatTimestampAsDate = (ts) => {
|
|
47
|
+
const formatter = new Intl.DateTimeFormat((0, exports.getLocale)(), {
|
|
48
|
+
year: "numeric",
|
|
49
|
+
month: "long",
|
|
50
|
+
day: "numeric",
|
|
51
|
+
});
|
|
52
|
+
return formatter.format((0, exports.secondsToDate)(ts));
|
|
53
|
+
};
|
|
54
|
+
exports.formatTimestampAsDate = formatTimestampAsDate;
|
|
55
|
+
const formatTimestampAsTime = (ts) => {
|
|
56
|
+
const formatter = new Intl.DateTimeFormat((0, exports.getLocale)(), {
|
|
57
|
+
timeStyle: "short",
|
|
58
|
+
});
|
|
59
|
+
return formatter.format((0, exports.secondsToDate)(ts));
|
|
60
|
+
};
|
|
61
|
+
exports.formatTimestampAsTime = formatTimestampAsTime;
|
|
62
|
+
//# sourceMappingURL=util.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.cjs","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA0B;AAE1B,uCAAoC;AAgB7B,MAAM,YAAY,G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AS;KACf,CAAC,CAAA;IAEF,OAAO,SAAS,CAAC,MAAM,CAAC,IAAA,qBAAa,EAAC,EAAE,CAAC,CAAC,CAAA;AAC5C,CAAC,CAAA;AARY,QAAA,qBAAqB,yBAQjC;AAEM,MAAM,qBAAqB,GAAG,CAAC,EAAU,EAAE,EAAE;IAClD,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,IAAA,iBAAS,GAAE,EAAE;QACrD,SAAS,EAAE,OAAO;KACnB,CAAC,CAAA;IAEF,OAAO,SAAS,CAAC,MAAM,CAAC,IAAA,qBAAa,EAAC,EAAE,CAAC,CAAC,CAAA;AAC5C,CAAC,CAAA;AANY,QAAA,qBAAqB,yBAMjC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { IFuseOptions, FuseResult } from "fuse.js";
|
|
2
|
+
export type SearchOptions<V, T> = {
|
|
3
|
+
getValue: (item: T) => V;
|
|
4
|
+
fuseOptions?: IFuseOptions<T>;
|
|
5
|
+
sortFn?: (items: FuseResult<T>) => any;
|
|
6
|
+
};
|
|
7
|
+
export type Search<V, T> = {
|
|
8
|
+
options: T[];
|
|
9
|
+
getValue: (item: T) => V;
|
|
10
|
+
getOption: (value: V) => T | undefined;
|
|
11
|
+
searchOptions: (term: string) => T[];
|
|
12
|
+
searchValues: (term: string) => V[];
|
|
13
|
+
};
|
|
14
|
+
export declare const createSearch: <V, T>(options: T[], opts: SearchOptions<V, T>) => Search<V, T>;
|
|
15
|
+
export declare const secondsToDate: (ts: number) => Date;
|
|
16
|
+
export declare const dateToSeconds: (date: Date) => number;
|
|
17
|
+
export declare const getTimeZone: () => RegExpMatchArray | null;
|
|
18
|
+
export declare const createLocalDate: (dateString: any) => Date;
|
|
19
|
+
export declare const getLocale: () => string;
|
|
20
|
+
export declare const formatTimestamp: (ts: number) => string;
|
|
21
|
+
export declare const formatTimestampAsDate: (ts: number) => string;
|
|
22
|
+
export declare const formatTimestampAsTime: (ts: number) => string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import Fuse from "fuse.js";
|
|
2
|
+
import { sortBy } from "@welshman/lib";
|
|
3
|
+
export const createSearch = (options, opts) => {
|
|
4
|
+
const fuse = new Fuse(options, { ...opts.fuseOptions, includeScore: true });
|
|
5
|
+
const map = new Map(options.map(item => [opts.getValue(item), item]));
|
|
6
|
+
const search = (term) => {
|
|
7
|
+
let results = term ? fuse.search(term) : options.map(item => ({ item, score: 1 }));
|
|
8
|
+
if (opts.sortFn) {
|
|
9
|
+
results = sortBy(opts.sortFn, results);
|
|
10
|
+
}
|
|
11
|
+
return results.map(result => result.item);
|
|
12
|
+
};
|
|
13
|
+
return {
|
|
14
|
+
options,
|
|
15
|
+
getValue: opts.getValue,
|
|
16
|
+
getOption: (value) => map.get(value),
|
|
17
|
+
searchOptions: (term) => search(term),
|
|
18
|
+
searchValues: (term) => search(term).map(opts.getValue),
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export const secondsToDate = (ts) => new Date(ts * 1000);
|
|
22
|
+
export const dateToSeconds = (date) => Math.round(date.valueOf() / 1000);
|
|
23
|
+
export const getTimeZone = () => new Date().toString().match(/GMT[^\s]+/);
|
|
24
|
+
export const createLocalDate = (dateString) => new Date(`${dateString} ${getTimeZone()}`);
|
|
25
|
+
export const getLocale = () => new Intl.DateTimeFormat().resolvedOptions().locale;
|
|
26
|
+
export const formatTimestamp = (ts) => {
|
|
27
|
+
const formatter = new Intl.DateTimeFormat(getLocale(), {
|
|
28
|
+
dateStyle: "short",
|
|
29
|
+
timeStyle: "short",
|
|
30
|
+
});
|
|
31
|
+
return formatter.format(secondsToDate(ts));
|
|
32
|
+
};
|
|
33
|
+
export const formatTimestampAsDate = (ts) => {
|
|
34
|
+
const formatter = new Intl.DateTimeFormat(getLocale(), {
|
|
35
|
+
year: "numeric",
|
|
36
|
+
month: "long",
|
|
37
|
+
day: "numeric",
|
|
38
|
+
});
|
|
39
|
+
return formatter.format(secondsToDate(ts));
|
|
40
|
+
};
|
|
41
|
+
export const formatTimestampAsTime = (ts) => {
|
|
42
|
+
const formatter = new Intl.DateTimeFormat(getLocale(), {
|
|
43
|
+
timeStyle: "short",
|
|
44
|
+
});
|
|
45
|
+
return formatter.format(secondsToDate(ts));
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=util.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.mjs","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"OAAO,IAAI,MAAM,SAAS;OAEnB,EAAC,MAAM,EAAC,MAAM,eAAe;AAgBpC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAO,OAAY,EAAE,IAAyB,EAAgB,EAAE;IAC1F,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,OAAO,EAAE,EAAC,GAAG,IAAI,CAAC,WAAW,EAAE,YAAY,EAAE,IAAI,EAAC,CAAC,CAAA;IACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IAE3E,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,EAAE;QAC9B,IAAI,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAC,CAAkB,CAAC,CAAA;QAEjG,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;SACvC;QAED,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC3C,CAAC,CAAA;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AC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAA;AAC5C,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EAAU,EAAE,EAAE;IAClD,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE;QACrD,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,MAAM;QACb,GAAG,EAAE,SAAS;KACf,CAAC,CAAA;IAEF,OAAO,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAA;AAC5C,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EAAU,EAAE,EAAE;IAClD,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE;QACrD,SAAS,EAAE,OAAO;KACnB,CAAC,CAAA;IAEF,OAAO,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAA;AAC5C,CAAC,CAAA"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.deriveZapperForPubkey = exports.loadZapper = exports.deriveZapper = exports.zappersByLnurl = exports.fetchZappers = exports.zappers = void 0;
|
|
5
|
+
const store_1 = require("svelte/store");
|
|
6
|
+
const store_2 = require("@welshman/store");
|
|
7
|
+
const lib_1 = require("@welshman/lib");
|
|
8
|
+
const collection_1 = require("./collection.cjs");
|
|
9
|
+
const profiles_1 = require("./profiles.cjs");
|
|
10
|
+
exports.zappers = (0, store_2.withGetter)((0, store_1.writable)([]));
|
|
11
|
+
const fetchZappers = async (lnurls) => {
|
|
12
|
+
const base = lib_1.ctx.app.dufflepudUrl;
|
|
13
|
+
const zappersByLnurl = new Map();
|
|
14
|
+
// Use dufflepud if we it's set up to protect user privacy, otherwise fetch directly
|
|
15
|
+
if (base) {
|
|
16
|
+
const hexUrls = lnurls.map(lnurl => (0, lib_1.tryCatch)(() => (0, lib_1.bech32ToHex)(lnurl))).filter(lib_1.identity);
|
|
17
|
+
const res = await (0, lib_1.tryCatch)(async () => await (0, lib_1.postJson)(`${base}/zapper/info`, { lnurls: hexUrls }));
|
|
18
|
+
for (const { lnurl, info } of (res === null || res === void 0 ? void 0 : res.data) || []) {
|
|
19
|
+
(0, lib_1.tryCatch)(() => zappersByLnurl.set((0, lib_1.hexToBech32)("lnurl", lnurl), info));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
const results = await Promise.all(lnurls.map(async (lnurl) => {
|
|
24
|
+
const hexUrl = (0, lib_1.tryCatch)(() => (0, lib_1.bech32ToHex)(lnurl));
|
|
25
|
+
const info = hexUrl ? await (0, lib_1.tryCatch)(async () => await (0, lib_1.fetchJson)(hexUrl)) : undefined;
|
|
26
|
+
return { lnurl, hexUrl, info };
|
|
27
|
+
}));
|
|
28
|
+
for (const { lnurl, info } of results) {
|
|
29
|
+
if (info) {
|
|
30
|
+
zappersByLnurl.set(lnurl, info);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return zappersByLnurl;
|
|
35
|
+
};
|
|
36
|
+
exports.fetchZappers = fetchZappers;
|
|
37
|
+
_a = (0, collection_1.collection)({
|
|
38
|
+
name: "zappers",
|
|
39
|
+
store: exports.zappers,
|
|
40
|
+
getKey: (zapper) => zapper.lnurl,
|
|
41
|
+
load: (0, lib_1.batcher)(800, async (lnurls) => {
|
|
42
|
+
const fresh = await (0, exports.fetchZappers)((0, lib_1.uniq)(lnurls));
|
|
43
|
+
const stale = exports.zappersByLnurl.get();
|
|
44
|
+
const items = lnurls.map(lnurl => {
|
|
45
|
+
const newZapper = fresh.get(lnurl);
|
|
46
|
+
const oldZapper = stale.get(lnurl);
|
|
47
|
+
if (newZapper) {
|
|
48
|
+
stale.set(lnurl, { ...newZapper, lnurl });
|
|
49
|
+
}
|
|
50
|
+
return { ...oldZapper, ...newZapper, lnurl };
|
|
51
|
+
});
|
|
52
|
+
exports.zappers.set(Array.from(stale.values()));
|
|
53
|
+
return items;
|
|
54
|
+
}),
|
|
55
|
+
}), exports.zappersByLnurl = _a.indexStore, exports.deriveZapper = _a.deriveItem, exports.loadZapper = _a.loadItem;
|
|
56
|
+
const deriveZapperForPubkey = (pubkey, request = {}) => (0, store_1.derived)([exports.zappersByLnurl, (0, profiles_1.deriveProfile)(pubkey, request)], ([$zappersByLnurl, $profile]) => {
|
|
57
|
+
if (!($profile === null || $profile === void 0 ? void 0 : $profile.lnurl)) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
(0, exports.loadZapper)($profile.lnurl);
|
|
61
|
+
return $zappersByLnurl.get($profile.lnurl);
|
|
62
|
+
});
|
|
63
|
+
exports.deriveZapperForPubkey = deriveZapperForPubkey;
|
|
64
|
+
//# sourceMappingURL=zappers.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zappers.cjs","sourceRoot":"","sources":["../../src/zappers.ts"],"names":[],"mappings":";;;;AAAA,wCAA8C;AAC9C,2CAA0C;AAG1C,uCAAmH;AACnH,iDAAuC;AACvC,6CAAwC;AAE3B,QAAA,OAAO,GAAG,IAAA,kBAAU,EAAC,IAAA,gBAAQ,EAAW,EAAE,CAAC,CAAC,CAAA;AAElD,MAAM,YAAY,GAAG,KAAK,EAAE,MAAgB,EAAE,EAAE;IACrD,MAAM,IAAI,GAAG,SAAG,CAAC,GAAG,CAAC,YAAa,CAAA;IAClC,MAAM,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAA;IAEhD,oFAAoF;IACpF,IAAI,IAAI,EAAE;QACR,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAA,cAAQ,EAAC,GAAG,EAAE,CAAC,IAAA,iBAAW,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MA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AAA,EAAE;QACpB,OAAO,SAAS,CAAA;KACjB;IAED,IAAA,kBAAU,EAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAE1B,OAAO,eAAe,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AAC5C,CAAC,CACF,CAAA;AAZU,QAAA,qBAAqB,yBAY/B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="svelte" />
|
|
2
|
+
import { type Zapper } from '@welshman/util';
|
|
3
|
+
import { type SubscribeRequest } from "@welshman/net";
|
|
4
|
+
export declare const zappers: import("svelte/store").Writable<Zapper[]> & {
|
|
5
|
+
get: () => Zapper[];
|
|
6
|
+
};
|
|
7
|
+
export declare const fetchZappers: (lnurls: string[]) => Promise<Map<string, Zapper>>;
|
|
8
|
+
export declare const zappersByLnurl: import("svelte/store").Readable<Map<string, Zapper>> & {
|
|
9
|
+
get: () => Map<string, Zapper>;
|
|
10
|
+
}, deriveZapper: (key: import("@welshman/lib").Maybe<string>) => import("svelte/store").Readable<Zapper | undefined>, loadZapper: (key: string) => Promise<Zapper | undefined>;
|
|
11
|
+
export declare const deriveZapperForPubkey: (pubkey: string, request?: Partial<SubscribeRequest>) => import("svelte/store").Readable<Zapper | undefined>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { writable, derived } from 'svelte/store';
|
|
2
|
+
import { withGetter } from '@welshman/store';
|
|
3
|
+
import { ctx, identity, fetchJson, uniq, bech32ToHex, hexToBech32, tryCatch, batcher, postJson } from '@welshman/lib';
|
|
4
|
+
import { collection } from "./collection.mjs";
|
|
5
|
+
import { deriveProfile } from "./profiles.mjs";
|
|
6
|
+
export const zappers = withGetter(writable([]));
|
|
7
|
+
export const fetchZappers = async (lnurls) => {
|
|
8
|
+
const base = ctx.app.dufflepudUrl;
|
|
9
|
+
const zappersByLnurl = new Map();
|
|
10
|
+
// Use dufflepud if we it's set up to protect user privacy, otherwise fetch directly
|
|
11
|
+
if (base) {
|
|
12
|
+
const hexUrls = lnurls.map(lnurl => tryCatch(() => bech32ToHex(lnurl))).filter(identity);
|
|
13
|
+
const res = await tryCatch(async () => await postJson(`${base}/zapper/info`, { lnurls: hexUrls }));
|
|
14
|
+
for (const { lnurl, info } of (res === null || res === void 0 ? void 0 : res.data) || []) {
|
|
15
|
+
tryCatch(() => zappersByLnurl.set(hexToBech32("lnurl", lnurl), info));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
const results = await Promise.all(lnurls.map(async (lnurl) => {
|
|
20
|
+
const hexUrl = tryCatch(() => bech32ToHex(lnurl));
|
|
21
|
+
const info = hexUrl ? await tryCatch(async () => await fetchJson(hexUrl)) : undefined;
|
|
22
|
+
return { lnurl, hexUrl, info };
|
|
23
|
+
}));
|
|
24
|
+
for (const { lnurl, info } of results) {
|
|
25
|
+
if (info) {
|
|
26
|
+
zappersByLnurl.set(lnurl, info);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return zappersByLnurl;
|
|
31
|
+
};
|
|
32
|
+
export const { indexStore: zappersByLnurl, deriveItem: deriveZapper, loadItem: loadZapper, } = collection({
|
|
33
|
+
name: "zappers",
|
|
34
|
+
store: zappers,
|
|
35
|
+
getKey: (zapper) => zapper.lnurl,
|
|
36
|
+
load: batcher(800, async (lnurls) => {
|
|
37
|
+
const fresh = await fetchZappers(uniq(lnurls));
|
|
38
|
+
const stale = zappersByLnurl.get();
|
|
39
|
+
const items = lnurls.map(lnurl => {
|
|
40
|
+
const newZapper = fresh.get(lnurl);
|
|
41
|
+
const oldZapper = stale.get(lnurl);
|
|
42
|
+
if (newZapper) {
|
|
43
|
+
stale.set(lnurl, { ...newZapper, lnurl });
|
|
44
|
+
}
|
|
45
|
+
return { ...oldZapper, ...newZapper, lnurl };
|
|
46
|
+
});
|
|
47
|
+
zappers.set(Array.from(stale.values()));
|
|
48
|
+
return items;
|
|
49
|
+
}),
|
|
50
|
+
});
|
|
51
|
+
export const deriveZapperForPubkey = (pubkey, request = {}) => derived([zappersByLnurl, deriveProfile(pubkey, request)], ([$zappersByLnurl, $profile]) => {
|
|
52
|
+
if (!($profile === null || $profile === void 0 ? void 0 : $profile.lnurl)) {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
loadZapper($profile.lnurl);
|
|
56
|
+
return $zappersByLnurl.get($profile.lnurl);
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=zappers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zappers.mjs","sourceRoot":"","sources":["../../src/zappers.ts"],"names":[],"mappings":"OAAO,EAAC,QAAQ,EAAE,OAAO,EAAC,MAAM,cAAc;OACvC,EAAC,UAAU,EAAC,MAAM,iBAAiB;OAGnC,EAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,eAAe;OAC5G,EAAC,UAAU,EAAC;OACZ,EAAC,aAAa,EAAC;AAEtB,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAW,EAAE,CAAC,CAAC,CAAA;AAEzD,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,MAAgB,EAAE,EAAE;IACrD,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,YAAa,CAAA;IAClC,MAAM,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAA;IAEhD,oFAAoF;IACpF,IAAI,IAAI,EAAE;QACR,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QACxF,MAAM,GAAG,GAAQ,MAAM,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC,MAAM,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C5C,CAAC,CACF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@welshman/app",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"author": "hodlbod",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A collection of svelte stores for use in building nostr client applications.",
|
|
@@ -31,8 +31,14 @@
|
|
|
31
31
|
"typescript": "~5.1.6"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@welshman/lib": "0.0.
|
|
35
|
-
"@welshman/
|
|
36
|
-
"
|
|
34
|
+
"@welshman/lib": "0.0.17",
|
|
35
|
+
"@welshman/net": "0.0.21",
|
|
36
|
+
"@welshman/signer": "0.0.5",
|
|
37
|
+
"@welshman/store": "0.0.5",
|
|
38
|
+
"@welshman/util": "0.0.30",
|
|
39
|
+
"fuse.js": "^7.0.0",
|
|
40
|
+
"idb": "^8.0.0",
|
|
41
|
+
"svelte": "^4.2.18",
|
|
42
|
+
"throttle-debounce": "^5.0.2"
|
|
37
43
|
}
|
|
38
44
|
}
|
package/build/src/relay.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tracker = exports.relay = exports.repository = void 0;
|
|
4
|
-
const util_1 = require("@welshman/util");
|
|
5
|
-
const net_1 = require("@welshman/net");
|
|
6
|
-
exports.repository = new util_1.Repository();
|
|
7
|
-
exports.relay = new util_1.Relay(exports.repository);
|
|
8
|
-
exports.tracker = new net_1.Tracker();
|
|
9
|
-
Object.assign(net_1.NetworkContext, {
|
|
10
|
-
onEvent: (url, event) => exports.tracker.track(event.id, url),
|
|
11
|
-
isDeleted: (url, event) => exports.repository.isDeleted(event),
|
|
12
|
-
});
|
|
13
|
-
//# sourceMappingURL=relay.cjs.map
|
package/build/src/relay.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"relay.cjs","sourceRoot":"","sources":["../../src/relay.ts"],"names":[],"mappings":";;;AACA,yCAAgD;AAChD,uCAAqD;AAExC,QAAA,UAAU,GAAG,IAAI,iBAAU,EAAe,CAAA;AAE1C,QAAA,KAAK,GAAG,IAAI,YAAK,CAAC,kBAAU,CAAC,CAAA;AAE7B,QAAA,OAAO,GAAG,IAAI,aAAO,EAAE,CAAA;AAEpC,MAAM,CAAC,MAAM,CAAC,oBAAc,EAAE;IAC5B,OAAO,EAAE,CAAC,GAAW,EAAE,KAAmB,EAAE,EAAE,CAAC,eAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG,CAAC;IAC3E,SAAS,EAAE,CAAC,GAAW,EAAE,KAAmB,EAAE,EAAE,CAAC,kBAAU,CAAC,SAAS,CAAC,KAAK,CAAC;CAC7E,CAAC,CAAA"}
|
package/build/src/relay.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { HashedEvent } from "@welshman/util";
|
|
2
|
-
import { Repository, Relay } from "@welshman/util";
|
|
3
|
-
import { Tracker } from "@welshman/net";
|
|
4
|
-
export declare const repository: Repository<HashedEvent>;
|
|
5
|
-
export declare const relay: Relay<HashedEvent>;
|
|
6
|
-
export declare const tracker: Tracker;
|
package/build/src/relay.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Repository, Relay } from "@welshman/util";
|
|
2
|
-
import { NetworkContext, Tracker } from "@welshman/net";
|
|
3
|
-
export const repository = new Repository();
|
|
4
|
-
export const relay = new Relay(repository);
|
|
5
|
-
export const tracker = new Tracker();
|
|
6
|
-
Object.assign(NetworkContext, {
|
|
7
|
-
onEvent: (url, event) => tracker.track(event.id, url),
|
|
8
|
-
isDeleted: (url, event) => repository.isDeleted(event),
|
|
9
|
-
});
|
|
10
|
-
//# sourceMappingURL=relay.mjs.map
|
package/build/src/relay.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"relay.mjs","sourceRoot":"","sources":["../../src/relay.ts"],"names":[],"mappings":"OACO,EAAC,UAAU,EAAE,KAAK,EAAC,MAAM,gBAAgB;OACzC,EAAC,cAAc,EAAE,OAAO,EAAC,MAAM,eAAe;AAErD,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,UAAU,EAAe,CAAA;AAEvD,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,UAAU,CAAC,CAAA;AAE1C,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAA;AAEpC,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE;IAC5B,OAAO,EAAE,CAAC,GAAW,EAAE,KAAmB,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG,CAAC;IAC3E,SAAS,EAAE,CAAC,GAAW,EAAE,KAAmB,EAAE,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC;CAC7E,CAAC,CAAA"}
|
package/build/src/types.cjs
DELETED
package/build/src/types.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
package/build/src/types.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Nip46Handler } from "@welshman/signer";
|
|
2
|
-
import type { RelayProfile } from "@welshman/util";
|
|
3
|
-
export type Session = {
|
|
4
|
-
method: string;
|
|
5
|
-
pubkey: string;
|
|
6
|
-
secret?: string;
|
|
7
|
-
handler?: Nip46Handler;
|
|
8
|
-
};
|
|
9
|
-
export type Relay = RelayProfile;
|
|
10
|
-
export type Handle = {
|
|
11
|
-
pubkey: string;
|
|
12
|
-
nip05: string;
|
|
13
|
-
nip46: string[];
|
|
14
|
-
relays: string[];
|
|
15
|
-
};
|
package/build/src/types.mjs
DELETED
package/build/src/types.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|