A service in front of a hub needs four things: start a flow, follow it, read what a detached run produced, and decide approvals. This is that surface, plus the part a gateway cannot test without: a fake hub that speaks the same service from the same .proto files and can be scripted into every failure a real hub produces. Errors carry the hub's own class (chain-error-kind), a coarse family, and reachedHub, which separates a refused connection from a hub that reports a dependency as down. Both arrive as gRPC UNAVAILABLE, and a gateway that shows 'service not reachable' for the second one lies to its users. The .proto files are carried verbatim and loaded at runtime, so no generated code can drift from the contract; two guards hold the copies in place, and a skew suite runs the same client against a real hub binary. 32 hermetic tests plus 4 against a real hub. Signed-off-by: Dr. Stefan Flemming <sf@flemming.it>
42 lines
1 KiB
JSON
42 lines
1 KiB
JSON
{
|
|
"name": "chain-client-sdk-ts",
|
|
"version": "0.1.0",
|
|
"description": "TypeScript client for a Ch∆In hub: run flows, follow them, decide approvals.",
|
|
"license": "Apache-2.0",
|
|
"author": "Dr. Stefan Flemming <chain@flemming.ai>",
|
|
"type": "module",
|
|
"engines": {
|
|
"node": ">=20.11"
|
|
},
|
|
"main": "./dist/index.js",
|
|
"types": "./dist/index.d.ts",
|
|
"exports": {
|
|
".": {
|
|
"types": "./dist/index.d.ts",
|
|
"default": "./dist/index.js"
|
|
},
|
|
"./fake-hub": {
|
|
"types": "./dist/fake_hub.d.ts",
|
|
"default": "./dist/fake_hub.js"
|
|
}
|
|
},
|
|
"files": [
|
|
"dist",
|
|
"proto",
|
|
"README.md",
|
|
"LICENSE"
|
|
],
|
|
"scripts": {
|
|
"build": "tsc -p tsconfig.json",
|
|
"test": "tsc -p tsconfig.test.json && node --test --test-timeout=30000 \"build-test/test/*.test.js\"",
|
|
"check": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json --noEmit"
|
|
},
|
|
"dependencies": {
|
|
"@grpc/grpc-js": "^1.14.0",
|
|
"@grpc/proto-loader": "^0.8.0"
|
|
},
|
|
"devDependencies": {
|
|
"@types/node": "^22.10.0",
|
|
"typescript": "^5.9.0"
|
|
}
|
|
}
|