@bsv/overlay-express 2.1.1 → 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.
package/mod.ts CHANGED
@@ -1,4 +1,13 @@
1
- export { default } from './src/OverlayExpress.js'
1
+ export {
2
+ default,
3
+ type EngineConfig,
4
+ type HealthCheckDefinition,
5
+ type HealthCheckHandler,
6
+ type HealthCheckResult,
7
+ type HealthConfig,
8
+ type HealthReport,
9
+ type HealthStatus
10
+ } from './src/OverlayExpress.js'
2
11
  export { BanService, type BannedRecord } from './src/BanService.js'
3
12
  export { BanAwareLookupWrapper } from './src/BanAwareLookupWrapper.js'
4
13
  export { JanitorService, type JanitorConfig, type JanitorReport, type HostHealthResult } from './src/JanitorService.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsv/overlay-express",
3
- "version": "2.1.1",
3
+ "version": "2.2.1",
4
4
  "type": "module",
5
5
  "description": "BSV Blockchain Overlay Express",
6
6
  "main": "dist/cjs/mod.js",
@@ -25,21 +25,10 @@
25
25
  "require": "./dist/cjs/src/*.js"
26
26
  }
27
27
  },
28
- "scripts": {
29
- "test": "jest",
30
- "test:watch": "jest --watch",
31
- "test:coverage": "jest --coverage",
32
- "lint": "ts-standard --fix src/**/*.ts",
33
- "lint:ci": "ts-standard src/**/*.ts",
34
- "build": "tsc -b && tsconfig-to-dual-package tsconfig.cjs.json",
35
- "dev": "tsc -b -w",
36
- "prepublish": "npm run build",
37
- "doc": "ts2md --inputFilename=mod.ts --outputFilename=API.md --filenameSubstring=API --firstHeadingLevel=1",
38
- "demo": "rm -r dist && npm run build && npx tsx demo-ui.ts"
39
- },
40
28
  "repository": {
41
29
  "type": "git",
42
- "url": "git+https://github.com/bsv-blockchain/overlay-express.git"
30
+ "url": "git+https://github.com/bsv-blockchain/ts-stack.git",
31
+ "directory": "packages/overlays/overlay-express"
43
32
  },
44
33
  "keywords": [
45
34
  "BSV",
@@ -51,30 +40,44 @@
51
40
  "author": "BSV Association",
52
41
  "license": "SEE LICENSE IN LICENSE.txt",
53
42
  "bugs": {
54
- "url": "https://github.com/bsv-blockchain/overlay-express/issues"
43
+ "url": "https://github.com/bsv-blockchain/ts-stack/issues"
55
44
  },
56
- "homepage": "https://github.com/bsv-blockchain/overlay-express#readme",
45
+ "homepage": "https://github.com/bsv-blockchain/ts-stack/tree/main/packages/overlays/overlay-express#readme",
57
46
  "devDependencies": {
47
+ "@jest/globals": "^30.3.0",
48
+ "@types/body-parser": "^1.19.5",
58
49
  "@types/express": "^5.0.0",
59
- "@types/jest": "^29.5.12",
60
- "jest": "^29.7.0",
61
- "ts-jest": "^29.1.1",
50
+ "@types/jest": "^30.0.0",
51
+ "jest": "^30.3.0",
52
+ "ts-jest": "^29.4.9",
62
53
  "ts-standard": "^12.0.2",
63
54
  "ts2md": "^0.2.0",
64
55
  "tsconfig-to-dual-package": "^1.2.0",
65
56
  "typescript": "^5.2.2"
66
57
  },
67
58
  "dependencies": {
68
- "@bsv/auth-express-middleware": "^2.0.2",
59
+ "@bsv/auth-express-middleware": "^2.0.5",
69
60
  "@bsv/overlay": "^2.0.2",
70
- "@bsv/overlay-discovery-services": "^2.0.2",
71
- "@bsv/sdk": "^2.0.4",
72
- "@bsv/wallet-toolbox-client": "^2.0.20",
61
+ "@bsv/overlay-discovery-services": "^2.0.3",
62
+ "@bsv/sdk": "^2.1.2",
63
+ "@bsv/wallet-toolbox-client": "^2.1.28",
73
64
  "body-parser": "^2.2.2",
74
65
  "chalk": "^5.6.2",
75
66
  "express": "^5.2.1",
76
67
  "knex": "^3.1.0",
77
68
  "mongodb": "^7.1.0",
78
69
  "uuid": "^13.0.0"
70
+ },
71
+ "scripts": {
72
+ "test": "jest",
73
+ "test:watch": "jest --watch",
74
+ "test:coverage": "jest --coverage",
75
+ "lint": "ts-standard --fix src/**/*.ts",
76
+ "lint:ci": "ts-standard src/**/*.ts",
77
+ "build": "tsc -b && tsconfig-to-dual-package tsconfig.cjs.json",
78
+ "dev": "tsc -b -w",
79
+ "prepublish": "npm run build",
80
+ "doc": "ts2md --inputFilename=mod.ts --outputFilename=API.md --filenameSubstring=API --firstHeadingLevel=1",
81
+ "demo": "rm -r dist && npm run build && npx tsx demo-ui.ts"
79
82
  }
80
- }
83
+ }
package/src/BanService.ts CHANGED
@@ -40,7 +40,7 @@ export class BanService {
40
40
  */
41
41
  private sanitize (value: unknown): string {
42
42
  if (typeof value !== 'string') {
43
- throw new Error('Invalid input: expected a string value')
43
+ throw new TypeError('Invalid input: expected a string value')
44
44
  }
45
45
  return value
46
46
  }
@@ -99,7 +99,7 @@ export class BanService {
99
99
  $set: {
100
100
  type: 'outpoint',
101
101
  value,
102
- domain: domain !== undefined ? this.sanitize(domain) : undefined,
102
+ domain: domain != null ? this.sanitize(domain) : undefined,
103
103
  reason: reason ?? 'Manually banned',
104
104
  bannedAt: new Date(),
105
105
  bannedBy
@@ -161,7 +161,7 @@ export class JanitorService {
161
161
  }
162
162
 
163
163
  const data = await response.json()
164
- const healthy = data?.status === 'ok'
164
+ const healthy = (data?.status === 'ok' && data?.ready !== false) || (data?.ready === true && data?.live !== false)
165
165
  return { healthy, responseTimeMs, statusCode: response.status, error: healthy ? undefined : 'Unexpected response' }
166
166
  } catch (error: any) {
167
167
  clearTimeout(timeout)