Skip to content

Commit 4aa858f

Browse files
authored
Stratconn 6646/other trait groups support (#3668)
* added other traits group support * single dropdown for traits * fix traitGroups response * added includeTraits * fix snapshots * change to profile identifiers * added test * update comment * check incorrect format key * reject profiles with invalid trait format * update desc * multiStatusResponse all invalid profiles * removed sent+body during validation * handle perform function * fix ExecuteInput * perform err handling * fix responses * remove redundant tests
1 parent 155ff1e commit 4aa858f

5 files changed

Lines changed: 697 additions & 275 deletions

File tree

packages/destination-actions/src/destinations/memora-internal/upsertProfile.types.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ export interface Payload {
1414
*/
1515
memora_store: string
1616
/**
17-
* Contact identifiers (email and/or phone). At least one identifier is required.
17+
* Profile identifiers (email and/or phone). At least one identifier is required. These identifiers are stored in the Contact trait group.
1818
*/
19-
contact_identifiers: {
19+
profile_identifiers: {
2020
/**
2121
* User email address
2222
*/
@@ -27,9 +27,9 @@ export interface Payload {
2727
phone?: string
2828
}
2929
/**
30-
* Contact traits for the profile. At least one trait is required. These fields are dynamically loaded from the selected Memora Store.
30+
* Traits for the profile from all trait groups. At least one trait is required. These fields are dynamically loaded from the selected Memora Store. When manually entering keys, use the format "TraitGroupName.$.traitName" (e.g., "Contact.$.firstName", "PurchaseHistory.$.lastPurchaseDate").
3131
*/
32-
contact_traits: {
32+
profile_traits: {
3333
[k: string]: unknown
3434
}
3535
}

packages/destination-actions/src/destinations/memora/__tests__/snapshot.test.ts

Lines changed: 7 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ describe(`Testing snapshot for ${destinationSlug} destination:`, () => {
3535
const mapping = {
3636
...event.properties,
3737
memora_store: 'test-store-id',
38-
contact_identifiers: {
38+
profile_identifiers: {
3939
4040
},
41-
contact_traits: {
42-
firstName: 'Test'
41+
profile_traits: {
42+
'Contact.$.firstName': 'Test'
4343
}
4444
}
4545

@@ -80,12 +80,12 @@ describe(`Testing snapshot for ${destinationSlug} destination:`, () => {
8080
const mapping = {
8181
...event.properties,
8282
memora_store: 'test-store-id',
83-
contact_identifiers: {
83+
profile_identifiers: {
8484
8585
},
86-
contact_traits: {
87-
firstName: 'Test',
88-
lastName: 'User'
86+
profile_traits: {
87+
'Contact.$.firstName': 'Test',
88+
'Contact.$.lastName': 'User'
8989
}
9090
}
9191

@@ -107,64 +107,5 @@ describe(`Testing snapshot for ${destinationSlug} destination:`, () => {
107107
expect(rawBody).toMatchSnapshot()
108108
}
109109
})
110-
111-
it(`${actionSlug} action - should throw error when memora_store is missing`, async () => {
112-
const seedName = `${destinationSlug}#${actionSlug}`
113-
const action = destination.actions[actionSlug]
114-
const [eventData, settingsData] = generateTestData(seedName, destination, action, true)
115-
116-
const event = createTestEvent({
117-
properties: eventData
118-
})
119-
120-
const mapping = {
121-
...event.properties,
122-
contact_identifiers: {
123-
124-
},
125-
contact_traits: {
126-
firstName: 'Test'
127-
}
128-
}
129-
130-
await expect(
131-
testDestination.testAction(actionSlug, {
132-
event: event,
133-
mapping: mapping,
134-
settings: settingsData,
135-
auth: undefined
136-
})
137-
).rejects.toThrow()
138-
})
139-
140-
it(`${actionSlug} action - should throw error when profile has no traits`, async () => {
141-
const seedName = `${destinationSlug}#${actionSlug}`
142-
const action = destination.actions[actionSlug]
143-
const [eventData, settingsData] = generateTestData(seedName, destination, action, true)
144-
145-
nock(/.*/).persist().get(/.*/).reply(200)
146-
nock(/.*/).persist().post(/.*/).reply(202)
147-
nock(/.*/).persist().put(/.*/).reply(202)
148-
149-
const event = createTestEvent({
150-
properties: eventData
151-
})
152-
153-
const mapping = {
154-
...event.properties,
155-
memora_store: 'test-store-id',
156-
contact_identifiers: {},
157-
contact_traits: {}
158-
}
159-
160-
await expect(
161-
testDestination.testAction(actionSlug, {
162-
event: event,
163-
mapping: mapping,
164-
settings: settingsData,
165-
auth: undefined
166-
})
167-
).rejects.toThrow('No valid profiles found for import')
168-
})
169110
}
170111
})

0 commit comments

Comments
 (0)