@bsv/overlay-express 2.2.0 → 2.2.1

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsv/overlay-express",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "type": "commonjs",
5
5
  "description": "BSV Blockchain Overlay Express",
6
6
  "files": [
@@ -24,7 +24,8 @@
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",
27
- "url": "git+https://github.com/bsv-blockchain/overlay-express.git"
27
+ "url": "git+https://github.com/bsv-blockchain/ts-stack.git",
28
+ "directory": "packages/overlays/overlay-express"
28
29
  },
29
30
  "keywords": [
30
31
  "BSV",
@@ -36,25 +37,27 @@
36
37
  "author": "BSV Association",
37
38
  "license": "SEE LICENSE IN LICENSE.txt",
38
39
  "bugs": {
39
- "url": "https://github.com/bsv-blockchain/overlay-express/issues"
40
+ "url": "https://github.com/bsv-blockchain/ts-stack/issues"
40
41
  },
41
- "homepage": "https://github.com/bsv-blockchain/overlay-express#readme",
42
+ "homepage": "https://github.com/bsv-blockchain/ts-stack/tree/main/packages/overlays/overlay-express#readme",
42
43
  "devDependencies": {
44
+ "@jest/globals": "^30.3.0",
45
+ "@types/body-parser": "^1.19.5",
43
46
  "@types/express": "^5.0.0",
44
- "@types/jest": "^29.5.12",
45
- "jest": "^29.7.0",
46
- "ts-jest": "^29.1.1",
47
+ "@types/jest": "^30.0.0",
48
+ "jest": "^30.3.0",
49
+ "ts-jest": "^29.4.9",
47
50
  "ts-standard": "^12.0.2",
48
51
  "ts2md": "^0.2.0",
49
52
  "tsconfig-to-dual-package": "^1.2.0",
50
53
  "typescript": "^5.2.2"
51
54
  },
52
55
  "dependencies": {
53
- "@bsv/auth-express-middleware": "^2.0.2",
56
+ "@bsv/auth-express-middleware": "^2.0.5",
54
57
  "@bsv/overlay": "^2.0.2",
55
- "@bsv/overlay-discovery-services": "^2.0.2",
56
- "@bsv/sdk": "^2.0.4",
57
- "@bsv/wallet-toolbox-client": "^2.0.20",
58
+ "@bsv/overlay-discovery-services": "^2.0.3",
59
+ "@bsv/sdk": "^2.1.2",
60
+ "@bsv/wallet-toolbox-client": "^2.1.28",
58
61
  "body-parser": "^2.2.2",
59
62
  "chalk": "^5.6.2",
60
63
  "express": "^5.2.1",
@@ -20,7 +20,7 @@ class BanService {
20
20
  */
21
21
  sanitize(value) {
22
22
  if (typeof value !== 'string') {
23
- throw new Error('Invalid input: expected a string value');
23
+ throw new TypeError('Invalid input: expected a string value');
24
24
  }
25
25
  return value;
26
26
  }
@@ -68,7 +68,7 @@ class BanService {
68
68
  $set: {
69
69
  type: 'outpoint',
70
70
  value,
71
- domain: domain !== undefined ? this.sanitize(domain) : undefined,
71
+ domain: domain != null ? this.sanitize(domain) : undefined,
72
72
  reason: reason !== null && reason !== void 0 ? reason : 'Manually banned',
73
73
  bannedAt: new Date(),
74
74
  bannedBy
@@ -1 +1 @@
1
- {"version":3,"file":"BanService.js","sourceRoot":"","sources":["../../../src/BanService.ts"],"names":[],"mappings":";;;AAoBA;;;;;;;GAOG;AACH,MAAa,UAAU;IAGrB,YAAa,EAAM;QACjB,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,UAAU,CAAe,eAAe,CAAC,CAAA;IAC1D,CAAC;IAED;;;;OAIG;IACK,QAAQ,CAAE,KAAc;QAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;QAC3D,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa;QACjB,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;QACpE,MAAM,IAAI,CAAC,IAAI,CAAC,WA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AAO,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAA;QACnE,OAAO,MAAM,KAAK,IAAI,CAAA;IACxB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ,CAAE,IAA4B;QAC1C,MAAM,KAAK,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;QACtD,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAA;IACrE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CAAE,IAA2B,EAAE,KAAa;QACzD,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAA0B,EAAE,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAChH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ;QACZ,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACnD,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;YAC5C,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;SAC/C,CAAC,CAAA;QACF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,GAAG,YAAY,EAAE,CAAA;IAC3E,CAAC;CACF;AA7HD,gCA6HC"}
@@ -45,7 +45,7 @@ const mongodb_1 = require("mongodb");
45
45
  const makeUserInterface_js_1 = __importDefault(require("./makeUserInterface.js"));
46
46
  const DiscoveryServices = __importStar(require("@bsv/overlay-discovery-services"));
47
47
  const chalk_1 = __importDefault(require("chalk"));
48
- const util_1 = __importDefault(require("util"));
48
+ const node_util_1 = __importDefault(require("node:util"));
49
49
  const uuid_1 = require("uuid");
50
50
  const JanitorService_js_1 = require("./JanitorService.js");
51
51
  const BanService_js_1 = require("./BanService.js");
@@ -272,7 +272,7 @@ class OverlayExpress {
272
272
  }
273
273
  /**
274
274
  * Configure Knex (SQL) database connection.
275
- * @param config - Knex configuration object, or MySQL connection string (e.g. mysql://overlayAdmin:overlay123@mysql:3306/overlay).
275
+ * @param config - Knex configuration object, or a MySQL connection string loaded from configuration.
276
276
  */
277
277
  async configureKnex(config) {
278
278
  if (typeof config === 'string') {
@@ -376,126 +376,98 @@ class OverlayExpress {
376
376
  var _a, _b, _c, _d, _e, _f, _g;
377
377
  const knex = this.ensureKnex();
378
378
  if (autoConfigureShipSlap) {
379
- // Auto-configure SHIP and SLAP services
380
379
  this.configureTopicManager('tm_ship', new DiscoveryServices.SHIPTopicManager());
381
380
  this.configureTopicManager('tm_slap', new DiscoveryServices.SLAPTopicManager());
382
381
  this.configureLookupServiceWithMongo('ls_ship', (db) => new DiscoveryServices.SHIPLookupService(new DiscoveryServices.SHIPStorage(db)));
383
382
  this.configureLookupServiceWithMongo('ls_slap', (db) => new DiscoveryServices.SLAPLookupService(new DiscoveryServices.SLAPStorage(db)));
384
383
  }
385
- // Wrap SHIP/SLAP lookup services with ban-aware wrappers if BanService is available.
386
- // This prevents GASP from re-syncing tokens whose domains or outpoints have been banned.
387
- if (this.banService !== undefined) {
388
- if (this.services.ls_ship !== undefined) {
389
- this.services.ls_ship = new BanAwareLookupWrapper_js_1.BanAwareLookupWrapper(this.services.ls_ship, this.banService, 'SHIP', this.logger);
390
- this.logger.log(chalk_1.default.blue('SHIP lookup service wrapped with ban-aware filter.'));
391
- }
392
- if (this.services.ls_slap !== undefined) {
393
- this.services.ls_slap = new BanAwareLookupWrapper_js_1.BanAwareLookupWrapper(this.services.ls_slap, this.banService, 'SLAP', this.logger);
394
- this.logger.log(chalk_1.default.blue('SLAP lookup service wrapped with ban-aware filter.'));
384
+ this.wrapBanAwareServices();
385
+ const syncConfig = this.buildSyncConfig();
386
+ const storage = new overlay_1.KnexStorage(knex);
387
+ this.migrationsToRun = [...overlay_1.KnexStorageMigrations.default, ...this.migrationsToRun];
388
+ const broadcaster = this.buildBroadcaster();
389
+ const advertiser = await this.buildAdvertiser();
390
+ this.engine = new overlay_1.Engine(this.managers, this.services, storage, (_a = this.engineConfig.chainTracker) !== null && _a !== void 0 ? _a : this.chainTracker, `https://${this.advertisableFQDN}`, this.network === 'test'
391
+ ? ((_b = this.engineConfig.shipTrackers) !== null && _b !== void 0 ? _b : sdk_1.DEFAULT_TESTNET_SLAP_TRACKERS)
392
+ : this.engineConfig.shipTrackers, this.resolveSlapTrackers(), broadcaster !== null && broadcaster !== void 0 ? broadcaster : this.engineConfig.broadcaster, advertiser, syncConfig, (_c = this.engineConfig.logTime) !== null && _c !== void 0 ? _c : false, (_d = this.engineConfig.logPrefix) !== null && _d !== void 0 ? _d : '[OVERLAY_ENGINE] ', (_e = this.engineConfig.throwOnBroadcastFailure) !== null && _e !== void 0 ? _e : false, (_f = this.engineConfig.overlayBroadcastFacilitator) !== null && _f !== void 0 ? _f : new sdk_1.HTTPSOverlayBroadcastFacilitator(), this.logger, (_g = this.engineConfig.suppressDefaultSyncAdvertisements) !== null && _g !== void 0 ? _g : true);
393
+ this.initServerWallet();
394
+ this.logger.log(chalk_1.default.green('Engine has been configured.'));
395
+ }
396
+ /** Wrap SHIP/SLAP with ban-aware filter if BanService is configured. */
397
+ wrapBanAwareServices() {
398
+ if (this.banService === undefined)
399
+ return;
400
+ for (const key of ['ls_ship', 'ls_slap']) {
401
+ if (this.services[key] !== undefined) {
402
+ const label = key === 'ls_ship' ? 'SHIP' : 'SLAP';
403
+ this.services[key] = new BanAwareLookupWrapper_js_1.BanAwareLookupWrapper(this.services[key], this.banService, label, this.logger);
404
+ this.logger.log(chalk_1.default.blue(`${label} lookup service wrapped with ban-aware filter.`));
395
405
  }
396
406
  }
397
- // Construct a default sync configuration, in case the user doesn't want GASP at all:
398
- let syncConfig = {};
399
- if (!this.enableGASPSync) {
400
- // For each manager, disable sync
401
- for (const managerName of Object.keys(this.managers)) {
402
- syncConfig[managerName] = false;
403
- }
407
+ }
408
+ /** Build the sync config based on enableGASPSync and engineConfig. */
409
+ buildSyncConfig() {
410
+ var _a;
411
+ if (this.enableGASPSync) {
412
+ return (_a = this.engineConfig.syncConfiguration) !== null && _a !== void 0 ? _a : {};
404
413
  }
405
- else {
406
- // If the user provided a syncConfiguration, use that. Otherwise default to an empty object.
407
- syncConfig = (_a = this.engineConfig.syncConfiguration) !== null && _a !== void 0 ? _a : {};
414
+ const syncConfig = {};
415
+ for (const name of Object.keys(this.managers)) {
416
+ syncConfig[name] = false;
408
417
  }
409
- // Build the actual Storage
410
- const storage = new overlay_1.KnexStorage(knex);
411
- // Include the KnexStorage migrations
412
- this.migrationsToRun = [...overlay_1.KnexStorageMigrations.default, ...this.migrationsToRun];
413
- // Prepare broadcaster if arcApiKey is set
414
- let broadcaster;
415
- if (typeof this.arcApiKey === 'string') {
416
- broadcaster = new sdk_1.ARC(
417
- // We hard-code some ARC URLs for now, but we should make this configurable later.
418
- this.network === 'test' ? 'https://arc-test.taal.com' : 'https://arc.taal.com', {
419
- apiKey: this.arcApiKey
420
- });
418
+ return syncConfig;
419
+ }
420
+ /** Build the ARC broadcaster if an API key is configured. */
421
+ buildBroadcaster() {
422
+ if (typeof this.arcApiKey !== 'string')
423
+ return undefined;
424
+ const arcUrl = this.network === 'test' ? 'https://arc-test.taal.com' : 'https://arc.taal.com';
425
+ return new sdk_1.ARC(arcUrl, { apiKey: this.arcApiKey });
426
+ }
427
+ /** Resolve the SLAP trackers from config or network defaults. */
428
+ resolveSlapTrackers() {
429
+ if (Array.isArray(this.engineConfig.slapTrackers))
430
+ return this.engineConfig.slapTrackers;
431
+ return this.network === 'test' ? sdk_1.DEFAULT_TESTNET_SLAP_TRACKERS : sdk_1.DEFAULT_SLAP_TRACKERS;
432
+ }
433
+ /** Build the WalletAdvertiser (or use user-provided one). */
434
+ async buildAdvertiser() {
435
+ if (this.engineConfig.advertiser !== undefined)
436
+ return this.engineConfig.advertiser;
437
+ const storageBase = this.network === 'test'
438
+ ? 'https://staging-storage.babbage.systems'
439
+ : 'https://storage.babbage.systems';
440
+ try {
441
+ return new DiscoveryServices.WalletAdvertiser(this.network, this.privateKey, storageBase, `https://${this.advertisableFQDN}`);
421
442
  }
422
- // Prepare advertiser if not set by the user
423
- let advertiser = this.engineConfig.advertiser;
424
- if (typeof advertiser === 'undefined') {
425
- try {
426
- advertiser = new DiscoveryServices.WalletAdvertiser(this.network, this.privateKey, this.network === 'test' // For now, we hard-code some storage servers. In the future, this needs to be configurable.
427
- ? 'https://staging-storage.babbage.systems'
428
- : 'https://storage.babbage.systems',
429
- // Until multiple protocols (like https+bsvauth+smf) are fully supported, HTTPS is the one to always use.
430
- `https://${this.advertisableFQDN}`);
431
- }
432
- catch (e) {
433
- this.logger.log(`Advertiser not initialized for FQDN ${this.advertisableFQDN} - SHIP and SLAP will be disabled.`);
434
- }
443
+ catch (e) {
444
+ this.logger.log(`Advertiser not initialized for FQDN ${this.advertisableFQDN} - SHIP and SLAP will be disabled. Reason: ${e}`);
445
+ return undefined;
435
446
  }
436
- // Construct the Engine with any advanced config overrides. Fallback to defaults.
437
- this.engine = new overlay_1.Engine(this.managers, this.services, storage,
438
- // chainTracker
439
- typeof this.engineConfig.chainTracker !== 'undefined'
440
- ? this.engineConfig.chainTracker
441
- : this.chainTracker,
442
- // hostingURL
443
- `https://${this.advertisableFQDN}`,
444
- // shipTrackers
445
- this.network === 'test'
446
- ? ((_b = this.engineConfig.shipTrackers) !== null && _b !== void 0 ? _b : sdk_1.DEFAULT_TESTNET_SLAP_TRACKERS)
447
- : this.engineConfig.shipTrackers,
448
- // slapTrackers
449
- Array.isArray(this.engineConfig.slapTrackers)
450
- ? this.engineConfig.slapTrackers
451
- : this.network === 'test'
452
- ? sdk_1.DEFAULT_TESTNET_SLAP_TRACKERS
453
- : sdk_1.DEFAULT_SLAP_TRACKERS,
454
- // broadcaster
455
- broadcaster !== null && broadcaster !== void 0 ? broadcaster : this.engineConfig.broadcaster,
456
- // advertiser
457
- advertiser,
458
- // syncConfiguration
459
- syncConfig,
460
- // logTime
461
- (_c = this.engineConfig.logTime) !== null && _c !== void 0 ? _c : false,
462
- // logPrefix
463
- (_d = this.engineConfig.logPrefix) !== null && _d !== void 0 ? _d : '[OVERLAY_ENGINE] ',
464
- // throwOnBroadcastFailure
465
- (_e = this.engineConfig.throwOnBroadcastFailure) !== null && _e !== void 0 ? _e : false,
466
- // overlayBroadcastFacilitator
467
- (_f = this.engineConfig.overlayBroadcastFacilitator) !== null && _f !== void 0 ? _f : new sdk_1.HTTPSOverlayBroadcastFacilitator(),
468
- // logger
469
- this.logger,
470
- // suppressDefaultSyncAdvertisements
471
- (_g = this.engineConfig.suppressDefaultSyncAdvertisements) !== null && _g !== void 0 ? _g : true);
472
- // Create the server wallet for BSV mutual authentication.
473
- // This uses the same private key as the WalletAdvertiser.
447
+ }
448
+ /** Initialize the server wallet for BSV mutual authentication. */
449
+ initServerWallet() {
450
+ var _a;
474
451
  try {
475
452
  const keyDeriver = new sdk_1.KeyDeriver(new sdk_1.PrivateKey(this.privateKey, 'hex'));
476
453
  const storageManager = new wallet_toolbox_client_1.WalletStorageManager(keyDeriver.identityKey);
477
454
  const signer = new wallet_toolbox_client_1.WalletSigner(this.network, keyDeriver, storageManager);
478
455
  const services = new wallet_toolbox_client_1.Services(this.network);
479
- const wallet = new wallet_toolbox_client_1.Wallet(signer, services);
480
- this.serverWallet = wallet;
481
- // Auto-set the admin identity key from the server's own key if not configured
482
- if (typeof this.adminIdentityKey === 'undefined') {
483
- this.adminIdentityKey = keyDeriver.identityKey;
484
- }
456
+ this.serverWallet = new wallet_toolbox_client_1.Wallet(signer, services);
457
+ (_a = this.adminIdentityKey) !== null && _a !== void 0 ? _a : (this.adminIdentityKey = keyDeriver.identityKey);
485
458
  this.logger.log(chalk_1.default.blue('Server wallet initialized for BSV mutual authentication.'));
486
459
  }
487
460
  catch (e) {
488
- this.logger.log(chalk_1.default.yellow('Server wallet could not be initialized. BSV auth will not be available.'));
461
+ this.logger.log(chalk_1.default.yellow(`Server wallet could not be initialized. BSV auth will not be available. Reason: ${e}`));
489
462
  }
490
- this.logger.log(chalk_1.default.green('Engine has been configured.'));
491
463
  }
492
464
  /**
493
465
  * Ensures that Knex is configured and returns it.
494
466
  * @throws Error if Knex is not configured
495
467
  */
496
468
  ensureKnex() {
497
- if (typeof this.knex === 'undefined') {
498
- throw new Error('You must configure your SQL database with the .configureKnex() method first!');
469
+ if (this.knex === undefined) {
470
+ throw new TypeError('You must configure your SQL database with the .configureKnex() method first!');
499
471
  }
500
472
  return this.knex;
501
473
  }
@@ -504,8 +476,8 @@ class OverlayExpress {
504
476
  * @throws Error if MongoDB is not configured
505
477
  */
506
478
  ensureMongo() {
507
- if (typeof this.mongoDb === 'undefined') {
508
- throw new Error('You must configure your MongoDB connection with the .configureMongo() method first!');
479
+ if (this.mongoDb === undefined) {
480
+ throw new TypeError('You must configure your MongoDB connection with the .configureMongo() method first!');
509
481
  }
510
482
  return this.mongoDb;
511
483
  }
@@ -514,8 +486,8 @@ class OverlayExpress {
514
486
  * @throws Error if the Engine is not configured
515
487
  */
516
488
  ensureEngine() {
517
- if (typeof this.engine === 'undefined') {
518
- throw new Error('You must configure your Overlay Services engine with the .configureEngine() method first!');
489
+ if (this.engine === undefined) {
490
+ throw new TypeError('You must configure your Overlay Services engine with the .configureEngine() method first!');
519
491
  }
520
492
  return this.engine;
521
493
  }
@@ -533,6 +505,71 @@ class OverlayExpress {
533
505
  autoBanOnRemoval: this.janitorConfig.autoBanOnRemoval
534
506
  });
535
507
  }
508
+ /** Ban a domain and remove all its SHIP/SLAP records from MongoDB. */
509
+ async handleBanDomain(res, value, reason) {
510
+ await this.banService.banDomain(value, reason);
511
+ const db = this.ensureMongo();
512
+ const [shipDeleted, slapDeleted] = await Promise.all([
513
+ db.collection('shipRecords').deleteMany({ domain: value }),
514
+ db.collection('slapRecords').deleteMany({ domain: value })
515
+ ]);
516
+ return res.status(200).json({
517
+ status: 'success',
518
+ message: `Domain "${value}" banned. Removed ${shipDeleted.deletedCount} SHIP and ${slapDeleted.deletedCount} SLAP records.`
519
+ });
520
+ }
521
+ /** Parse outpoint string, ban it, and evict it from all lookup services. */
522
+ async handleBanOutpoint(res, engine, value, reason) {
523
+ const dotIndex = value.lastIndexOf('.');
524
+ if (dotIndex === -1) {
525
+ return res.status(400).json({ status: 'error', message: 'Outpoint format must be "txid.outputIndex"' });
526
+ }
527
+ const txid = value.substring(0, dotIndex);
528
+ const outputIndex = Number.parseInt(value.substring(dotIndex + 1));
529
+ if (Number.isNaN(outputIndex)) {
530
+ return res.status(400).json({ status: 'error', message: 'Invalid outputIndex in outpoint' });
531
+ }
532
+ await this.banService.banOutpoint(txid, outputIndex, reason);
533
+ await this.evictFromServices(engine, txid, outputIndex);
534
+ return res.status(200).json({
535
+ status: 'success',
536
+ message: `Outpoint "${value}" banned and evicted from lookup services.`
537
+ });
538
+ }
539
+ /** Evict an output from a specific service or all services (silent per-service errors). */
540
+ async evictFromServices(engine, txid, outputIndex, service) {
541
+ if (typeof service === 'string') {
542
+ const svc = engine.lookupServices[service];
543
+ if (svc !== undefined)
544
+ await svc.outputEvicted(txid, outputIndex);
545
+ return;
546
+ }
547
+ for (const svc of Object.values(engine.lookupServices)) {
548
+ try {
549
+ await svc.outputEvicted(txid, outputIndex);
550
+ }
551
+ catch { /* best-effort */ }
552
+ }
553
+ }
554
+ /** Look up the domain of an outpoint from SHIP or SLAP records. */
555
+ async lookupDomainForOutpoint(txid, outputIndex) {
556
+ var _a;
557
+ const db = this.ensureMongo();
558
+ const [shipRecord, slapRecord] = await Promise.all([
559
+ db.collection('shipRecords').findOne({ txid, outputIndex }),
560
+ db.collection('slapRecords').findOne({ txid, outputIndex })
561
+ ]);
562
+ return ((_a = shipRecord === null || shipRecord === void 0 ? void 0 : shipRecord.domain) !== null && _a !== void 0 ? _a : slapRecord === null || slapRecord === void 0 ? void 0 : slapRecord.domain);
563
+ }
564
+ /** Ban a domain and delete all SHIP/SLAP records for it. */
565
+ async banDomainAndRemoveRecords(domain, reason) {
566
+ await this.banService.banDomain(domain, reason);
567
+ const db = this.ensureMongo();
568
+ await Promise.all([
569
+ db.collection('shipRecords').deleteMany({ domain }),
570
+ db.collection('slapRecords').deleteMany({ domain })
571
+ ]);
572
+ }
536
573
  async runHealthCheck(definition) {
537
574
  var _a, _b;
538
575
  const startedAt = Date.now();
@@ -583,8 +620,8 @@ class OverlayExpress {
583
620
  scope: 'ready',
584
621
  critical: true,
585
622
  handler: async () => {
586
- if (typeof this.engine === 'undefined') {
587
- throw new Error('Overlay engine is not configured');
623
+ if (this.engine === undefined) {
624
+ throw new TypeError('Overlay engine is not configured');
588
625
  }
589
626
  return {
590
627
  status: 'ok',
@@ -601,8 +638,8 @@ class OverlayExpress {
601
638
  critical: true,
602
639
  handler: async () => {
603
640
  var _a, _b, _c;
604
- if (typeof this.knex === 'undefined') {
605
- throw new Error('Knex is not configured');
641
+ if (this.knex === undefined) {
642
+ throw new TypeError('Knex is not configured');
606
643
  }
607
644
  await this.knex.raw('select 1 as ok');
608
645
  return {
@@ -618,8 +655,8 @@ class OverlayExpress {
618
655
  scope: 'ready',
619
656
  critical: true,
620
657
  handler: async () => {
621
- if (typeof this.mongoDb === 'undefined') {
622
- throw new Error('MongoDB is not configured');
658
+ if (this.mongoDb === undefined) {
659
+ throw new TypeError('MongoDB is not configured');
623
660
  }
624
661
  await this.mongoDb.command({ ping: 1 });
625
662
  return {
@@ -670,7 +707,7 @@ class OverlayExpress {
670
707
  port: this.port,
671
708
  network: this.network,
672
709
  startedAt: (_c = this.startTime) === null || _c === void 0 ? void 0 : _c.toISOString(),
673
- uptimeMs: typeof this.startTime === 'undefined' ? 0 : Date.now() - this.startTime.getTime(),
710
+ uptimeMs: this.startTime === undefined ? 0 : Date.now() - this.startTime.getTime(),
674
711
  topicManagerCount: Object.keys(this.managers).length,
675
712
  lookupServiceCount: Object.keys(this.services).length
676
713
  },
@@ -699,7 +736,7 @@ class OverlayExpress {
699
736
  this.logger.log(chalk_1.default.magenta.bold(`Incoming Request: ${String(req.method)} ${String(req.originalUrl)}`));
700
737
  // Pretty-print headers
701
738
  this.logger.log(chalk_1.default.cyan('Headers:'));
702
- this.logger.log(util_1.default.inspect(req.headers, { colors: true, depth: null }));
739
+ this.logger.log(node_util_1.default.inspect(req.headers, { colors: true, depth: null }));
703
740
  // Handle request body
704
741
  if (req.body != null && Object.keys(req.body).length > 0) {
705
742
  let bodyContent;
@@ -733,7 +770,7 @@ class OverlayExpress {
733
770
  const duration = Date.now() - startTime;
734
771
  this.logger.log(chalk_1.default.magenta.bold(`Outgoing Response: ${String(req.method)} ${String(req.originalUrl)} - Status: ${String(res.statusCode)} - Duration: ${String(duration)}ms`));
735
772
  this.logger.log(chalk_1.default.cyan('Response Headers:'));
736
- this.logger.log(util_1.default.inspect(res.getHeaders(), { colors: true, depth: null }));
773
+ this.logger.log(node_util_1.default.inspect(res.getHeaders(), { colors: true, depth: null }));
737
774
  // Handle response body
738
775
  if (responseBody != null) {
739
776
  let bodyContent;
@@ -916,7 +953,7 @@ class OverlayExpress {
916
953
  const topicsHeader = req.headers['x-topics'];
917
954
  const includesOffChain = req.headers['x-includes-off-chain-values'] === 'true';
918
955
  if (typeof topicsHeader !== 'string') {
919
- throw new Error('Missing x-topics header');
956
+ throw new TypeError('Missing x-topics header');
920
957
  }
921
958
  const topics = JSON.parse(topicsHeader);
922
959
  let offChainValues;
@@ -1178,7 +1215,7 @@ class OverlayExpress {
1178
1215
  data: {
1179
1216
  nodeName: this.name,
1180
1217
  network: this.network,
1181
- uptime: this.startTime !== undefined ? Date.now() - this.startTime.getTime() : 0,
1218
+ uptime: this.startTime != null ? Date.now() - this.startTime.getTime() : 0,
1182
1219
  startedAt: (_c = this.startTime) === null || _c === void 0 ? void 0 : _c.toISOString(),
1183
1220
  shipRecordCount: shipCount,
1184
1221
  slapRecordCount: slapCount,
@@ -1211,9 +1248,9 @@ class OverlayExpress {
1211
1248
  const db = this.ensureMongo();
1212
1249
  const collection = db.collection('shipRecords');
1213
1250
  const search = typeof req.query.search === 'string' ? req.query.search : undefined;
1214
- const rawPage = parseInt(req.query.page, 10);
1251
+ const rawPage = Number.parseInt(req.query.page, 10);
1215
1252
  const page = Math.max(1, Number.isNaN(rawPage) ? 1 : rawPage);
1216
- const rawLimit = parseInt(req.query.limit, 10);
1253
+ const rawLimit = Number.parseInt(req.query.limit, 10);
1217
1254
  const limit = Math.min(200, Math.max(1, Number.isNaN(rawLimit) ? 50 : rawLimit));
1218
1255
  const skip = (page - 1) * limit;
1219
1256
  const query = {};
@@ -1254,9 +1291,9 @@ class OverlayExpress {
1254
1291
  const db = this.ensureMongo();
1255
1292
  const collection = db.collection('slapRecords');
1256
1293
  const search = typeof req.query.search === 'string' ? req.query.search : undefined;
1257
- const rawPage = parseInt(req.query.page, 10);
1294
+ const rawPage = Number.parseInt(req.query.page, 10);
1258
1295
  const page = Math.max(1, Number.isNaN(rawPage) ? 1 : rawPage);
1259
- const rawLimit = parseInt(req.query.limit, 10);
1296
+ const rawLimit = Number.parseInt(req.query.limit, 10);
1260
1297
  const limit = Math.min(200, Math.max(1, Number.isNaN(rawLimit) ? 50 : rawLimit));
1261
1298
  const skip = (page - 1) * limit;
1262
1299
  const query = {};
@@ -1330,45 +1367,9 @@ class OverlayExpress {
1330
1367
  return res.status(400).json({ status: 'error', message: 'value is required' });
1331
1368
  }
1332
1369
  if (type === 'domain') {
1333
- await this.banService.banDomain(value, reason);
1334
- // Also remove any existing records for this domain from SHIP and SLAP
1335
- const db = this.ensureMongo();
1336
- const [shipDeleted, slapDeleted] = await Promise.all([
1337
- db.collection('shipRecords').deleteMany({ domain: value }),
1338
- db.collection('slapRecords').deleteMany({ domain: value })
1339
- ]);
1340
- return res.status(200).json({
1341
- status: 'success',
1342
- message: `Domain "${value}" banned. Removed ${shipDeleted.deletedCount} SHIP and ${slapDeleted.deletedCount} SLAP records.`
1343
- });
1344
- }
1345
- else {
1346
- // Parse outpoint: "txid.outputIndex"
1347
- const dotIndex = value.lastIndexOf('.');
1348
- if (dotIndex === -1) {
1349
- return res.status(400).json({ status: 'error', message: 'Outpoint format must be "txid.outputIndex"' });
1350
- }
1351
- const txid = value.substring(0, dotIndex);
1352
- const outputIndex = parseInt(value.substring(dotIndex + 1));
1353
- if (isNaN(outputIndex)) {
1354
- return res.status(400).json({ status: 'error', message: 'Invalid outputIndex in outpoint' });
1355
- }
1356
- await this.banService.banOutpoint(txid, outputIndex, reason);
1357
- // Also evict from lookup services
1358
- const services = Object.values(engine.lookupServices);
1359
- for (const service of services) {
1360
- try {
1361
- await service.outputEvicted(txid, outputIndex);
1362
- }
1363
- catch {
1364
- continue;
1365
- }
1366
- }
1367
- return res.status(200).json({
1368
- status: 'success',
1369
- message: `Outpoint "${value}" banned and evicted from lookup services.`
1370
- });
1370
+ return await this.handleBanDomain(res, value, reason);
1371
1371
  }
1372
+ return await this.handleBanOutpoint(res, engine, value, reason);
1372
1373
  }
1373
1374
  catch (error) {
1374
1375
  return res.status(400).json({
@@ -1441,55 +1442,30 @@ class OverlayExpress {
1441
1442
  this.app.post('/admin/remove-token', checkAdminAuth, (req, res) => {
1442
1443
  ;
1443
1444
  (async () => {
1444
- var _a;
1445
1445
  try {
1446
1446
  const { txid, outputIndex, service, ban, banDomain: shouldBanDomain } = req.body;
1447
1447
  if (typeof txid !== 'string' || typeof outputIndex !== 'number') {
1448
1448
  return res.status(400).json({ status: 'error', message: 'txid (string) and outputIndex (number) are required' });
1449
1449
  }
1450
- // Get the domain before removing (for ban option)
1450
+ // Look up domain before eviction if needed for banning
1451
1451
  let removedDomain;
1452
1452
  if (shouldBanDomain === true || ban === true) {
1453
- const db = this.ensureMongo();
1454
- const shipRecord = await db.collection('shipRecords').findOne({ txid, outputIndex });
1455
- const slapRecord = await db.collection('slapRecords').findOne({ txid, outputIndex });
1456
- removedDomain = ((_a = shipRecord === null || shipRecord === void 0 ? void 0 : shipRecord.domain) !== null && _a !== void 0 ? _a : slapRecord === null || slapRecord === void 0 ? void 0 : slapRecord.domain);
1457
- }
1458
- // Evict from specified service or all services
1459
- if (typeof service === 'string') {
1460
- const svc = engine.lookupServices[service];
1461
- if (svc !== undefined) {
1462
- await svc.outputEvicted(txid, outputIndex);
1463
- }
1464
- }
1465
- else {
1466
- const services = Object.values(engine.lookupServices);
1467
- for (const svc of services) {
1468
- try {
1469
- await svc.outputEvicted(txid, outputIndex);
1470
- }
1471
- catch {
1472
- continue;
1473
- }
1474
- }
1453
+ removedDomain = await this.lookupDomainForOutpoint(txid, outputIndex);
1475
1454
  }
1476
- // Ban the outpoint if requested
1455
+ await this.evictFromServices(engine, txid, outputIndex, service);
1477
1456
  if (ban === true && this.banService !== undefined) {
1478
1457
  await this.banService.banOutpoint(txid, outputIndex, 'Manually removed by admin', removedDomain);
1479
1458
  }
1480
- // Ban the domain if requested
1481
1459
  if (shouldBanDomain === true && typeof removedDomain === 'string' && this.banService !== undefined) {
1482
- await this.banService.banDomain(removedDomain, 'Domain banned by admin via token removal');
1483
- // Remove all records for this domain
1484
- const banDb = this.ensureMongo();
1485
- await Promise.all([
1486
- banDb.collection('shipRecords').deleteMany({ domain: removedDomain }),
1487
- banDb.collection('slapRecords').deleteMany({ domain: removedDomain })
1488
- ]);
1460
+ await this.banDomainAndRemoveRecords(removedDomain, 'Domain banned by admin via token removal');
1489
1461
  }
1462
+ const banMsg = ban === true ? ' Outpoint banned.' : '';
1463
+ const domainMsg = shouldBanDomain === true && typeof removedDomain === 'string'
1464
+ ? ` Domain "${removedDomain}" banned.`
1465
+ : '';
1490
1466
  return res.status(200).json({
1491
1467
  status: 'success',
1492
- message: `Token ${txid}.${outputIndex} removed.${ban === true ? ' Outpoint banned.' : ''}${shouldBanDomain === true && typeof removedDomain === 'string' ? ` Domain "${removedDomain}" banned.` : ''}`
1468
+ message: `Token ${txid}.${outputIndex} removed.${banMsg}${domainMsg}`
1493
1469
  });
1494
1470
  }
1495
1471
  catch (error) {
@@ -1563,9 +1539,9 @@ class OverlayExpress {
1563
1539
  }
1564
1540
  else {
1565
1541
  const services = Object.values(engine.lookupServices);
1566
- for (let i = 0; i < services.length; i++) {
1542
+ for (const service of services) {
1567
1543
  try {
1568
- await services[i].outputEvicted(req.body.txid, req.body.outputIndex);
1544
+ await service.outputEvicted(req.body.txid, req.body.outputIndex);
1569
1545
  }
1570
1546
  catch {
1571
1547
  continue;