Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,16 @@ export interface Payload {
profile_traits?: {
[k: string]: unknown
}
/**
* Per-field map of Segment trait names referenced by each directive (keyed by stored field key). Used by the control plane to wire up event-emitter enrichment. Set automatically — do not edit manually.
*/
segment_traits_by_field?: {
[k: string]: unknown
}
Comment thread
monutwilio marked this conversation as resolved.
/**
* Per-field map of Segment identifier names referenced by each directive (keyed by stored field key). Used by the control plane to wire up id_sync. Set automatically — do not edit manually.
*/
segment_identifiers_by_field?: {
[k: string]: unknown
}
Comment thread
monutwilio marked this conversation as resolved.
}
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,38 @@ describe('Memora.upsertProfile', () => {
})
})

it('should not include segment_traits_by_field or segment_identifiers_by_field in the outbound request', async () => {
const event = createTestEvent({
type: 'identify',
userId: 'user-123',
traits: { email: 'john@example.com', first_name: 'John' }
})

let capturedBody: Record<string, unknown> = {}

nock(BASE_URL)
.put(`/${API_VERSION}/Stores/test-store-id/Profiles/Bulk`, (body) => {
capturedBody = body as Record<string, unknown>
return true
})
.reply(202)

await testDestination.testAction('upsertProfile', {
event,
settings: defaultSettings,
mapping: {
...defaultMapping,
segment_traits_by_field: { 'Contact.$.first_name': ['first_name'] },
segment_identifiers_by_field: { 'Contact.$.email': ['email'] }
},
useDefaultMappings: true
})

const requestBodyStr = JSON.stringify(capturedBody)
expect(requestBodyStr).not.toContain('segment_traits_by_field')
expect(requestBodyStr).not.toContain('segment_identifiers_by_field')
})

describe('performBatch (multiple profiles)', () => {
it('should upsert multiple profiles in a single bulk request', async () => {
const events = [
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,38 @@ const action: ActionDefinition<Settings, Payload> = {
additionalProperties: true,
dynamic: true,
defaultObjectUI: 'keyvalue'
},
/**
* Used exclusively by the Segment control plane (actions-memora-internal destination) as part of the
* Conversation Memory Sync feature. The control plane writes this map when creating or updating a mapping,
* and reads it back to build the event-emitter enrichment mapping that ensures the referenced Segment traits
* are present in event payloads at runtime. Not consumed by this action itself — marked unsafe_hidden so it
* round-trips through subscription settings without being exposed or stripped.
*/
segment_traits_by_field: {
label: 'Segment Traits Used',
description:
'Per-field map of Segment trait names referenced by each directive (keyed by stored field key). Used by the control plane to wire up event-emitter enrichment. Set automatically — do not edit manually.',
type: 'object',
Comment thread
monutwilio marked this conversation as resolved.
Outdated
required: false,
additionalProperties: true,
unsafe_hidden: true
},
/**
* Used exclusively by the Segment control plane (actions-memora-internal destination) as part of the
* Conversation Memory Sync feature. The control plane writes this map when creating or updating a mapping,
* and reads it back to populate id_sync so that the declared Segment identifiers are available as external
* IDs at runtime. Not consumed by this action itself — marked unsafe_hidden so it round-trips through
* subscription settings without being exposed or stripped.
*/
segment_identifiers_by_field: {
label: 'Segment Identifiers Used',
description:
'Per-field map of Segment identifier names referenced by each directive (keyed by stored field key). Used by the control plane to wire up id_sync. Set automatically — do not edit manually.',
type: 'object',
required: false,
additionalProperties: true,
unsafe_hidden: true
}
},
dynamicFields: {
Expand Down