Skip to content

Commit 40ac8c3

Browse files
MO-Thibaultclaude
andauthored
Mo/rtd proxy safe merge (#285)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 75c0415 commit 40ac8c3

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

lib/core/prebid/rtd.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,12 @@ function merge(config: RTDConfig, targetORTB2: ORTB2, sourceORTB2: ORTB2): numbe
249249
/* eslint-disable no-param-reassign */
250250
targetORTB2.user = targetORTB2.user ?? {};
251251
targetORTB2.user.ext = targetORTB2.user.ext ?? {};
252-
targetORTB2.user.ext.eids = targetORTB2.user.ext.eids ?? [];
253252
/* eslint-enable no-param-reassign */
253+
254+
// Use Object.getOwnPropertyDescriptor/defineProperty to bypass Prebid's ORTB2
255+
// Proxy whose get trap blocks direct reads of `eids`.
256+
const eidsDesc = Object.getOwnPropertyDescriptor(targetORTB2.user.ext, "eids");
257+
let currentEids: EID[] = Array.isArray(eidsDesc?.value) ? eidsDesc.value : [];
254258
let skipped = 0;
255259

256260
const eidsBySource =
@@ -267,8 +271,14 @@ function merge(config: RTDConfig, targetORTB2: ORTB2, sourceORTB2: ORTB2): numbe
267271
}
268272

269273
const mergeFn = mergeStrategy(config, eidSource);
270-
// eslint-disable-next-line no-param-reassign
271-
targetORTB2.user!.ext!.eids = mergeFn(targetORTB2.user!.ext!.eids!, eids);
274+
currentEids = mergeFn(currentEids, eids);
275+
});
276+
277+
Object.defineProperty(targetORTB2.user!.ext!, "eids", {
278+
value: currentEids,
279+
writable: true,
280+
enumerable: true,
281+
configurable: true,
272282
});
273283
return skipped;
274284
}

0 commit comments

Comments
 (0)