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