Skip to content

Commit 14abd6d

Browse files
committed
update test
1 parent f3abe1e commit 14abd6d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/core/src/destination-kit/action.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,13 @@ const isSyncMode = (value: unknown): value is SyncMode => {
248248
return syncModeTypes.find((validValue) => value === validValue) !== undefined
249249
}
250250

251+
const INTERNAL_HIDDEN_FIELDS = ['__segment_internal_sync_mode', '__segment_internal_matching_key']
252+
const removeInternalHiddenFields = (mapping: JSONLikeObject): JSONLikeObject => {
253+
return Object.keys(mapping).reduce((acc, key) => {
254+
return INTERNAL_HIDDEN_FIELDS.includes(key) ? acc : { ...acc, [key]: mapping[key] }
255+
}, {})
256+
}
257+
251258
/**
252259
* Action is the beginning step for all partner actions. Entrypoints always start with the
253260
* MapAndValidateInput step.
@@ -334,6 +341,8 @@ export class Action<Settings, Payload extends JSONLikeObject, AudienceSettings =
334341
results.push({ output: 'Payload validated' })
335342
}
336343

344+
payload = removeInternalHiddenFields(payload) as Payload
345+
337346
let hookOutputs = {}
338347
if (this.definition.hooks) {
339348
for (const hookType in this.definition.hooks) {
@@ -402,10 +411,11 @@ export class Action<Settings, Payload extends JSONLikeObject, AudienceSettings =
402411

403412
for (let i = 0; i < payloads.length; i++) {
404413
// Remove empty values (`null`, `undefined`, `''`) when not explicitly accepted
405-
const payload = removeEmptyValues(payloads[i], schema) as Payload
414+
let payload = removeEmptyValues(payloads[i], schema) as Payload
406415
// Validate payload schema
407416
try {
408417
validateSchema(payload, schema, validationOptions)
418+
payload = removeInternalHiddenFields(payload) as Payload
409419
} catch (e) {
410420
// Validation failed with an exception, record the filtered out event
411421
multiStatusResponse[i] = {

0 commit comments

Comments
 (0)