TASK22269: consolidate azurestorage hash metadata mapping

This commit is contained in:
2026-03-25 14:27:52 +00:00
parent fcce6a3978
commit 8744d3dafc
2 changed files with 76 additions and 65 deletions
+43 -65
View File
@@ -84,6 +84,31 @@ const buildGetBlobListQueryPath = ({ containerName, casefolderID }) => {
); );
}; };
const buildHashMetadataPaths = ({ containerName, casefolderID, blobname }) => {
return {
"hashedfilepath": hashAPIPath(
buildDownloadBlobQueryPath({
containerName,
casefolderID,
blobname
})
),
"hasheddeletepath": hashAPIPath(
buildDeleteBlobQueryPath({
containerName,
casefolderID,
blobname
})
),
"hashgetblobs": hashAPIPath(
buildGetBlobListQueryPath({
containerName,
casefolderID
})
)
};
};
export const createContainerSas = async (containerName) => { export const createContainerSas = async (containerName) => {
// Get environment variables // Get environment variables
@@ -266,33 +291,18 @@ export const getBlobs = async (containerName, casefolderID) => {
encodeURIComponent(casefolderID) + encodeURIComponent(casefolderID) +
"&blobname=" + "&blobname=" +
encodeURIComponent(blob.name), encodeURIComponent(blob.name),
"hashedfilepath": hashAPIPath( ...buildHashMetadataPaths({
buildDownloadBlobQueryPath({ containerName,
containerName, casefolderID,
casefolderID, blobname: blob.name.split("/")[2]
blobname: blob.name.split("/")[2] }),
})
),
"deletepath": "deletepath":
"/api/file/deleteblob?container=" + "/api/file/deleteblob?container=" +
containerName + containerName +
"&casefolderID=" + "&casefolderID=" +
encodeURIComponent(casefolderID) + encodeURIComponent(casefolderID) +
"&blobname=" + "&blobname=" +
encodeURIComponent(blob.name.split("/")[2]), encodeURIComponent(blob.name.split("/")[2])
"hasheddeletepath": hashAPIPath(
buildDeleteBlobQueryPath({
containerName,
casefolderID,
blobname: blob.name.split("/")[2]
})
),
"hashgetblobs": hashAPIPath(
buildGetBlobListQueryPath({
containerName,
casefolderID
})
)
}); });
} }
//console.log("blobObj:", blobObj); //console.log("blobObj:", blobObj);
@@ -1296,26 +1306,11 @@ export const getProgressBlobs = async (containerName, caseReference) => {
"contentLength": blob.properties.contentLength, "contentLength": blob.properties.contentLength,
"contentType": blob.contentType, "contentType": blob.contentType,
"lastModified": blob.properties.lastModified, "lastModified": blob.properties.lastModified,
"hashedfilepath": hashAPIPath( ...buildHashMetadataPaths({
buildDownloadBlobQueryPath({ containerName,
containerName, casefolderID: caseReference,
casefolderID: caseReference, blobname: blob.name.split("/")[1]
blobname: blob.name.split("/")[1] })
})
),
"hasheddeletepath": hashAPIPath(
buildDeleteBlobQueryPath({
containerName,
casefolderID: caseReference,
blobname: blob.name.split("/")[1]
})
),
"hashgetblobs": hashAPIPath(
buildGetBlobListQueryPath({
containerName,
casefolderID: caseReference
})
)
}); });
} }
@@ -1503,14 +1498,12 @@ export const getRepsFilesBlobs = async (
) + ) +
"&blobname=" + "&blobname=" +
encodeURIComponent(blob.name.split("/")[3]), encodeURIComponent(blob.name.split("/")[3]),
"hashedfilepath": hashAPIPath( ...buildHashMetadataPaths({
buildDownloadBlobQueryPath({ containerName,
containerName, casefolderID:
casefolderID: blob.name.split("/")[0] + "/" + blob.name.split("/")[1],
blob.name.split("/")[0] + "/" + blob.name.split("/")[1], blobname: blob.name.split("/")[3]
blobname: blob.name.split("/")[3] }),
})
),
"deletepath": "deletepath":
"/api/file/deleteblob?container=" + "/api/file/deleteblob?container=" +
containerName + containerName +
@@ -1519,22 +1512,7 @@ export const getRepsFilesBlobs = async (
"/" + "/" +
blob.name.split("/")[1] + blob.name.split("/")[1] +
"&blobname=" + "&blobname=" +
blob.name.split("/")[3], blob.name.split("/")[3]
"hasheddeletepath": hashAPIPath(
buildDeleteBlobQueryPath({
containerName,
casefolderID:
blob.name.split("/")[0] + "/" + blob.name.split("/")[1],
blobname: blob.name.split("/")[3]
})
),
"hashgetblobs": hashAPIPath(
buildGetBlobListQueryPath({
containerName,
casefolderID:
blob.name.split("/")[0] + "/" + blob.name.split("/")[1]
})
)
}); });
} }
console.log("blobObj:", blobObj); console.log("blobObj:", blobObj);
+33
View File
@@ -2942,3 +2942,36 @@ Validation:
Follow-ups: Follow-ups:
- Remaining potential cleanups in `actions/azurestorage.js` are broader non-slice refactors (legacy logging verbosity, large function decomposition) and should be handled separately to keep risk bounded. - Remaining potential cleanups in `actions/azurestorage.js` are broader non-slice refactors (legacy logging verbosity, large function decomposition) and should be handled separately to keep risk bounded.
---
### CL-082: TASK22269 Slice B1.7 — azurestorage hash metadata helper consolidation
date: 2026-03-25
author: Cline
scope: `actions/azurestorage.js`
type: change
rationale: Continue bounded normalization by consolidating repeated hash metadata object field population into a single local helper.
impact: Reduces duplicated metadata field assembly and drift risk while preserving existing output shape and hash behavior.
status: completed
Summary:
- Added `buildHashMetadataPaths({ containerName, casefolderID, blobname })` helper.
- Replaced repeated per-object hash metadata assignment in:
- `getBlobs`
- `getProgressBlobs`
- `getRepsFilesBlobs`
- Preserved existing metadata contracts:
- keys unchanged: `hashedfilepath`, `hasheddeletepath`, `hashgetblobs`
- same encoded query path inputs and route semantics.
Validation:
- `npm run lint` -> pass with warnings only (pre-existing `react-hooks/exhaustive-deps`; no new lint errors)
- `node tests/phase22/index.test.cjs` -> pass
- `node tests/phase7/service-behaviour.test.cjs` -> pass (13/13)
Follow-ups:
- Any further `azurestorage.js` cleanup should remain bounded (e.g., logging-only normalization) and separated from behavior-affecting refactors.