applesauce-core 1.0.0 → 1.2.0
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/__tests__/exports.test.d.ts +1 -0
- package/dist/__tests__/exports.test.js +17 -0
- package/dist/helpers/__tests__/exports.test.d.ts +1 -0
- package/dist/helpers/__tests__/exports.test.js +220 -0
- package/dist/helpers/blossom.d.ts +2 -0
- package/dist/helpers/blossom.js +18 -0
- package/dist/helpers/profile.js +1 -1
- package/dist/observable/__tests__/exports.test.d.ts +1 -0
- package/dist/observable/__tests__/exports.test.js +18 -0
- package/dist/observable/index.d.ts +2 -0
- package/dist/observable/index.js +3 -0
- package/dist/promise/__tests__/exports.test.d.ts +1 -0
- package/dist/promise/__tests__/exports.test.js +11 -0
- package/dist/queries/__tests__/exports.test.d.ts +1 -0
- package/dist/queries/__tests__/exports.test.js +41 -0
- package/dist/query-store/__tests__/exports.test.d.ts +1 -0
- package/dist/query-store/__tests__/exports.test.js +12 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import * as exports from "../index.js";
|
|
3
|
+
describe("exports", () => {
|
|
4
|
+
it("should export the expected functions", () => {
|
|
5
|
+
expect(Object.keys(exports).sort()).toMatchInlineSnapshot(`
|
|
6
|
+
[
|
|
7
|
+
"Database",
|
|
8
|
+
"EventStore",
|
|
9
|
+
"EventStoreSymbol",
|
|
10
|
+
"Helpers",
|
|
11
|
+
"Queries",
|
|
12
|
+
"QueryStore",
|
|
13
|
+
"logger",
|
|
14
|
+
]
|
|
15
|
+
`);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import * as exports from "../index.js";
|
|
3
|
+
describe("exports", () => {
|
|
4
|
+
it("should export the expected functions", () => {
|
|
5
|
+
expect(Object.keys(exports).sort()).toMatchInlineSnapshot(`
|
|
6
|
+
[
|
|
7
|
+
"AUDIO_EXT",
|
|
8
|
+
"BLOSSOM_SERVER_LIST_KIND",
|
|
9
|
+
"BookmarkHiddenSymbol",
|
|
10
|
+
"BookmarkPublicSymbol",
|
|
11
|
+
"COMMENT_KIND",
|
|
12
|
+
"ChannelMetadataSymbol",
|
|
13
|
+
"CommentReplyPointerSymbol",
|
|
14
|
+
"CommentRootPointerSymbol",
|
|
15
|
+
"ContactsRelaysSymbol",
|
|
16
|
+
"EventContentEncryptionMethod",
|
|
17
|
+
"EventIndexableTagsSymbol",
|
|
18
|
+
"EventUIDSymbol",
|
|
19
|
+
"FAVORITE_RELAYS_KIND",
|
|
20
|
+
"FromCacheSymbol",
|
|
21
|
+
"GROUPS_LIST_KIND",
|
|
22
|
+
"GROUP_MESSAGE_KIND",
|
|
23
|
+
"GiftWrapEventSymbol",
|
|
24
|
+
"GiftWrapSealSymbol",
|
|
25
|
+
"GroupsHiddenSymbol",
|
|
26
|
+
"GroupsPublicSymbol",
|
|
27
|
+
"HiddenContactsSymbol",
|
|
28
|
+
"HiddenContentSymbol",
|
|
29
|
+
"HiddenTagsSymbol",
|
|
30
|
+
"IMAGE_EXT",
|
|
31
|
+
"LRU",
|
|
32
|
+
"MailboxesInboxesSymbol",
|
|
33
|
+
"MailboxesOutboxesSymbol",
|
|
34
|
+
"MediaAttachmentsSymbol",
|
|
35
|
+
"MuteHiddenSymbol",
|
|
36
|
+
"MutePublicSymbol",
|
|
37
|
+
"NIP05_REGEX",
|
|
38
|
+
"Nip10ThreadRefsSymbol",
|
|
39
|
+
"PICTURE_POST_KIND",
|
|
40
|
+
"ProfileContentSymbol",
|
|
41
|
+
"PublicContactsSymbol",
|
|
42
|
+
"ReplaceableIdentifierSymbol",
|
|
43
|
+
"STREAM_EXT",
|
|
44
|
+
"SeenRelaysSymbol",
|
|
45
|
+
"SharedEventSymbol",
|
|
46
|
+
"UserStatusPointerSymbol",
|
|
47
|
+
"VIDEO_EXT",
|
|
48
|
+
"ZapAddressPointerSymbol",
|
|
49
|
+
"ZapEventPointerSymbol",
|
|
50
|
+
"ZapFromSymbol",
|
|
51
|
+
"ZapInvoiceSymbol",
|
|
52
|
+
"ZapRequestSymbol",
|
|
53
|
+
"addSeenRelay",
|
|
54
|
+
"areBlossomServersEqual",
|
|
55
|
+
"canHaveHiddenContent",
|
|
56
|
+
"canHaveHiddenTags",
|
|
57
|
+
"convertToUrl",
|
|
58
|
+
"createMutedWordsRegExp",
|
|
59
|
+
"createReplaceableAddress",
|
|
60
|
+
"decodeGroupPointer",
|
|
61
|
+
"decodeLNURL",
|
|
62
|
+
"decryptDirectMessage",
|
|
63
|
+
"encodeDecodeResult",
|
|
64
|
+
"encodeGroupPointer",
|
|
65
|
+
"fakeVerifyEvent",
|
|
66
|
+
"getAddressPointerForEvent",
|
|
67
|
+
"getAddressPointerFromATag",
|
|
68
|
+
"getAddressPointersFromList",
|
|
69
|
+
"getBlossomServersFromList",
|
|
70
|
+
"getBookmarks",
|
|
71
|
+
"getCachedValue",
|
|
72
|
+
"getChannelMetadataContent",
|
|
73
|
+
"getChannelPointer",
|
|
74
|
+
"getCommentAddressPointer",
|
|
75
|
+
"getCommentEventPointer",
|
|
76
|
+
"getCommentExternalPointer",
|
|
77
|
+
"getCommentReplyPointer",
|
|
78
|
+
"getCommentRootPointer",
|
|
79
|
+
"getContacts",
|
|
80
|
+
"getContentWarning",
|
|
81
|
+
"getCoordinateFromAddressPointer",
|
|
82
|
+
"getDeleteCoordinates",
|
|
83
|
+
"getDeleteIds",
|
|
84
|
+
"getDisplayName",
|
|
85
|
+
"getEmojiTag",
|
|
86
|
+
"getEmojis",
|
|
87
|
+
"getEventPointerForEvent",
|
|
88
|
+
"getEventPointerFromETag",
|
|
89
|
+
"getEventPointerFromQTag",
|
|
90
|
+
"getEventPointerFromThreadTag",
|
|
91
|
+
"getEventPointersFromList",
|
|
92
|
+
"getEventUID",
|
|
93
|
+
"getExternalPointerFromTag",
|
|
94
|
+
"getFileMetadata",
|
|
95
|
+
"getFileMetadataFromImetaTag",
|
|
96
|
+
"getGiftWrapEvent",
|
|
97
|
+
"getGiftWrapSeal",
|
|
98
|
+
"getGroupPointerFromGroupTag",
|
|
99
|
+
"getHashtagTag",
|
|
100
|
+
"getHiddenBookmarks",
|
|
101
|
+
"getHiddenContacts",
|
|
102
|
+
"getHiddenContent",
|
|
103
|
+
"getHiddenContentEncryptionMethods",
|
|
104
|
+
"getHiddenGroups",
|
|
105
|
+
"getHiddenMutedThings",
|
|
106
|
+
"getHiddenTags",
|
|
107
|
+
"getHiddenTagsEncryptionMethods",
|
|
108
|
+
"getInboxes",
|
|
109
|
+
"getIndexableTags",
|
|
110
|
+
"getInvoice",
|
|
111
|
+
"getListTags",
|
|
112
|
+
"getMediaAttachments",
|
|
113
|
+
"getMutedThings",
|
|
114
|
+
"getNip10References",
|
|
115
|
+
"getOrComputeCachedValue",
|
|
116
|
+
"getOutboxes",
|
|
117
|
+
"getPackName",
|
|
118
|
+
"getParentEventStore",
|
|
119
|
+
"getPicturePostAttachments",
|
|
120
|
+
"getPointerForEvent",
|
|
121
|
+
"getPointerFromTag",
|
|
122
|
+
"getProfileContent",
|
|
123
|
+
"getProfilePointerFromPTag",
|
|
124
|
+
"getProfilePointersFromList",
|
|
125
|
+
"getPubkeyFromDecodeResult",
|
|
126
|
+
"getPublicBookmarks",
|
|
127
|
+
"getPublicContacts",
|
|
128
|
+
"getPublicGroups",
|
|
129
|
+
"getPublicMutedThings",
|
|
130
|
+
"getRelaysFromContactsEvent",
|
|
131
|
+
"getRelaysFromList",
|
|
132
|
+
"getReplaceableAddress",
|
|
133
|
+
"getReplaceableIdentifier",
|
|
134
|
+
"getReplaceableUID",
|
|
135
|
+
"getSeenRelays",
|
|
136
|
+
"getSha256FromURL",
|
|
137
|
+
"getTagValue",
|
|
138
|
+
"getURLFilename",
|
|
139
|
+
"getUserStatusPointer",
|
|
140
|
+
"getZapAddressPointer",
|
|
141
|
+
"getZapEventPointer",
|
|
142
|
+
"getZapPayment",
|
|
143
|
+
"getZapPreimage",
|
|
144
|
+
"getZapRecipient",
|
|
145
|
+
"getZapRequest",
|
|
146
|
+
"getZapSender",
|
|
147
|
+
"getZapSplits",
|
|
148
|
+
"hasHiddenContent",
|
|
149
|
+
"hasHiddenTags",
|
|
150
|
+
"interpretThreadTags",
|
|
151
|
+
"isATag",
|
|
152
|
+
"isAddressPointer",
|
|
153
|
+
"isAddressPointerInList",
|
|
154
|
+
"isAudioURL",
|
|
155
|
+
"isCommentAddressPointer",
|
|
156
|
+
"isCommentEventPointer",
|
|
157
|
+
"isDTag",
|
|
158
|
+
"isETag",
|
|
159
|
+
"isEvent",
|
|
160
|
+
"isEventPointer",
|
|
161
|
+
"isEventPointerInList",
|
|
162
|
+
"isFilterEqual",
|
|
163
|
+
"isFromCache",
|
|
164
|
+
"isGiftWrapLocked",
|
|
165
|
+
"isHex",
|
|
166
|
+
"isHexKey",
|
|
167
|
+
"isHiddenContentLocked",
|
|
168
|
+
"isHiddenTagsLocked",
|
|
169
|
+
"isImageURL",
|
|
170
|
+
"isNameValueTag",
|
|
171
|
+
"isNip05",
|
|
172
|
+
"isPTag",
|
|
173
|
+
"isProfilePointerInList",
|
|
174
|
+
"isRTag",
|
|
175
|
+
"isReplaceable",
|
|
176
|
+
"isSafeRelayURL",
|
|
177
|
+
"isSameURL",
|
|
178
|
+
"isSha256",
|
|
179
|
+
"isStreamURL",
|
|
180
|
+
"isTTag",
|
|
181
|
+
"isValidList",
|
|
182
|
+
"isValidProfile",
|
|
183
|
+
"isValidZap",
|
|
184
|
+
"isVideoURL",
|
|
185
|
+
"lockHiddenContent",
|
|
186
|
+
"lockHiddenTags",
|
|
187
|
+
"markFromCache",
|
|
188
|
+
"matchFilter",
|
|
189
|
+
"matchFilters",
|
|
190
|
+
"matchMutes",
|
|
191
|
+
"mergeBlossomServers",
|
|
192
|
+
"mergeBookmarks",
|
|
193
|
+
"mergeContacts",
|
|
194
|
+
"mergeFilters",
|
|
195
|
+
"mergeMutes",
|
|
196
|
+
"mergeRelaySets",
|
|
197
|
+
"normalizeURL",
|
|
198
|
+
"parseBolt11",
|
|
199
|
+
"parseBookmarkTags",
|
|
200
|
+
"parseCoordinate",
|
|
201
|
+
"parseExternalPointer",
|
|
202
|
+
"parseFileMetadataTags",
|
|
203
|
+
"parseLNURLOrAddress",
|
|
204
|
+
"parseLightningAddress",
|
|
205
|
+
"parseMutedTags",
|
|
206
|
+
"parseNIP05Address",
|
|
207
|
+
"parseSharedEvent",
|
|
208
|
+
"processTags",
|
|
209
|
+
"safeParse",
|
|
210
|
+
"setCachedValue",
|
|
211
|
+
"setEventContentEncryptionMethod",
|
|
212
|
+
"stripInvisibleChar",
|
|
213
|
+
"unixNow",
|
|
214
|
+
"unlockGiftWrap",
|
|
215
|
+
"unlockHiddenContent",
|
|
216
|
+
"unlockHiddenTags",
|
|
217
|
+
]
|
|
218
|
+
`);
|
|
219
|
+
});
|
|
220
|
+
});
|
|
@@ -7,3 +7,5 @@ export declare function isSha256(str: string): boolean;
|
|
|
7
7
|
export declare function getBlossomServersFromList(event: {
|
|
8
8
|
tags: string[][];
|
|
9
9
|
} | string[][]): URL[];
|
|
10
|
+
/** A method that merges multiple arrays of blossom servers into a single array of unique servers */
|
|
11
|
+
export declare function mergeBlossomServers<T extends URL | string | (string | URL)>(...servers: (T | null | undefined | T[])[]): T[];
|
package/dist/helpers/blossom.js
CHANGED
|
@@ -20,3 +20,21 @@ export function getBlossomServersFromList(event) {
|
|
|
20
20
|
return undefined;
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
+
/** A method that merges multiple arrays of blossom servers into a single array of unique servers */
|
|
24
|
+
export function mergeBlossomServers(...servers) {
|
|
25
|
+
let merged = [];
|
|
26
|
+
const seen = new Set();
|
|
27
|
+
for (const arg of servers) {
|
|
28
|
+
let arr = Array.isArray(arg) ? arg : [arg];
|
|
29
|
+
for (const s of arr) {
|
|
30
|
+
if (s === null || s === undefined)
|
|
31
|
+
continue;
|
|
32
|
+
const key = new URL("/", s).toString();
|
|
33
|
+
if (seen.has(key))
|
|
34
|
+
continue;
|
|
35
|
+
seen.add(key);
|
|
36
|
+
merged.push(s);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return merged;
|
|
40
|
+
}
|
package/dist/helpers/profile.js
CHANGED
|
@@ -31,5 +31,5 @@ export function isValidProfile(profile) {
|
|
|
31
31
|
}
|
|
32
32
|
/** Gets the display name from a profile with fallbacks */
|
|
33
33
|
export function getDisplayName(metadata) {
|
|
34
|
-
return metadata?.display_name || metadata?.displayName || metadata?.name;
|
|
34
|
+
return metadata?.display_name?.trim() || metadata?.displayName?.trim() || metadata?.name?.trim();
|
|
35
35
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import * as exports from "../index.js";
|
|
3
|
+
describe("exports", () => {
|
|
4
|
+
it("should export the expected functions", () => {
|
|
5
|
+
expect(Object.keys(exports).sort()).toMatchInlineSnapshot(`
|
|
6
|
+
[
|
|
7
|
+
"TimeoutError",
|
|
8
|
+
"defined",
|
|
9
|
+
"firstValueFrom",
|
|
10
|
+
"getObservableValue",
|
|
11
|
+
"lastValueFrom",
|
|
12
|
+
"listenLatestUpdates",
|
|
13
|
+
"simpleTimeout",
|
|
14
|
+
"withImmediateValueOrDefault",
|
|
15
|
+
]
|
|
16
|
+
`);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { firstValueFrom, lastValueFrom } from "rxjs";
|
|
1
2
|
export * from "./defined.js";
|
|
2
3
|
export * from "./get-observable-value.js";
|
|
3
4
|
export * from "./listen-latest-updates.js";
|
|
4
5
|
export * from "./simple-timeout.js";
|
|
5
6
|
export * from "./with-immediate-value.js";
|
|
7
|
+
export { firstValueFrom, lastValueFrom };
|
package/dist/observable/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { firstValueFrom, lastValueFrom } from "rxjs";
|
|
1
2
|
export * from "./defined.js";
|
|
2
3
|
export * from "./get-observable-value.js";
|
|
3
4
|
export * from "./listen-latest-updates.js";
|
|
4
5
|
export * from "./simple-timeout.js";
|
|
5
6
|
export * from "./with-immediate-value.js";
|
|
7
|
+
// Re-export some useful rxjs functions
|
|
8
|
+
export { firstValueFrom, lastValueFrom };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import * as exports from "../index.js";
|
|
3
|
+
describe("exports", () => {
|
|
4
|
+
it("should export the expected functions", () => {
|
|
5
|
+
expect(Object.keys(exports).sort()).toMatchInlineSnapshot(`
|
|
6
|
+
[
|
|
7
|
+
"createDefer",
|
|
8
|
+
]
|
|
9
|
+
`);
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import * as exports from "../index.js";
|
|
3
|
+
describe("exports", () => {
|
|
4
|
+
it("should export the expected functions", () => {
|
|
5
|
+
expect(Object.keys(exports).sort()).toMatchInlineSnapshot(`
|
|
6
|
+
[
|
|
7
|
+
"BlockedRelays",
|
|
8
|
+
"ChannelHiddenQuery",
|
|
9
|
+
"ChannelMessagesQuery",
|
|
10
|
+
"ChannelMetadataQuery",
|
|
11
|
+
"ChannelMutedQuery",
|
|
12
|
+
"CommentsQuery",
|
|
13
|
+
"ContactsQuery",
|
|
14
|
+
"EventZapsQuery",
|
|
15
|
+
"FavoriteRelaySets",
|
|
16
|
+
"FavoriteRelays",
|
|
17
|
+
"HiddenContactsQuery",
|
|
18
|
+
"HiddenMuteQuery",
|
|
19
|
+
"MailboxesQuery",
|
|
20
|
+
"MultipleEventsQuery",
|
|
21
|
+
"MuteQuery",
|
|
22
|
+
"ProfileQuery",
|
|
23
|
+
"PublicContactsQuery",
|
|
24
|
+
"PublicMuteQuery",
|
|
25
|
+
"ReactionsQuery",
|
|
26
|
+
"ReplaceableQuery",
|
|
27
|
+
"ReplaceableSetQuery",
|
|
28
|
+
"RepliesQuery",
|
|
29
|
+
"SearchRelays",
|
|
30
|
+
"SingleEventQuery",
|
|
31
|
+
"ThreadQuery",
|
|
32
|
+
"TimelineQuery",
|
|
33
|
+
"UserBlossomServersQuery",
|
|
34
|
+
"UserBookmarkQuery",
|
|
35
|
+
"UserHiddenBookmarkQuery",
|
|
36
|
+
"UserPinnedQuery",
|
|
37
|
+
"UserPublicBookmarkQuery",
|
|
38
|
+
]
|
|
39
|
+
`);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import * as exports from "../index.js";
|
|
3
|
+
describe("exports", () => {
|
|
4
|
+
it("should export the expected functions", () => {
|
|
5
|
+
expect(Object.keys(exports).sort()).toMatchInlineSnapshot(`
|
|
6
|
+
[
|
|
7
|
+
"Queries",
|
|
8
|
+
"QueryStore",
|
|
9
|
+
]
|
|
10
|
+
`);
|
|
11
|
+
});
|
|
12
|
+
});
|