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 { hashAPIPath } from "../core/hash";
import { buildHashedQueryUrl } from "../clients/relayClient";
import { getJson } from "../clients/endpointClient";
export const getAwaitingSubmissionFromBlob = (containerName) => {
return axios
@@ -40,27 +41,32 @@ export const getRepsFromBlob = (containerName) => {
};
export const getRepsFromBlobProxy = async (containerName) => {
try {
const res = await axios.get(
"/api/file/getrepsblobproxy?container=" + containerName
);
return res.data;
} catch (error) {
return getJson(
"/api/file/getrepsblobproxy?container=" + containerName
).catch((error) => {
consoleLogger(error);
}
});
};
export const getAwaitingSubmissionFromBlobProxy = async (containerName) => {
try {
const res = await axios.get(
BASE_URL +
"/api/file/getawaitingsubmissionfromblobproxy?container=" +
containerName
);
return res.data;
} catch (error) {
return getJson(
BASE_URL +
"/api/file/getawaitingsubmissionfromblobproxy?container=" +
containerName
).catch((error) => {
consoleLogger(error);
}
});
};
export const getFilesFromBlobproxy = (containerName, casefolderID) => {
return getJson(
"/api/file/getbloblistproxy?container=" +
containerName +
"&casefolderID=" +
casefolderID
).catch((error) => {
consoleLogger(error);
});
};
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 = (
containerName,
getblobshash,
casefolderID
) => {
return axios
.get(
"/api/file/getbloblist?container=" +
containerName +
"&casefolderID=" +
casefolderID +
getblobshash
)
.then((res) => {
return res.data;
})
.catch((error) => {
consoleLogger(error);
});
return getJson(
"/api/file/getbloblist?container=" +
containerName +
"&casefolderID=" +
casefolderID +
getblobshash
).catch((error) => {
consoleLogger(error);
});
};
export const deleteBlob = async (
@@ -404,24 +389,21 @@ export const downloadBlob = (containerName, blobName) => {
};
export const getProgressFromBlob = async (containerName, casereference) => {
try {
const res = await axios.get(
BASE_URL +
return getJson(
BASE_URL +
"/api/file/getprogressobjblob?container=" +
encodeURIComponent(containerName) +
"&casefolderID=" +
encodeURIComponent(casereference) +
hashAPIPath(
"/api/file/getprogressobjblob?container=" +
encodeURIComponent(containerName) +
"&casefolderID=" +
encodeURIComponent(casereference) +
hashAPIPath(
"/api/file/getprogressobjblob?container=" +
encodeURIComponent(containerName) +
"&casefolderID=" +
encodeURIComponent(casereference)
)
);
return res.data;
} catch (error) {
encodeURIComponent(containerName) +
"&casefolderID=" +
encodeURIComponent(casereference)
)
).catch((error) => {
consoleLogger(error);
}
});
};
export const createContainerProxy = (containerName) => {
@@ -430,12 +412,9 @@ export const createContainerProxy = (containerName) => {
containerName +
hashAPIPath("/api/file/setupcontainer?ident=" + containerName);
return axios
.get(BASE_URL + queryUrl)
.then((res) => res.data)
.catch((error) => {
consoleLogger(error);
return getJson(BASE_URL + queryUrl).catch((error) => {
consoleLogger(error);
return JSON.stringify(error);
});
return JSON.stringify(error);
});
};
+34
View File
@@ -1600,3 +1600,37 @@ Validation:
Follow-ups:
- 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.