@segment/action-destinations 3.434.0 → 3.436.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/amazon-amc/index.js +14 -0
- package/dist/destinations/amazon-amc/index.js.map +1 -1
- package/dist/destinations/amazon-eventbridge/send/functions.js +1 -1
- package/dist/destinations/amazon-eventbridge/send/functions.js.map +1 -1
- package/dist/destinations/amazon-eventbridge/send/hooks.js +5 -5
- package/dist/destinations/amazon-eventbridge/send/hooks.js.map +1 -1
- package/dist/destinations/amazon-eventbridge/send/index.js +1 -1
- package/dist/destinations/amazon-eventbridge/send/index.js.map +1 -1
- package/dist/destinations/amplitude/groupIdentifyUser/index.js +23 -21
- package/dist/destinations/amplitude/groupIdentifyUser/index.js.map +1 -1
- package/dist/destinations/aws-s3/index.js +14 -0
- package/dist/destinations/aws-s3/index.js.map +1 -1
- package/dist/destinations/delivrai-activate/index.js +14 -0
- package/dist/destinations/delivrai-activate/index.js.map +1 -1
- package/dist/destinations/display-video-360/index.js +14 -0
- package/dist/destinations/display-video-360/index.js.map +1 -1
- package/dist/destinations/dynamic-yield-audiences/index.js +14 -0
- package/dist/destinations/dynamic-yield-audiences/index.js.map +1 -1
- package/dist/destinations/facebook-custom-audiences/index.js +14 -0
- package/dist/destinations/facebook-custom-audiences/index.js.map +1 -1
- package/dist/destinations/first-party-dv360/_tests_/index.test.js +134 -19
- package/dist/destinations/first-party-dv360/_tests_/index.test.js.map +1 -1
- package/dist/destinations/first-party-dv360/addToAudContactInfo/_tests_/index.test.js +52 -0
- package/dist/destinations/first-party-dv360/addToAudContactInfo/_tests_/index.test.js.map +1 -1
- package/dist/destinations/first-party-dv360/addToAudContactInfo/index.js +4 -4
- package/dist/destinations/first-party-dv360/addToAudContactInfo/index.js.map +1 -1
- package/dist/destinations/first-party-dv360/addToAudMobileDeviceId/_tests_/index.test.js +60 -0
- package/dist/destinations/first-party-dv360/addToAudMobileDeviceId/_tests_/index.test.js.map +1 -1
- package/dist/destinations/first-party-dv360/addToAudMobileDeviceId/index.js +4 -4
- package/dist/destinations/first-party-dv360/addToAudMobileDeviceId/index.js.map +1 -1
- package/dist/destinations/first-party-dv360/functions.d.ts +7 -4
- package/dist/destinations/first-party-dv360/functions.js +42 -11
- package/dist/destinations/first-party-dv360/functions.js.map +1 -1
- package/dist/destinations/first-party-dv360/index.js +26 -6
- package/dist/destinations/first-party-dv360/index.js.map +1 -1
- package/dist/destinations/first-party-dv360/properties.d.ts +1 -0
- package/dist/destinations/first-party-dv360/properties.js +2 -1
- package/dist/destinations/first-party-dv360/properties.js.map +1 -1
- package/dist/destinations/first-party-dv360/removeFromAudContactInfo/_tests_/index.test.d.ts +7 -1
- package/dist/destinations/first-party-dv360/removeFromAudContactInfo/_tests_/index.test.js +132 -2
- package/dist/destinations/first-party-dv360/removeFromAudContactInfo/_tests_/index.test.js.map +1 -1
- package/dist/destinations/first-party-dv360/removeFromAudContactInfo/index.js +4 -4
- package/dist/destinations/first-party-dv360/removeFromAudContactInfo/index.js.map +1 -1
- package/dist/destinations/first-party-dv360/removeFromAudMobileDeviceId/index.js +4 -4
- package/dist/destinations/first-party-dv360/removeFromAudMobileDeviceId/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/index.js +14 -0
- package/dist/destinations/google-enhanced-conversions/index.js.map +1 -1
- package/dist/destinations/hubspot/errors.d.ts +1 -0
- package/dist/destinations/hubspot/errors.js.map +1 -1
- package/dist/destinations/hubspot/upsertObject/client.d.ts +5 -1
- package/dist/destinations/hubspot/upsertObject/client.js +27 -0
- package/dist/destinations/hubspot/upsertObject/client.js.map +1 -1
- package/dist/destinations/hubspot/upsertObject/common-fields.js +133 -2
- package/dist/destinations/hubspot/upsertObject/common-fields.js.map +1 -1
- package/dist/destinations/hubspot/upsertObject/constants.d.ts +1 -0
- package/dist/destinations/hubspot/upsertObject/constants.js +2 -1
- package/dist/destinations/hubspot/upsertObject/constants.js.map +1 -1
- package/dist/destinations/hubspot/upsertObject/functions/cache-functions.d.ts +5 -2
- package/dist/destinations/hubspot/upsertObject/functions/cache-functions.js +30 -5
- package/dist/destinations/hubspot/upsertObject/functions/cache-functions.js.map +1 -1
- package/dist/destinations/hubspot/upsertObject/functions/dynamic-field-functions.d.ts +29 -0
- package/dist/destinations/hubspot/upsertObject/functions/dynamic-field-functions.js +103 -1
- package/dist/destinations/hubspot/upsertObject/functions/dynamic-field-functions.js.map +1 -1
- package/dist/destinations/hubspot/upsertObject/functions/hubspot-association-functions.d.ts +4 -3
- package/dist/destinations/hubspot/upsertObject/functions/hubspot-association-functions.js +11 -5
- package/dist/destinations/hubspot/upsertObject/functions/hubspot-association-functions.js.map +1 -1
- package/dist/destinations/hubspot/upsertObject/functions/hubspot-list-functions.d.ts +9 -0
- package/dist/destinations/hubspot/upsertObject/functions/hubspot-list-functions.js +152 -0
- package/dist/destinations/hubspot/upsertObject/functions/hubspot-list-functions.js.map +1 -0
- package/dist/destinations/hubspot/upsertObject/functions/hubspot-record-functions.js +5 -0
- package/dist/destinations/hubspot/upsertObject/functions/hubspot-record-functions.js.map +1 -1
- package/dist/destinations/hubspot/upsertObject/functions/validation-functions.d.ts +1 -1
- package/dist/destinations/hubspot/upsertObject/functions/validation-functions.js +22 -1
- package/dist/destinations/hubspot/upsertObject/functions/validation-functions.js.map +1 -1
- package/dist/destinations/hubspot/upsertObject/generated-types.d.ts +18 -0
- package/dist/destinations/hubspot/upsertObject/index.js +46 -36
- package/dist/destinations/hubspot/upsertObject/index.js.map +1 -1
- package/dist/destinations/hubspot/upsertObject/types.d.ts +53 -11
- package/dist/destinations/hubspot/upsertObject/types.js.map +1 -1
- package/dist/destinations/iterable-lists/index.js +14 -0
- package/dist/destinations/iterable-lists/index.js.map +1 -1
- package/dist/destinations/kafka/utils.d.ts +1 -0
- package/dist/destinations/kafka/utils.js +28 -8
- package/dist/destinations/kafka/utils.js.map +1 -1
- package/dist/destinations/klaviyo/index.js +14 -0
- package/dist/destinations/klaviyo/index.js.map +1 -1
- package/dist/destinations/marketo-static-lists/index.js +14 -0
- package/dist/destinations/marketo-static-lists/index.js.map +1 -1
- package/dist/destinations/ms-bing-capi/index.js +2 -2
- package/dist/destinations/ms-bing-capi/index.js.map +1 -1
- package/dist/destinations/ms-bing-capi/sendEvent/fields.js +1 -1
- package/dist/destinations/ms-bing-capi/sendEvent/fields.js.map +1 -1
- package/dist/destinations/ortto/common-fields.js +0 -21
- package/dist/destinations/ortto/common-fields.js.map +1 -1
- package/dist/destinations/ortto/trackActivity/generated-types.d.ts +2 -2
- package/dist/destinations/ortto/trackActivity/index.js +21 -2
- package/dist/destinations/ortto/trackActivity/index.js.map +1 -1
- package/dist/destinations/ortto/upsertContactProfile/generated-types.d.ts +2 -2
- package/dist/destinations/ortto/upsertContactProfile/index.js +23 -2
- package/dist/destinations/ortto/upsertContactProfile/index.js.map +1 -1
- package/dist/destinations/ortto-audiences/syncAudience/index.js +2 -0
- package/dist/destinations/ortto-audiences/syncAudience/index.js.map +1 -1
- package/dist/destinations/reddit-audiences/index.js +14 -0
- package/dist/destinations/reddit-audiences/index.js.map +1 -1
- package/dist/destinations/s3/{client.d.ts → syncToS3/client.d.ts} +1 -1
- package/dist/destinations/s3/syncToS3/client.js.map +1 -0
- package/dist/destinations/s3/{fields.d.ts → syncToS3/fields.d.ts} +1 -1
- package/dist/destinations/s3/{fields.js → syncToS3/fields.js} +11 -7
- package/dist/destinations/s3/syncToS3/fields.js.map +1 -0
- package/dist/destinations/s3/{functions.d.ts → syncToS3/functions.d.ts} +2 -2
- package/dist/destinations/s3/syncToS3/functions.js.map +1 -0
- package/dist/destinations/s3/syncToS3/index.js +2 -2
- package/dist/destinations/s3/syncToS3/index.js.map +1 -1
- package/dist/destinations/s3/syncToS3/types.js.map +1 -0
- package/dist/destinations/sendgrid-audiences/index.js +14 -0
- package/dist/destinations/sendgrid-audiences/index.js.map +1 -1
- package/dist/destinations/snap-audiences/index.js +14 -0
- package/dist/destinations/snap-audiences/index.js.map +1 -1
- package/dist/destinations/stackadapt-audiences/common-fields.d.ts +2 -0
- package/dist/destinations/stackadapt-audiences/common-fields.js +215 -0
- package/dist/destinations/stackadapt-audiences/common-fields.js.map +1 -0
- package/dist/destinations/stackadapt-audiences/common-functions.d.ts +8 -0
- package/dist/destinations/stackadapt-audiences/common-functions.js +212 -0
- package/dist/destinations/stackadapt-audiences/common-functions.js.map +1 -0
- package/dist/destinations/stackadapt-audiences/constants.d.ts +15 -0
- package/dist/destinations/stackadapt-audiences/constants.js +133 -0
- package/dist/destinations/stackadapt-audiences/constants.js.map +1 -0
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/fields.d.ts +2 -0
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/fields.js +63 -0
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/fields.js.map +1 -0
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/generated-types.d.ts +24 -5
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/index.js +19 -83
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/index.js.map +1 -1
- package/dist/destinations/stackadapt-audiences/forwardProfile/generated-types.d.ts +15 -9
- package/dist/destinations/stackadapt-audiences/forwardProfile/index.js +78 -124
- package/dist/destinations/stackadapt-audiences/forwardProfile/index.js.map +1 -1
- package/dist/destinations/stackadapt-audiences/generated-types.d.ts +1 -0
- package/dist/destinations/stackadapt-audiences/index.js +20 -8
- package/dist/destinations/stackadapt-audiences/index.js.map +1 -1
- package/dist/destinations/stackadapt-audiences/types.d.ts +37 -0
- package/dist/destinations/taboola-actions/index.js +14 -0
- package/dist/destinations/taboola-actions/index.js.map +1 -1
- package/dist/destinations/tiktok-audiences/index.js +14 -0
- package/dist/destinations/tiktok-audiences/index.js.map +1 -1
- package/dist/destinations/webhook-audiences/index.js +14 -0
- package/dist/destinations/webhook-audiences/index.js.map +1 -1
- package/dist/destinations/yahoo-audiences/index.js +14 -0
- package/dist/destinations/yahoo-audiences/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/destinations/s3/client.js.map +0 -1
- package/dist/destinations/s3/fields.js.map +0 -1
- package/dist/destinations/s3/functions.js.map +0 -1
- package/dist/destinations/s3/types.js.map +0 -1
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/functions.d.ts +0 -3
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/functions.js +0 -83
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/functions.js.map +0 -1
- package/dist/destinations/stackadapt-audiences/forwardProfile/functions.d.ts +0 -3
- package/dist/destinations/stackadapt-audiences/forwardProfile/functions.js +0 -131
- package/dist/destinations/stackadapt-audiences/forwardProfile/functions.js.map +0 -1
- package/dist/destinations/stackadapt-audiences/functions.d.ts +0 -7
- package/dist/destinations/stackadapt-audiences/functions.js +0 -62
- package/dist/destinations/stackadapt-audiences/functions.js.map +0 -1
- /package/dist/destinations/s3/{client.js → syncToS3/client.js} +0 -0
- /package/dist/destinations/s3/{functions.js → syncToS3/functions.js} +0 -0
- /package/dist/destinations/s3/{types.d.ts → syncToS3/types.d.ts} +0 -0
- /package/dist/destinations/s3/{types.js → syncToS3/types.js} +0 -0
|
@@ -1,131 +0,0 @@
|
|
|
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
|
-
exports.performForwardProfiles = performForwardProfiles;
|
|
7
|
-
const camelCase_1 = __importDefault(require("lodash/camelCase"));
|
|
8
|
-
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
9
|
-
const functions_1 = require("../functions");
|
|
10
|
-
const standardFields = new Set([
|
|
11
|
-
'email',
|
|
12
|
-
'firstName',
|
|
13
|
-
'lastName',
|
|
14
|
-
'phone',
|
|
15
|
-
'marketingStatus',
|
|
16
|
-
'company',
|
|
17
|
-
'gender',
|
|
18
|
-
'city',
|
|
19
|
-
'state',
|
|
20
|
-
'country',
|
|
21
|
-
'timezone',
|
|
22
|
-
'postalCode',
|
|
23
|
-
'birthDay',
|
|
24
|
-
'birthMonth',
|
|
25
|
-
'address',
|
|
26
|
-
'previousId'
|
|
27
|
-
]);
|
|
28
|
-
async function performForwardProfiles(request, events) {
|
|
29
|
-
const fieldsToMap = new Set(['userId']);
|
|
30
|
-
const fieldTypes = { userId: 'string' };
|
|
31
|
-
const advertiserId = events[0].advertiser_id;
|
|
32
|
-
const profileUpdates = events.flatMap((event) => {
|
|
33
|
-
const { event_type, previous_id, user_id, traits } = event;
|
|
34
|
-
const profile = {
|
|
35
|
-
userId: user_id
|
|
36
|
-
};
|
|
37
|
-
if (event_type === 'alias') {
|
|
38
|
-
profile.previousId = previous_id;
|
|
39
|
-
}
|
|
40
|
-
else if ((0, isEmpty_1.default)(traits)) {
|
|
41
|
-
return [];
|
|
42
|
-
}
|
|
43
|
-
const { birthday, ...rest } = traits ?? {};
|
|
44
|
-
if (birthday) {
|
|
45
|
-
const [birthDay, birthMonth] = birthday.split('T')[0].split('-').slice(1);
|
|
46
|
-
profile.birthDay = parseInt(birthDay);
|
|
47
|
-
profile.birthMonth = parseInt(birthMonth);
|
|
48
|
-
}
|
|
49
|
-
return { ...processTraits(rest), ...profile };
|
|
50
|
-
});
|
|
51
|
-
const profiles = (0, functions_1.stringifyJsonWithEscapedQuotes)(profileUpdates);
|
|
52
|
-
const mutation = `mutation {
|
|
53
|
-
upsertProfiles(
|
|
54
|
-
input: {
|
|
55
|
-
advertiserId: ${advertiserId},
|
|
56
|
-
externalProvider: "${functions_1.EXTERNAL_PROVIDER}",
|
|
57
|
-
syncId: "${(0, functions_1.sha256hash)(profiles)}",
|
|
58
|
-
profiles: "${profiles}"
|
|
59
|
-
}
|
|
60
|
-
) {
|
|
61
|
-
userErrors {
|
|
62
|
-
message
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
upsertProfileMapping(
|
|
66
|
-
input: {
|
|
67
|
-
advertiserId: ${advertiserId},
|
|
68
|
-
mappingSchemaV2: ${getProfileMappings(Array.from(fieldsToMap), fieldTypes)},
|
|
69
|
-
mappableType: "${functions_1.EXTERNAL_PROVIDER}"
|
|
70
|
-
}
|
|
71
|
-
) {
|
|
72
|
-
userErrors {
|
|
73
|
-
message
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}`;
|
|
77
|
-
return await request(functions_1.GQL_ENDPOINT, {
|
|
78
|
-
body: JSON.stringify({ query: mutation })
|
|
79
|
-
});
|
|
80
|
-
function processTraits(traits) {
|
|
81
|
-
return Object.keys(traits).reduce((acc, key) => {
|
|
82
|
-
const camelCaseKey = (0, camelCase_1.default)(key);
|
|
83
|
-
acc[camelCaseKey] = traits[key];
|
|
84
|
-
if (!standardFields.has(camelCaseKey)) {
|
|
85
|
-
fieldsToMap.add(camelCaseKey);
|
|
86
|
-
if (traits[key] || traits[key] === 0) {
|
|
87
|
-
const type = getType(traits[key]);
|
|
88
|
-
if (fieldTypes[camelCaseKey] && fieldTypes[camelCaseKey] !== type) {
|
|
89
|
-
fieldTypes[camelCaseKey] = 'STRING';
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
fieldTypes[camelCaseKey] = type;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return acc;
|
|
97
|
-
}, {});
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
function getProfileMappings(customFields, fieldTypes) {
|
|
101
|
-
const mappingSchema = [];
|
|
102
|
-
for (const field of customFields) {
|
|
103
|
-
mappingSchema.push({
|
|
104
|
-
incomingKey: field,
|
|
105
|
-
destinationKey: field === 'userId' ? 'external_id' : field,
|
|
106
|
-
label: generateLabel(field),
|
|
107
|
-
type: fieldTypes[field] ?? 'STRING',
|
|
108
|
-
isPii: false
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
return (0, functions_1.stringifyMappingSchemaForGraphQL)(mappingSchema);
|
|
112
|
-
}
|
|
113
|
-
function generateLabel(field) {
|
|
114
|
-
let label = field
|
|
115
|
-
.replace(/([A-Z])/g, ' $1')
|
|
116
|
-
.trim()
|
|
117
|
-
.replace(/^./, (str) => str.toUpperCase());
|
|
118
|
-
if (field.startsWith('audience')) {
|
|
119
|
-
label = `External ${label}`;
|
|
120
|
-
}
|
|
121
|
-
return label;
|
|
122
|
-
}
|
|
123
|
-
function getType(value) {
|
|
124
|
-
if (isDateStr(value))
|
|
125
|
-
return 'DATE';
|
|
126
|
-
return (typeof value).toUpperCase();
|
|
127
|
-
}
|
|
128
|
-
function isDateStr(value) {
|
|
129
|
-
return typeof value === 'string' && !isNaN(Date.parse(value));
|
|
130
|
-
}
|
|
131
|
-
//# sourceMappingURL=functions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../../src/destinations/stackadapt-audiences/forwardProfile/functions.ts"],"names":[],"mappings":";;;;;AAiCA,wDA2EC;AA3GD,iEAAwC;AACxC,6DAAoC;AAEpC,4CAA4I;AAE5I,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,OAAO;IACP,WAAW;IACX,UAAU;IACV,OAAO;IACP,iBAAiB;IACjB,SAAS;IACT,QAAQ;IACR,MAAM;IACN,OAAO;IACP,SAAS;IACT,UAAU;IACV,YAAY;IACZ,UAAU;IACV,YAAY;IACZ,SAAS;IACT,YAAY;CACb,CAAC,CAAA;AAUK,KAAK,UAAU,sBAAsB,CAAC,OAAsB,EAAE,MAAiB;IACpF,MAAM,WAAW,GAAgB,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAA;IACpD,MAAM,UAAU,GAA2B,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAA;IAC/D,MAAM,YAAY,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAA;IAC5C,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,KA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AC,KAAK;YAC1D,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC;YAC3B,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,IAAI,QAAQ;YACnC,KAAK,EAAE,KAAK;SACb,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,IAAA,4CAAgC,EAAC,aAAa,CAAC,CAAA;AACxD,CAAC;AAED,SAAS,aAAa,CAAC,KAAa;IAElC,IAAI,KAAK,GAAG,KAAK;SACd,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC;SAC1B,IAAI,EAAE;SACN,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAA;IAG5C,IAAI,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QACjC,KAAK,GAAG,YAAY,KAAK,EAAE,CAAA;IAC7B,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAC7B,IAAI,SAAS,CAAC,KAAK,CAAC;QAAE,OAAO,MAAM,CAAA;IACnC,OAAO,CAAC,OAAO,KAAK,CAAC,CAAC,WAAW,EAAE,CAAA;AACrC,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;AAC/D,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { createRequestClient, DynamicFieldResponse } from '@segment/actions-core';
|
|
2
|
-
export declare const EXTERNAL_PROVIDER = "segment_io";
|
|
3
|
-
export declare const GQL_ENDPOINT = "https://api.stackadapt.com/graphql";
|
|
4
|
-
export declare function advertiserIdFieldImplementation(request: ReturnType<typeof createRequestClient>): Promise<DynamicFieldResponse>;
|
|
5
|
-
export declare function sha256hash(data: string): string;
|
|
6
|
-
export declare function stringifyJsonWithEscapedQuotes(value: unknown): string;
|
|
7
|
-
export declare function stringifyMappingSchemaForGraphQL(value: unknown): string;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GQL_ENDPOINT = exports.EXTERNAL_PROVIDER = void 0;
|
|
4
|
-
exports.advertiserIdFieldImplementation = advertiserIdFieldImplementation;
|
|
5
|
-
exports.sha256hash = sha256hash;
|
|
6
|
-
exports.stringifyJsonWithEscapedQuotes = stringifyJsonWithEscapedQuotes;
|
|
7
|
-
exports.stringifyMappingSchemaForGraphQL = stringifyMappingSchemaForGraphQL;
|
|
8
|
-
const crypto_1 = require("crypto");
|
|
9
|
-
exports.EXTERNAL_PROVIDER = 'segment_io';
|
|
10
|
-
exports.GQL_ENDPOINT = 'https://api.stackadapt.com/graphql';
|
|
11
|
-
async function advertiserIdFieldImplementation(request) {
|
|
12
|
-
try {
|
|
13
|
-
const query = `query {
|
|
14
|
-
tokenInfo {
|
|
15
|
-
scopesByAdvertiser {
|
|
16
|
-
nodes {
|
|
17
|
-
advertiser {
|
|
18
|
-
id
|
|
19
|
-
name
|
|
20
|
-
}
|
|
21
|
-
scopes
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}`;
|
|
26
|
-
const response = await request(exports.GQL_ENDPOINT, {
|
|
27
|
-
body: JSON.stringify({ query })
|
|
28
|
-
});
|
|
29
|
-
const scopesByAdvertiser = response.data.data.tokenInfo.scopesByAdvertiser;
|
|
30
|
-
const choices = scopesByAdvertiser.nodes
|
|
31
|
-
.filter((advertiserEntry) => advertiserEntry.scopes.includes('WRITE'))
|
|
32
|
-
.map((advertiserEntry) => ({ value: advertiserEntry.advertiser.id, label: advertiserEntry.advertiser.name }))
|
|
33
|
-
.sort((a, b) => a.label.localeCompare(b.label));
|
|
34
|
-
return { choices };
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
return {
|
|
38
|
-
choices: [],
|
|
39
|
-
nextPage: '',
|
|
40
|
-
error: {
|
|
41
|
-
message: error.message ?? 'Unknown error',
|
|
42
|
-
code: error.status?.toString() ?? 'Unknown error'
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function sha256hash(data) {
|
|
48
|
-
const hash = (0, crypto_1.createHash)('sha256');
|
|
49
|
-
hash.update(data);
|
|
50
|
-
return hash.digest('hex');
|
|
51
|
-
}
|
|
52
|
-
function stringifyJsonWithEscapedQuotes(value) {
|
|
53
|
-
const jsonString = JSON.stringify(value);
|
|
54
|
-
return jsonString.replace(/"/g, '\\"');
|
|
55
|
-
}
|
|
56
|
-
function stringifyMappingSchemaForGraphQL(value) {
|
|
57
|
-
let jsonString = JSON.stringify(value);
|
|
58
|
-
jsonString = jsonString.replace(/"type":"([^"]+)"/g, (_, typeValue) => `type:${typeValue.toUpperCase()}`);
|
|
59
|
-
jsonString = jsonString.replace(/"([a-zA-Z_][a-zA-Z0-9_]*)"\s*:/g, '$1:');
|
|
60
|
-
return jsonString;
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=functions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/destinations/stackadapt-audiences/functions.ts"],"names":[],"mappings":";;;AA6BA,0EAoCC;AAED,gCAIC;AAGD,wEAKC;AAGD,4EAWC;AA3FD,mCAAmC;AAwBtB,QAAA,iBAAiB,GAAG,YAAY,CAAA;AAChC,QAAA,YAAY,GAAG,oCAAoC,CAAA;AAEzD,KAAK,UAAU,+BAA+B,CACnD,OAA+C;IAE/C,IAAI,CAAC;QACH,MAAM,KAAK,GAAG;;;;;;;;;;;;QAYV,CAAA;QACJ,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAoB,oBAAY,EAAE;YAC9D,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC;SAChC,CAAC,C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