/** * @typedef {import('../src/activities/redactor.js').TransformationRuleDef} TransformationRuleDef * @typedef {import('../src/adapters/bidderFactory.js').TransformationRule} TransformationRule * @typedef {Object} ObjectGuard * @property {*} obj a view on the guarded object * @property {function(): void} verify a function that checks for and rolls back disallowed changes to the guarded object */ /** * Create a factory function for object guards using the given rules. * * An object guard is a pair {obj, verify} where: * - `obj` is a view on the guarded object that applies "redact" rules (the same rules used in activites/redactor.js) * - `verify` is a function that, when called, will check that the guarded object was not modified * in a way that violates any "write protect" rules, and rolls back any offending changes. * * This is meant to provide sandboxed version of a privacy-sensitive object, where reads * are filtered through redaction rules and writes are checked against write protect rules. * * @param {Array[TransformationRule]} rules * @return {function(*, ...[*]): ObjectGuard} */ export function objectGuard(rules: any): (arg0: any, ...args: [any][]) => ObjectGuard; /** * @param {TransformationRuleDef} ruleDef * @return {TransformationRule} */ export function writeProtectRule(ruleDef: TransformationRuleDef): TransformationRule; export type TransformationRuleDef = any; export type TransformationRule = any; export type ObjectGuard = { /** * a view on the guarded object */ obj: any; /** * a function that checks for and rolls back disallowed changes to the guarded object */ verify: () => void; };