@bsv/overlay-express 2.2.1 → 2.3.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.
@@ -0,0 +1,306 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OverlayMonitor = void 0;
4
+ exports.analyzeOverlayLookupResponse = analyzeOverlayLookupResponse;
5
+ const sdk_1 = require("@bsv/sdk");
6
+ const defaultThresholds = {
7
+ responseBytes: 1024 * 1024,
8
+ beefBytes: 64 * 1024,
9
+ txsWithoutProof: 1,
10
+ requireSubjectProof: true
11
+ };
12
+ /**
13
+ * OverlayMonitor runs generic Overlay Express /lookup probes and reports response
14
+ * size plus BEEF proof shape. It is intended for long-running monitor workers or
15
+ * scheduled jobs, analogous to a storage monitor but scoped to overlay health.
16
+ */
17
+ class OverlayMonitor {
18
+ constructor(config) {
19
+ var _a, _b, _c, _d;
20
+ this.running = false;
21
+ this.targets = config.targets;
22
+ this.thresholds = { ...defaultThresholds, ...config.thresholds };
23
+ // Bind to globalThis so calling through this.fetchImpl does not rebind `this`
24
+ // (browser fetch throws "Illegal invocation" when invoked as a method).
25
+ this.fetchImpl = (_a = config.fetchImpl) !== null && _a !== void 0 ? _a : fetch.bind(globalThis);
26
+ this.logger = (_b = config.logger) !== null && _b !== void 0 ? _b : console;
27
+ this.onReport = config.onReport;
28
+ this.now = (_c = config.now) !== null && _c !== void 0 ? _c : (() => new Date());
29
+ this.intervalMs = config.intervalMs;
30
+ this.timeoutMs = (_d = config.timeoutMs) !== null && _d !== void 0 ? _d : 30000;
31
+ }
32
+ async runOnce() {
33
+ var _a;
34
+ const startedAt = this.now();
35
+ const results = [];
36
+ for (const target of this.targets) {
37
+ for (const probe of target.probes) {
38
+ results.push(await this.runProbe(target, probe));
39
+ }
40
+ }
41
+ const completedAt = this.now();
42
+ const report = {
43
+ startedAt,
44
+ completedAt,
45
+ durationMs: completedAt.getTime() - startedAt.getTime(),
46
+ results,
47
+ summary: summarize(results, this.targets.length)
48
+ };
49
+ await ((_a = this.onReport) === null || _a === void 0 ? void 0 : _a.call(this, report));
50
+ return report;
51
+ }
52
+ start() {
53
+ if (this.intervalMs === undefined) {
54
+ throw new Error('intervalMs is required to start OverlayMonitor');
55
+ }
56
+ if (this.timer !== undefined)
57
+ return;
58
+ this.timer = setInterval(() => {
59
+ if (this.running)
60
+ return;
61
+ this.running = true;
62
+ this.runOnce()
63
+ .catch(error => {
64
+ this.logger.error('OverlayMonitor run failed', error);
65
+ })
66
+ .finally(() => {
67
+ this.running = false;
68
+ });
69
+ }, this.intervalMs);
70
+ }
71
+ stop() {
72
+ if (this.timer !== undefined) {
73
+ clearInterval(this.timer);
74
+ this.timer = undefined;
75
+ }
76
+ }
77
+ async runProbe(target, probe) {
78
+ var _a;
79
+ const startedAt = this.now();
80
+ const url = new URL('/lookup', target.baseUrl).toString();
81
+ const controller = new AbortController();
82
+ const timeout = setTimeout(() => controller.abort(), this.timeoutMs);
83
+ try {
84
+ const response = await this.fetchImpl(url, {
85
+ method: 'POST',
86
+ headers: {
87
+ Accept: 'application/json',
88
+ 'Content-Type': 'application/json',
89
+ ...target.headers
90
+ },
91
+ body: JSON.stringify({ service: probe.service, query: probe.query }),
92
+ signal: controller.signal
93
+ });
94
+ const text = await response.text();
95
+ const responseBytes = new TextEncoder().encode(text).length;
96
+ const completedAt = this.now();
97
+ let body;
98
+ try {
99
+ body = text.length === 0 ? {} : JSON.parse(text);
100
+ }
101
+ catch (error) {
102
+ return makeFailedResult({
103
+ target,
104
+ probe,
105
+ url,
106
+ status: response.status,
107
+ ok: response.ok,
108
+ responseBytes,
109
+ durationMs: completedAt.getTime() - startedAt.getTime(),
110
+ error: error instanceof Error ? error.message : 'Invalid JSON response'
111
+ });
112
+ }
113
+ return analyzeOverlayLookupResponse({
114
+ target: target.name,
115
+ url,
116
+ probe: (_a = probe.name) !== null && _a !== void 0 ? _a : probe.service,
117
+ service: probe.service,
118
+ status: response.status,
119
+ ok: response.ok,
120
+ responseBody: body,
121
+ responseBytes,
122
+ durationMs: completedAt.getTime() - startedAt.getTime(),
123
+ thresholds: this.thresholds,
124
+ maxOutputs: probe.maxOutputs
125
+ });
126
+ }
127
+ catch (error) {
128
+ const completedAt = this.now();
129
+ const fallbackMessage = error instanceof Error ? error.message : 'Lookup probe failed';
130
+ const message = controller.signal.aborted
131
+ ? `Lookup probe timed out after ${this.timeoutMs}ms`
132
+ : fallbackMessage;
133
+ return makeFailedResult({
134
+ target,
135
+ probe,
136
+ url,
137
+ status: 0,
138
+ ok: false,
139
+ responseBytes: 0,
140
+ durationMs: completedAt.getTime() - startedAt.getTime(),
141
+ error: message
142
+ });
143
+ }
144
+ finally {
145
+ clearTimeout(timeout);
146
+ }
147
+ }
148
+ }
149
+ exports.OverlayMonitor = OverlayMonitor;
150
+ function analyzeOverlayLookupResponse(options) {
151
+ var _a;
152
+ const thresholds = { ...defaultThresholds, ...options.thresholds };
153
+ const outputs = extractOutputs(options.responseBody);
154
+ const maxOutputs = (_a = options.maxOutputs) !== null && _a !== void 0 ? _a : outputs.length;
155
+ const analyzedOutputs = outputs.slice(0, maxOutputs).map(analyzeOutput);
156
+ const warnings = [];
157
+ if (options.responseBytes >= thresholds.responseBytes) {
158
+ warnings.push({
159
+ code: 'response-bytes',
160
+ message: `Lookup response is ${options.responseBytes} bytes`,
161
+ value: options.responseBytes,
162
+ threshold: thresholds.responseBytes
163
+ });
164
+ }
165
+ for (const output of analyzedOutputs) {
166
+ addOutputWarnings(warnings, output, thresholds);
167
+ }
168
+ return {
169
+ target: options.target,
170
+ url: options.url,
171
+ probe: options.probe,
172
+ service: options.service,
173
+ status: options.status,
174
+ ok: options.ok,
175
+ responseBytes: options.responseBytes,
176
+ outputCount: outputs.length,
177
+ analyzedOutputCount: analyzedOutputs.length,
178
+ outputs: analyzedOutputs,
179
+ warnings,
180
+ durationMs: options.durationMs,
181
+ error: options.error
182
+ };
183
+ }
184
+ function makeFailedResult(options) {
185
+ var _a;
186
+ return {
187
+ target: options.target.name,
188
+ url: options.url,
189
+ probe: (_a = options.probe.name) !== null && _a !== void 0 ? _a : options.probe.service,
190
+ service: options.probe.service,
191
+ status: options.status,
192
+ ok: options.ok,
193
+ responseBytes: options.responseBytes,
194
+ outputCount: 0,
195
+ analyzedOutputCount: 0,
196
+ outputs: [],
197
+ warnings: [],
198
+ durationMs: options.durationMs,
199
+ error: options.error
200
+ };
201
+ }
202
+ function summarize(results, targetCount) {
203
+ return {
204
+ targetCount,
205
+ probeCount: results.length,
206
+ failedProbeCount: results.filter(result => !result.ok || result.error !== undefined).length,
207
+ responseBytes: results.reduce((sum, result) => sum + result.responseBytes, 0),
208
+ outputCount: results.reduce((sum, result) => sum + result.outputCount, 0),
209
+ analyzedOutputCount: results.reduce((sum, result) => sum + result.analyzedOutputCount, 0),
210
+ outputsMissingSubjectProof: results.reduce((sum, result) => {
211
+ return sum + result.outputs.filter(output => output.subjectHasProof === false).length;
212
+ }, 0),
213
+ warningCount: results.reduce((sum, result) => sum + result.warnings.length, 0)
214
+ };
215
+ }
216
+ function extractOutputs(body) {
217
+ if (typeof body !== 'object' || body === null || !('outputs' in body))
218
+ return [];
219
+ const outputs = body.outputs;
220
+ if (!Array.isArray(outputs))
221
+ return [];
222
+ return outputs.filter((output) => typeof output === 'object' && output !== null);
223
+ }
224
+ function analyzeOutput(output) {
225
+ var _a, _b, _c;
226
+ const outputIndex = typeof output.outputIndex === 'number' ? output.outputIndex : -1;
227
+ const beef = readNumberArray(output.beef);
228
+ const context = readNumberArray(output.context);
229
+ if (beef === undefined) {
230
+ return {
231
+ outputIndex,
232
+ beefBytes: 0,
233
+ contextBytes: context === null || context === void 0 ? void 0 : context.length,
234
+ error: 'Output did not include numeric BEEF'
235
+ };
236
+ }
237
+ try {
238
+ const subjectTx = sdk_1.Transaction.fromBEEF(beef);
239
+ const txid = subjectTx.id('hex');
240
+ const parsedBeef = sdk_1.Beef.fromBinary(beef);
241
+ const subject = parsedBeef.findTxid(txid);
242
+ const subjectRawTxBytes = (_b = (_a = subject === null || subject === void 0 ? void 0 : subject.rawTx) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : subjectTx.toBinary().length;
243
+ const proofCount = parsedBeef.txs.filter(tx => tx.hasProof).length;
244
+ const txsWithoutProof = parsedBeef.txs.filter(tx => !tx.hasProof && !tx.isTxidOnly).length;
245
+ return {
246
+ outputIndex,
247
+ txid,
248
+ beefBytes: beef.length,
249
+ txCount: parsedBeef.txs.length,
250
+ proofCount,
251
+ txsWithoutProof,
252
+ subjectHasProof: (_c = subject === null || subject === void 0 ? void 0 : subject.hasProof) !== null && _c !== void 0 ? _c : false,
253
+ subjectRawTxBytes,
254
+ currentToSubjectRawRatio: subjectRawTxBytes > 0 ? beef.length / subjectRawTxBytes : undefined,
255
+ contextBytes: context === null || context === void 0 ? void 0 : context.length
256
+ };
257
+ }
258
+ catch (error) {
259
+ return {
260
+ outputIndex,
261
+ beefBytes: beef.length,
262
+ contextBytes: context === null || context === void 0 ? void 0 : context.length,
263
+ error: error instanceof Error ? error.message : 'Failed to parse BEEF'
264
+ };
265
+ }
266
+ }
267
+ function addOutputWarnings(warnings, output, thresholds) {
268
+ if (output.beefBytes >= thresholds.beefBytes) {
269
+ warnings.push({
270
+ code: 'beef-bytes',
271
+ message: `Output BEEF is ${output.beefBytes} bytes`,
272
+ value: output.beefBytes,
273
+ threshold: thresholds.beefBytes,
274
+ outputIndex: output.outputIndex,
275
+ txid: output.txid
276
+ });
277
+ }
278
+ if (typeof output.txsWithoutProof === 'number' && output.txsWithoutProof >= thresholds.txsWithoutProof) {
279
+ warnings.push({
280
+ code: 'txs-without-proof',
281
+ message: `Output BEEF has ${output.txsWithoutProof} transactions without direct proof`,
282
+ value: output.txsWithoutProof,
283
+ threshold: thresholds.txsWithoutProof,
284
+ outputIndex: output.outputIndex,
285
+ txid: output.txid
286
+ });
287
+ }
288
+ if (thresholds.requireSubjectProof && output.subjectHasProof === false) {
289
+ warnings.push({
290
+ code: 'subject-proof-missing',
291
+ message: 'Output subject transaction does not have a direct Merkle proof',
292
+ value: false,
293
+ threshold: true,
294
+ outputIndex: output.outputIndex,
295
+ txid: output.txid
296
+ });
297
+ }
298
+ }
299
+ function readNumberArray(value) {
300
+ if (!Array.isArray(value))
301
+ return undefined;
302
+ if (!value.every(item => Number.isInteger(item) && item >= 0 && item <= 255))
303
+ return undefined;
304
+ return value;
305
+ }
306
+ //# sourceMappingURL=OverlayMonitor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OverlayMonitor.js","sourceRoot":"","sources":["../../../src/OverlayMonitor.ts"],"names":[],"mappings":";;;AA8QA,oEAmCC;AAjTD,kCAA4C;AAgH5C,MAAM,iBAAiB,GAAuC;IAC5D,aAAa,EAAE,IAAI,GAAG,IAAI;IAC1B,SAAS,EAAE,EAAE,GAAG,IAAI;IACpB,eAAe,EAAE,CAAC;IAClB,mBAAmB,EAAE,IAAI;CAC1B,CAAA;AAED;;;;GAIG;AACH,MAAa,cAAc;IAYzB,YAAa,MAA4B;;QAFjC,YAAO,GAAG,KAAK,CAAA;QAGrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAA;QAC7B,IAAI,CAAC,UAAU,GAAG,EAAE,GAAG,iBAAiB,EAAE,GAAG,MAAM,CAAC,UAAU,EAAE,CAAA;QAChE,8EAA8E;QAC9E,wEAAwE;QACxE,IAAI,CAAC,SAAS,GAAG,MAAA,MAAM,CAAC,SAAS,mCAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QAC3D,IAAI,CAAC,MAAM,GAAG,MAAA,MAAM,CAAC,MAAM,mCAAI,OAAO,CAAA;QACtC,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAA;QAC/B,IAAI,CAAC,GAAG,GAAG,MAAA,MAAM,CAAC,GAAG,mCAAI,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;QAC3C,IAA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