@segment/action-destinations 3.115.1-alpha.5 → 3.115.1-stat-before-clone.4
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/amplitude/event-schema.js +1 -5
- package/dist/destinations/amplitude/event-schema.js.map +1 -1
- package/dist/destinations/amplitude/identifyUser/index.js +1 -5
- package/dist/destinations/amplitude/identifyUser/index.js.map +1 -1
- package/dist/destinations/index.js +1 -1
- package/dist/destinations/index.js.map +1 -1
- package/dist/destinations/segment/errors.d.ts +3 -0
- package/dist/destinations/segment/errors.js +7 -0
- package/dist/destinations/segment/errors.js.map +1 -0
- package/dist/destinations/segment/generated-types.d.ts +4 -0
- package/dist/destinations/{1plusx-asset-api → segment}/generated-types.js +0 -0
- package/dist/destinations/segment/generated-types.js.map +1 -0
- package/dist/destinations/{1plusx-asset-api → segment}/index.d.ts +0 -0
- package/dist/destinations/segment/index.js +58 -0
- package/dist/destinations/segment/index.js.map +1 -0
- package/dist/destinations/segment/properties.d.ts +10 -0
- package/dist/destinations/segment/properties.js +17 -0
- package/dist/destinations/segment/properties.js.map +1 -0
- package/dist/destinations/segment/segment-properties.d.ts +23 -0
- package/dist/destinations/segment/segment-properties.js +322 -0
- package/dist/destinations/segment/segment-properties.js.map +1 -0
- package/dist/destinations/segment/sendGroup/generated-types.d.ts +65 -0
- package/dist/destinations/{1plusx-asset-api/sendAssetData → segment/sendGroup}/generated-types.js +0 -0
- package/dist/destinations/segment/sendGroup/generated-types.js.map +1 -0
- package/dist/destinations/{1plusx-asset-api/sendAssetData → segment/sendGroup}/index.d.ts +1 -1
- package/dist/destinations/segment/sendGroup/index.js +67 -0
- package/dist/destinations/segment/sendGroup/index.js.map +1 -0
- package/dist/destinations/segment/sendIdentify/generated-types.d.ts +65 -0
- package/dist/destinations/segment/sendIdentify/generated-types.js +3 -0
- package/dist/destinations/segment/sendIdentify/generated-types.js.map +1 -0
- package/dist/destinations/segment/sendIdentify/index.d.ts +5 -0
- package/dist/destinations/segment/sendIdentify/index.js +67 -0
- package/dist/destinations/segment/sendIdentify/index.js.map +1 -0
- package/dist/destinations/segment/sendPage/generated-types.d.ts +67 -0
- package/dist/destinations/segment/sendPage/generated-types.js +3 -0
- package/dist/destinations/segment/sendPage/generated-types.js.map +1 -0
- package/dist/destinations/segment/sendPage/index.d.ts +5 -0
- package/dist/destinations/segment/sendPage/index.js +77 -0
- package/dist/destinations/segment/sendPage/index.js.map +1 -0
- package/dist/destinations/segment/sendScreen/generated-types.d.ts +66 -0
- package/dist/destinations/segment/sendScreen/generated-types.js +3 -0
- package/dist/destinations/segment/sendScreen/generated-types.js.map +1 -0
- package/dist/destinations/segment/sendScreen/index.d.ts +5 -0
- package/dist/destinations/segment/sendScreen/index.js +69 -0
- package/dist/destinations/segment/sendScreen/index.js.map +1 -0
- package/dist/destinations/segment/sendTrack/generated-types.d.ts +66 -0
- package/dist/destinations/segment/sendTrack/generated-types.js +3 -0
- package/dist/destinations/segment/sendTrack/generated-types.js.map +1 -0
- package/dist/destinations/segment/sendTrack/index.d.ts +5 -0
- package/dist/destinations/segment/sendTrack/index.js +69 -0
- package/dist/destinations/segment/sendTrack/index.js.map +1 -0
- package/package.json +4 -4
- package/dist/destinations/1plusx-asset-api/generated-types.d.ts +0 -5
- package/dist/destinations/1plusx-asset-api/generated-types.js.map +0 -1
- package/dist/destinations/1plusx-asset-api/index.js +0 -61
- package/dist/destinations/1plusx-asset-api/index.js.map +0 -1
- package/dist/destinations/1plusx-asset-api/sendAssetData/generated-types.d.ts +0 -8
- package/dist/destinations/1plusx-asset-api/sendAssetData/generated-types.js.map +0 -1
- package/dist/destinations/1plusx-asset-api/sendAssetData/index.js +0 -67
- package/dist/destinations/1plusx-asset-api/sendAssetData/index.js.map +0 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
user_id?: string;
|
|
3
|
+
anonymous_id?: string;
|
|
4
|
+
timestamp?: string;
|
|
5
|
+
event_name?: string;
|
|
6
|
+
application?: {
|
|
7
|
+
name?: string;
|
|
8
|
+
version?: string;
|
|
9
|
+
build?: string;
|
|
10
|
+
namespace?: string;
|
|
11
|
+
};
|
|
12
|
+
campaign_parameters?: {
|
|
13
|
+
name?: string;
|
|
14
|
+
source?: string;
|
|
15
|
+
medium?: string;
|
|
16
|
+
term?: string;
|
|
17
|
+
content?: string;
|
|
18
|
+
};
|
|
19
|
+
device?: {
|
|
20
|
+
id?: string;
|
|
21
|
+
advertising_id?: string;
|
|
22
|
+
adTracking_Enabled?: boolean;
|
|
23
|
+
manufacturer?: string;
|
|
24
|
+
model?: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
type?: string;
|
|
27
|
+
token?: string;
|
|
28
|
+
};
|
|
29
|
+
ip_address?: string;
|
|
30
|
+
locale?: string;
|
|
31
|
+
location?: {
|
|
32
|
+
city?: string;
|
|
33
|
+
country?: string;
|
|
34
|
+
latitude?: number;
|
|
35
|
+
longitude?: number;
|
|
36
|
+
speed?: number;
|
|
37
|
+
};
|
|
38
|
+
network?: {
|
|
39
|
+
bluetooth?: boolean;
|
|
40
|
+
carrier?: string;
|
|
41
|
+
cellular?: boolean;
|
|
42
|
+
wifi?: boolean;
|
|
43
|
+
};
|
|
44
|
+
operating_system?: {
|
|
45
|
+
name?: string;
|
|
46
|
+
version?: string;
|
|
47
|
+
};
|
|
48
|
+
page?: {
|
|
49
|
+
path?: string;
|
|
50
|
+
referrer?: string;
|
|
51
|
+
search?: string;
|
|
52
|
+
title?: string;
|
|
53
|
+
url?: string;
|
|
54
|
+
};
|
|
55
|
+
screen?: {
|
|
56
|
+
density?: number;
|
|
57
|
+
height?: number;
|
|
58
|
+
width?: number;
|
|
59
|
+
};
|
|
60
|
+
user_agent?: string;
|
|
61
|
+
timezone?: string;
|
|
62
|
+
group_id?: string;
|
|
63
|
+
properties?: {
|
|
64
|
+
[k: string]: unknown;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/segment/sendTrack/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const segment_properties_1 = require("../segment-properties");
|
|
4
|
+
const properties_1 = require("../properties");
|
|
5
|
+
const errors_1 = require("../errors");
|
|
6
|
+
const action = {
|
|
7
|
+
title: 'Send Track',
|
|
8
|
+
description: 'Send a track call to Segment’s tracking API. This is used to record actions your users perform.',
|
|
9
|
+
defaultSubscription: 'type = "track"',
|
|
10
|
+
fields: {
|
|
11
|
+
user_id: segment_properties_1.user_id,
|
|
12
|
+
anonymous_id: segment_properties_1.anonymous_id,
|
|
13
|
+
timestamp: segment_properties_1.timestamp,
|
|
14
|
+
event_name: segment_properties_1.event_name,
|
|
15
|
+
application: segment_properties_1.application,
|
|
16
|
+
campaign_parameters: segment_properties_1.campaign_parameters,
|
|
17
|
+
device: segment_properties_1.device,
|
|
18
|
+
ip_address: segment_properties_1.ip_address,
|
|
19
|
+
locale: segment_properties_1.locale,
|
|
20
|
+
location: segment_properties_1.location,
|
|
21
|
+
network: segment_properties_1.network,
|
|
22
|
+
operating_system: segment_properties_1.operating_system,
|
|
23
|
+
page: segment_properties_1.page,
|
|
24
|
+
screen: segment_properties_1.screen,
|
|
25
|
+
user_agent: segment_properties_1.user_agent,
|
|
26
|
+
timezone: segment_properties_1.timezone,
|
|
27
|
+
group_id: segment_properties_1.group_id,
|
|
28
|
+
properties: segment_properties_1.properties
|
|
29
|
+
},
|
|
30
|
+
perform: (request, { payload, settings }) => {
|
|
31
|
+
if (!payload.anonymous_id && !payload.user_id) {
|
|
32
|
+
throw errors_1.MissingUserOrAnonymousIdThrowableError;
|
|
33
|
+
}
|
|
34
|
+
const trackPayload = {
|
|
35
|
+
userId: payload?.user_id,
|
|
36
|
+
anonymousId: payload?.anonymous_id,
|
|
37
|
+
timestamp: payload?.timestamp,
|
|
38
|
+
event: payload?.event_name,
|
|
39
|
+
context: {
|
|
40
|
+
app: payload?.application,
|
|
41
|
+
campaign: payload?.campaign_parameters,
|
|
42
|
+
device: payload?.device,
|
|
43
|
+
ip: payload?.ip_address,
|
|
44
|
+
locale: payload?.locale,
|
|
45
|
+
location: payload?.location,
|
|
46
|
+
network: payload?.network,
|
|
47
|
+
os: payload?.operating_system,
|
|
48
|
+
page: payload?.page,
|
|
49
|
+
screen: payload?.screen,
|
|
50
|
+
userAgent: payload?.user_agent,
|
|
51
|
+
timezone: payload?.timezone,
|
|
52
|
+
groupId: payload?.group_id
|
|
53
|
+
},
|
|
54
|
+
properties: {
|
|
55
|
+
...payload?.properties
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
if (!settings.endpoint || !(settings.endpoint in properties_1.SEGMENT_ENDPOINTS)) {
|
|
59
|
+
throw errors_1.InvalidEndpointSelectedThrowableError;
|
|
60
|
+
}
|
|
61
|
+
const selectedSegmentEndpoint = properties_1.SEGMENT_ENDPOINTS[settings.endpoint].url;
|
|
62
|
+
return request(`${selectedSegmentEndpoint}/track`, {
|
|
63
|
+
method: 'POST',
|
|
64
|
+
json: trackPayload
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
exports.default = action;
|
|
69
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/segment/sendTrack/index.ts"],"names":[],"mappings":";;AAGA,8DAmB8B;AAC9B,8CAAiD;AACjD,sCAAyG;AAEzG,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,iGAAiG;IAC9G,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,OAAO,EAAP,4BAAO;QACP,YAAY,EAAZ,iCAAY;QACZ,SAAS,EAAT,8BAAS;QACT,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,EAAE,OAAO,EAAE,QAAQ;aAC3B;YACD,UAAU,EAAE;gBACV,GAAG,OAAO,EAAE,UAAU;aACvB;SACF,CAAA;QAGD,IAAI,CAAC,QAAQ,CAAC,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,IAAI,8BAAiB,CAAC,EAAE;YACnE,MAAM,8CAAqC,CAAA;SAC5C;QAED,MAAM,uBAAuB,GAAG,8BAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAA;QACxE,OAAO,OAAO,CAAC,GAAG,uBAAuB,QAAQ,EAAE;YACjD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,YAAY;SACnB,CAAC,CAAA;IACJ,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.115.1-
|
|
4
|
+
"version": "3.115.1-stat-before-clone.4+687063aa",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@amplitude/ua-parser-js": "^0.7.25",
|
|
40
40
|
"@segment/a1-notation": "^2.1.4",
|
|
41
|
-
"@segment/actions-core": "^3.42.1-
|
|
42
|
-
"@segment/actions-shared": "^1.25.1-
|
|
41
|
+
"@segment/actions-core": "^3.42.1-stat-before-clone.4+687063aa",
|
|
42
|
+
"@segment/actions-shared": "^1.25.1-stat-before-clone.4+687063aa",
|
|
43
43
|
"cheerio": "^1.0.0-rc.10",
|
|
44
44
|
"dayjs": "^1.10.7",
|
|
45
45
|
"escape-goat": "^3",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"lcov"
|
|
66
66
|
]
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "687063aad5fa93d7495b4dd644fc1e7cb8495097"
|
|
69
69
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/1plusx-asset-api/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -1,61 +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
|
-
const sendAssetData_1 = __importDefault(require("./sendAssetData"));
|
|
7
|
-
const destination = {
|
|
8
|
-
name: '1Plusx Asset Api',
|
|
9
|
-
slug: 'actions-1plusx-asset-api',
|
|
10
|
-
mode: 'cloud',
|
|
11
|
-
authentication: {
|
|
12
|
-
scheme: 'oauth2',
|
|
13
|
-
fields: {
|
|
14
|
-
client_name: {
|
|
15
|
-
label: 'Client Name',
|
|
16
|
-
description: 'Your 1plusX Client Name. Please refer to your 1PlusX representative to obtain it.',
|
|
17
|
-
type: 'string',
|
|
18
|
-
required: true
|
|
19
|
-
},
|
|
20
|
-
client_id: {
|
|
21
|
-
label: 'Client ID',
|
|
22
|
-
description: 'Your 1plusX Client ID. Available in 1plusX UI in the "API Keys" section.',
|
|
23
|
-
type: 'string',
|
|
24
|
-
required: true
|
|
25
|
-
},
|
|
26
|
-
client_secret: {
|
|
27
|
-
label: 'Client Secret',
|
|
28
|
-
description: 'Your 1plusX Client Secret. Available in 1plusX UI in the "API Keys" section.',
|
|
29
|
-
type: 'string',
|
|
30
|
-
required: true
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
refreshAccessToken: async (request, { settings }) => {
|
|
34
|
-
console.log('refreshAccessToken start');
|
|
35
|
-
const res = await request('https://ui.1plusx.io/api/auth/token', {
|
|
36
|
-
method: 'POST',
|
|
37
|
-
headers: {
|
|
38
|
-
'Content-Type': 'application/json',
|
|
39
|
-
Authorization: 'Basic ' + btoa(settings.client_id + ':' + settings.client_secret)
|
|
40
|
-
},
|
|
41
|
-
body: '{"grant_type":"client_credentials"}'
|
|
42
|
-
});
|
|
43
|
-
console.log('refresh token');
|
|
44
|
-
return { accessToken: res.data.access_token };
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
extendRequest({ auth }) {
|
|
48
|
-
console.log('access token ' + auth?.accessToken);
|
|
49
|
-
console.log('extendRequest starts');
|
|
50
|
-
return {
|
|
51
|
-
headers: {
|
|
52
|
-
authorization: `Bearer ${auth?.accessToken}`
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
},
|
|
56
|
-
actions: {
|
|
57
|
-
sendAssetData: sendAssetData_1.default
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
exports.default = destination;
|
|
61
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/1plusx-asset-api/index.ts"],"names":[],"mappings":";;;;;AAGA,oEAA2C;AAM3C,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,0BAA0B;IAChC,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,WAAW,EAAE;gBACX,KAAK,EAAE,aAAa;gBACpB,WAAW,EAAE,mFAAmF;gBAChG,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,SAAS,EAAE;gBACT,KAAK,EAAE,WAAW;gBAClB,WAAW,EAAE,0EAA0E;gBACvF,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,aAAa,EAAE;gBACb,KAAK,EAAE,eAAe;gBACtB,WAAW,EAAE,8EAA8E;gBAC3F,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;SACF;QAED,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YAClD,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAA;YAEvC,MAAM,GAAG,GAAG,MAAM,OAAO,CAAuB,qCAAqC,EAAE;gBACrF,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;oBAClC,aAAa,EAAE,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,GAAG,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC;iBAClF;gBACD,IAAI,EAAE,qCAAqC;aAC5C,CAAC,CAAA;YACF,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;YAC5B,OAAO,EAAE,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,CAAA;QAC/C,CAAC;KACF;IACD,aAAa,CAAC,EAAE,IAAI,EAAE;QACpB,OAAO,CAAC,GAAG,CAAC,eAAe,GAAG,IAAI,EAAE,WAAW,CAAC,CAAA;QAChD,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAA;QACnC,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,EAAE,WAAW,EAAE;aAC7C;SACF,CAAA;IACH,CAAC;IAED,OAAO,EAAE;QACP,aAAa,EAAb,uBAAa;KACd;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/1plusx-asset-api/sendAssetData/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -1,67 +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
|
-
const mapValues_1 = __importDefault(require("lodash/mapValues"));
|
|
7
|
-
const action = {
|
|
8
|
-
title: 'Send Asset Data',
|
|
9
|
-
description: 'Send Asset data into 1PlusX',
|
|
10
|
-
fields: {
|
|
11
|
-
asset_uri: {
|
|
12
|
-
label: 'Asset ID',
|
|
13
|
-
description: "The asset's unique identifier",
|
|
14
|
-
type: 'string',
|
|
15
|
-
required: true,
|
|
16
|
-
default: {
|
|
17
|
-
'@template': 'ASSETnamespace:ASSETid'
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
ope_title: {
|
|
21
|
-
label: 'Asset Title',
|
|
22
|
-
description: 'User friendly description of the asset in the UI',
|
|
23
|
-
type: 'string',
|
|
24
|
-
required: false,
|
|
25
|
-
default: {
|
|
26
|
-
'@path': '$.properties.title'
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
ope_content: {
|
|
30
|
-
label: 'Asset Content',
|
|
31
|
-
description: 'Textual content of the asset processing using NLP alogrithms',
|
|
32
|
-
type: 'string',
|
|
33
|
-
required: false,
|
|
34
|
-
default: {
|
|
35
|
-
'@path': '$.properties.content'
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
custom_fields: {
|
|
39
|
-
label: 'Custom Fields',
|
|
40
|
-
description: 'Custom fields to include with the event',
|
|
41
|
-
type: 'object'
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
perform: (request, { settings, payload }) => {
|
|
45
|
-
const { custom_fields, asset_uri, ...cleanPayload } = payload;
|
|
46
|
-
const cleanProps = mapValues_1.default(custom_fields, function (value) {
|
|
47
|
-
if (typeof value === 'object' && !(value instanceof Array) && !(value instanceof Date))
|
|
48
|
-
return;
|
|
49
|
-
else if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean')
|
|
50
|
-
return value;
|
|
51
|
-
else if (value instanceof Array)
|
|
52
|
-
return value;
|
|
53
|
-
else
|
|
54
|
-
return JSON.stringify(value);
|
|
55
|
-
});
|
|
56
|
-
const endpoint = `https://${settings.client_name}.assets.tagger.opecloud.com/v2/native/asset/${payload.asset_uri}`;
|
|
57
|
-
return request(endpoint, {
|
|
58
|
-
method: 'post',
|
|
59
|
-
json: {
|
|
60
|
-
...cleanPayload,
|
|
61
|
-
...cleanProps
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
exports.default = action;
|
|
67
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/1plusx-asset-api/sendAssetData/index.ts"],"names":[],"mappings":";;;;;AAGA,iEAAwC;AAExC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,6BAA6B;IAC1C,MAAM,EAAE;QAEN,SAAS,EAAE;YACT,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,+BAA+B;YAC5C,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,WAAW,EAAE,wBAAwB;aACtC;SACF;QACD,SAAS,EAAE;YACT,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,kDAAkD;YAC/D,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,oBAAoB;aAC9B;SACF;QACD,WAAW,EAAE;YACX,KAAK,EAAE,eAAe;YACtB,WAAW,EAAE,8DAA8D;YAC3E,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,sBAAsB;aAChC;SACF;QACD,aAAa,EAAE;YACb,KAAK,EAAE,eAAe;YACtB,WAAW,EAAE,yCAAyC;YACtD,IAAI,EAAE,QAAQ;SACf;KACF;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QA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