refactor(actions): adopt endpoint client in document service reads

This commit is contained in:
2026-03-25 06:43:51 +00:00
parent 6e6a104dd9
commit 17be69323e
2 changed files with 82 additions and 69 deletions
+48 -69
View File
@@ -3,6 +3,7 @@ import { BASE_URL } from "../core/env";
import { consoleLogger } from "../core/logger"; import { consoleLogger } from "../core/logger";
import { hashAPIPath } from "../core/hash"; import { hashAPIPath } from "../core/hash";
import { buildHashedQueryUrl } from "../clients/relayClient"; import { buildHashedQueryUrl } from "../clients/relayClient";
import { getJson } from "../clients/endpointClient";
export const getAwaitingSubmissionFromBlob = (containerName) => { export const getAwaitingSubmissionFromBlob = (containerName) => {
return axios return axios
@@ -40,27 +41,32 @@ export const getRepsFromBlob = (containerName) => {
}; };
export const getRepsFromBlobProxy = async (containerName) => { export const getRepsFromBlobProxy = async (containerName) => {
try { return getJson(
const res = await axios.get( "/api/file/getrepsblobproxy?container=" + containerName
"/api/file/getrepsblobproxy?container=" + containerName ).catch((error) => {
);
return res.data;
} catch (error) {
consoleLogger(error); consoleLogger(error);
} });
}; };
export const getAwaitingSubmissionFromBlobProxy = async (containerName) => { export const getAwaitingSubmissionFromBlobProxy = async (containerName) => {
try { return getJson(
const res = await axios.get( BASE_URL +
BASE_URL + "/api/file/getawaitingsubmissionfromblobproxy?container=" +
"/api/file/getawaitingsubmissionfromblobproxy?container=" + containerName
containerName ).catch((error) => {
);
return res.data;
} catch (error) {
consoleLogger(error); consoleLogger(error);
} });
};
export const getFilesFromBlobproxy = (containerName, casefolderID) => {
return getJson(
"/api/file/getbloblistproxy?container=" +
containerName +
"&casefolderID=" +
casefolderID
).catch((error) => {
consoleLogger(error);
});
}; };
export const deleteAwaitingSubmissionsFromBlob = ( export const deleteAwaitingSubmissionsFromBlob = (
@@ -298,41 +304,20 @@ export const getFilesFromBlob = (containerName, casefolderID) => {
}); });
}; };
export const getFilesFromBlobproxy = (containerName, casefolderID) => {
return axios
.get(
"/api/file/getbloblistproxy?container=" +
containerName +
"&casefolderID=" +
casefolderID
)
.then((res) => {
return res.data;
})
.catch((error) => {
consoleLogger(error);
});
};
export const getFilesFromBlobHashed = ( export const getFilesFromBlobHashed = (
containerName, containerName,
getblobshash, getblobshash,
casefolderID casefolderID
) => { ) => {
return axios return getJson(
.get( "/api/file/getbloblist?container=" +
"/api/file/getbloblist?container=" + containerName +
containerName + "&casefolderID=" +
"&casefolderID=" + casefolderID +
casefolderID + getblobshash
getblobshash ).catch((error) => {
) consoleLogger(error);
.then((res) => { });
return res.data;
})
.catch((error) => {
consoleLogger(error);
});
}; };
export const deleteBlob = async ( export const deleteBlob = async (
@@ -404,24 +389,21 @@ export const downloadBlob = (containerName, blobName) => {
}; };
export const getProgressFromBlob = async (containerName, casereference) => { export const getProgressFromBlob = async (containerName, casereference) => {
try { return getJson(
const res = await axios.get( BASE_URL +
BASE_URL + "/api/file/getprogressobjblob?container=" +
encodeURIComponent(containerName) +
"&casefolderID=" +
encodeURIComponent(casereference) +
hashAPIPath(
"/api/file/getprogressobjblob?container=" + "/api/file/getprogressobjblob?container=" +
encodeURIComponent(containerName) + encodeURIComponent(containerName) +
"&casefolderID=" + "&casefolderID=" +
encodeURIComponent(casereference) + encodeURIComponent(casereference)
hashAPIPath( )
"/api/file/getprogressobjblob?container=" + ).catch((error) => {
encodeURIComponent(containerName) +
"&casefolderID=" +
encodeURIComponent(casereference)
)
);
return res.data;
} catch (error) {
consoleLogger(error); consoleLogger(error);
} });
}; };
export const createContainerProxy = (containerName) => { export const createContainerProxy = (containerName) => {
@@ -430,12 +412,9 @@ export const createContainerProxy = (containerName) => {
containerName + containerName +
hashAPIPath("/api/file/setupcontainer?ident=" + containerName); hashAPIPath("/api/file/setupcontainer?ident=" + containerName);
return axios return getJson(BASE_URL + queryUrl).catch((error) => {
.get(BASE_URL + queryUrl) consoleLogger(error);
.then((res) => res.data)
.catch((error) => {
consoleLogger(error);
return JSON.stringify(error); return JSON.stringify(error);
}); });
}; };
+34
View File
@@ -1600,3 +1600,37 @@ Validation:
Follow-ups: Follow-ups:
- Optional next bounded slice: begin selective `requestJson` adoption for remaining config-based calls in `documentDirectService` where hash flow is already centralized. - Optional next bounded slice: begin selective `requestJson` adoption for remaining config-based calls in `documentDirectService` where hash flow is already centralized.
---
### CL-044: TASK22260 next slice — document direct service low-risk getJson adoption
date: 2026-03-25
author: Cline
scope: `actions/services/documentDirectService.js`
type: change
rationale: Continue incremental façade/client rollout by migrating low-risk document service GET wrappers that already return JSON and do not alter hash-signing semantics.
impact: Reduces duplicated axios `.get(...).then(res => res.data)` boilerplate and aligns document retrieval helpers with shared endpoint client usage.
status: completed
Summary:
- Added `getJson` usage in selected document service helpers:
- `getRepsFromBlobProxy`
- `getAwaitingSubmissionFromBlobProxy`
- `getFilesFromBlobproxy`
- `getFilesFromBlobHashed`
- `getProgressFromBlob`
- `createContainerProxy`
- Preserved existing behavior contracts:
- same query composition and hash query fragments
- same catch-path logging and return conventions (including JSON string return in `createContainerProxy` error path)
- Left hash-sensitive delete/upload/generation flows unchanged in this slice.
Validation:
- `npm run lint` -> warnings only (pre-existing `react-hooks/exhaustive-deps`; no new lint errors)
Follow-ups:
- Optional next bounded slice: migrate selected `requestJson`-eligible upload/generation helpers in `documentDirectService` (non-download paths) while preserving multipart/blob behavior.