Link GVL snapshots to raw evidence records
Dieser Commit ist enthalten in:
@@ -619,7 +619,8 @@ function isGvlImportCandidate(value) {
|
||||
|
||||
async function handleFetchOfficialGvlMessage() {
|
||||
try {
|
||||
const { rawJson, responseStatus } = await fetchOfficialGvlJson();
|
||||
const { rawJson, rawGvlSha256, responseStatus } =
|
||||
await fetchOfficialGvlJson();
|
||||
|
||||
if (!isGvlImportCandidate(rawJson)) {
|
||||
return {
|
||||
@@ -633,6 +634,7 @@ async function handleFetchOfficialGvlMessage() {
|
||||
const result = await VendorGetGvlService.ingestGvlSnapshot(db, rawJson, {
|
||||
sourceUrl: OFFICIAL_IAB_GVL_URL,
|
||||
fetchedAt: new Date().toISOString(),
|
||||
rawGvlSha256: rawGvlSha256,
|
||||
diagnostics: {
|
||||
ingestionSource: "official_iab_fetch",
|
||||
responseStatus: responseStatus
|
||||
@@ -689,6 +691,7 @@ async function fetchOfficialGvlJson() {
|
||||
|
||||
return {
|
||||
rawJson: JSON.parse(rawBody),
|
||||
rawGvlSha256: rawGvlSha256,
|
||||
responseStatus: response.status
|
||||
};
|
||||
}
|
||||
@@ -773,7 +776,8 @@ async function runStartupGvlAutoUpdateCheck() {
|
||||
result: "started"
|
||||
});
|
||||
|
||||
const { rawJson, responseStatus } = await fetchOfficialGvlJson();
|
||||
const { rawJson, rawGvlSha256, responseStatus } =
|
||||
await fetchOfficialGvlJson();
|
||||
|
||||
if (!isGvlImportCandidate(rawJson)) {
|
||||
throw new Error("invalid_gvl_json");
|
||||
@@ -793,6 +797,7 @@ async function runStartupGvlAutoUpdateCheck() {
|
||||
{
|
||||
sourceUrl: OFFICIAL_IAB_GVL_URL,
|
||||
fetchedAt: new Date().toISOString(),
|
||||
rawGvlSha256: rawGvlSha256,
|
||||
diagnostics: {
|
||||
ingestionSource: "official_iab_auto_update",
|
||||
responseStatus: responseStatus,
|
||||
|
||||
@@ -50,11 +50,17 @@ function storeGvlRawEvidenceIfNew(db, rawEvidence) {
|
||||
});
|
||||
}
|
||||
|
||||
async function buildGvlSnapshotRecord(rawJson, sourceUrl, fetchedAt) {
|
||||
async function buildGvlSnapshotRecord(
|
||||
rawJson,
|
||||
sourceUrl,
|
||||
fetchedAt,
|
||||
rawGvlSha256
|
||||
) {
|
||||
const gvlJson = normalizeGvlSnapshotValueForMetadata(rawJson);
|
||||
|
||||
return {
|
||||
sha256: await calculateGvlSnapshotSha256(rawJson),
|
||||
rawGvlSha256: rawGvlSha256 ?? null,
|
||||
vendorListVersion: gvlJson?.vendorListVersion ?? null,
|
||||
gvlSpecificationVersion: gvlJson?.gvlSpecificationVersion ?? null,
|
||||
tcfPolicyVersion: gvlJson?.tcfPolicyVersion ?? null,
|
||||
@@ -129,7 +135,8 @@ async function ingestGvlSnapshot(db, rawJson, options = {}) {
|
||||
const snapshot = await buildGvlSnapshotRecord(
|
||||
rawJson,
|
||||
options.sourceUrl ?? null,
|
||||
options.fetchedAt ?? null
|
||||
options.fetchedAt ?? null,
|
||||
options.rawGvlSha256 ?? null
|
||||
);
|
||||
const storeResult = await storeGvlSnapshotIfNew(db, snapshot);
|
||||
const alreadyKnown = !storeResult.stored;
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren