Critical: - router: fail loudly (WRN-SERVICE-COLLISION) when two app/services files scan to the same service name, instead of silently letting directory-walk order pick a winner. Important: - server.ts: wrap a throwing input schema so its raw message cannot escape invoke(); returns RPC_INVALID and logs server-side instead. - client.ts: race timeoutMs against transport.call so a stalled transport cannot hang the caller; rejects with a ServiceError(RPC_TRANSPORT). - client.ts: the proxy returns undefined for undeclared properties (incl. then/catch/finally) instead of a function that throws, closing the await-client thenable trap. - gateway.ts / rpc-dispatch.ts: import RPC_PATH_PREFIX / RPC_INTERNAL_HEADER from @wrnexus/rpc instead of hardcoding local copies. - gateway.test.ts: cover the RPC-prefix edge block and internal-header stripping across casing variants. - http.test.ts / client.test.ts: cover anonymous-call header omission, the internal marker, the retryable-status sweep, network/malformed/HTML failures, AbortSignal propagation, the timeout path, and timer cleanup. Minor: - transport.ts: Object.hasOwn for handler lookup; note the entry-only abort check. - client.ts: wrap a missing/invalid WRNEXUS_RPC_SECRET as a ServiceError (RPC_IDENTITY) instead of a bare Error. - rpc/package.json: drop the unused @wrnexus/authz dependency. - server.ts: implement() now throws at construction time if a declared procedure has no own handler. Verified: reverting the service-collision check and the client timeout race each make their new test fail, then restore green. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
32 lines
725 B
JSON
32 lines
725 B
JSON
{
|
|
"name": "@wrnexus/rpc",
|
|
"version": "0.8.4",
|
|
"private": true,
|
|
"type": "module",
|
|
"main": "./src/index.ts",
|
|
"types": "./src/index.ts",
|
|
"exports": {
|
|
".": "./src/index.ts"
|
|
},
|
|
"description": "Typed request/response calls between workspace apps, carrying end-user identity.",
|
|
"files": [
|
|
"src",
|
|
"README.md"
|
|
],
|
|
"scripts": {
|
|
"test": "bun test",
|
|
"typecheck": "tsc --noEmit",
|
|
"check": "bun run typecheck && bun run test"
|
|
},
|
|
"dependencies": {
|
|
"@wrnexus/core": "workspace:*",
|
|
"@wrnexus/jwt": "workspace:*",
|
|
"@wrnexus/helpers": "workspace:*",
|
|
"@wrnexus/validation": "workspace:*"
|
|
},
|
|
"devDependencies": {
|
|
"@types/bun": "^1.3.14",
|
|
"typescript": "^5.9.2"
|
|
}
|
|
}
|