@segment/action-destinations 3.118.1-staging.105 → 3.118.1-staging.106
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/adobe-target/adobeTarget_operations.d.ts +2 -1
- package/dist/destinations/adobe-target/adobeTarget_operations.js +8 -4
- package/dist/destinations/adobe-target/adobeTarget_operations.js.map +1 -1
- package/dist/destinations/adobe-target/updateProfile/index.js +3 -11
- package/dist/destinations/adobe-target/updateProfile/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { RequestClient } from '@segment/actions-core';
|
|
2
|
+
import { StatsContext } from '@segment/actions-core/src/destination-kit';
|
|
2
3
|
export default class AdobeTarget {
|
|
3
4
|
userId: string;
|
|
4
5
|
clientCode: string;
|
|
5
6
|
traits: object;
|
|
6
7
|
request: RequestClient;
|
|
7
8
|
constructor(userId: string, clientCode: string, traits: object, request: RequestClient);
|
|
8
|
-
updateProfile: () => Promise<import("@segment/actions-core").ModifiedResponse<unknown> | undefined>;
|
|
9
|
+
updateProfile: (statsContext: StatsContext | undefined) => Promise<import("@segment/actions-core").ModifiedResponse<unknown> | undefined>;
|
|
9
10
|
private lookupProfile;
|
|
10
11
|
}
|
|
@@ -20,8 +20,8 @@ const objectToQueryString = (object) => Object.keys(object)
|
|
|
20
20
|
.join('&');
|
|
21
21
|
class AdobeTarget {
|
|
22
22
|
constructor(userId, clientCode, traits, request) {
|
|
23
|
-
this.updateProfile = async () => {
|
|
24
|
-
const err = await this.lookupProfile(this.userId, this.clientCode);
|
|
23
|
+
this.updateProfile = async (statsContext) => {
|
|
24
|
+
const err = await this.lookupProfile(this.userId, this.clientCode, statsContext);
|
|
25
25
|
if (err) {
|
|
26
26
|
throw err;
|
|
27
27
|
}
|
|
@@ -35,13 +35,17 @@ class AdobeTarget {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
this.lookupProfile = async (userId, clientCode) => {
|
|
38
|
+
this.lookupProfile = async (userId, clientCode, statsContext) => {
|
|
39
39
|
try {
|
|
40
40
|
await this.request(`https://${clientCode}.tt.omtrdc.net/rest/v1/profiles/thirdPartyId/${userId}?client=${clientCode}`, { method: 'get' });
|
|
41
41
|
}
|
|
42
42
|
catch (error) {
|
|
43
43
|
if (error instanceof Error) {
|
|
44
|
-
|
|
44
|
+
const errorCode = error.message == 'Forbidden' ? 403 : 500;
|
|
45
|
+
if (errorCode == 500) {
|
|
46
|
+
statsContext?.statsClient.incr('actions-adobe-target.profile-not-found', 1, statsContext.tags);
|
|
47
|
+
}
|
|
48
|
+
throw new actions_core_1.IntegrationError(error.message, error.stack, errorCode);
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adobeTarget_operations.js","sourceRoot":"","sources":["../../../src/destinations/adobe-target/adobeTarget_operations.ts"],"names":[],"mappings":";;AAAA,wDAAuE;
|
|
1
|
+
{"version":3,"file":"adobeTarget_operations.js","sourceRoot":"","sources":["../../../src/destinations/adobe-target/adobeTarget_operations.ts"],"names":[],"mappings":";;AAAA,wDAAuE;AAGvE,SAAS,gBAAgB,CAAC,GAAyB,EAAE,UAAU,GAAG,EAAE,EAAE,aAAsC,EAAE;IAE5G,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,IAAI,SAAS,EAAE;QACnC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YAC/B,MAAM,cAAc,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAA;YAEhE,IAAI,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE;gBAChC,UAAU,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAA;aACj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WAAW,UAAU,EAAE,EAClG,EAAE,MAAM,EAAE,KAAK,EAAE,CAClB,CAAA;aACF;YAAC,OAAO,KAAK,EAAE;gBACd,IAAI,KAAK,YAAY,KAAK,EAAE;oBAK1B,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAA;oBAE1D,IAAI,SAAS,IAAI,GAAG,EAAE;wBAEpB,YAAY,EAAE,WAAW,CAAC,IAAI,CAAC,wCAAwC,EAAE,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;qBAC/F;oBAED,MAAM,IAAI,+BAAgB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;iBAClE;aACF;YAED,OAAO,SAAS,CAAA;QAClB,CAAC,CAAA;QAnDC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;CAgDF;AA3DD,8BA2DC"}
|
|
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
7
6
|
const adobeTarget_operations_1 = __importDefault(require("../adobeTarget_operations"));
|
|
8
7
|
const action = {
|
|
9
8
|
title: 'Update Profile',
|
|
@@ -31,16 +30,9 @@ const action = {
|
|
|
31
30
|
defaultObjectUI: 'keyvalue'
|
|
32
31
|
}
|
|
33
32
|
},
|
|
34
|
-
perform: async (request, { settings, payload }) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return await at.updateProfile();
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
if (error instanceof Error) {
|
|
41
|
-
throw new actions_core_1.IntegrationError(error.message, error.message == 'Forbidden' ? '403' : '400');
|
|
42
|
-
}
|
|
43
|
-
}
|
|
33
|
+
perform: async (request, { settings, payload, statsContext }) => {
|
|
34
|
+
const at = new adobeTarget_operations_1.default(payload.user_id, settings.client_code, payload.traits, request);
|
|
35
|
+
return await at.updateProfile(statsContext);
|
|
44
36
|
}
|
|
45
37
|
};
|
|
46
38
|
exports.default = action;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/adobe-target/updateProfile/index.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/adobe-target/updateProfile/index.ts"],"names":[],"mappings":";;;;;AAEA,uFAAmD;AAGnD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,kDAAkD;IAC/D,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,OAAO,EAAE;YACP,KAAK,EAAE,mBAAmB;YAC1B,WAAW,EACT,+LAA+L;YACjM,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;oBAC/B,IAAI,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;oBAC7B,IAAI,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE;iBACnC;aACF;SACF;QACD,MAAM,EAAE;YACN,KAAK,EAAE,oBAAoB;YAC3B,WAAW,EACT,oHAAoH;YACtH,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,eAAe,EAAE,UAAU;SAC5B;KACF;IAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE;QAC9D,MAAM,EAAE,GAAgB,IAAI,gCAAW,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QACvG,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,YAAY,CAAC,CAAA;IAC7C,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
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.118.1-staging.
|
|
4
|
+
"version": "3.118.1-staging.106+e0d2abff",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"lcov"
|
|
66
66
|
]
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "e0d2abffafed4827df5705b634312461a241df2f"
|
|
69
69
|
}
|