@welshman/app 0.0.4 → 0.0.6

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.
Files changed (53) hide show
  1. package/build/src/collection.d.ts +2 -3
  2. package/build/src/context.cjs +8 -1
  3. package/build/src/context.cjs.map +1 -1
  4. package/build/src/context.mjs +9 -2
  5. package/build/src/context.mjs.map +1 -1
  6. package/build/src/core.cjs +10 -3
  7. package/build/src/core.cjs.map +1 -1
  8. package/build/src/core.d.ts +1 -2
  9. package/build/src/core.mjs +10 -3
  10. package/build/src/core.mjs.map +1 -1
  11. package/build/src/follows.cjs.map +1 -1
  12. package/build/src/follows.d.ts +3 -7
  13. package/build/src/follows.mjs.map +1 -1
  14. package/build/src/freshness.d.ts +1 -4
  15. package/build/src/handles.cjs +3 -5
  16. package/build/src/handles.cjs.map +1 -1
  17. package/build/src/handles.d.ts +4 -8
  18. package/build/src/handles.mjs +3 -5
  19. package/build/src/handles.mjs.map +1 -1
  20. package/build/src/mutes.cjs.map +1 -1
  21. package/build/src/mutes.d.ts +3 -7
  22. package/build/src/mutes.mjs.map +1 -1
  23. package/build/src/plaintext.d.ts +1 -4
  24. package/build/src/profiles.cjs +14 -2
  25. package/build/src/profiles.cjs.map +1 -1
  26. package/build/src/profiles.d.ts +4 -8
  27. package/build/src/profiles.mjs +14 -2
  28. package/build/src/profiles.mjs.map +1 -1
  29. package/build/src/relaySelections.cjs.map +1 -1
  30. package/build/src/relaySelections.d.ts +5 -13
  31. package/build/src/relaySelections.mjs.map +1 -1
  32. package/build/src/relays.cjs +13 -11
  33. package/build/src/relays.cjs.map +1 -1
  34. package/build/src/relays.d.ts +3 -7
  35. package/build/src/relays.mjs +14 -12
  36. package/build/src/relays.mjs.map +1 -1
  37. package/build/src/session.d.ts +4 -13
  38. package/build/src/storage.cjs +55 -8
  39. package/build/src/storage.cjs.map +1 -1
  40. package/build/src/storage.d.ts +50 -6
  41. package/build/src/storage.mjs +57 -10
  42. package/build/src/storage.mjs.map +1 -1
  43. package/build/src/thunk.cjs +3 -0
  44. package/build/src/thunk.cjs.map +1 -1
  45. package/build/src/thunk.mjs +4 -1
  46. package/build/src/thunk.mjs.map +1 -1
  47. package/build/src/topics.d.ts +1 -4
  48. package/build/src/zappers.cjs +8 -8
  49. package/build/src/zappers.cjs.map +1 -1
  50. package/build/src/zappers.d.ts +4 -8
  51. package/build/src/zappers.mjs +8 -8
  52. package/build/src/zappers.mjs.map +1 -1
  53. package/package.json +4 -4
@@ -1,11 +1,7 @@
1
1
  /// <reference types="svelte" />
2
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
- };
3
+ import { type SubscribeRequestWithHandlers } from "@welshman/net";
4
+ export declare const zappers: import("@welshman/store").WritableWithGetter<Zapper[]>;
7
5
  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>;
6
+ export declare const zappersByLnurl: import("@welshman/store").ReadableWithGetter<Map<string, Zapper>>, deriveZapper: (key: import("@welshman/lib").Maybe<string>) => import("svelte/store").Readable<Zapper | undefined>, loadZapper: (key: string) => Promise<Zapper | undefined>;
7
+ export declare const deriveZapperForPubkey: (pubkey: string, request?: Partial<SubscribeRequestWithHandlers>) => import("svelte/store").Readable<Zapper | undefined>;
@@ -10,9 +10,11 @@ export const fetchZappers = async (lnurls) => {
10
10
  // Use dufflepud if we it's set up to protect user privacy, otherwise fetch directly
11
11
  if (base) {
12
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));
13
+ if (hexUrls.length > 0) {
14
+ const res = await tryCatch(async () => await postJson(`${base}/zapper/info`, { lnurls: hexUrls }));
15
+ for (const { lnurl, info } of (res === null || res === void 0 ? void 0 : res.data) || []) {
16
+ tryCatch(() => zappersByLnurl.set(hexToBech32("lnurl", lnurl), info));
17
+ }
16
18
  }
17
19
  }
18
20
  else {
@@ -36,16 +38,14 @@ export const { indexStore: zappersByLnurl, deriveItem: deriveZapper, loadItem: l
36
38
  load: batcher(800, async (lnurls) => {
37
39
  const fresh = await fetchZappers(uniq(lnurls));
38
40
  const stale = zappersByLnurl.get();
39
- const items = lnurls.map(lnurl => {
41
+ for (const lnurl of lnurls) {
40
42
  const newZapper = fresh.get(lnurl);
41
- const oldZapper = stale.get(lnurl);
42
43
  if (newZapper) {
43
44
  stale.set(lnurl, { ...newZapper, lnurl });
44
45
  }
45
- return { ...oldZapper, ...newZapper, lnurl };
46
- });
46
+ }
47
47
  zappers.set(Array.from(stale.values()));
48
- return items;
48
+ return lnurls;
49
49
  }),
50
50
  });
51
51
  export const deriveZapperForPubkey = (pubkey, request = {}) => derived([zappersByLnurl, deriveProfile(pubkey, request)], ([$zappersByLnurl, $profile]) => {
@@ -1 +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,MAA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,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@welshman/app",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "author": "hodlbod",
5
5
  "license": "MIT",
6
6
  "description": "A collection of svelte stores for use in building nostr client applications.",
@@ -32,10 +32,10 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@welshman/lib": "0.0.17",
35
- "@welshman/net": "0.0.21",
35
+ "@welshman/net": "0.0.22",
36
36
  "@welshman/signer": "0.0.5",
37
- "@welshman/store": "0.0.5",
38
- "@welshman/util": "0.0.30",
37
+ "@welshman/store": "0.0.7",
38
+ "@welshman/util": "0.0.31",
39
39
  "fuse.js": "^7.0.0",
40
40
  "idb": "^8.0.0",
41
41
  "svelte": "^4.2.18",