@segment/action-destinations 3.113.1-alpha.9 → 3.114.1-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/destinations/clevertap/index.js +1 -1
- package/dist/destinations/clevertap/index.js.map +1 -1
- package/dist/destinations/criteo-audiences/addUserToAudience/index.js +5 -5
- package/dist/destinations/criteo-audiences/addUserToAudience/index.js.map +1 -1
- package/dist/destinations/criteo-audiences/criteo-audiences.d.ts +2 -2
- package/dist/destinations/criteo-audiences/criteo-audiences.js +10 -5
- package/dist/destinations/criteo-audiences/criteo-audiences.js.map +1 -1
- package/dist/destinations/criteo-audiences/removeUserFromAudience/index.js +5 -5
- package/dist/destinations/criteo-audiences/removeUserFromAudience/index.js.map +1 -1
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js +3 -3
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js.map +1 -1
- package/dist/destinations/engage-messaging-twilio/sendSms/index.js +1 -1
- package/dist/destinations/engage-messaging-twilio/sendSms/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/generated-types.d.ts +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.js +5 -3
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.js.map +1 -1
- package/dist/destinations/index.js +2 -0
- package/dist/destinations/index.js.map +1 -1
- package/dist/destinations/linkedin-audiences/api/index.js +2 -2
- package/dist/destinations/linkedin-audiences/api/index.js.map +1 -1
- package/dist/destinations/linkedin-audiences/constants.d.ts +1 -0
- package/dist/destinations/linkedin-audiences/constants.js +2 -1
- package/dist/destinations/linkedin-audiences/constants.js.map +1 -1
- package/dist/destinations/linkedin-audiences/index.js +1 -1
- package/dist/destinations/linkedin-audiences/index.js.map +1 -1
- package/dist/destinations/linkedin-audiences/updateAudience/generated-types.d.ts +2 -0
- package/dist/destinations/linkedin-audiences/updateAudience/index.js +67 -28
- package/dist/destinations/linkedin-audiences/updateAudience/index.js.map +1 -1
- package/dist/destinations/loops/createOrUpdateContact/generated-types.d.ts +8 -0
- package/dist/destinations/loops/{createContact → createOrUpdateContact}/generated-types.js +0 -0
- package/dist/destinations/loops/createOrUpdateContact/generated-types.js.map +1 -0
- package/dist/destinations/loops/{createContact → createOrUpdateContact}/index.d.ts +0 -0
- package/dist/destinations/loops/createOrUpdateContact/index.js +82 -0
- package/dist/destinations/loops/createOrUpdateContact/index.js.map +1 -0
- package/dist/destinations/loops/index.js +2 -2
- package/dist/destinations/loops/index.js.map +1 -1
- package/dist/destinations/mixpanel/groupIdentifyUser/index.js +1 -1
- package/dist/destinations/mixpanel/groupIdentifyUser/index.js.map +1 -1
- package/dist/destinations/mixpanel/identifyUser/index.js.map +1 -1
- package/dist/destinations/mixpanel/index.js +1 -1
- package/dist/destinations/mixpanel/mixpanel-properties.js.map +1 -1
- package/dist/destinations/mixpanel/trackEvent/functions.js.map +1 -1
- package/dist/destinations/mixpanel/trackEvent/index.js.map +1 -1
- package/dist/destinations/mixpanel/trackPurchase/index.js +2 -0
- package/dist/destinations/mixpanel/trackPurchase/index.js.map +1 -1
- package/dist/destinations/qualtrics/qualtricsApiClient.js +1 -2
- package/dist/destinations/qualtrics/qualtricsApiClient.js.map +1 -1
- package/dist/destinations/salesforce-marketing-cloud/_tests_/apiEvent.test.d.ts +1 -0
- package/dist/destinations/salesforce-marketing-cloud/_tests_/apiEvent.test.js +84 -0
- package/dist/destinations/salesforce-marketing-cloud/_tests_/apiEvent.test.js.map +1 -0
- package/dist/destinations/salesforce-marketing-cloud/_tests_/contact.test.d.ts +1 -0
- package/dist/destinations/salesforce-marketing-cloud/_tests_/contact.test.js +59 -0
- package/dist/destinations/salesforce-marketing-cloud/_tests_/contact.test.js.map +1 -0
- package/dist/destinations/salesforce-marketing-cloud/_tests_/contactDataExtension.test.d.ts +1 -0
- package/dist/destinations/salesforce-marketing-cloud/_tests_/contactDataExtension.test.js +77 -0
- package/dist/destinations/salesforce-marketing-cloud/_tests_/contactDataExtension.test.js.map +1 -0
- package/dist/destinations/salesforce-marketing-cloud/_tests_/dataExtension.test.d.ts +1 -0
- package/dist/destinations/salesforce-marketing-cloud/_tests_/dataExtension.test.js +61 -0
- package/dist/destinations/salesforce-marketing-cloud/_tests_/dataExtension.test.js.map +1 -0
- package/dist/destinations/salesforce-marketing-cloud/apiEvent/generated-types.d.ts +7 -0
- package/dist/destinations/salesforce-marketing-cloud/apiEvent/generated-types.js +3 -0
- package/dist/destinations/salesforce-marketing-cloud/apiEvent/generated-types.js.map +1 -0
- package/dist/destinations/salesforce-marketing-cloud/apiEvent/index.d.ts +5 -0
- package/dist/destinations/salesforce-marketing-cloud/apiEvent/index.js +20 -0
- package/dist/destinations/salesforce-marketing-cloud/apiEvent/index.js.map +1 -0
- package/dist/destinations/{loops/createContact → salesforce-marketing-cloud/contact}/generated-types.d.ts +1 -1
- package/dist/destinations/salesforce-marketing-cloud/contact/generated-types.js +3 -0
- package/dist/destinations/salesforce-marketing-cloud/contact/generated-types.js.map +1 -0
- package/dist/destinations/salesforce-marketing-cloud/contact/index.d.ts +5 -0
- package/dist/destinations/salesforce-marketing-cloud/contact/index.js +22 -0
- package/dist/destinations/salesforce-marketing-cloud/contact/index.js.map +1 -0
- package/dist/destinations/salesforce-marketing-cloud/contactDataExtension/generated-types.d.ts +12 -0
- package/dist/destinations/salesforce-marketing-cloud/contactDataExtension/generated-types.js +3 -0
- package/dist/destinations/salesforce-marketing-cloud/contactDataExtension/generated-types.js.map +1 -0
- package/dist/destinations/salesforce-marketing-cloud/contactDataExtension/index.d.ts +5 -0
- package/dist/destinations/salesforce-marketing-cloud/contactDataExtension/index.js +37 -0
- package/dist/destinations/salesforce-marketing-cloud/contactDataExtension/index.js.map +1 -0
- package/dist/destinations/salesforce-marketing-cloud/dataExtension/generated-types.d.ts +11 -0
- package/dist/destinations/salesforce-marketing-cloud/dataExtension/generated-types.js +3 -0
- package/dist/destinations/salesforce-marketing-cloud/dataExtension/generated-types.js.map +1 -0
- package/dist/destinations/salesforce-marketing-cloud/dataExtension/index.d.ts +5 -0
- package/dist/destinations/salesforce-marketing-cloud/dataExtension/index.js +23 -0
- package/dist/destinations/salesforce-marketing-cloud/dataExtension/index.js.map +1 -0
- package/dist/destinations/salesforce-marketing-cloud/generated-types.d.ts +6 -0
- package/dist/destinations/salesforce-marketing-cloud/generated-types.js +3 -0
- package/dist/destinations/salesforce-marketing-cloud/generated-types.js.map +1 -0
- package/dist/destinations/salesforce-marketing-cloud/index.d.ts +4 -0
- package/dist/destinations/salesforce-marketing-cloud/index.js +71 -0
- package/dist/destinations/salesforce-marketing-cloud/index.js.map +1 -0
- package/dist/destinations/salesforce-marketing-cloud/sfmc-operations.d.ts +4 -0
- package/dist/destinations/salesforce-marketing-cloud/sfmc-operations.js +31 -0
- package/dist/destinations/salesforce-marketing-cloud/sfmc-operations.js.map +1 -0
- package/dist/destinations/salesforce-marketing-cloud/sfmc-properties.d.ts +10 -0
- package/dist/destinations/salesforce-marketing-cloud/sfmc-properties.js +59 -0
- package/dist/destinations/salesforce-marketing-cloud/sfmc-properties.js.map +1 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/generated-types.d.ts +3 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/index.js +4 -1
- package/dist/destinations/snap-conversions-api/reportConversionEvent/index.js.map +1 -1
- package/dist/destinations/snap-conversions-api/snap-capi-properties.d.ts +3 -0
- package/dist/destinations/snap-conversions-api/snap-capi-properties.js +21 -3
- package/dist/destinations/snap-conversions-api/snap-capi-properties.js.map +1 -1
- package/dist/destinations/twilio/sendSMS.types.d.ts +4 -0
- package/dist/destinations/twilio/sendSMS.types.js +3 -0
- package/dist/destinations/twilio/sendSMS.types.js.map +1 -0
- package/package.json +4 -4
- package/dist/destinations/loops/createContact/generated-types.js.map +0 -1
- package/dist/destinations/loops/createContact/index.js +0 -33
- package/dist/destinations/loops/createContact/index.js.map +0 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const nock_1 = __importDefault(require("nock"));
|
|
7
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
8
|
+
const index_1 = __importDefault(require("../index"));
|
|
9
|
+
const testDestination = actions_core_1.createTestIntegration(index_1.default);
|
|
10
|
+
const timestamp = '2022-05-12T15:21:15.449Z';
|
|
11
|
+
const settings = {
|
|
12
|
+
subdomain: 'test123',
|
|
13
|
+
client_id: 'test123',
|
|
14
|
+
client_secret: 'test123',
|
|
15
|
+
account_id: 'test123'
|
|
16
|
+
};
|
|
17
|
+
const event = actions_core_1.createTestEvent({
|
|
18
|
+
timestamp: timestamp,
|
|
19
|
+
userId: 'eric-15',
|
|
20
|
+
type: 'identify',
|
|
21
|
+
traits: {
|
|
22
|
+
contactKey: 'ericForman15'
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const requestUrl = `https://${settings.subdomain}.rest.marketingcloudapis.com/contacts/v1/contacts`;
|
|
26
|
+
describe('Salesforce Marketing Cloud', () => {
|
|
27
|
+
describe('Create Contact Action', () => {
|
|
28
|
+
it('Create a Contact', async () => {
|
|
29
|
+
nock_1.default(requestUrl).post('').reply(200, {});
|
|
30
|
+
const responses = await testDestination.testAction('contact', {
|
|
31
|
+
event,
|
|
32
|
+
settings,
|
|
33
|
+
mapping: {
|
|
34
|
+
contactKey: { '@path': '$.traits.contactKey' }
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
expect(responses[0].status).toBe(200);
|
|
38
|
+
expect(responses[0].options.body).toMatchInlineSnapshot(`"{\\"contactKey\\":\\"ericForman15\\",\\"attributeSets\\":[]}"`);
|
|
39
|
+
});
|
|
40
|
+
it('Create a Contact with Default', async () => {
|
|
41
|
+
nock_1.default(requestUrl).post('').reply(200, {});
|
|
42
|
+
const responses = await testDestination.testAction('contact', {
|
|
43
|
+
event,
|
|
44
|
+
settings,
|
|
45
|
+
useDefaultMappings: true
|
|
46
|
+
});
|
|
47
|
+
expect(responses[0].status).toBe(200);
|
|
48
|
+
expect(responses[0].options.body).toMatchInlineSnapshot(`"{\\"contactKey\\":\\"eric-15\\",\\"attributeSets\\":[]}"`);
|
|
49
|
+
});
|
|
50
|
+
it('Fail to create contact due to missing required field -> contactKey', async () => {
|
|
51
|
+
nock_1.default(requestUrl).post('').reply(400, {});
|
|
52
|
+
await expect(testDestination.testAction('contact', {
|
|
53
|
+
event,
|
|
54
|
+
settings
|
|
55
|
+
})).rejects.toThrowError(`The root value is missing the required field 'contactKey'.`);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=contact.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact.test.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce-marketing-cloud/_tests_/contact.test.ts"],"names":[],"mappings":";;;;;AAAA,gDAAuB;AACvB,wDAA8E;AAC9E,qDAAiC;AAGjC,MAAM,eAAe,GAAG,oCAAqB,CAAC,eAAU,CAAC,CAAA;AACzD,MAAM,SAAS,GAAG,0BAA0B,CAAA;AAC5C,MAAM,QAAQ,GAAa;IACzB,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,SAAS;IACpB,aAAa,EAAE,SAAS;IACxB,UAAU,EAAE,SAAS;CACtB,CAAA;AAED,MAAM,KAAK,GAAG,8BAAe,CAAC;IAC5B,SAAS,EAAE,SAAS;IACpB,MAAM,EAAE,SAAS;IACjB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE;QACN,UAAU,EAAE,cAAc;KAC3B;CACF,CAAC,CAAA;AAEF,MAAM,UAAU,GAAG,WAAW,QAAQ,CAAC,SAAS,mDAAmD,CAAA;AACnG,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;QACrC,EAAE,CAAC,kBAAkB,EAAE,KAAK,IAAI,EAAE;YAChC,cAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;YACxC,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC,UAAU,CAAC,SAAS,EAAE;gBAC5D,KAAK;gBACL,QAAQ;gBACR,OAAO,EAAE;oBACP,UAAU,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE;iBAC/C;aACF,CAAC,CAAA;YACF,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACrC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,qBAAqB,CACrD,gEAAgE,CACjE,CAAA;QACH,CAAC,CAAC,CAAA;QACF,EAAE,CAAC,+BAA+B,EAAE,KAAK,IAAI,EAAE;YAC7C,cAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;YACxC,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC,UAAU,CAAC,SAAS,EAAE;gBAC5D,KAAK;gBACL,QAAQ;gBACR,kBAAkB,EAAE,IAAI;aACzB,CAAC,CAAA;YACF,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACrC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,qBAAqB,CACrD,2DAA2D,CAC5D,CAAA;QACH,CAAC,CAAC,CAAA;QACF,EAAE,CAAC,oEAAoE,EAAE,KAAK,IAAI,EAAE;YAClF,cAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;YACxC,MAAM,MAAM,CACV,eAAe,CAAC,UAAU,CAAC,SAAS,EAAE;gBACpC,KAAK;gBACL,QAAQ;aACT,CAAC,CACH,CAAC,OAAO,CAAC,YAAY,CAAC,4DAA4D,CAAC,CAAA;QACtF,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const nock_1 = __importDefault(require("nock"));
|
|
7
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
8
|
+
const index_1 = __importDefault(require("../index"));
|
|
9
|
+
const testDestination = actions_core_1.createTestIntegration(index_1.default);
|
|
10
|
+
const timestamp = '2022-05-12T15:21:15.449Z';
|
|
11
|
+
const settings = {
|
|
12
|
+
subdomain: 'test123',
|
|
13
|
+
client_id: 'test123',
|
|
14
|
+
client_secret: 'test123',
|
|
15
|
+
account_id: 'test123'
|
|
16
|
+
};
|
|
17
|
+
const event = actions_core_1.createTestEvent({
|
|
18
|
+
timestamp: timestamp,
|
|
19
|
+
userId: 'harry-1',
|
|
20
|
+
type: 'identify',
|
|
21
|
+
traits: {
|
|
22
|
+
key: 'dataExtension12',
|
|
23
|
+
keys: {
|
|
24
|
+
contactKey: 'harryStyles1',
|
|
25
|
+
id: 'HS1'
|
|
26
|
+
},
|
|
27
|
+
values: {
|
|
28
|
+
First_Name: 'Harry',
|
|
29
|
+
Last_Name: 'Styles'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const requestUrl = `https://${settings.subdomain}.rest.marketingcloudapis.com/hub/v1/dataevents/key:dataExtension12/rowset`;
|
|
34
|
+
describe('Salesforce Marketing Cloud', () => {
|
|
35
|
+
describe('Contact Data Extension Action', () => {
|
|
36
|
+
it('Add Contact to Data Extension', async () => {
|
|
37
|
+
nock_1.default(requestUrl).post('').reply(200, {});
|
|
38
|
+
const responses = await testDestination.testAction('contactDataExtension', {
|
|
39
|
+
event,
|
|
40
|
+
settings,
|
|
41
|
+
mapping: {
|
|
42
|
+
key: { '@path': '$.traits.key' },
|
|
43
|
+
keys: { '@path': '$.traits.keys' },
|
|
44
|
+
values: { '@path': '$.traits.values' }
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
expect(responses[0].status).toBe(200);
|
|
48
|
+
expect(responses[0].options.body).toMatchInlineSnapshot(`"[{\\"keys\\":{\\"contactKey\\":\\"harryStyles1\\",\\"id\\":\\"HS1\\"},\\"values\\":{\\"First_Name\\":\\"Harry\\",\\"Last_Name\\":\\"Styles\\"}}]"`);
|
|
49
|
+
});
|
|
50
|
+
it('Add Contact to Data Extension with default', async () => {
|
|
51
|
+
nock_1.default(requestUrl).post('').reply(200, {});
|
|
52
|
+
const responses = await testDestination.testAction('contactDataExtension', {
|
|
53
|
+
event,
|
|
54
|
+
settings,
|
|
55
|
+
useDefaultMappings: true,
|
|
56
|
+
mapping: {
|
|
57
|
+
key: { '@path': '$.traits.key' },
|
|
58
|
+
values: { '@path': '$.traits.values' }
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
expect(responses[0].status).toBe(200);
|
|
62
|
+
expect(responses[0].options.body).toMatchInlineSnapshot(`"[{\\"keys\\":{\\"contactKey\\":\\"harry-1\\"},\\"values\\":{\\"First_Name\\":\\"Harry\\",\\"Last_Name\\":\\"Styles\\"}}]"`);
|
|
63
|
+
});
|
|
64
|
+
it('Fail to add contact to data extension due to missing key and id', async () => {
|
|
65
|
+
nock_1.default(requestUrl).post('').reply(400, {});
|
|
66
|
+
await expect(testDestination.testAction('contactDataExtension', {
|
|
67
|
+
event,
|
|
68
|
+
settings,
|
|
69
|
+
mapping: {
|
|
70
|
+
keys: { '@path': '$.traits.keys' },
|
|
71
|
+
values: { '@path': '$.traits.values' }
|
|
72
|
+
}
|
|
73
|
+
})).rejects.toThrowError(`In order to send an event to a data extension either Data Extension ID or Data Extension Key must be defined.`);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=contactDataExtension.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contactDataExtension.test.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce-marketing-cloud/_tests_/contactDataExtension.test.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const nock_1 = __importDefault(require("nock"));
|
|
7
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
8
|
+
const index_1 = __importDefault(require("../index"));
|
|
9
|
+
const testDestination = actions_core_1.createTestIntegration(index_1.default);
|
|
10
|
+
const timestamp = '2022-05-12T15:21:15.449Z';
|
|
11
|
+
const settings = {
|
|
12
|
+
subdomain: 'test123',
|
|
13
|
+
client_id: 'test123',
|
|
14
|
+
client_secret: 'test123',
|
|
15
|
+
account_id: 'test123'
|
|
16
|
+
};
|
|
17
|
+
const event = actions_core_1.createTestEvent({
|
|
18
|
+
timestamp: timestamp,
|
|
19
|
+
type: 'track',
|
|
20
|
+
userId: 'harry-1',
|
|
21
|
+
properties: {
|
|
22
|
+
id: '1234567890',
|
|
23
|
+
keys: {
|
|
24
|
+
id: 'HS1'
|
|
25
|
+
},
|
|
26
|
+
values: {
|
|
27
|
+
name: 'Harry Styles'
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const requestUrl = `https://${settings.subdomain}.rest.marketingcloudapis.com/hub/v1/dataevents/1234567890/rowset`;
|
|
32
|
+
describe('Salesforce Marketing Cloud', () => {
|
|
33
|
+
describe('Data Extension Action', () => {
|
|
34
|
+
it('Add Event to Data Extension', async () => {
|
|
35
|
+
nock_1.default(requestUrl).post('').reply(200, {});
|
|
36
|
+
const responses = await testDestination.testAction('dataExtension', {
|
|
37
|
+
event,
|
|
38
|
+
settings,
|
|
39
|
+
mapping: {
|
|
40
|
+
id: { '@path': '$.properties.id' },
|
|
41
|
+
keys: { '@path': '$.properties.keys' },
|
|
42
|
+
values: { '@path': '$.properties.values' }
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
expect(responses[0].status).toBe(200);
|
|
46
|
+
expect(responses[0].options.body).toMatchInlineSnapshot(`"[{\\"keys\\":{\\"id\\":\\"HS1\\"},\\"values\\":{\\"name\\":\\"Harry Styles\\"}}]"`);
|
|
47
|
+
});
|
|
48
|
+
it('Fail to add event to data extension due to missing key and id', async () => {
|
|
49
|
+
nock_1.default(requestUrl).post('').reply(400, {});
|
|
50
|
+
await expect(testDestination.testAction('dataExtension', {
|
|
51
|
+
event,
|
|
52
|
+
settings,
|
|
53
|
+
mapping: {
|
|
54
|
+
keys: { '@path': '$.properties.keys' },
|
|
55
|
+
values: { '@path': '$.properties.values' }
|
|
56
|
+
}
|
|
57
|
+
})).rejects.toThrowError(`In order to send an event to a data extension either Data Extension ID or Data Extension Key must be defined.`);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=dataExtension.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataExtension.test.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce-marketing-cloud/_tests_/dataExtension.test.ts"],"names":[],"mappings":";;;;;AAAA,gDAAuB;AACvB,wDAA8E;AAC9E,qDAAiC;AAGjC,MAAM,eAAe,GAAG,oCAAqB,CAAC,eAAU,CAAC,CAAA;AACzD,MAAM,SAAS,GAAG,0BAA0B,CAAA;AAC5C,MAAM,QAAQ,GAAa;IACzB,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,SAAS;IACpB,aAAa,EAAE,SAAS;IACxB,UAAU,EAAE,SAAS;CACtB,CAAA;AAED,MAAM,KAAK,GAAG,8BAAe,CAAC;IAC5B,SAAS,EAAE,SAAS;IACpB,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,SAAS;IACjB,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,IAAI,EAAE;YACJ,EAAE,EAAE,KAAK;SACV;QACD,MAAM,EAAE;YACN,IAAI,EAAE,cAAc;SACrB;KACF;CACF,CAAC,CAAA;AAEF,MAAM,UAAU,GAAG,WAAW,QAAQ,CAAC,SAAS,kEAAkE,CAAA;AAClH,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;QACrC,EAAE,CAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;YAC3C,cAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;YACxC,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC,UAAU,CAAC,eAAe,EAAE;gBAClE,KAAK;gBACL,QAAQ;gBACR,OAAO,EAAE;oBACP,EAAE,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE;oBAClC,IAAI,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE;oBACtC,MAAM,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE;iBAC3C;aACF,CAAC,CAAA;YACF,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACrC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,qBAAqB,CACrD,oFAAoF,CACrF,CAAA;QACH,CAAC,CAAC,CAAA;QACF,EAAE,CAAC,+DAA+D,EAAE,KAAK,IAAI,EAAE;YAC7E,cAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;YACxC,MAAM,MAAM,CACV,eAAe,CAAC,UAAU,CAAC,eAAe,EAAE;gBAC1C,KAAK;gBACL,QAAQ;gBACR,OAAO,EAAE;oBACP,IAAI,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE;oBACtC,MAAM,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE;iBAC3C;aACF,CAAC,CACH,CAAC,OAAO,CAAC,YAAY,CACpB,+GAA+G,CAChH,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce-marketing-cloud/apiEvent/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const sfmc_properties_1 = require("../sfmc-properties");
|
|
4
|
+
const action = {
|
|
5
|
+
title: 'Send API Event',
|
|
6
|
+
description: 'Send events into an existing Event Definition in Salesforce Marketing Cloud.',
|
|
7
|
+
fields: {
|
|
8
|
+
eventDefinitionKey: sfmc_properties_1.eventDefinitionKey,
|
|
9
|
+
contactKey: sfmc_properties_1.contactKeyAPIEvent,
|
|
10
|
+
data: sfmc_properties_1.eventData
|
|
11
|
+
},
|
|
12
|
+
perform: (request, { settings, payload }) => {
|
|
13
|
+
return request(`https://${settings.subdomain}.rest.marketingcloudapis.com/interaction/v1/events`, {
|
|
14
|
+
method: 'POST',
|
|
15
|
+
json: payload
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
exports.default = action;
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce-marketing-cloud/apiEvent/index.ts"],"names":[],"mappings":";;AAEA,wDAAsF;AAGtF,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,8EAA8E;IAC3F,MAAM,EAAE;QACN,kBAAkB,EAAE,oCAAkB;QACtC,UAAU,EAAE,oCAAkB;QAC9B,IAAI,EAAE,2BAAS;KAChB;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAC1C,OAAO,OAAO,CAAC,WAAW,QAAQ,CAAC,SAAS,oDAAoD,EAAE;YAChG,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,OAAO;SACd,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce-marketing-cloud/contact/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const sfmc_properties_1 = require("../sfmc-properties");
|
|
4
|
+
const action = {
|
|
5
|
+
title: 'Create Contact',
|
|
6
|
+
description: 'Create contacts in Salesforce Marketing Cloud.',
|
|
7
|
+
defaultSubscription: 'type = "identify"',
|
|
8
|
+
fields: {
|
|
9
|
+
contactKey: { ...sfmc_properties_1.contactKey, required: true }
|
|
10
|
+
},
|
|
11
|
+
perform: (request, { settings, payload }) => {
|
|
12
|
+
return request(`https://${settings.subdomain}.rest.marketingcloudapis.com/contacts/v1/contacts`, {
|
|
13
|
+
method: 'POST',
|
|
14
|
+
json: {
|
|
15
|
+
contactKey: payload.contactKey,
|
|
16
|
+
attributeSets: []
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.default = action;
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce-marketing-cloud/contact/index.ts"],"names":[],"mappings":";;AAEA,wDAA+C;AAG/C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,gDAAgD;IAC7D,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,UAAU,EAAE,EAAE,GAAG,4BAAU,EAAE,QAAQ,EAAE,IAAI,EAAE;KAC9C;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAC1C,OAAO,OAAO,CAAC,WAAW,QAAQ,CAAC,SAAS,mDAAmD,EAAE;YAC/F,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,aAAa,EAAE,EAAE;aAClB;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
package/dist/destinations/salesforce-marketing-cloud/contactDataExtension/generated-types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce-marketing-cloud/contactDataExtension/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const sfmc_properties_1 = require("../sfmc-properties");
|
|
4
|
+
const sfmc_operations_1 = require("../sfmc-operations");
|
|
5
|
+
const action = {
|
|
6
|
+
title: 'Contact Data Extension',
|
|
7
|
+
defaultSubscription: 'type = "identify"',
|
|
8
|
+
description: 'Upsert contact data as rows into an existing data extension in Salesforce Marketing Cloud.',
|
|
9
|
+
fields: {
|
|
10
|
+
key: sfmc_properties_1.key,
|
|
11
|
+
id: sfmc_properties_1.id,
|
|
12
|
+
keys: {
|
|
13
|
+
...sfmc_properties_1.keys,
|
|
14
|
+
properties: {
|
|
15
|
+
contactKey: {
|
|
16
|
+
label: 'Contact Key',
|
|
17
|
+
description: 'The unique identifier that you assign to a contact. Contact Key must be a Primary Key in the data extension that contains contact information.',
|
|
18
|
+
type: 'string',
|
|
19
|
+
required: true
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
default: {
|
|
23
|
+
contactKey: { '@path': '$.userId' }
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
values: sfmc_properties_1.values,
|
|
27
|
+
enable_batching: sfmc_properties_1.enable_batching
|
|
28
|
+
},
|
|
29
|
+
perform: async (request, { settings, payload }) => {
|
|
30
|
+
return sfmc_operations_1.upsertRows(request, settings.subdomain, [payload]);
|
|
31
|
+
},
|
|
32
|
+
performBatch: async (request, { settings, payload }) => {
|
|
33
|
+
return sfmc_operations_1.upsertRows(request, settings.subdomain, payload);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
exports.default = action;
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce-marketing-cloud/contactDataExtension/index.ts"],"names":[],"mappings":";;AAGA,wDAA2E;AAC3E,wDAA+C;AAE/C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,wBAAwB;IAC/B,mBAAmB,EAAE,mBAAmB;IACxC,WAAW,EAAE,4FAA4F;IACzG,MAAM,EAAE;QACN,GAAG,EAAE,qBAAG;QACR,EAAE,EAAE,oBAAE;QACN,IAAI,EAAE;YACJ,GAAG,sBAAI;YACP,UAAU,EAAE;gBACV,UAAU,EAAE;oBACV,KAAK,EAAE,aAAa;oBACpB,WAAW,EACT,gJAAgJ;oBAClJ,IAAI,EAAE,QAAQ;oBACd,QAAQ,EAAE,IAAI;iBACf;aACF;YACD,OAAO,EAAE;gBACP,UAAU,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;aACpC;SACF;QACD,MAAM,EAAE,wBAAM;QACd,eAAe,EAAE,iCAAe;KACjC;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAChD,OAAO,4BAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IAC3D,CAAC;IACD,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QACrD,OAAO,4BAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IACzD,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce-marketing-cloud/dataExtension/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const sfmc_properties_1 = require("../sfmc-properties");
|
|
4
|
+
const sfmc_operations_1 = require("../sfmc-operations");
|
|
5
|
+
const action = {
|
|
6
|
+
title: 'Send Event to Data Extension',
|
|
7
|
+
description: 'Upsert events as rows into an existing data extension in Salesforce Marketing Cloud.',
|
|
8
|
+
fields: {
|
|
9
|
+
key: sfmc_properties_1.key,
|
|
10
|
+
id: sfmc_properties_1.id,
|
|
11
|
+
keys: { ...sfmc_properties_1.keys, required: true },
|
|
12
|
+
values: sfmc_properties_1.values,
|
|
13
|
+
enable_batching: sfmc_properties_1.enable_batching
|
|
14
|
+
},
|
|
15
|
+
perform: async (request, { settings, payload }) => {
|
|
16
|
+
return sfmc_operations_1.upsertRows(request, settings.subdomain, [payload]);
|
|
17
|
+
},
|
|
18
|
+
performBatch: async (request, { settings, payload }) => {
|
|
19
|
+
return sfmc_operations_1.upsertRows(request, settings.subdomain, payload);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
exports.default = action;
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce-marketing-cloud/dataExtension/index.ts"],"names":[],"mappings":";;AAGA,wDAA2E;AAC3E,wDAA+C;AAE/C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,8BAA8B;IACrC,WAAW,EAAE,sFAAsF;IACnG,MAAM,EAAE;QACN,GAAG,EAAE,qBAAG;QACR,EAAE,EAAE,oBAAE;QACN,IAAI,EAAE,EAAE,GAAG,sBAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;QACjC,MAAM,EAAE,wBAAM;QACd,eAAe,EAAE,iCAAe;KACjC;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAChD,OAAO,4BAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IAC3D,CAAC;IACD,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QACrD,OAAO,4BAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IACzD,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/salesforce-marketing-cloud/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const contact_1 = __importDefault(require("./contact"));
|
|
7
|
+
const dataExtension_1 = __importDefault(require("./dataExtension"));
|
|
8
|
+
const contactDataExtension_1 = __importDefault(require("./contactDataExtension"));
|
|
9
|
+
const apiEvent_1 = __importDefault(require("./apiEvent"));
|
|
10
|
+
const destination = {
|
|
11
|
+
name: 'Salesforce Marketing Cloud (Actions)',
|
|
12
|
+
slug: 'actions-salesforce-marketing-cloud',
|
|
13
|
+
mode: 'cloud',
|
|
14
|
+
authentication: {
|
|
15
|
+
scheme: 'oauth2',
|
|
16
|
+
fields: {
|
|
17
|
+
subdomain: {
|
|
18
|
+
label: 'Subdomain',
|
|
19
|
+
description: 'The unique subdomain Salesforce Marketing Cloud assigned to your account. Subdomains are tenant specific and should be a 28-character string starting with the letters "mc". Do not include the .rest.marketingcloudapis.com part of your subdomain URL. See more information on how to find your subdomain [here](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/your-subdomain-tenant-specific-endpoints.html).',
|
|
20
|
+
type: 'string',
|
|
21
|
+
required: true
|
|
22
|
+
},
|
|
23
|
+
account_id: {
|
|
24
|
+
label: 'account id',
|
|
25
|
+
description: 'Your Salesforce Marketing Cloud account identifier (or MID). See more information on how to find your MID [here](https://help.salesforce.com/s/articleView?id=sf.mc_overview_determine_your_marketing_cloud_instance.htm&type=5).',
|
|
26
|
+
type: 'string',
|
|
27
|
+
required: true
|
|
28
|
+
},
|
|
29
|
+
client_id: {
|
|
30
|
+
label: 'client_id',
|
|
31
|
+
description: 'Your Salesforce Marketing Cloud client ID. The client ID is issued when you create an API integration in [Installed Packages](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/install-packages.html).',
|
|
32
|
+
type: 'string',
|
|
33
|
+
required: true
|
|
34
|
+
},
|
|
35
|
+
client_secret: {
|
|
36
|
+
label: 'client_secret',
|
|
37
|
+
description: 'Your Salesforce Marketing Cloud client secret. The client secret is issued when you create an API integration in Installed Packages.',
|
|
38
|
+
type: 'password',
|
|
39
|
+
required: true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
refreshAccessToken: async (request, { settings }) => {
|
|
43
|
+
const baseUrl = `https://${settings.subdomain}.auth.marketingcloudapis.com/v2/token`;
|
|
44
|
+
const res = await request(`${baseUrl}`, {
|
|
45
|
+
method: 'POST',
|
|
46
|
+
body: new URLSearchParams({
|
|
47
|
+
account_id: settings.account_id,
|
|
48
|
+
client_id: settings.client_id,
|
|
49
|
+
client_secret: settings.client_secret,
|
|
50
|
+
grant_type: 'client_credentials'
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
return { accessToken: res.data.access_token };
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
extendRequest({ auth }) {
|
|
57
|
+
return {
|
|
58
|
+
headers: {
|
|
59
|
+
authorization: `Bearer ${auth?.accessToken}`
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
actions: {
|
|
64
|
+
contact: contact_1.default,
|
|
65
|
+
dataExtension: dataExtension_1.default,
|
|
66
|
+
contactDataExtension: contactDataExtension_1.default,
|
|
67
|
+
apiEvent: apiEvent_1.default
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
exports.default = destination;
|
|
71
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/salesforce-marketing-cloud/index.ts"],"names":[],"mappings":";;;;;AAEA,wDAA+B;AAC/B,oEAA2C;AAC3C,kFAAyD;AACzD,0DAAiC;AAMjC,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,sCAAsC;IAC5C,IAAI,EAAE,oCAAoC;IAC1C,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,SAAS,EAAE;gBACT,KAAK,EAAE,WAAW;gBAClB,WAAW,EACT,0aAA0a;gBAC5a,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,UAAU,EAAE;gBACV,KAAK,EAAE,YAAY;gBACnB,WAAW,EACT,mOAAmO;gBACrO,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,SAAS,EAAE;gBACT,KAAK,EAAE,WAAW;gBAClB,WAAW,EACT,6NAA6N;gBAC/N,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,aAAa,EAAE;gBACb,KAAK,EAAE,eAAe;gBACtB,WAAW,EACT,sIAAsI;gBACxI,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,IAAI;aACf;SACF;QACD,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YAClD,MAAM,OAAO,GAAG,WAAW,QAAQ,CAAC,SAAS,uCAAuC,CAAA;YACpF,MAAM,GAAG,GAAG,MAAM,OAAO,CAAuB,GAAG,OAAO,EAAE,EAAE;gBAC5D,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,IAAI,eAAe,CAAC;oBACxB,UAAU,EAAE,QAAQ,CAAC,UAAU;oBAC/B,SAAS,EAAE,QAAQ,CAAC,SAAS;oBAC7B,aAAa,EAAE,QAAQ,CAAC,aAAa;oBACrC,UAAU,EAAE,oBAAoB;iBACjC,CAAC;aACH,CAAC,CAAA;YACF,OAAO,EAAE,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,CAAA;QAC/C,CAAC;KACF;IACD,aAAa,CAAC,EAAE,IAAI,EAAE;QACpB,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,EAAE,WAAW,EAAE;aAC7C;SACF,CAAA;IACH,CAAC;IACD,OAAO,EAAE;QACP,OAAO,EAAP,iBAAO;QACP,aAAa,EAAb,uBAAa;QACb,oBAAoB,EAApB,8BAAoB;QACpB,QAAQ,EAAR,kBAAQ;KACT;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RequestClient } from '@segment/actions-core';
|
|
2
|
+
import { Payload as payload_dataExtension } from './dataExtension/generated-types';
|
|
3
|
+
import { Payload as payload_contactDataExtension } from './contactDataExtension/generated-types';
|
|
4
|
+
export declare function upsertRows(request: RequestClient, subdomain: String, payloads: payload_dataExtension[] | payload_contactDataExtension[]): Promise<import("@segment/actions-core").ModifiedResponse<unknown>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.upsertRows = void 0;
|
|
4
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
5
|
+
function upsertRows(request, subdomain, payloads) {
|
|
6
|
+
const { key, id } = payloads[0];
|
|
7
|
+
if (!key && !id) {
|
|
8
|
+
throw new actions_core_1.IntegrationError(`In order to send an event to a data extension either Data Extension ID or Data Extension Key must be defined.`, 'Misconfigured required field', 400);
|
|
9
|
+
}
|
|
10
|
+
const rows = [];
|
|
11
|
+
payloads.forEach((payload) => {
|
|
12
|
+
rows.push({
|
|
13
|
+
keys: payload.keys,
|
|
14
|
+
values: payload.values
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
if (key) {
|
|
18
|
+
return request(`https://${subdomain}.rest.marketingcloudapis.com/hub/v1/dataevents/key:${key}/rowset`, {
|
|
19
|
+
method: 'POST',
|
|
20
|
+
json: rows
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return request(`https://${subdomain}.rest.marketingcloudapis.com/hub/v1/dataevents/${id}/rowset`, {
|
|
25
|
+
method: 'POST',
|
|
26
|
+
json: rows
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.upsertRows = upsertRows;
|
|
31
|
+
//# sourceMappingURL=sfmc-operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sfmc-operations.js","sourceRoot":"","sources":["../../../src/destinations/salesforce-marketing-cloud/sfmc-operations.ts"],"names":[],"mappings":";;;AAAA,wDAAuE;AAIvE,SAAgB,UAAU,CACxB,OAAsB,EACtB,SAAiB,EACjB,QAAkE;IAElE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC/B,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE;QACf,MAAM,IAAI,+BAAgB,CACxB,+GAA+G,EAC/G,8BAA8B,EAC9B,GAAG,CACJ,CAAA;KACF;IACD,MAAM,IAAI,GAA0B,EAAE,CAAA;IACtC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAA6D,EAAE,EAAE;QACjF,IAAI,CAAC,IAAI,CAAC;YACR,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IACF,IAAI,GAAG,EAAE;QACP,OAAO,OAAO,CAAC,WAAW,SAAS,sDAAsD,GAAG,SAAS,EAAE;YACrG,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;KACH;SAAM;QACL,OAAO,OAAO,CAAC,WAAW,SAAS,kDAAkD,EAAE,SAAS,EAAE;YAChG,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;KACH;AACH,CAAC;AA/BD,gCA+BC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { InputField } from '@segment/actions-core/src/destination-kit/types';
|
|
2
|
+
export declare const contactKey: InputField;
|
|
3
|
+
export declare const contactKeyAPIEvent: InputField;
|
|
4
|
+
export declare const key: InputField;
|
|
5
|
+
export declare const id: InputField;
|
|
6
|
+
export declare const keys: InputField;
|
|
7
|
+
export declare const values: InputField;
|
|
8
|
+
export declare const eventDefinitionKey: InputField;
|
|
9
|
+
export declare const eventData: InputField;
|
|
10
|
+
export declare const enable_batching: InputField;
|