@bsv/sdk 1.7.1 → 1.7.2
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/cjs/package.json +1 -1
- package/dist/cjs/src/overlay-tools/LookupResolver.js +153 -75
- package/dist/cjs/src/overlay-tools/LookupResolver.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/overlay-tools/LookupResolver.js +160 -75
- package/dist/esm/src/overlay-tools/LookupResolver.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/overlay-tools/LookupResolver.d.ts +29 -1
- package/dist/types/src/overlay-tools/LookupResolver.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/umd/bundle.js +3 -3
- package/dist/umd/bundle.js.map +1 -1
- package/docs/reference/overlay-tools.md +10 -1
- package/package.json +1 -1
- package/src/overlay-tools/LookupResolver.ts +168 -81
- package/src/overlay-tools/__tests/LookupResolver.test.ts +0 -47
package/dist/cjs/package.json
CHANGED
|
@@ -35,32 +35,39 @@ class HTTPSOverlayLookupFacilitator {
|
|
|
35
35
|
if (!url.startsWith('https:') && !this.allowHTTP) {
|
|
36
36
|
throw new Error('HTTPS facilitator can only use URLs that start with "https:"');
|
|
37
37
|
}
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
38
|
+
const controller = typeof AbortController !== 'undefined' ? new AbortController() : undefined;
|
|
39
|
+
const timer = setTimeout(() => {
|
|
40
|
+
try {
|
|
41
|
+
controller?.abort();
|
|
42
|
+
}
|
|
43
|
+
catch { /* noop */ }
|
|
44
|
+
}, timeout);
|
|
45
|
+
try {
|
|
46
|
+
const fco = {
|
|
47
|
+
method: 'POST',
|
|
48
|
+
headers: { 'Content-Type': 'application/json' },
|
|
49
|
+
body: JSON.stringify({ service: question.service, query: question.query }),
|
|
50
|
+
signal: controller?.signal
|
|
51
|
+
};
|
|
52
|
+
const response = await this.fetchClient(`${url}/lookup`, fco);
|
|
53
|
+
if (!response.ok)
|
|
54
|
+
throw new Error(`Failed to facilitate lookup (HTTP ${response.status})`);
|
|
54
55
|
return await response.json();
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
catch (e) {
|
|
58
|
+
// Normalize timeouts to a consistent error message
|
|
59
|
+
if (e?.name === 'AbortError')
|
|
60
|
+
throw new Error('Request timed out');
|
|
61
|
+
throw e;
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
clearTimeout(timer);
|
|
58
65
|
}
|
|
59
66
|
}
|
|
60
67
|
}
|
|
61
68
|
exports.HTTPSOverlayLookupFacilitator = HTTPSOverlayLookupFacilitator;
|
|
62
69
|
/**
|
|
63
|
-
* Represents
|
|
70
|
+
* Represents a Lookup Resolver.
|
|
64
71
|
*/
|
|
65
72
|
class LookupResolver {
|
|
66
73
|
constructor(config = {}) {
|
|
@@ -69,6 +76,13 @@ class LookupResolver {
|
|
|
69
76
|
this.slapTrackers = config.slapTrackers ?? (this.networkPreset === 'mainnet' ? exports.DEFAULT_SLAP_TRACKERS : exports.DEFAULT_TESTNET_SLAP_TRACKERS);
|
|
70
77
|
this.hostOverrides = config.hostOverrides ?? {};
|
|
71
78
|
this.additionalHosts = config.additionalHosts ?? {};
|
|
79
|
+
// cache tuning
|
|
80
|
+
this.hostsTtlMs = config.cache?.hostsTtlMs ?? 5 * 60 * 1000; // 5 min
|
|
81
|
+
this.hostsMaxEntries = config.cache?.hostsMaxEntries ?? 128;
|
|
82
|
+
this.txMemoTtlMs = config.cache?.txMemoTtlMs ?? 10 * 60 * 1000; // 10 min
|
|
83
|
+
this.hostsCache = new Map();
|
|
84
|
+
this.hostsInFlight = new Map();
|
|
85
|
+
this.txMemo = new Map();
|
|
72
86
|
}
|
|
73
87
|
/**
|
|
74
88
|
* Given a LookupQuestion, returns a LookupAnswer. Aggregates across multiple services and supports resiliency.
|
|
@@ -85,53 +99,119 @@ class LookupResolver {
|
|
|
85
99
|
competentHosts = ['http://localhost:8080'];
|
|
86
100
|
}
|
|
87
101
|
else {
|
|
88
|
-
competentHosts = await this.
|
|
102
|
+
competentHosts = await this.getCompetentHostsCached(question.service);
|
|
89
103
|
}
|
|
90
104
|
if (this.additionalHosts[question.service]?.length > 0) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
105
|
+
// preserve order: resolved hosts first, then additional (unique)
|
|
106
|
+
const extra = this.additionalHosts[question.service];
|
|
107
|
+
const seen = new Set(competentHosts);
|
|
108
|
+
for (const h of extra)
|
|
109
|
+
if (!seen.has(h))
|
|
110
|
+
competentHosts.push(h);
|
|
95
111
|
}
|
|
96
112
|
if (competentHosts.length < 1) {
|
|
97
113
|
throw new Error(`No competent ${this.networkPreset} hosts found by the SLAP trackers for lookup service: ${question.service}`);
|
|
98
114
|
}
|
|
99
|
-
//
|
|
100
|
-
const hostResponses = await Promise.allSettled(competentHosts.map(async (host) =>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
115
|
+
// Fire all hosts with per-host timeout, harvest successful output-list responses
|
|
116
|
+
const hostResponses = await Promise.allSettled(competentHosts.map(async (host) => {
|
|
117
|
+
return await this.facilitator.lookup(host, question, timeout);
|
|
118
|
+
}));
|
|
119
|
+
const outputsMap = new Map();
|
|
120
|
+
// Memo key helper for tx parsing
|
|
121
|
+
const beefKey = (beef) => {
|
|
122
|
+
if (typeof beef !== 'object')
|
|
123
|
+
return ''; // The invalid BEEF has an empty key.
|
|
124
|
+
// A fast and deterministic key for memoization; avoids large JSON strings
|
|
125
|
+
// since beef is an array of integers, join is safe and compact.
|
|
126
|
+
return beef.join(',');
|
|
127
|
+
};
|
|
128
|
+
for (const result of hostResponses) {
|
|
129
|
+
if (result.status !== 'fulfilled')
|
|
112
130
|
continue;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
131
|
+
const response = result.value;
|
|
132
|
+
if (response?.type !== 'output-list' || !Array.isArray(response.outputs))
|
|
133
|
+
continue;
|
|
134
|
+
for (const output of response.outputs) {
|
|
135
|
+
const keyForBeef = beefKey(output.beef);
|
|
136
|
+
let memo = this.txMemo.get(keyForBeef);
|
|
137
|
+
const now = Date.now();
|
|
138
|
+
if (typeof memo !== 'object' || memo === null || memo.expiresAt <= now) {
|
|
116
139
|
try {
|
|
117
|
-
const txId = index_js_1.Transaction.fromBEEF(output.beef).id('hex');
|
|
118
|
-
|
|
119
|
-
|
|
140
|
+
const txId = index_js_1.Transaction.fromBEEF(output.beef).id('hex');
|
|
141
|
+
memo = { txId, expiresAt: now + this.txMemoTtlMs };
|
|
142
|
+
// prune opportunistically if the map gets too large (cheap heuristic)
|
|
143
|
+
if (this.txMemo.size > 4096)
|
|
144
|
+
this.evictOldest(this.txMemo);
|
|
145
|
+
this.txMemo.set(keyForBeef, memo);
|
|
120
146
|
}
|
|
121
147
|
catch {
|
|
122
148
|
continue;
|
|
123
149
|
}
|
|
124
150
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
151
|
+
const uniqKey = `${memo.txId}.${output.outputIndex}`;
|
|
152
|
+
// last-writer wins is fine here; outputs are identical if uniqKey matches
|
|
153
|
+
outputsMap.set(uniqKey, output);
|
|
128
154
|
}
|
|
129
155
|
}
|
|
130
156
|
return {
|
|
131
157
|
type: 'output-list',
|
|
132
|
-
outputs: Array.from(
|
|
158
|
+
outputs: Array.from(outputsMap.values())
|
|
133
159
|
};
|
|
134
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* Cached wrapper for competent host discovery with stale-while-revalidate.
|
|
163
|
+
*/
|
|
164
|
+
async getCompetentHostsCached(service) {
|
|
165
|
+
const now = Date.now();
|
|
166
|
+
const cached = this.hostsCache.get(service);
|
|
167
|
+
// if fresh, return immediately
|
|
168
|
+
if (typeof cached === 'object' && cached.expiresAt > now) {
|
|
169
|
+
return cached.hosts.slice();
|
|
170
|
+
}
|
|
171
|
+
// if stale but present, kick off a refresh if not already in-flight and return stale
|
|
172
|
+
if (typeof cached === 'object' && cached.expiresAt <= now) {
|
|
173
|
+
if (!this.hostsInFlight.has(service)) {
|
|
174
|
+
this.hostsInFlight.set(service, this.refreshHosts(service).finally(() => {
|
|
175
|
+
this.hostsInFlight.delete(service);
|
|
176
|
+
}));
|
|
177
|
+
}
|
|
178
|
+
return cached.hosts.slice();
|
|
179
|
+
}
|
|
180
|
+
// no cache: coalesce concurrent requests
|
|
181
|
+
if (this.hostsInFlight.has(service)) {
|
|
182
|
+
try {
|
|
183
|
+
const hosts = await this.hostsInFlight.get(service);
|
|
184
|
+
if (typeof hosts !== 'object') {
|
|
185
|
+
throw new Error('Hosts is not defined.');
|
|
186
|
+
}
|
|
187
|
+
return hosts.slice();
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
// fall through to a fresh attempt below
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
const promise = this.refreshHosts(service).finally(() => {
|
|
194
|
+
this.hostsInFlight.delete(service);
|
|
195
|
+
});
|
|
196
|
+
this.hostsInFlight.set(service, promise);
|
|
197
|
+
const hosts = await promise;
|
|
198
|
+
return hosts.slice();
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Actually resolves competent hosts from SLAP trackers and updates cache.
|
|
202
|
+
*/
|
|
203
|
+
async refreshHosts(service) {
|
|
204
|
+
const hosts = await this.findCompetentHosts(service);
|
|
205
|
+
const expiresAt = Date.now() + this.hostsTtlMs;
|
|
206
|
+
// bounded cache with simple FIFO eviction
|
|
207
|
+
if (!this.hostsCache.has(service) && this.hostsCache.size >= this.hostsMaxEntries) {
|
|
208
|
+
const oldestKey = this.hostsCache.keys().next().value;
|
|
209
|
+
if (oldestKey !== undefined)
|
|
210
|
+
this.hostsCache.delete(oldestKey);
|
|
211
|
+
}
|
|
212
|
+
this.hostsCache.set(service, { hosts, expiresAt });
|
|
213
|
+
return hosts;
|
|
214
|
+
}
|
|
135
215
|
/**
|
|
136
216
|
* Returns a list of competent hosts for a given lookup service.
|
|
137
217
|
* @param service Service for which competent hosts are to be returned
|
|
@@ -140,45 +220,43 @@ class LookupResolver {
|
|
|
140
220
|
async findCompetentHosts(service) {
|
|
141
221
|
const query = {
|
|
142
222
|
service: 'ls_slap',
|
|
143
|
-
query: {
|
|
144
|
-
service
|
|
145
|
-
}
|
|
223
|
+
query: { service }
|
|
146
224
|
};
|
|
147
|
-
//
|
|
225
|
+
// Query all SLAP trackers; tolerate failures.
|
|
148
226
|
const trackerResponses = await Promise.allSettled(this.slapTrackers.map(async (tracker) => await this.facilitator.lookup(tracker, query, MAX_TRACKER_WAIT_TIME)));
|
|
149
227
|
const hosts = new Set();
|
|
150
228
|
for (const result of trackerResponses) {
|
|
151
|
-
if (result.status
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
const parsed = OverlayAdminTokenTemplate_js_1.default.decode(script);
|
|
162
|
-
if (parsed.topicOrService !== service ||
|
|
163
|
-
parsed.protocol !== 'SLAP') {
|
|
164
|
-
// Invalid advertisement, skip
|
|
165
|
-
continue;
|
|
166
|
-
}
|
|
167
|
-
hosts.add(parsed.domain);
|
|
168
|
-
}
|
|
169
|
-
catch {
|
|
170
|
-
// Invalid output, skip
|
|
229
|
+
if (result.status !== 'fulfilled')
|
|
230
|
+
continue;
|
|
231
|
+
const answer = result.value;
|
|
232
|
+
if (answer.type !== 'output-list')
|
|
233
|
+
continue;
|
|
234
|
+
for (const output of answer.outputs) {
|
|
235
|
+
try {
|
|
236
|
+
const tx = index_js_1.Transaction.fromBEEF(output.beef);
|
|
237
|
+
const script = tx.outputs[output.outputIndex]?.lockingScript;
|
|
238
|
+
if (typeof script !== 'object' || script === null)
|
|
171
239
|
continue;
|
|
240
|
+
const parsed = OverlayAdminTokenTemplate_js_1.default.decode(script);
|
|
241
|
+
if (parsed.topicOrService !== service || parsed.protocol !== 'SLAP')
|
|
242
|
+
continue;
|
|
243
|
+
if (typeof parsed.domain === 'string' && parsed.domain.length > 0) {
|
|
244
|
+
hosts.add(parsed.domain);
|
|
172
245
|
}
|
|
173
246
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
continue;
|
|
247
|
+
catch {
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
178
250
|
}
|
|
179
251
|
}
|
|
180
252
|
return [...hosts];
|
|
181
253
|
}
|
|
254
|
+
/** Evict an arbitrary “oldest” entry from a Map (iteration order). */
|
|
255
|
+
evictOldest(m) {
|
|
256
|
+
const firstKey = m.keys().next().value;
|
|
257
|
+
if (firstKey !== undefined)
|
|
258
|
+
m.delete(firstKey);
|
|
259
|
+
}
|
|
182
260
|
}
|
|
183
261
|
exports.default = LookupResolver;
|
|
184
262
|
//# sourceMappingURL=LookupResolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LookupResolver.js","sourceRoot":"","sources":["../../../../src/overlay-tools/LookupResolver.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAqD;AACrD,kGAAsE;AAgCtE,4BAA4B;AACf,QAAA,qBAAqB,GAAa;IAC7C,gBAAgB;IAChB,gCAAgC;IAChC,gCAAgC;IAChC,gCAAgC;IAEhC,kCAAkC;IAClC,wBAAwB;IAExB,uGAAuG;IACvG,0FAA0F;IAC1F,qEAAqE;IAErE,cAAc;IACd,8GAA8G;CAC/G,CAAA;AAED,oCAAoC;AACvB,QAAA,6BAA6B,GAAa;IACrD,0CAA0C;IAC1C,gCAAgC;CACjC,CAAA;AAED,MAAM,qBAAqB,GAAG,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"LookupResolver.js","sourceRoot":"","sources":["../../../../src/overlay-tools/LookupResolver.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAqD;AACrD,kGAAsE;AAgCtE,4BAA4B;AACf,QAAA,qBAAqB,GAAa;IAC7C,gBAAgB;IAChB,gCAAgC;IAChC,gCAAgC;IAChC,gCAAgC;IAEhC,kCAAkC;IAClC,wBAAwB;IAExB,uGAAuG;IACvG,0FAA0F;IAC1F,qEAAqE;IAErE,cAAc;IACd,8GAA8G;CAC/G,CAAA;AAED,oCAAoC;AACvB,QAAA,6BAA6B,GAAa;IACrD,0CAA0C;IAC1C,gCAAgC;CACjC,CAAA;AAED,MAAM,qBAAqB,GAAG,IAAI,CAAA;AAiDlC,MAAa,6BAA6B;IAIxC,YAAa,UAAU,GAAG,KAAK,EAAE,YAAqB,KAAK;QACzD,IAAI,CAAC,WAAW,GAAG,UAAU,CAAA;QAC7B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;IAED,KAAK,CAAC,MAAM,CACV,GAAW,EACX,QAAwB,EACxB,UAAkB,IAAI;QAEtB,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YAChD,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAAA;SACF;QAED,MAAM,UAAU,GAAG,OAAO,eAAe,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,eAAe,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;QAC7F,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,IAAI;gBAAE,UAAU,EAAE,KAAK,EAAE,CAAA;aAAE;YAAC,MAAM,EAAE,UAAU,EAAE;QAClD,CAAC,EAAE,OAAO,CAAC,CAAA;QAEX,IAAI;YACF,MAAM,GAAG,GAAgB;gBACvB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