Introduce minimal VG-Core module registry
Dieser Commit ist enthalten in:
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
"background": {
|
"background": {
|
||||||
"scripts": [
|
"scripts": [
|
||||||
|
"src/core/module-registry.js",
|
||||||
"src/background/db/db-constants.js",
|
"src/background/db/db-constants.js",
|
||||||
"src/background/db/db-core.js",
|
"src/background/db/db-core.js",
|
||||||
"src/background/gvl/gvl-vendor-normalizer.js",
|
"src/background/gvl/gvl-vendor-normalizer.js",
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
console.log("VendorGet-IV background loaded");
|
console.log("VendorGet-IV background loaded");
|
||||||
|
|
||||||
|
globalThis.VGCoreModuleRegistry.registerModule({
|
||||||
|
id: "vg-iv",
|
||||||
|
name: "VG-IV",
|
||||||
|
description: "Consent, TCF, GVL and evidence observation module",
|
||||||
|
kind: "evidence",
|
||||||
|
status: "active",
|
||||||
|
});
|
||||||
|
|
||||||
const OFFICIAL_IAB_GVL_URL =
|
const OFFICIAL_IAB_GVL_URL =
|
||||||
"https://vendor-list.consensu.org/v3/vendor-list.json";
|
"https://vendor-list.consensu.org/v3/vendor-list.json";
|
||||||
const EVIDENCE_RECORDING_SOURCE = "vendorget_background_mirror";
|
const EVIDENCE_RECORDING_SOURCE = "vendorget_background_mirror";
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
(function () {
|
||||||
|
const modules = new Map();
|
||||||
|
|
||||||
|
function validateModuleDefinition(moduleDefinition) {
|
||||||
|
if (!moduleDefinition || typeof moduleDefinition !== "object") {
|
||||||
|
throw new TypeError("moduleDefinition must be an object");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
typeof moduleDefinition.id !== "string" ||
|
||||||
|
moduleDefinition.id.trim() === ""
|
||||||
|
) {
|
||||||
|
throw new TypeError("moduleDefinition.id is required");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
typeof moduleDefinition.name !== "string" ||
|
||||||
|
moduleDefinition.name.trim() === ""
|
||||||
|
) {
|
||||||
|
throw new TypeError("moduleDefinition.name is required");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function cloneModuleDefinition(moduleDefinition) {
|
||||||
|
return { ...moduleDefinition };
|
||||||
|
}
|
||||||
|
|
||||||
|
globalThis.VGCoreModuleRegistry = {
|
||||||
|
registerModule(moduleDefinition) {
|
||||||
|
validateModuleDefinition(moduleDefinition);
|
||||||
|
|
||||||
|
const storedModuleDefinition = cloneModuleDefinition(moduleDefinition);
|
||||||
|
modules.set(storedModuleDefinition.id, storedModuleDefinition);
|
||||||
|
|
||||||
|
return cloneModuleDefinition(storedModuleDefinition);
|
||||||
|
},
|
||||||
|
|
||||||
|
getModules() {
|
||||||
|
return Array.from(modules.values(), cloneModuleDefinition);
|
||||||
|
},
|
||||||
|
|
||||||
|
getModuleById(moduleId) {
|
||||||
|
return modules.has(moduleId)
|
||||||
|
? cloneModuleDefinition(modules.get(moduleId))
|
||||||
|
: null;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
})();
|
||||||
In neuem Issue referenzieren
Einen Benutzer sperren