@candypoets/nipworker 0.93.0 → 0.95.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/NarrowTypes.js +139 -119
- package/dist/cache/index.js +55 -55
- package/dist/cache/pkg/cache.d.ts +1 -1
- package/dist/cache/pkg/cache_bg.wasm.d.ts +1 -1
- package/dist/connections/index.js +16 -16
- package/dist/connections/pkg/connections.d.ts +2 -2
- package/dist/connections/pkg/connections_bg.wasm.d.ts +2 -2
- package/dist/connections/proxy.js +1 -1
- package/dist/connections/proxy.js.map +4 -4
- package/dist/crypto/index.js +40 -40
- package/dist/generated/nostr/fb/content-block.d.ts +3 -2
- package/dist/generated/nostr/fb/content-block.d.ts.map +1 -1
- package/dist/generated/nostr/fb/content-data.d.ts +5 -3
- package/dist/generated/nostr/fb/content-data.d.ts.map +1 -1
- package/dist/generated/nostr/fb/emoji-data.d.ts +30 -0
- package/dist/generated/nostr/fb/emoji-data.d.ts.map +1 -0
- package/dist/generated/nostr/fb/kind1018-parsed.d.ts +37 -0
- package/dist/generated/nostr/fb/kind1018-parsed.d.ts.map +1 -0
- package/dist/generated/nostr/fb/kind1068-parsed.d.ts +58 -0
- package/dist/generated/nostr/fb/kind1068-parsed.d.ts.map +1 -0
- package/dist/generated/nostr/fb/kind20-parsed.d.ts.map +1 -1
- package/dist/generated/nostr/fb/parsed-data-union.d.ts +2 -0
- package/dist/generated/nostr/fb/parsed-data-union.d.ts.map +1 -1
- package/dist/generated/nostr/fb/parsed-data.d.ts +17 -13
- package/dist/generated/nostr/fb/parsed-data.d.ts.map +1 -1
- package/dist/generated/nostr/fb/parsed-event.d.ts +4 -2
- package/dist/generated/nostr/fb/parsed-event.d.ts.map +1 -1
- package/dist/generated/nostr/fb/poll-option.d.ts +26 -0
- package/dist/generated/nostr/fb/poll-option.d.ts.map +1 -0
- package/dist/generated/nostr/fb/poll-type.d.ts +5 -0
- package/dist/generated/nostr/fb/poll-type.d.ts.map +1 -0
- package/dist/generated/nostr/fb.d.ts +5 -0
- package/dist/generated/nostr/fb.d.ts.map +1 -1
- package/dist/index.js +159 -150
- package/dist/index2.js +31 -31
- package/dist/lib/ConnectionTracker.d.ts +2 -0
- package/dist/lib/ConnectionTracker.d.ts.map +1 -1
- package/dist/lib/NarrowTypes.d.ts +6 -1
- package/dist/lib/NarrowTypes.d.ts.map +1 -1
- package/dist/parser/index.js +306 -306
- package/dist/relayProxyServer.js +298 -352
- package/dist/utils.js +91 -82
- package/dist/worker-message.js +1151 -763
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "flatbuffers";
|
|
2
|
-
import { C as i, B as n, D as r, E as t, F as d, G as o, H as
|
|
3
|
-
import { B as Fa,
|
|
2
|
+
import { C as i, B as n, D as r, E as t, F as d, G as o, H as P, I as T, J as g, K as p, L as b, M as K, O as f, P as C, Q as u, R as c, S as l, T as v, N as S, U as D, V as m, W as M, X as E, Y as R, Z as h, $ as k, _ as L, a0 as y, a1 as V, a2 as I, a3 as N, a4 as F, a5 as q, a6 as W, a7 as x, a8 as G, a9 as H, aa as j, ab as w, ac as A, ad as B, ae as z, af as O, ag as U, ah as Q, ai as Z, aj as J, ak as X, al as Y, am as _, ao as $, an as aa, ap as sa, aq as ea, ar as ia, as as na, at as ra, au as ta, c as da, l as oa, z as Pa, k as Ta, e as ga, f as pa, b as ba, d as Ka, g as fa, i as Ca, x as ua, o as ca, t as la, m as va, h as Sa, u as Da, v as ma, n as Ma, q as Ea, p as Ra, w as ha, j as ka, r as La, a as ya, s as Va, y as Ia } from "./index2.js";
|
|
3
|
+
import { B as Fa, a4 as qa, x as Wa, Z as xa, w as Ga, Y as Ha, C as ja, a5 as wa, a6 as Aa, a7 as Ba, a8 as za, O as Oa, v as Ua, a9 as Qa, aa as Za, a as Ja, ab as Xa, ac as Ya, ad as _a, ae as $a, F as as, ag as ss, af as es, E as is, ah as ns, ai as rs, aj as ts, ak as ds, al as os, H as Ps, _ as Ts, am as gs, an as ps, I as bs, T as Ks, ao as fs, ap as Cs, K as us, aq as cs, m as ls, ar as vs, n as Ss, as as Ds, at as ms, au as Ms, av as Es, aw as Rs, k as hs, ax as ks, l as Ls, ay as ys, o as Vs, az as Is, h as Ns, aA as Fs, c as qs, aB as Ws, i as xs, aC as Gs, j as Hs, aD as js, G as ws, aE as As, d as Bs, aF as zs, e as Os, aG as Us, f as Qs, aH as Zs, p as Js, aI as Xs, q as Ys, aJ as _s, r as $s, aK as ae, g as se, aL as ee, s as ie, aM as ne, t as re, aN as te, D as de, $ as oe, L as Pe, aO as Te, aP as ge, aQ as pe, aR as be, aS as Ke, aT as fe, aU as Ce, z as ue, X as ce, aV as le, Q as ve, J as Se, M as De, aW as me, aX as Me, aY as Ee, aZ as Re, A as he, a0 as ke, N as Le, a_ as ye, a$ as Ve, b0 as Ie, b as Ne, P as Fe, b1 as qe, b2 as We, b3 as xe, b4 as Ge, u as He, b5 as je, b6 as we, b7 as Ae, b8 as Be, b9 as ze, ba as Oe, bb as Ue, bc as Qe, bd as Ze, be as Je, bf as Xe, R as Ye, bg as _e, bh as $e, bi as ai, bj as si, a1 as ei, a2 as ii, bk as ni, bl as ri, S as ti, a3 as di, bm as oi, bn as Pi, V as Ti, bo as gi, y as pi, U as bi, bp as Ki, bq as fi, br as Ci, bs as ui, bt as ci, W as li, bu as vi, bv as Si, bw as Di } from "./worker-message.js";
|
|
4
4
|
export {
|
|
5
5
|
Fa as BufferFull,
|
|
6
6
|
qa as BufferFullT,
|
|
@@ -10,7 +10,7 @@ export {
|
|
|
10
10
|
t as CacheRequest,
|
|
11
11
|
d as CacheRequestT,
|
|
12
12
|
o as CacheResponse,
|
|
13
|
-
|
|
13
|
+
P as CacheResponseT,
|
|
14
14
|
Wa as CashuData,
|
|
15
15
|
xa as CashuDataT,
|
|
16
16
|
Ga as CodeData,
|
|
@@ -20,146 +20,155 @@ export {
|
|
|
20
20
|
Aa as Contact,
|
|
21
21
|
Ba as ContactT,
|
|
22
22
|
za as ContentBlock,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
Oa as ContentBlockT,
|
|
24
|
+
Ua as ContentData,
|
|
25
|
+
Qa as Coordinate,
|
|
26
|
+
Za as CoordinateT,
|
|
27
27
|
Ja as CountResponse,
|
|
28
28
|
Xa as CountResponseT,
|
|
29
|
-
|
|
29
|
+
T as CounterPipeConfig,
|
|
30
30
|
g as CounterPipeConfigT,
|
|
31
31
|
Ya as DLEQProof,
|
|
32
32
|
_a as DLEQProofT,
|
|
33
33
|
$a as Emoji,
|
|
34
|
-
as as
|
|
35
|
-
ss as
|
|
36
|
-
es as
|
|
37
|
-
is as
|
|
38
|
-
ns as
|
|
34
|
+
as as EmojiData,
|
|
35
|
+
ss as EmojiDataT,
|
|
36
|
+
es as EmojiT,
|
|
37
|
+
is as Eoce,
|
|
38
|
+
ns as EoceT,
|
|
39
|
+
rs as EventPointer,
|
|
40
|
+
ts as EventPointerT,
|
|
39
41
|
p as GetPublicKey,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
b as GetPublicKeyT,
|
|
43
|
+
ds as HTLCWitness,
|
|
44
|
+
os as HTLCWitnessT,
|
|
45
|
+
Ps as HashtagData,
|
|
46
|
+
Ts as HashtagDataT,
|
|
47
|
+
gs as HistoryTag,
|
|
48
|
+
ps as HistoryTagT,
|
|
49
|
+
bs as ImageData,
|
|
50
|
+
Ks as ImageDataT,
|
|
49
51
|
fs as ImetaTag,
|
|
50
52
|
Cs as ImetaTagT,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
53
|
+
us as Kind0Parsed,
|
|
54
|
+
cs as Kind0ParsedT,
|
|
55
|
+
ls as Kind10002Parsed,
|
|
56
|
+
vs as Kind10002ParsedT,
|
|
57
|
+
Ss as Kind10019Parsed,
|
|
58
|
+
Ds as Kind10019ParsedT,
|
|
59
|
+
ms as Kind1018Parsed,
|
|
60
|
+
Ms as Kind1018ParsedT,
|
|
61
|
+
Es as Kind1068Parsed,
|
|
62
|
+
Rs as Kind1068ParsedT,
|
|
63
|
+
hs as Kind1111Parsed,
|
|
64
|
+
ks as Kind1111ParsedT,
|
|
65
|
+
Ls as Kind1311Parsed,
|
|
66
|
+
ys as Kind1311ParsedT,
|
|
67
|
+
Vs as Kind17375Parsed,
|
|
68
|
+
Is as Kind17375ParsedT,
|
|
69
|
+
Ns as Kind17Parsed,
|
|
70
|
+
Fs as Kind17ParsedT,
|
|
71
|
+
qs as Kind1Parsed,
|
|
72
|
+
Ws as Kind1ParsedT,
|
|
73
|
+
xs as Kind20Parsed,
|
|
74
|
+
Gs as Kind20ParsedT,
|
|
75
|
+
Hs as Kind22Parsed,
|
|
76
|
+
js as Kind22ParsedT,
|
|
77
|
+
ws as Kind30023Parsed,
|
|
78
|
+
As as Kind30023ParsedT,
|
|
79
|
+
Bs as Kind3Parsed,
|
|
80
|
+
zs as Kind3ParsedT,
|
|
81
|
+
Os as Kind4Parsed,
|
|
82
|
+
Us as Kind4ParsedT,
|
|
83
|
+
Qs as Kind6Parsed,
|
|
84
|
+
Zs as Kind6ParsedT,
|
|
85
|
+
Js as Kind7374Parsed,
|
|
86
|
+
Xs as Kind7374ParsedT,
|
|
87
|
+
Ys as Kind7375Parsed,
|
|
88
|
+
_s as Kind7375ParsedT,
|
|
89
|
+
$s as Kind7376Parsed,
|
|
90
|
+
ae as Kind7376ParsedT,
|
|
91
|
+
se as Kind7Parsed,
|
|
92
|
+
ee as Kind7ParsedT,
|
|
93
|
+
ie as Kind9321Parsed,
|
|
94
|
+
ne as Kind9321ParsedT,
|
|
95
|
+
re as Kind9735Parsed,
|
|
96
|
+
te as Kind9735ParsedT,
|
|
97
|
+
K as KindFilterPipeConfig,
|
|
98
|
+
f as KindFilterPipeConfigT,
|
|
99
|
+
de as LinkPreviewData,
|
|
100
|
+
oe as LinkPreviewDataT,
|
|
101
|
+
Pe as ListParsed,
|
|
102
|
+
Te as ListParsedT,
|
|
103
|
+
ge as LiveActivityRef,
|
|
104
|
+
pe as LiveActivityRefT,
|
|
105
|
+
be as LiveChatParticipant,
|
|
106
|
+
Ke as LiveChatParticipantT,
|
|
107
|
+
fe as LiveChatThreadRef,
|
|
108
|
+
Ce as LiveChatThreadRefT,
|
|
109
|
+
C as MainContent,
|
|
104
110
|
u as MainMessage,
|
|
105
111
|
c as MainMessageT,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
ue as MediaGroupData,
|
|
113
|
+
ce as MediaGroupDataT,
|
|
114
|
+
le as MediaItem,
|
|
115
|
+
ve as MediaItemT,
|
|
116
|
+
Se as Message,
|
|
117
|
+
De as MessageType,
|
|
118
|
+
me as MintInfo,
|
|
119
|
+
Me as MintInfoT,
|
|
120
|
+
Ee as MintProofs,
|
|
121
|
+
Re as MintProofsT,
|
|
116
122
|
l as MuteFilterPipeConfig,
|
|
117
123
|
v as MuteFilterPipeConfigT,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
124
|
+
he as NostrData,
|
|
125
|
+
ke as NostrDataT,
|
|
126
|
+
Le as NostrEvent,
|
|
127
|
+
ye as NostrEventT,
|
|
122
128
|
S as NostrManager,
|
|
123
129
|
D as NpubLimiterPipeConfig,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
m as NpubLimiterPipeConfigT,
|
|
131
|
+
Ve as P2PKWitness,
|
|
132
|
+
Ie as P2PKWitnessT,
|
|
133
|
+
M as ParsePipeConfig,
|
|
134
|
+
E as ParsePipeConfigT,
|
|
135
|
+
Ne as ParsedData,
|
|
136
|
+
R as ParsedDataUnion,
|
|
137
|
+
Fe as ParsedEvent,
|
|
138
|
+
qe as ParsedEventT,
|
|
133
139
|
h as Pipe,
|
|
134
140
|
k as PipeConfig,
|
|
135
141
|
L as PipeT,
|
|
136
142
|
y as PipelineConfig,
|
|
137
143
|
V as PipelineConfigT,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
+
We as PollOption,
|
|
145
|
+
xe as PollOptionT,
|
|
146
|
+
Ge as PollType,
|
|
147
|
+
He as PreGenericParsed,
|
|
148
|
+
je as PreGenericParsedT,
|
|
149
|
+
we as PreParticipant,
|
|
150
|
+
Ae as PreParticipantT,
|
|
151
|
+
Be as PreRefEvent,
|
|
152
|
+
ze as PreRefEventT,
|
|
144
153
|
I as PrivateKey,
|
|
145
154
|
N as PrivateKeyT,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
155
|
+
Oe as ProfilePointer,
|
|
156
|
+
Ue as ProfilePointerT,
|
|
157
|
+
Qe as Proof,
|
|
158
|
+
Ze as ProofT,
|
|
150
159
|
F as ProofVerificationPipeConfig,
|
|
151
160
|
q as ProofVerificationPipeConfigT,
|
|
152
|
-
|
|
153
|
-
|
|
161
|
+
Je as Pubkey,
|
|
162
|
+
Xe as PubkeyT,
|
|
154
163
|
W as Publish,
|
|
155
164
|
x as PublishT,
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
165
|
+
Ye as Raw,
|
|
166
|
+
_e as RawT,
|
|
167
|
+
$e as ReactionType,
|
|
168
|
+
ai as RelayInfo,
|
|
169
|
+
si as RelayInfoT,
|
|
170
|
+
ei as Request,
|
|
171
|
+
ii as RequestT,
|
|
163
172
|
G as SaveToDbPipeConfig,
|
|
164
173
|
H as SaveToDbPipeConfigT,
|
|
165
174
|
j as SerializeEventsPipeConfig,
|
|
@@ -167,61 +176,61 @@ export {
|
|
|
167
176
|
A as SetSigner,
|
|
168
177
|
B as SetSignerT,
|
|
169
178
|
z as SignEvent,
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
179
|
+
O as SignEventT,
|
|
180
|
+
ni as SignedEvent,
|
|
181
|
+
ri as SignedEventT,
|
|
182
|
+
U as SignerOp,
|
|
183
|
+
Q as SignerRequest,
|
|
184
|
+
Z as SignerRequestT,
|
|
176
185
|
J as SignerResponse,
|
|
177
186
|
X as SignerResponseT,
|
|
178
187
|
Y as SignerType,
|
|
179
|
-
|
|
180
|
-
|
|
188
|
+
ti as StringVec,
|
|
189
|
+
di as StringVecT,
|
|
181
190
|
_ as Subscribe,
|
|
182
191
|
$ as SubscribeKind,
|
|
183
192
|
aa as SubscribeT,
|
|
184
193
|
sa as SubscriptionConfig,
|
|
185
194
|
ea as SubscriptionConfigT,
|
|
186
|
-
|
|
187
|
-
|
|
195
|
+
oi as Tag,
|
|
196
|
+
Pi as TagT,
|
|
188
197
|
ia as Template,
|
|
189
198
|
na as TemplateT,
|
|
190
199
|
ra as Unsubscribe,
|
|
191
200
|
ta as UnsubscribeT,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
201
|
+
Ti as ValidProofs,
|
|
202
|
+
gi as ValidProofsT,
|
|
203
|
+
pi as VideoData,
|
|
204
|
+
bi as VideoDataT,
|
|
205
|
+
Ki as VideoVariant,
|
|
206
|
+
fi as VideoVariantT,
|
|
207
|
+
Ci as Witness,
|
|
208
|
+
ui as WitnessString,
|
|
209
|
+
ci as WitnessStringT,
|
|
210
|
+
li as WorkerMessage,
|
|
211
|
+
vi as WorkerMessageT,
|
|
212
|
+
Si as ZapRequest,
|
|
213
|
+
Di as ZapRequestT,
|
|
205
214
|
da as createNostrManager,
|
|
206
215
|
oa as ensureD,
|
|
207
|
-
|
|
208
|
-
|
|
216
|
+
Pa as ensureDTagForPre,
|
|
217
|
+
Ta as extractDFromTags,
|
|
209
218
|
ga as extractTag,
|
|
210
219
|
pa as extractTagMap,
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
220
|
+
ba as extractTagValue,
|
|
221
|
+
Ka as extractTagValues,
|
|
222
|
+
fa as getManager,
|
|
223
|
+
Ca as isHex64,
|
|
215
224
|
ua as isPreKind,
|
|
216
225
|
ca as makeAPointer,
|
|
217
226
|
la as makeAPointerForEvent,
|
|
218
227
|
va as makeNaddr,
|
|
219
228
|
Sa as makeNaddrForEvent,
|
|
220
229
|
Da as makeNaddrLike,
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
230
|
+
ma as makeNaddrLikeForEvent,
|
|
231
|
+
Ma as normalizeSlug,
|
|
232
|
+
Ea as parseAPointer,
|
|
233
|
+
Ra as parseNaddr,
|
|
225
234
|
ha as parseNaddrLike,
|
|
226
235
|
ka as randomId,
|
|
227
236
|
La as readStringVec,
|
package/dist/index2.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as c from "flatbuffers";
|
|
2
2
|
import { ByteBuffer as St } from "flatbuffers";
|
|
3
|
-
import {
|
|
3
|
+
import { a1 as ut, N as mt, P as vt, W as dt, S as Et, a2 as Tt, a3 as nt } from "./worker-message.js";
|
|
4
4
|
import { nip19 as ft } from "nostr-tools";
|
|
5
5
|
class y {
|
|
6
6
|
constructor() {
|
|
@@ -1642,7 +1642,7 @@ class V {
|
|
|
1642
1642
|
return V.startMainMessage(t), V.addContentType(t, s), V.addContent(t, i), V.endMainMessage(t);
|
|
1643
1643
|
}
|
|
1644
1644
|
unpack() {
|
|
1645
|
-
return new
|
|
1645
|
+
return new U(
|
|
1646
1646
|
this.contentType(),
|
|
1647
1647
|
(() => {
|
|
1648
1648
|
const t = ct(this.contentType(), this.content.bind(this));
|
|
@@ -1657,7 +1657,7 @@ class V {
|
|
|
1657
1657
|
})();
|
|
1658
1658
|
}
|
|
1659
1659
|
}
|
|
1660
|
-
class
|
|
1660
|
+
class U {
|
|
1661
1661
|
constructor(t = C.NONE, s = null) {
|
|
1662
1662
|
this.contentType = t, this.content = s;
|
|
1663
1663
|
}
|
|
@@ -1670,7 +1670,7 @@ class Z {
|
|
|
1670
1670
|
);
|
|
1671
1671
|
}
|
|
1672
1672
|
}
|
|
1673
|
-
var Gt = /* @__PURE__ */ ((e) => (e[e.Kind0Parsed = 0] = "Kind0Parsed", e[e.Kind1Parsed = 1] = "Kind1Parsed", e[e.Kind3Parsed = 3] = "Kind3Parsed", e[e.Kind4Parsed = 4] = "Kind4Parsed", e[e.Kind6Parsed = 6] = "Kind6Parsed", e[e.Kind7Parsed = 7] = "Kind7Parsed", e[e.Kind17Parsed = 17] = "Kind17Parsed", e[e.Kind20Parsed = 20] = "Kind20Parsed", e[e.Kind22Parsed = 22] = "Kind22Parsed", e[e.Kind1111Parsed = 1111] = "Kind1111Parsed", e[e.Kind1311Parsed = 1311] = "Kind1311Parsed", e[e.Kind7374Parsed = 7374] = "Kind7374Parsed", e[e.Kind7375Parsed = 7375] = "Kind7375Parsed", e[e.Kind7376Parsed = 7376] = "Kind7376Parsed", e[e.Kind9321Parsed = 9321] = "Kind9321Parsed", e[e.Kind9735Parsed = 9735] = "Kind9735Parsed", e[e.Kind10002Parsed = 10002] = "Kind10002Parsed", e[e.Kind10019Parsed = 10019] = "Kind10019Parsed", e[e.Kind17375Parsed = 17375] = "Kind17375Parsed", e[e.Kind30023Parsed = 30023] = "Kind30023Parsed", e[e.Kind39089Parsed = 39089] = "Kind39089Parsed", e[e.ListParsed = 51e3] = "ListParsed", e[e.PreGenericParsed = 52e3] = "PreGenericParsed", e))(Gt || {}), tt = /* @__PURE__ */ ((e) => (e[e.GetPubkey = 0] = "GetPubkey", e[e.SignEvent = 1] = "SignEvent", e[e.Nip04Encrypt = 2] = "Nip04Encrypt", e[e.Nip04Decrypt = 3] = "Nip04Decrypt", e[e.Nip44Encrypt = 4] = "Nip44Encrypt", e[e.Nip44Decrypt = 5] = "Nip44Decrypt", e[e.Nip04DecryptBetween = 6] = "Nip04DecryptBetween", e[e.Nip44DecryptBetween = 7] = "Nip44DecryptBetween", e[e.VerifyProof = 8] = "VerifyProof", e[e.AuthEvent = 9] = "AuthEvent", e))(tt || {});
|
|
1673
|
+
var Gt = /* @__PURE__ */ ((e) => (e[e.Kind0Parsed = 0] = "Kind0Parsed", e[e.Kind1Parsed = 1] = "Kind1Parsed", e[e.Kind3Parsed = 3] = "Kind3Parsed", e[e.Kind4Parsed = 4] = "Kind4Parsed", e[e.Kind6Parsed = 6] = "Kind6Parsed", e[e.Kind7Parsed = 7] = "Kind7Parsed", e[e.Kind17Parsed = 17] = "Kind17Parsed", e[e.Kind20Parsed = 20] = "Kind20Parsed", e[e.Kind22Parsed = 22] = "Kind22Parsed", e[e.Kind1018Parsed = 1018] = "Kind1018Parsed", e[e.Kind1068Parsed = 1068] = "Kind1068Parsed", e[e.Kind1111Parsed = 1111] = "Kind1111Parsed", e[e.Kind1311Parsed = 1311] = "Kind1311Parsed", e[e.Kind7374Parsed = 7374] = "Kind7374Parsed", e[e.Kind7375Parsed = 7375] = "Kind7375Parsed", e[e.Kind7376Parsed = 7376] = "Kind7376Parsed", e[e.Kind9321Parsed = 9321] = "Kind9321Parsed", e[e.Kind9735Parsed = 9735] = "Kind9735Parsed", e[e.Kind10002Parsed = 10002] = "Kind10002Parsed", e[e.Kind10019Parsed = 10019] = "Kind10019Parsed", e[e.Kind17375Parsed = 17375] = "Kind17375Parsed", e[e.Kind30023Parsed = 30023] = "Kind30023Parsed", e[e.Kind39089Parsed = 39089] = "Kind39089Parsed", e[e.ListParsed = 51e3] = "ListParsed", e[e.PreGenericParsed = 52e3] = "PreGenericParsed", e))(Gt || {}), tt = /* @__PURE__ */ ((e) => (e[e.GetPubkey = 0] = "GetPubkey", e[e.SignEvent = 1] = "SignEvent", e[e.Nip04Encrypt = 2] = "Nip04Encrypt", e[e.Nip04Decrypt = 3] = "Nip04Decrypt", e[e.Nip44Encrypt = 4] = "Nip44Encrypt", e[e.Nip44Decrypt = 5] = "Nip44Decrypt", e[e.Nip04DecryptBetween = 6] = "Nip04DecryptBetween", e[e.Nip44DecryptBetween = 7] = "Nip44DecryptBetween", e[e.VerifyProof = 8] = "VerifyProof", e[e.AuthEvent = 9] = "AuthEvent", e))(tt || {});
|
|
1674
1674
|
class P {
|
|
1675
1675
|
constructor() {
|
|
1676
1676
|
this.bb = null, this.bb_pos = 0;
|
|
@@ -1835,7 +1835,7 @@ class $t {
|
|
|
1835
1835
|
}
|
|
1836
1836
|
}
|
|
1837
1837
|
var Ht = /* @__PURE__ */ ((e) => (e[e.CachedEvent = 0] = "CachedEvent", e[e.FetchedEvent = 1] = "FetchedEvent", e[e.Count = 2] = "Count", e[e.ConnectionStatus = 3] = "ConnectionStatus", e[e.Eoce = 4] = "Eoce", e[e.BufferFull = 5] = "BufferFull", e))(Ht || {});
|
|
1838
|
-
class
|
|
1838
|
+
class Z {
|
|
1839
1839
|
/**
|
|
1840
1840
|
* Initialize a buffer for writing - sets the write position header to 4
|
|
1841
1841
|
* @param buffer The ArrayBuffer to initialize
|
|
@@ -1948,10 +1948,10 @@ class X {
|
|
|
1948
1948
|
return 4 + n + r;
|
|
1949
1949
|
}
|
|
1950
1950
|
}
|
|
1951
|
-
const
|
|
1951
|
+
const Xt = new TextDecoder();
|
|
1952
1952
|
function ht(e) {
|
|
1953
1953
|
if (typeof e == "string") return e;
|
|
1954
|
-
if (e instanceof Uint8Array) return
|
|
1954
|
+
if (e instanceof Uint8Array) return Xt.decode(e);
|
|
1955
1955
|
}
|
|
1956
1956
|
function H(e) {
|
|
1957
1957
|
if (Array.isArray(e))
|
|
@@ -1969,14 +1969,14 @@ function H(e) {
|
|
|
1969
1969
|
return s ? [s] : [];
|
|
1970
1970
|
}) : [];
|
|
1971
1971
|
}
|
|
1972
|
-
function
|
|
1972
|
+
function X(e, t, s) {
|
|
1973
1973
|
return e[0] !== t ? false : (s == null ? void 0 : s.where) ? s.where(e) : true;
|
|
1974
1974
|
}
|
|
1975
|
-
function
|
|
1975
|
+
function Zt(e, t, s) {
|
|
1976
1976
|
if (Array.isArray(e)) {
|
|
1977
1977
|
for (const i of e) {
|
|
1978
1978
|
const n = H(i);
|
|
1979
|
-
if (
|
|
1979
|
+
if (X(n, t, s))
|
|
1980
1980
|
return n;
|
|
1981
1981
|
}
|
|
1982
1982
|
return;
|
|
@@ -1985,21 +1985,21 @@ function Xt(e, t, s) {
|
|
|
1985
1985
|
const n = e.tags(i);
|
|
1986
1986
|
if (!n) continue;
|
|
1987
1987
|
const r = H(n);
|
|
1988
|
-
if (
|
|
1988
|
+
if (X(r, t, s))
|
|
1989
1989
|
return r;
|
|
1990
1990
|
}
|
|
1991
1991
|
}
|
|
1992
1992
|
function os(e, t, s = 1, i) {
|
|
1993
1993
|
var _a;
|
|
1994
1994
|
const n = typeof s == "number" ? s : 1;
|
|
1995
|
-
return (_a =
|
|
1995
|
+
return (_a = Zt(e, t, typeof s == "number" ? i : s)) == null ? void 0 : _a[n];
|
|
1996
1996
|
}
|
|
1997
1997
|
function as(e, t, s = 1, i) {
|
|
1998
1998
|
const n = typeof s == "number" ? s : 1, r = typeof s == "number" ? i : s, o = [];
|
|
1999
1999
|
if (Array.isArray(e)) {
|
|
2000
2000
|
for (const a of e) {
|
|
2001
2001
|
const h = H(a);
|
|
2002
|
-
|
|
2002
|
+
X(h, t, r) && h[n] !== void 0 && o.push(h[n]);
|
|
2003
2003
|
}
|
|
2004
2004
|
return o;
|
|
2005
2005
|
}
|
|
@@ -2007,7 +2007,7 @@ function as(e, t, s = 1, i) {
|
|
|
2007
2007
|
const h = e.tags(a);
|
|
2008
2008
|
if (!h) continue;
|
|
2009
2009
|
const p = H(h);
|
|
2010
|
-
|
|
2010
|
+
X(p, t, r) && p[n] !== void 0 && o.push(p[n]);
|
|
2011
2011
|
}
|
|
2012
2012
|
return o;
|
|
2013
2013
|
}
|
|
@@ -2018,7 +2018,7 @@ function cs(e, t) {
|
|
|
2018
2018
|
const n = H(i);
|
|
2019
2019
|
if (n.length < 2) continue;
|
|
2020
2020
|
const r = n[0];
|
|
2021
|
-
if (!
|
|
2021
|
+
if (!X(n, r, t)) continue;
|
|
2022
2022
|
const o = s.get(r) || [];
|
|
2023
2023
|
o.push(...n.slice(1)), s.set(r, o);
|
|
2024
2024
|
}
|
|
@@ -2029,13 +2029,13 @@ function cs(e, t) {
|
|
|
2029
2029
|
const r = H(n);
|
|
2030
2030
|
if (r.length < 2) continue;
|
|
2031
2031
|
const o = r[0];
|
|
2032
|
-
if (!
|
|
2032
|
+
if (!X(r, o, t)) continue;
|
|
2033
2033
|
const a = s.get(o) || [];
|
|
2034
2034
|
a.push(...r.slice(1)), s.set(o, a);
|
|
2035
2035
|
}
|
|
2036
2036
|
return Object.fromEntries(s);
|
|
2037
2037
|
}
|
|
2038
|
-
function
|
|
2038
|
+
function Ut(e, t, s, i) {
|
|
2039
2039
|
if (!Number.isInteger(e) || e < 0 || e > 65535)
|
|
2040
2040
|
throw new Error(`Invalid kind: ${e}`);
|
|
2041
2041
|
if (!et(t))
|
|
@@ -2053,7 +2053,7 @@ function hs(e, t) {
|
|
|
2053
2053
|
const s = D(e.tags);
|
|
2054
2054
|
if (!s)
|
|
2055
2055
|
throw new Error(`Missing "d" tag for PRE event of kind ${e.kind}`);
|
|
2056
|
-
return
|
|
2056
|
+
return Ut(e.kind, e.pubkey, s, t);
|
|
2057
2057
|
}
|
|
2058
2058
|
function ps(e) {
|
|
2059
2059
|
const t = ft.decode(e);
|
|
@@ -2204,12 +2204,12 @@ class ss {
|
|
|
2204
2204
|
}
|
|
2205
2205
|
const B = this.subscriptions.get(u);
|
|
2206
2206
|
if (B) {
|
|
2207
|
-
|
|
2207
|
+
Z.writeBatchedData(B.buffer, S, u) && this.dispatch(`subscription:${u}`, u);
|
|
2208
2208
|
return;
|
|
2209
2209
|
}
|
|
2210
2210
|
const it = this.publishes.get(u);
|
|
2211
2211
|
if (it) {
|
|
2212
|
-
|
|
2212
|
+
Z.writeBatchedData(it.buffer, S, u) && this.dispatch(`publish:${u}`, u);
|
|
2213
2213
|
return;
|
|
2214
2214
|
}
|
|
2215
2215
|
console.log("[main] no subscription or publish found for subId:", u);
|
|
@@ -2378,8 +2378,8 @@ class ss {
|
|
|
2378
2378
|
const n = this.createShortId(t), r = this.subscriptions.get(n);
|
|
2379
2379
|
if (r)
|
|
2380
2380
|
return r.refCount++, r.buffer;
|
|
2381
|
-
const o = s.reduce((d, _) => d + (_.limit || 100), 0), a =
|
|
2382
|
-
|
|
2381
|
+
const o = s.reduce((d, _) => d + (_.limit || 100), 0), a = Z.calculateBufferSize(o, i.bytesPerEvent), h = new ArrayBuffer(a);
|
|
2382
|
+
Z.initializeBuffer(h), this.subscriptions.set(n, { buffer: h, options: i, refCount: 1 });
|
|
2383
2383
|
const p = new yt(
|
|
2384
2384
|
new gt(i.pipeline || []),
|
|
2385
2385
|
i.closeOnEose,
|
|
@@ -2412,7 +2412,7 @@ class ss {
|
|
|
2412
2412
|
)
|
|
2413
2413
|
),
|
|
2414
2414
|
p
|
|
2415
|
-
), g = new
|
|
2415
|
+
), g = new U(C.Subscribe, f), I = new c.Builder(2048);
|
|
2416
2416
|
I.finish(g.pack(I));
|
|
2417
2417
|
const $ = I.asUint8Array();
|
|
2418
2418
|
return this.postToWorker({ serializedMessage: $ }, [$.buffer]), h;
|
|
@@ -2435,7 +2435,7 @@ class ss {
|
|
|
2435
2435
|
}
|
|
2436
2436
|
publish(t, s, i = [], n) {
|
|
2437
2437
|
const r = new ArrayBuffer(3072);
|
|
2438
|
-
|
|
2438
|
+
Z.initializeBuffer(r);
|
|
2439
2439
|
const o = new bt(
|
|
2440
2440
|
s.kind,
|
|
2441
2441
|
s.created_at,
|
|
@@ -2446,7 +2446,7 @@ class ss {
|
|
|
2446
2446
|
o,
|
|
2447
2447
|
i,
|
|
2448
2448
|
n || []
|
|
2449
|
-
), h = new
|
|
2449
|
+
), h = new U(C.Publish, a), p = new c.Builder(2048);
|
|
2450
2450
|
p.finish(h.pack(p));
|
|
2451
2451
|
const f = p.asUint8Array();
|
|
2452
2452
|
return this.postToWorker({ serializedMessage: f }, [f.buffer]), this.publishes.set(t, { buffer: r }), r;
|
|
@@ -2472,7 +2472,7 @@ class ss {
|
|
|
2472
2472
|
this.signCB = s, this.crypto.postMessage({ type: "sign_event", payload: JSON.stringify(t) });
|
|
2473
2473
|
}
|
|
2474
2474
|
getPublicKey() {
|
|
2475
|
-
const t = new
|
|
2475
|
+
const t = new U(C.GetPublicKey, new lt()), s = new c.Builder(2048);
|
|
2476
2476
|
s.finish(t.pack(s));
|
|
2477
2477
|
const i = s.asUint8Array();
|
|
2478
2478
|
this.parser.postMessage({ serializedMessage: i }, [i.buffer]);
|
|
@@ -2550,7 +2550,7 @@ class ss {
|
|
|
2550
2550
|
for (const [s, i] of this.subscriptions.entries())
|
|
2551
2551
|
i.refCount <= 0 && !this.PERPETUAL_SUBSCRIPTIONS.includes(s) && t.push(s);
|
|
2552
2552
|
for (const s of t) {
|
|
2553
|
-
const i = new Pt(this.textEncoder.encode(s)), n = new
|
|
2553
|
+
const i = new Pt(this.textEncoder.encode(s)), n = new U(C.Unsubscribe, i), r = new c.Builder(256);
|
|
2554
2554
|
r.finish(n.pack(r));
|
|
2555
2555
|
const o = r.asUint8Array();
|
|
2556
2556
|
this.postToWorker({ serializedMessage: o }, [o.buffer]), this.connections.postMessage(s), this.subscriptions.delete(s);
|
|
@@ -2576,7 +2576,7 @@ function ys(e) {
|
|
|
2576
2576
|
}
|
|
2577
2577
|
export {
|
|
2578
2578
|
Y as $,
|
|
2579
|
-
|
|
2579
|
+
Z as A,
|
|
2580
2580
|
A as B,
|
|
2581
2581
|
J as C,
|
|
2582
2582
|
Rt as D,
|
|
@@ -2593,7 +2593,7 @@ export {
|
|
|
2593
2593
|
Nt as O,
|
|
2594
2594
|
C as P,
|
|
2595
2595
|
V as Q,
|
|
2596
|
-
|
|
2596
|
+
U as R,
|
|
2597
2597
|
b as S,
|
|
2598
2598
|
xt as T,
|
|
2599
2599
|
m as U,
|
|
@@ -2638,7 +2638,7 @@ export {
|
|
|
2638
2638
|
os as b,
|
|
2639
2639
|
_s as c,
|
|
2640
2640
|
as as d,
|
|
2641
|
-
|
|
2641
|
+
Zt as e,
|
|
2642
2642
|
cs as f,
|
|
2643
2643
|
gs as g,
|
|
2644
2644
|
hs as h,
|
|
@@ -2646,7 +2646,7 @@ export {
|
|
|
2646
2646
|
pt as j,
|
|
2647
2647
|
D as k,
|
|
2648
2648
|
Qt as l,
|
|
2649
|
-
|
|
2649
|
+
Ut as m,
|
|
2650
2650
|
Jt as n,
|
|
2651
2651
|
wt as o,
|
|
2652
2652
|
ps as p,
|
|
@@ -19,5 +19,7 @@ export declare class ConnectionTracker {
|
|
|
19
19
|
get totalResolved(): number;
|
|
20
20
|
/** Quick ratio (0...1) of resolved vs incoming */
|
|
21
21
|
get resolutionRate(): number;
|
|
22
|
+
/** Reset all tracking state for a fresh subscription */
|
|
23
|
+
reset(): void;
|
|
22
24
|
}
|
|
23
25
|
//# sourceMappingURL=ConnectionTracker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionTracker.d.ts","sourceRoot":"","sources":["../../src/lib/ConnectionTracker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGzE,qBAAa,iBAAiB;IAC7B,OAAO,CAAC,WAAW,CAA4C;IAC/D,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,aAAa,CAAK;IAE1B;;OAEG;IACH,aAAa,CAAC,GAAG,EAAE,aAAa;IAchC;;;OAGG;IACH,OAAO,CAAC,UAAU;IAIlB,0CAA0C;IAC1C,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,iCAAiC;IACjC,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,kDAAkD;IAClD,IAAI,cAAc,IAAI,MAAM,CAE3B;
|
|
1
|
+
{"version":3,"file":"ConnectionTracker.d.ts","sourceRoot":"","sources":["../../src/lib/ConnectionTracker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGzE,qBAAa,iBAAiB;IAC7B,OAAO,CAAC,WAAW,CAA4C;IAC/D,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,aAAa,CAAK;IAE1B;;OAEG;IACH,aAAa,CAAC,GAAG,EAAE,aAAa;IAchC;;;OAGG;IACH,OAAO,CAAC,UAAU;IAIlB,0CAA0C;IAC1C,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,iCAAiC;IACjC,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,kDAAkD;IAClD,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED,wDAAwD;IACxD,KAAK,IAAI,IAAI;CAKb"}
|