refactor(actions): extract shared relay client for direct services

This commit is contained in:
2026-03-25 06:14:23 +00:00
parent 5e51c2eb97
commit 6fa7cf9375
12 changed files with 112 additions and 88 deletions
+41
View File
@@ -1444,3 +1444,44 @@ Validation:
Follow-ups:
- P2-S3 planned slices are now complete; no further mandatory relay policy rollout slices remain for this stream.
---
### CL-039: TASK22260 actions façade increment — shared relay client extraction
date: 2026-03-25
author: Cline
scope: `actions/clients/{relayClient,index}.js`, `actions/services/{accountDirectService,portalDirectService,documentDirectService}.js`, `actions/index.js`, `actions/clients/README.md`
type: change
rationale: Continue Priority 1 façade decomposition by extracting duplicated hash-signing relay helper logic into a dedicated client module while preserving existing service/public export contracts.
impact: Reduces duplication and drift risk in security-sensitive relay signing helper logic without changing call-site behavior.
status: completed
Summary:
- Added a new shared client wrapper:
- `actions/clients/relayClient.js` exporting `buildHashedQueryUrl`
- Added `actions/clients/index.js` barrel and exposed client exports via `actions/index.js`.
- Updated direct services to consume shared relay client helper instead of duplicating local helper implementations:
- `actions/services/accountDirectService.js`
- `actions/services/portalDirectService.js`
- `actions/services/documentDirectService.js`
- Updated `actions/clients/README.md` to reflect the now-implemented relay client extraction and future incremental client split path.
Validation:
- `npm run lint` -> warnings only (pre-existing `react-hooks/exhaustive-deps`; no new lint errors)
- Verified no remaining duplicated local `buildHashedQueryUrl` definitions across `actions/services/*DirectService.js`
Follow-ups:
- Optional next TASK22260 increment: extract common axios invocation helpers into dedicated clients (`endpointClient`, `fileClient`, `notifyClient`) while keeping `actions/index.js` API stable.
Addendum (same TASK22260 slice):
- Added shared `endpointClient` with `getJson` and `requestJson` helpers (`actions/clients/endpointClient.js`) and exported it via `actions/clients/index.js`.
- Migrated additional direct services to consume shared endpoint client helpers:
- `actions/services/notifyDirectService.js` (POST via `requestJson`)
- `actions/services/integrationDirectService.js` (POST via `requestJson`)
- `actions/services/adminDirectService.js` (GET flows via `getJson`)
- Updated `actions/clients/README.md` to include `endpointClient` in current extracted clients.