@segment/action-destinations 3.218.0 → 3.219.0-staging.0
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/airship/utilities.js +2 -2
- package/dist/destinations/airship/utilities.js.map +1 -1
- package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.d.ts +1 -0
- package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js +8 -1
- package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js.map +1 -1
- package/dist/destinations/engage/twilio/utils/PhoneMessageSender.d.ts +0 -1
- package/dist/destinations/engage/twilio/utils/PhoneMessageSender.js +2 -2
- package/dist/destinations/engage/twilio/utils/PhoneMessageSender.js.map +1 -1
- package/dist/destinations/fullstory/identifyUserV2/generated-types.d.ts +1 -1
- package/dist/destinations/fullstory/identifyUserV2/index.js +1 -1
- package/dist/destinations/fullstory/identifyUserV2/index.js.map +1 -1
- package/dist/destinations/fullstory/index.js +1 -1
- package/dist/destinations/fullstory/index.js.map +1 -1
- package/dist/destinations/fullstory/request-params.d.ts +2 -2
- package/dist/destinations/fullstory/request-params.js +6 -6
- package/dist/destinations/fullstory/request-params.js.map +1 -1
- package/dist/destinations/fullstory/trackEventV2/generated-types.d.ts +1 -1
- package/dist/destinations/fullstory/trackEventV2/index.js +1 -1
- package/dist/destinations/fullstory/trackEventV2/index.js.map +1 -1
- package/dist/destinations/hyperengage/commonFields.d.ts +3 -0
- package/dist/destinations/hyperengage/commonFields.js +165 -0
- package/dist/destinations/hyperengage/commonFields.js.map +1 -0
- package/dist/destinations/hyperengage/generated-types.d.ts +4 -0
- package/dist/destinations/{liveramp-audiences/audienceEnteredSFTP.types.js → hyperengage/generated-types.js} +1 -1
- package/dist/destinations/hyperengage/generated-types.js.map +1 -0
- package/dist/destinations/hyperengage/group/generated-types.d.ts +35 -0
- package/dist/destinations/hyperengage/group/generated-types.js +3 -0
- package/dist/destinations/hyperengage/group/generated-types.js.map +1 -0
- package/dist/destinations/hyperengage/group/index.d.ts +5 -0
- package/dist/destinations/hyperengage/group/index.js +81 -0
- package/dist/destinations/hyperengage/group/index.js.map +1 -0
- package/dist/destinations/hyperengage/identify/generated-types.d.ts +36 -0
- package/dist/destinations/hyperengage/identify/generated-types.js +3 -0
- package/dist/destinations/hyperengage/identify/generated-types.js.map +1 -0
- package/dist/destinations/hyperengage/identify/index.d.ts +5 -0
- package/dist/destinations/hyperengage/identify/index.js +110 -0
- package/dist/destinations/hyperengage/identify/index.js.map +1 -0
- package/dist/destinations/hyperengage/index.d.ts +4 -0
- package/dist/destinations/hyperengage/index.js +72 -0
- package/dist/destinations/hyperengage/index.js.map +1 -0
- package/dist/destinations/hyperengage/track/generated-types.d.ts +32 -0
- package/dist/destinations/hyperengage/track/generated-types.js +3 -0
- package/dist/destinations/hyperengage/track/generated-types.js.map +1 -0
- package/dist/destinations/hyperengage/track/index.d.ts +5 -0
- package/dist/destinations/hyperengage/track/index.js +54 -0
- package/dist/destinations/hyperengage/track/index.js.map +1 -0
- package/dist/destinations/hyperengage/validateInput.d.ts +2 -0
- package/dist/destinations/hyperengage/validateInput.js +90 -0
- package/dist/destinations/hyperengage/validateInput.js.map +1 -0
- package/dist/destinations/index.js +3 -0
- package/dist/destinations/index.js.map +1 -1
- package/dist/destinations/klaviyo/config.d.ts +1 -0
- package/dist/destinations/klaviyo/config.js +5 -0
- package/dist/destinations/klaviyo/config.js.map +1 -0
- package/dist/destinations/klaviyo/index.js +9 -5
- package/dist/destinations/klaviyo/index.js.map +1 -1
- package/dist/destinations/klaviyo/orderCompleted/generated-types.d.ts +22 -0
- package/dist/destinations/klaviyo/orderCompleted/generated-types.js +3 -0
- package/dist/destinations/klaviyo/orderCompleted/generated-types.js.map +1 -0
- package/dist/destinations/klaviyo/orderCompleted/index.d.ts +5 -0
- package/dist/destinations/klaviyo/orderCompleted/index.js +152 -0
- package/dist/destinations/klaviyo/orderCompleted/index.js.map +1 -0
- package/dist/destinations/klaviyo/trackEvent/generated-types.d.ts +16 -0
- package/dist/destinations/klaviyo/trackEvent/generated-types.js +3 -0
- package/dist/destinations/klaviyo/trackEvent/generated-types.js.map +1 -0
- package/dist/destinations/klaviyo/trackEvent/index.d.ts +5 -0
- package/dist/destinations/klaviyo/trackEvent/index.js +118 -0
- package/dist/destinations/klaviyo/trackEvent/index.js.map +1 -0
- package/dist/destinations/klaviyo/types.d.ts +61 -0
- package/dist/destinations/klaviyo/types.js +8 -0
- package/dist/destinations/klaviyo/types.js.map +1 -0
- package/dist/destinations/klaviyo/upsertProfile/generated-types.d.ts +21 -1
- package/dist/destinations/klaviyo/upsertProfile/index.js +150 -5
- package/dist/destinations/klaviyo/upsertProfile/index.js.map +1 -1
- package/dist/destinations/liveramp-audiences/audienceEnteredS3/index.js +1 -1
- package/dist/destinations/liveramp-audiences/audienceEnteredS3/index.js.map +1 -1
- package/dist/destinations/liveramp-audiences/audienceEnteredSftp/index.js +1 -1
- package/dist/destinations/liveramp-audiences/audienceEnteredSftp/index.js.map +1 -1
- package/dist/destinations/pinterest-conversions/pinterest-capi-custom-data.js +1 -1
- package/dist/destinations/pinterest-conversions/pinterest-capi-custom-data.js.map +1 -1
- package/dist/destinations/pinterest-conversions/reportConversionEvent/generated-types.d.ts +1 -1
- package/dist/destinations/snap-conversions-api/_tests_/index.test.js.map +1 -1
- package/dist/destinations/the-trade-desk-crm/awsClient.d.ts +0 -1
- package/dist/destinations/the-trade-desk-crm/awsClient.js +0 -1
- package/dist/destinations/the-trade-desk-crm/awsClient.js.map +1 -1
- package/dist/destinations/the-trade-desk-crm/functions.js +5 -54
- package/dist/destinations/the-trade-desk-crm/functions.js.map +1 -1
- package/dist/destinations/the-trade-desk-crm/generated-types.d.ts +1 -1
- package/dist/destinations/the-trade-desk-crm/index.js +3 -2
- package/dist/destinations/the-trade-desk-crm/index.js.map +1 -1
- package/dist/destinations/the-trade-desk-crm/properties.d.ts +0 -2
- package/dist/destinations/the-trade-desk-crm/properties.js +1 -18
- package/dist/destinations/the-trade-desk-crm/properties.js.map +1 -1
- package/dist/destinations/the-trade-desk-crm/syncAudience/generated-types.d.ts +0 -2
- package/dist/destinations/the-trade-desk-crm/syncAudience/index.js +0 -2
- package/dist/destinations/the-trade-desk-crm/syncAudience/index.js.map +1 -1
- package/dist/destinations/tiktok-audiences/addToAudience/index.js +2 -9
- package/dist/destinations/tiktok-audiences/addToAudience/index.js.map +1 -1
- package/dist/destinations/tiktok-audiences/addUser/index.js +2 -9
- package/dist/destinations/tiktok-audiences/addUser/index.js.map +1 -1
- package/dist/destinations/tiktok-audiences/constants.d.ts +1 -1
- package/dist/destinations/tiktok-audiences/constants.js +1 -1
- package/dist/destinations/tiktok-audiences/constants.js.map +1 -1
- package/dist/destinations/tiktok-audiences/removeFromAudience/index.js +2 -9
- package/dist/destinations/tiktok-audiences/removeFromAudience/index.js.map +1 -1
- package/dist/destinations/tiktok-audiences/removeUser/index.js +2 -9
- package/dist/destinations/tiktok-audiences/removeUser/index.js.map +1 -1
- package/dist/destinations/yahoo-audiences/constants.d.ts +2 -0
- package/dist/destinations/yahoo-audiences/constants.js +6 -0
- package/dist/destinations/yahoo-audiences/constants.js.map +1 -0
- package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.d.ts +4 -0
- package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.js +3 -0
- package/dist/destinations/yahoo-audiences/createCustomerNode/generated-types.js.map +1 -0
- package/dist/destinations/yahoo-audiences/createCustomerNode/index.d.ts +5 -0
- package/dist/destinations/yahoo-audiences/createCustomerNode/index.js +33 -0
- package/dist/destinations/yahoo-audiences/createCustomerNode/index.js.map +1 -0
- package/dist/destinations/yahoo-audiences/createSegment/generated-types.d.ts +6 -0
- package/dist/destinations/yahoo-audiences/createSegment/generated-types.js +3 -0
- package/dist/destinations/yahoo-audiences/createSegment/generated-types.js.map +1 -0
- package/dist/destinations/yahoo-audiences/createSegment/index.d.ts +5 -0
- package/dist/destinations/yahoo-audiences/createSegment/index.js +45 -0
- package/dist/destinations/yahoo-audiences/createSegment/index.js.map +1 -0
- package/dist/destinations/yahoo-audiences/generated-types.d.ts +12 -0
- package/dist/destinations/yahoo-audiences/generated-types.js +3 -0
- package/dist/destinations/yahoo-audiences/generated-types.js.map +1 -0
- package/dist/destinations/yahoo-audiences/index.d.ts +4 -0
- package/dist/destinations/yahoo-audiences/index.js +145 -0
- package/dist/destinations/yahoo-audiences/index.js.map +1 -0
- package/dist/destinations/yahoo-audiences/types.d.ts +25 -0
- package/dist/destinations/yahoo-audiences/types.js +3 -0
- package/dist/destinations/yahoo-audiences/types.js.map +1 -0
- package/dist/destinations/yahoo-audiences/updateSegment/generated-types.d.ts +17 -0
- package/dist/destinations/yahoo-audiences/updateSegment/generated-types.js +3 -0
- package/dist/destinations/yahoo-audiences/updateSegment/generated-types.js.map +1 -0
- package/dist/destinations/yahoo-audiences/updateSegment/index.d.ts +5 -0
- package/dist/destinations/yahoo-audiences/updateSegment/index.js +168 -0
- package/dist/destinations/yahoo-audiences/updateSegment/index.js.map +1 -0
- package/dist/destinations/yahoo-audiences/utils-rt.d.ts +10 -0
- package/dist/destinations/yahoo-audiences/utils-rt.js +95 -0
- package/dist/destinations/yahoo-audiences/utils-rt.js.map +1 -0
- package/dist/destinations/yahoo-audiences/utils-tax.d.ts +10 -0
- package/dist/destinations/yahoo-audiences/utils-tax.js +67 -0
- package/dist/destinations/yahoo-audiences/utils-tax.js.map +1 -0
- package/dist/destinations/yahoo-audiences/utils.d.ts +4 -0
- package/dist/destinations/yahoo-audiences/utils.js +30 -0
- package/dist/destinations/yahoo-audiences/utils.js.map +1 -0
- package/package.json +2 -2
- package/dist/destinations/liveramp-audiences/audienceEnteredSFTP.types.d.ts +0 -16
- package/dist/destinations/liveramp-audiences/audienceEnteredSFTP.types.js.map +0 -1
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
4
|
+
const utils_rt_1 = require("../utils-rt");
|
|
5
|
+
const action = {
|
|
6
|
+
title: 'Sync To Yahoo Ads Segment',
|
|
7
|
+
description: 'Sync Segment Audience to Yahoo Ads Segment',
|
|
8
|
+
defaultSubscription: 'type = "identify" or type = "track"',
|
|
9
|
+
fields: {
|
|
10
|
+
segment_audience_id: {
|
|
11
|
+
label: 'Segment Audience Id',
|
|
12
|
+
description: 'Segment Audience Id (aud_...). Maps to "Id" of a Segment node in Yahoo taxonomy',
|
|
13
|
+
type: 'hidden',
|
|
14
|
+
required: true,
|
|
15
|
+
default: {
|
|
16
|
+
'@path': '$.context.personas.computation_id'
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
segment_audience_key: {
|
|
20
|
+
label: 'Segment Audience Key',
|
|
21
|
+
description: 'Segment Audience Key. Maps to the "Name" of the Segment node in Yahoo taxonomy',
|
|
22
|
+
type: 'hidden',
|
|
23
|
+
required: true,
|
|
24
|
+
default: {
|
|
25
|
+
'@path': '$.context.personas.computation_key'
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
event_attributes: {
|
|
29
|
+
label: 'Event traits or properties. Do not modify this setting',
|
|
30
|
+
description: 'Event traits or properties. Do not modify this setting',
|
|
31
|
+
type: 'object',
|
|
32
|
+
readOnly: true,
|
|
33
|
+
required: true,
|
|
34
|
+
default: {
|
|
35
|
+
'@if': {
|
|
36
|
+
exists: { '@path': '$.properties' },
|
|
37
|
+
then: { '@path': '$.properties' },
|
|
38
|
+
else: { '@path': '$.traits' }
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
segment_computation_action: {
|
|
43
|
+
label: 'Segment Computation Action',
|
|
44
|
+
description: "Segment computation class used to determine if input event is from an Engage Audience'. Value must be = 'audience'.",
|
|
45
|
+
type: 'hidden',
|
|
46
|
+
required: true,
|
|
47
|
+
default: {
|
|
48
|
+
'@path': '$.context.personas.computation_class'
|
|
49
|
+
},
|
|
50
|
+
choices: [{ label: 'audience', value: 'audience' }]
|
|
51
|
+
},
|
|
52
|
+
enable_batching: {
|
|
53
|
+
label: 'Enable Batching',
|
|
54
|
+
description: 'Enable batching of requests',
|
|
55
|
+
type: 'hidden',
|
|
56
|
+
default: true
|
|
57
|
+
},
|
|
58
|
+
batch_size: {
|
|
59
|
+
label: 'Batch Size',
|
|
60
|
+
description: 'Maximum number of events to include in each batch. Actual batch sizes may be lower.',
|
|
61
|
+
type: 'number',
|
|
62
|
+
unsafe_hidden: true,
|
|
63
|
+
required: false,
|
|
64
|
+
default: 1000
|
|
65
|
+
},
|
|
66
|
+
email: {
|
|
67
|
+
label: 'User Email',
|
|
68
|
+
description: 'Email address of a user',
|
|
69
|
+
type: 'hidden',
|
|
70
|
+
default: {
|
|
71
|
+
'@if': {
|
|
72
|
+
exists: { '@path': '$.context.traits.email' },
|
|
73
|
+
then: { '@path': '$.context.traits.email' },
|
|
74
|
+
else: { '@path': '$.traits.email' }
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
advertising_id: {
|
|
79
|
+
label: 'User Mobile Advertising ID',
|
|
80
|
+
description: "User's Mobile Advertising Id",
|
|
81
|
+
type: 'hidden',
|
|
82
|
+
default: {
|
|
83
|
+
'@path': '$.context.device.advertisingId'
|
|
84
|
+
},
|
|
85
|
+
required: true
|
|
86
|
+
},
|
|
87
|
+
device_type: {
|
|
88
|
+
label: 'User Mobile Device Type',
|
|
89
|
+
description: "The user's mobile device type",
|
|
90
|
+
type: 'hidden',
|
|
91
|
+
default: {
|
|
92
|
+
'@path': '$.context.device.type'
|
|
93
|
+
},
|
|
94
|
+
required: true
|
|
95
|
+
},
|
|
96
|
+
send_advertising_id: {
|
|
97
|
+
label: 'Send Mobile Advertising ID',
|
|
98
|
+
description: 'Send mobile advertising ID (IDFA or Google Ad Id) to Yahoo. Segment will hash MAIDs',
|
|
99
|
+
type: 'boolean',
|
|
100
|
+
required: true,
|
|
101
|
+
default: true
|
|
102
|
+
},
|
|
103
|
+
send_email: {
|
|
104
|
+
label: 'Send User Email',
|
|
105
|
+
description: 'Send user email to Yahoo. Segment will hash emails',
|
|
106
|
+
type: 'boolean',
|
|
107
|
+
required: true,
|
|
108
|
+
default: true
|
|
109
|
+
},
|
|
110
|
+
gdpr_flag: {
|
|
111
|
+
label: 'GDPR Flag',
|
|
112
|
+
description: 'Set to true to indicate that audience data is subject to GDPR regulations',
|
|
113
|
+
type: 'boolean',
|
|
114
|
+
required: true,
|
|
115
|
+
default: false
|
|
116
|
+
},
|
|
117
|
+
gdpr_euconsent: {
|
|
118
|
+
label: 'GDPR Consent Attributes',
|
|
119
|
+
description: 'Required if GDPR flag is set to "true". Using IAB Purpose bit descriptions specify the following user consent attributes: "Storage and Access of Information", "Personalization"',
|
|
120
|
+
type: 'string',
|
|
121
|
+
required: false
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
perform: (request, { payload, auth }) => {
|
|
125
|
+
const rt_access_token = auth?.accessToken;
|
|
126
|
+
if (rt_access_token) {
|
|
127
|
+
throw new actions_core_1.IntegrationError('Missing authentication token', 'MISSING_REQUIRED_FIELD', 400);
|
|
128
|
+
}
|
|
129
|
+
const body = utils_rt_1.gen_update_segment_payload([payload]);
|
|
130
|
+
return request('https://dataxonline.yahoo.com/online/audience/', {
|
|
131
|
+
method: 'POST',
|
|
132
|
+
json: body,
|
|
133
|
+
headers: {
|
|
134
|
+
Authorization: `Bearer ${auth?.accessToken}`
|
|
135
|
+
}
|
|
136
|
+
})
|
|
137
|
+
.then((response) => response.json())
|
|
138
|
+
.then((response) => {
|
|
139
|
+
return response;
|
|
140
|
+
})
|
|
141
|
+
.catch((err) => {
|
|
142
|
+
console.log('perform: error updating segment >', err);
|
|
143
|
+
});
|
|
144
|
+
},
|
|
145
|
+
performBatch: (request, { payload, auth }) => {
|
|
146
|
+
const rt_access_token = auth?.accessToken;
|
|
147
|
+
if (!rt_access_token) {
|
|
148
|
+
throw new actions_core_1.IntegrationError('Missing authentication token', 'MISSING_REQUIRED_FIELD', 400);
|
|
149
|
+
}
|
|
150
|
+
const body = utils_rt_1.gen_update_segment_payload(payload);
|
|
151
|
+
return request('https://dataxonline.yahoo.com/online/audience/', {
|
|
152
|
+
method: 'POST',
|
|
153
|
+
json: body,
|
|
154
|
+
headers: {
|
|
155
|
+
Authorization: `Bearer ${rt_access_token}`
|
|
156
|
+
}
|
|
157
|
+
})
|
|
158
|
+
.then((response) => response.json())
|
|
159
|
+
.then((response) => {
|
|
160
|
+
return response;
|
|
161
|
+
})
|
|
162
|
+
.catch((err) => {
|
|
163
|
+
console.log('perform: error updating segment >', err);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
exports.default = action;
|
|
168
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/yahoo-audiences/updateSegment/index.ts"],"names":[],"mappings":";;AACA,wDAAwD;AAGxD,0CAAwD;AAExD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,2BAA2B;IAClC,WAAW,EAAE,4CAA4C;IACzD,mBAAmB,EAAE,qCAAqC;IAC1D,MAAM,EAAE;QACN,mBAAmB,EAAE;YACnB,KAAK,EAAE,qBAAqB;YAC5B,WAAW,EAAE,iFAAiF;YAC9F,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,mCAAmC;aAC7C;SACF;QACD,oBAAoB,EAAE;YACpB,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EAAE,gFAAgF;YAC7F,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,oCAAoC;aAC9C;SACF;QAED,gBAAgB,EAAE;YAChB,KAAK,EAAE,wDAAwD;YAC/D,WAAW,EAAE,wDAAwD;YACrE,IAAI,EAAE,QAAQ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aAC7C;SACF,CAAC;aACC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;aACnC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YACjB,OAAO,QAAQ,CAAA;QACjB,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACb,OAAO,CAAC,GAAG,CAAC,mCAAmC,EAAE,GAAG,CAAC,CAAA;QACvD,CAAC,CAAC,CAAA;IACN,CAAC;IACD,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE;QAC3C,MAAM,eAAe,GAAG,IAAI,EAAE,WAAW,CAAA;QACzC,IAAI,CAAC,eAAe,EAAE;YACpB,MAAM,IAAI,+BAAgB,CAAC,8BAA8B,EAAE,wBAAwB,EAAE,GAAG,CAAC,CAAA;SAC1F;QACD,MAAM,IAAI,GAAG,qCAA0B,CAAC,OAAO,CAAC,CAAA;QAEhD,OAAO,OAAO,CAAC,gDAAgD,EAAE;YAC/D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,eAAe,EAAE;aAC3C;SACF,CAAC;aACC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;aACnC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YACjB,OAAO,QAAQ,CAAA;QACjB,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACb,OAAO,CAAC,GAAG,CAAC,mCAAmC,EAAE,GAAG,CAAC,CAAA;QACvD,CAAC,CAAC,CAAA;IACN,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Payload } from './updateSegment/generated-types';
|
|
2
|
+
import { YahooPayload } from './types';
|
|
3
|
+
export declare function create_hash(input: string | undefined): string | undefined;
|
|
4
|
+
export declare function generate_jwt(client_id: string, client_secret: string): string;
|
|
5
|
+
export declare function get_id_schema(payload: Payload): {
|
|
6
|
+
maid: boolean;
|
|
7
|
+
email: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function check_schema(payload: Payload): void;
|
|
10
|
+
export declare function gen_update_segment_payload(payloads: Payload[]): YahooPayload;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gen_update_segment_payload = exports.check_schema = exports.get_id_schema = exports.generate_jwt = exports.create_hash = void 0;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
6
|
+
const utils_tax_1 = require("./utils-tax");
|
|
7
|
+
function create_hash(input) {
|
|
8
|
+
if (input === undefined)
|
|
9
|
+
return;
|
|
10
|
+
return crypto_1.createHash('sha256').update(input).digest('hex');
|
|
11
|
+
}
|
|
12
|
+
exports.create_hash = create_hash;
|
|
13
|
+
function generate_jwt(client_id, client_secret) {
|
|
14
|
+
const random_id = utils_tax_1.gen_random_id(24);
|
|
15
|
+
const current_time = Math.floor(new Date().getTime() / 1000);
|
|
16
|
+
const url = 'https://id.b2b.yahooinc.com/identity/oauth2/access_token';
|
|
17
|
+
const jwt_payload = {
|
|
18
|
+
iss: client_id,
|
|
19
|
+
sub: client_id,
|
|
20
|
+
aud: url + '?realm=dataxonline',
|
|
21
|
+
jti: random_id,
|
|
22
|
+
exp: current_time + 3600,
|
|
23
|
+
iat: current_time
|
|
24
|
+
};
|
|
25
|
+
const jwt_header = {
|
|
26
|
+
alg: 'HS256',
|
|
27
|
+
typ: 'JWT'
|
|
28
|
+
};
|
|
29
|
+
const jwt_header_encoded = Buffer.from(JSON.stringify(jwt_header)).toString('base64');
|
|
30
|
+
const jwt_payload_encoded = Buffer.from(JSON.stringify(jwt_payload)).toString('base64');
|
|
31
|
+
const jwt_head_payload = jwt_header_encoded + '.' + jwt_payload_encoded;
|
|
32
|
+
const hash = crypto_1.createHmac('sha256', client_secret);
|
|
33
|
+
const signature = hash.update(jwt_head_payload).digest('base64');
|
|
34
|
+
const jwt = jwt_head_payload + '.' + signature;
|
|
35
|
+
return jwt;
|
|
36
|
+
}
|
|
37
|
+
exports.generate_jwt = generate_jwt;
|
|
38
|
+
function get_id_schema(payload) {
|
|
39
|
+
return {
|
|
40
|
+
maid: payload.send_advertising_id === true,
|
|
41
|
+
email: payload.send_email === true
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
exports.get_id_schema = get_id_schema;
|
|
45
|
+
function check_schema(payload) {
|
|
46
|
+
if (payload.send_email === false && payload.send_advertising_id === false) {
|
|
47
|
+
throw new actions_core_1.IntegrationError('Either `Send Email`, or `Send Advertising ID` setting must be set to `true`.', 'INVALID_SETTINGS', 400);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.check_schema = check_schema;
|
|
51
|
+
function gen_update_segment_payload(payloads) {
|
|
52
|
+
check_schema(payloads[0]);
|
|
53
|
+
const schema = get_id_schema(payloads[0]);
|
|
54
|
+
const data = [];
|
|
55
|
+
let exp;
|
|
56
|
+
for (const event of payloads) {
|
|
57
|
+
let hashed_email = '';
|
|
58
|
+
if (schema.email === true) {
|
|
59
|
+
hashed_email = create_hash(event.email);
|
|
60
|
+
}
|
|
61
|
+
let idfa = '';
|
|
62
|
+
let gpsaid = '';
|
|
63
|
+
if (schema.maid === true) {
|
|
64
|
+
switch (event.device_type) {
|
|
65
|
+
case 'ios':
|
|
66
|
+
idfa = event.advertising_id;
|
|
67
|
+
break;
|
|
68
|
+
case 'android':
|
|
69
|
+
gpsaid = event.advertising_id;
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const ts = Math.floor(new Date().getTime() / 1000);
|
|
74
|
+
const seg_key = event.segment_audience_key;
|
|
75
|
+
if (event.event_attributes[seg_key] == true) {
|
|
76
|
+
exp = ts + 90 * 24 * 60 * 60;
|
|
77
|
+
}
|
|
78
|
+
if (event.event_attributes[seg_key] == false) {
|
|
79
|
+
exp = 0;
|
|
80
|
+
}
|
|
81
|
+
const seg_id = event.segment_audience_id;
|
|
82
|
+
data.push([hashed_email, idfa, gpsaid, 'exp=' + exp + '&seg_id=' + seg_id + '&ts=' + ts]);
|
|
83
|
+
}
|
|
84
|
+
const yahoo_payload = {
|
|
85
|
+
schema: ['SHA256EMAIL', 'IDFA', 'GPADVID', 'SEGMENTS'],
|
|
86
|
+
data: data,
|
|
87
|
+
gdpr: payloads[0].gdpr_flag
|
|
88
|
+
};
|
|
89
|
+
if (payloads[0].gdpr_flag) {
|
|
90
|
+
yahoo_payload.gdpr_euconsent = payloads[0].gdpr_euconsent;
|
|
91
|
+
}
|
|
92
|
+
return yahoo_payload;
|
|
93
|
+
}
|
|
94
|
+
exports.gen_update_segment_payload = gen_update_segment_payload;
|
|
95
|
+
//# sourceMappingURL=utils-rt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils-rt.js","sourceRoot":"","sources":["../../../src/destinations/yahoo-audiences/utils-rt.ts"],"names":[],"mappings":";;;AAAA,mCAA+C;AAE/C,wDAAwD;AAGxD,2CAA2C;AAO3C,SAAgB,WAAW,CAAC,KAAyB;IACnD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAM;IAC/B,OAAO,mBAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AACzD,CAAC;AAHD,kCAGC;AAQD,SAAgB,YAAY,CAAC,SAAiB,EAAE,aAAqB;IACnE,MAAM,SAAS,GAAG,yBAAa,CAAC,EAAE,CAAC,CAAA;IACnC,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAA;IAC5D,MAAM,GAAG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AAG,CAAC,CAAA;SACR;QAED,MAAM,MAAM,GAAG,KAAK,CAAC,mBAAmB,CAAA;QACxC,IAAI,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,EAAE,CAAC,CAAC,CAAA;KAC1F;IAED,MAAM,aAAa,GAAiB;QAClC,MAAM,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC;QACtD,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;KAC5B,CAAA;IAED,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE;QACzB,aAAa,CAAC,cAAc,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,cAAc,CAAA;KAC1D;IAED,OAAO,aAAa,CAAA;AACtB,CAAC;AAjDD,gEAiDC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Payload as SegmentNodePayload } from './createSegment/generated-types';
|
|
2
|
+
import { Payload as CustomerNodePayload } from './createCustomerNode/generated-types';
|
|
3
|
+
import type { Settings } from './generated-types';
|
|
4
|
+
import { CredsObj } from './types';
|
|
5
|
+
import { RequestClient } from '@segment/actions-core';
|
|
6
|
+
export declare function gen_customer_taxonomy_payload(settings: Settings, payload: CustomerNodePayload): string;
|
|
7
|
+
export declare function gen_segment_subtaxonomy_payload(payload: SegmentNodePayload): string;
|
|
8
|
+
export declare function gen_random_id(length: number): string;
|
|
9
|
+
export declare function gen_oauth1_signature(client_key: string, client_secret: string, method: string, url: string): string;
|
|
10
|
+
export declare function update_taxonomy(engage_space_id: string, tx_creds: CredsObj, request: RequestClient, body_form_data: string): Promise<any>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.update_taxonomy = exports.gen_oauth1_signature = exports.gen_random_id = exports.gen_segment_subtaxonomy_payload = exports.gen_customer_taxonomy_payload = void 0;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
function gen_customer_taxonomy_payload(settings, payload) {
|
|
6
|
+
const data = {
|
|
7
|
+
id: payload.engage_space_id,
|
|
8
|
+
name: payload.engage_space_id,
|
|
9
|
+
description: payload.customer_desc,
|
|
10
|
+
users: {
|
|
11
|
+
include: [settings.mdm_id]
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const req_body_form = `--SEGMENT-DATA\r\nContent-Disposition: form-data; name="metadata"\r\nContent-Type: application/json;charset=UTF-8\r\n\r\n{ "description" : "${payload.customer_desc}" }\r\n--SEGMENT-DATA\r\nContent-Disposition: form-data; name="data"\r\nContent-Type: application/json;charset=UTF-8\r\n\r\n${JSON.stringify(data)}\r\n--SEGMENT-DATA--`;
|
|
15
|
+
return req_body_form;
|
|
16
|
+
}
|
|
17
|
+
exports.gen_customer_taxonomy_payload = gen_customer_taxonomy_payload;
|
|
18
|
+
function gen_segment_subtaxonomy_payload(payload) {
|
|
19
|
+
const data = {
|
|
20
|
+
id: payload.segment_audience_id,
|
|
21
|
+
name: payload.segment_audience_key,
|
|
22
|
+
type: 'SEGMENT'
|
|
23
|
+
};
|
|
24
|
+
const req_body_form = `--SEGMENT-DATA\r\nContent-Disposition: form-data; name="metadata"\r\nContent-Type: application/json;charset=UTF-8\r\n\r\n{ "description" : "${payload.customer_desc}" }\r\n--SEGMENT-DATA\r\nContent-Disposition: form-data; name="data"\r\nContent-Type: application/json;charset=UTF-8\r\n\r\n${JSON.stringify(data)}\r\n--SEGMENT-DATA--`;
|
|
25
|
+
return req_body_form;
|
|
26
|
+
}
|
|
27
|
+
exports.gen_segment_subtaxonomy_payload = gen_segment_subtaxonomy_payload;
|
|
28
|
+
function gen_random_id(length) {
|
|
29
|
+
const pattern = 'abcdefghijklmnopqrstuvwxyz123456789';
|
|
30
|
+
const random_id = [];
|
|
31
|
+
for (let i = 0; i < length; i++) {
|
|
32
|
+
random_id.push(pattern[Math.floor(Math.random() * pattern.length)]);
|
|
33
|
+
}
|
|
34
|
+
return random_id.join('');
|
|
35
|
+
}
|
|
36
|
+
exports.gen_random_id = gen_random_id;
|
|
37
|
+
function gen_oauth1_signature(client_key, client_secret, method, url) {
|
|
38
|
+
const timestamp = Math.floor(new Date().getTime() / 1000);
|
|
39
|
+
const nonce = gen_random_id(15);
|
|
40
|
+
const param_string = `oauth_consumer_key=${encodeURIComponent(client_key)}&oauth_nonce=${encodeURIComponent(nonce)}&oauth_signature_method=${encodeURIComponent('HMAC-SHA1')}&oauth_timestamp=${encodeURIComponent(timestamp)}&oauth_version=${encodeURIComponent('1.0')}`;
|
|
41
|
+
const base_string = `${method.toUpperCase()}&${encodeURIComponent(url)}&${encodeURIComponent(param_string)}`;
|
|
42
|
+
const encoded_client_secret = encodeURIComponent(client_secret);
|
|
43
|
+
const signature = encodeURIComponent(crypto_1.createHmac('sha1', encoded_client_secret + '&')
|
|
44
|
+
.update(base_string)
|
|
45
|
+
.digest('base64'));
|
|
46
|
+
const oauth1_auth_string = `OAuth oauth_consumer_key="${client_key}", oauth_nonce="${nonce}", oauth_signature="${signature}", oauth_signature_method="HMAC-SHA1", oauth_timestamp="${timestamp}", oauth_version="1.0"`;
|
|
47
|
+
return oauth1_auth_string;
|
|
48
|
+
}
|
|
49
|
+
exports.gen_oauth1_signature = gen_oauth1_signature;
|
|
50
|
+
async function update_taxonomy(engage_space_id, tx_creds, request, body_form_data) {
|
|
51
|
+
const tx_client_secret = tx_creds.tx_client_key;
|
|
52
|
+
const tx_client_key = tx_creds.tx_client_secret;
|
|
53
|
+
const url = `https://datax.yahooapis.com/v1/taxonomy/append${engage_space_id.length > 0 ? '/' + engage_space_id : ''}`;
|
|
54
|
+
const oauth1_auth_string = gen_oauth1_signature(tx_client_key, tx_client_secret, 'PUT', url);
|
|
55
|
+
const add_segment_node = await request(url, {
|
|
56
|
+
method: 'PUT',
|
|
57
|
+
body: body_form_data,
|
|
58
|
+
headers: {
|
|
59
|
+
Authorization: oauth1_auth_string,
|
|
60
|
+
'Content-Type': 'multipart/form-data; boundary=SEGMENT-DATA'
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
console.log('upd tax status:', add_segment_node.status);
|
|
64
|
+
return await add_segment_node.json();
|
|
65
|
+
}
|
|
66
|
+
exports.update_taxonomy = update_taxonomy;
|
|
67
|
+
//# sourceMappingURL=utils-tax.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils-tax.js","sourceRoot":"","sources":["../../../src/destinations/yahoo-audiences/utils-tax.ts"],"names":[],"mappings":";;;AAGA,mCAAmC;AAInC,SAAgB,6BAA6B,CAAC,QAAkB,EAAE,OAA4B;IAC5F,MAAM,IAAI,GAAG;QACX,EAAE,EAAE,OAAO,CAAC,eAAe;QAC3B,IAAI,EAAE,OAAO,CAAC,eAAe;QAC7B,WAAW,EAAE,OAAO,CAAC,aAAa;QAClC,KAAK,EAAE;YACL,OAAO,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC;SAC3B;KACF,CAAA;IAED,MAAM,aAAa,GAAG,+IACpB,OAAO,CAAC,aACV,+HAA+H,IAAI,CAAC,SAAS,CAC3I,IAAI,CACL,sBAAsB,CAAA;IACvB,OAAO,aAAa,CAAA;AACtB,CAAC;AAhBD,sEAgBC;AAED,SAAgB,+BAA+B,CAAC,OAA2B;IACzE,MAAM,IAAI,GAAG;QACX,EAAE,EAAE,OAAO,CAAC,mBAAmB;QAC/B,IAAI,EAAE,OAAO,CAAC,oBAAoB;QAClC,IAAI,EAAE,SAAS;KAChB,CAAA;IACD,MAAM,aAAa,GAAG,+IACpB,OAAO,CAAC,aACV,+HAA+H,IAAI,CAAC,SAAS,CAC3I,IAAI,CACL,sBAAsB,CAAA;IACvB,OAAO,aAAa,CAAA;AACtB,CAAC;AAZD,0EAYC;AAED,SAAgB,aAAa,CAAC,MAAc;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AAmB,KAAK,uBAAuB,SAAS,2DAA2D,SAAS,wBAAwB,CAAA;IACtN,OAAO,kBAAkB,CAAA;AAC3B,CAAC;AApBD,oDAoBC;AAEM,KAAK,UAAU,eAAe,CACnC,eAAuB,EACvB,QAAkB,EAClB,OAAsB,EACtB,cAAsB;IAEtB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,aAAa,CAAA;IAC/C,MAAM,aAAa,GAAG,QAAQ,CAAC,gBAAgB,CAAA;IAC/C,MAAM,GAAG,GAAG,iDAAiD,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;IACtH,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,aAAa,EAAE,gBAAgB,EAAE,KAAK,EAAE,GAAG,CAAC,CAAA;IAE5F,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE;QAC1C,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE;YACP,aAAa,EAAE,kBAAkB;YACjC,cAAc,EAAE,4CAA4C;SAC7D;KACF,CAAC,CAAA;IACF,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IACvD,OAAO,MAAM,gBAAgB,CAAC,IAAI,EAAE,CAAA;AACtC,CAAC;AArBD,0CAqBC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RequestClient } from '@segment/actions-core';
|
|
2
|
+
import { CredsObj } from './types';
|
|
3
|
+
export declare function gen_random_id(length: number): string;
|
|
4
|
+
export declare function update_taxonomy(engage_space_id: string, tx_creds: CredsObj, request: RequestClient, body_form_data: string): Promise<any>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.update_taxonomy = exports.gen_random_id = void 0;
|
|
4
|
+
const utils_tax_1 = require("./utils-tax");
|
|
5
|
+
function gen_random_id(length) {
|
|
6
|
+
const pattern = 'abcdefghijklmnopqrstuvwxyz123456789';
|
|
7
|
+
const result = [];
|
|
8
|
+
for (let i = 0; i < length; i++) {
|
|
9
|
+
result.push(pattern[Math.floor(Math.random() * pattern.length)]);
|
|
10
|
+
}
|
|
11
|
+
return result.join('');
|
|
12
|
+
}
|
|
13
|
+
exports.gen_random_id = gen_random_id;
|
|
14
|
+
async function update_taxonomy(engage_space_id, tx_creds, request, body_form_data) {
|
|
15
|
+
const tx_client_secret = tx_creds.tx_client_key;
|
|
16
|
+
const tx_client_key = tx_creds.tx_client_secret;
|
|
17
|
+
const url = `https://datax.yahooapis.com/v1/taxonomy/append${engage_space_id.length > 0 ? '/' + engage_space_id : ''}`;
|
|
18
|
+
const oauth1_auth_string = utils_tax_1.gen_oauth1_signature(tx_client_key, tx_client_secret, 'PUT', url);
|
|
19
|
+
const add_segment_node = await request(url, {
|
|
20
|
+
method: 'PUT',
|
|
21
|
+
body: body_form_data,
|
|
22
|
+
headers: {
|
|
23
|
+
Authorization: oauth1_auth_string,
|
|
24
|
+
'Content-Type': 'multipart/form-data; boundary=SEGMENT-DATA'
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return await add_segment_node.json();
|
|
28
|
+
}
|
|
29
|
+
exports.update_taxonomy = update_taxonomy;
|
|
30
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/destinations/yahoo-audiences/utils.ts"],"names":[],"mappings":";;;AAEA,2CAAkD;AAQlD,SAAgB,aAAa,CAAC,MAAc;IAC1C,MAAM,OAAO,GAAG,qCAAqC,CAAA;IACrD,MAAM,MAAM,GAAG,EAAE,CAAA;IACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QAC/B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;KACjE;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxB,CAAC;AAPD,sCAOC;AAEM,KAAK,UAAU,eAAe,CACnC,eAAuB,EACvB,QAAkB,EAClB,OAAsB,EACtB,cAAsB;IAEtB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,aAAa,CAAA;IAC/C,MAAM,aAAa,GAAG,QAAQ,CAAC,gBAAgB,CAAA;IAC/C,MAAM,GAAG,GAAG,iDAAiD,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;IACtH,MAAM,kBAAkB,GAAG,gCAAoB,CAAC,aAAa,EAAE,gBAAgB,EAAE,KAAK,EAAE,GAAG,CAAC,CAAA;IAE5F,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE;QAC1C,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE;YACP,aAAa,EAAE,kBAAkB;YACjC,cAAc,EAAE,4CAA4C;SAC7D;KACF,CAAC,CAAA;IAEF,OAAO,MAAM,gBAAgB,CAAC,IAAI,EAAE,CAAA;AACtC,CAAC;AArBD,0CAqBC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segment/action-destinations",
|
|
3
3
|
"description": "Destination Actions engine and definitions.",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.219.0-staging.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"__tests__/__helpers__/"
|
|
78
78
|
]
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "9c04e12c4a0e81f6b68dca0a297fb2c0209d2431"
|
|
81
81
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface Payload {
|
|
2
|
-
sftp_username?: string;
|
|
3
|
-
sftp_password?: string;
|
|
4
|
-
sftp_folder_path?: string;
|
|
5
|
-
audience_key: string;
|
|
6
|
-
identifier_data?: {
|
|
7
|
-
[k: string]: unknown;
|
|
8
|
-
};
|
|
9
|
-
unhashed_identifier_data?: {
|
|
10
|
-
[k: string]: unknown;
|
|
11
|
-
};
|
|
12
|
-
delimiter: string;
|
|
13
|
-
filename: string;
|
|
14
|
-
enable_batching: boolean;
|
|
15
|
-
batch_size?: number;
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audienceEnteredSFTP.types.js","sourceRoot":"","sources":["../../../src/destinations/liveramp-audiences/audienceEnteredSFTP.types.ts"],"names":[],"mappings":""}
|