@segment/action-destinations 3.27.1 → 3.27.3-alpha.1
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/google-enhanced-conversions/postConversion/generated-types.d.ts +1 -1
- package/dist/destinations/metronome/generated-types.d.ts +3 -0
- package/dist/destinations/metronome/generated-types.js +3 -0
- package/dist/destinations/metronome/generated-types.js.map +1 -0
- package/dist/destinations/metronome/index.d.ts +4 -0
- package/dist/destinations/metronome/index.js +51 -0
- package/dist/destinations/metronome/index.js.map +1 -0
- package/dist/destinations/metronome/sendEvent/generated-types.d.ts +9 -0
- package/dist/destinations/metronome/sendEvent/generated-types.js +3 -0
- package/dist/destinations/metronome/sendEvent/generated-types.js.map +1 -0
- package/dist/destinations/metronome/sendEvent/index.d.ts +5 -0
- package/dist/destinations/metronome/sendEvent/index.js +73 -0
- package/dist/destinations/metronome/sendEvent/index.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/metronome/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,51 @@
|
|
|
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 actions_core_1 = require("@segment/actions-core");
|
|
7
|
+
const sendEvent_1 = __importDefault(require("./sendEvent"));
|
|
8
|
+
const destination = {
|
|
9
|
+
name: 'Metronome',
|
|
10
|
+
mode: 'cloud',
|
|
11
|
+
authentication: {
|
|
12
|
+
scheme: 'custom',
|
|
13
|
+
fields: {
|
|
14
|
+
apiToken: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
label: 'API Token',
|
|
17
|
+
description: 'Your Metronome API Token',
|
|
18
|
+
required: true
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
testAuthentication: async (request) => {
|
|
22
|
+
const response = await request('https://api.getmetronome.com/v1/ingest', {
|
|
23
|
+
method: 'post',
|
|
24
|
+
json: [],
|
|
25
|
+
throwHttpErrors: false
|
|
26
|
+
});
|
|
27
|
+
if (response.status === 400) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
throw new Error('Invalid API Token');
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
extendRequest: ({ settings }) => {
|
|
34
|
+
return {
|
|
35
|
+
headers: { Authorization: `Bearer ${settings.apiToken}` }
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
actions: {
|
|
39
|
+
sendEvent: sendEvent_1.default
|
|
40
|
+
},
|
|
41
|
+
presets: [
|
|
42
|
+
{
|
|
43
|
+
name: 'Send track events to Metronome',
|
|
44
|
+
subscribe: 'type = "track"',
|
|
45
|
+
partnerAction: 'sendEvent',
|
|
46
|
+
mapping: actions_core_1.defaultValues(sendEvent_1.default.fields)
|
|
47
|
+
},
|
|
48
|
+
]
|
|
49
|
+
};
|
|
50
|
+
exports.default = destination;
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/metronome/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA4E;AAG5E,4DAAmC;AAEnC,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,WAAW;gBAClB,WAAW,EAAE,0BAA0B;gBACvC,QAAQ,EAAE,IAAI;aACf;SACF;QACD,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YACpC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,wCAAwC,EAAE;gBACvE,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,EAAE;gBACR,eAAe,EAAE,KAAK;aACvB,CAAC,CAAA;YAEF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;gBAC3B,OAAO,IAAI,CAAA;aACZ;YACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAA;QACtC,CAAC;KACF;IACD,aAAa,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC9B,OAAO;YACL,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,QAAQ,CAAC,QAAQ,EAAE,EAAE;SAC1D,CAAA;IACH,CAAC;IACD,OAAO,EAAE;QACP,SAAS,EAAT,mBAAS;KACV;IACD,OAAO,EAAE;QACP;YACE,IAAI,EAAE,gCAAgC;YACtC,SAAS,EAAE,gBAAgB;YAC3B,aAAa,EAAE,WAAW;YAC1B,OAAO,EAAE,4BAAa,CAAC,mBAAS,CAAC,MAAM,CAAC;SACzC;KACF;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/metronome/sendEvent/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,73 @@
|
|
|
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 dayjs_1 = __importDefault(require("../../../lib/dayjs"));
|
|
7
|
+
function serializeEvent(event) {
|
|
8
|
+
return {
|
|
9
|
+
...event,
|
|
10
|
+
timestamp: dayjs_1.default.utc(event.timestamp).toISOString(),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
const action = {
|
|
14
|
+
title: 'Send Event',
|
|
15
|
+
description: 'Send an event to Metronome',
|
|
16
|
+
fields: {
|
|
17
|
+
transaction_id: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
label: 'transaction_id',
|
|
20
|
+
description: 'The Metronome transaction ID uniquely identifies an event to ensure Metronome only processes each event once.',
|
|
21
|
+
required: true,
|
|
22
|
+
default: {
|
|
23
|
+
'@path': '$.messageId'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
customer_id: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
label: 'customer_id',
|
|
29
|
+
description: 'The Metronome customer ID or ingest alias this event should be associated with.',
|
|
30
|
+
required: true,
|
|
31
|
+
default: {
|
|
32
|
+
'@path': '$.context.groupId'
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
timestamp: {
|
|
36
|
+
type: 'datetime',
|
|
37
|
+
label: 'timestamp',
|
|
38
|
+
description: 'The timestamp at which this event occurred.',
|
|
39
|
+
required: true,
|
|
40
|
+
default: {
|
|
41
|
+
'@path': '$.timestamp'
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
event_type: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
label: 'event_type',
|
|
47
|
+
description: 'The Metronome `event_type`.',
|
|
48
|
+
required: true,
|
|
49
|
+
default: {
|
|
50
|
+
'@path': '$.event'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
properties: {
|
|
54
|
+
type: 'object',
|
|
55
|
+
label: 'properties',
|
|
56
|
+
description: 'The Metronome properties object.',
|
|
57
|
+
required: true,
|
|
58
|
+
default: {
|
|
59
|
+
'@path': '$.properties'
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
perform: (request, { payload }) => {
|
|
64
|
+
return request('https://api.getmetronome.com/v1/ingest', {
|
|
65
|
+
method: 'post',
|
|
66
|
+
json: [
|
|
67
|
+
serializeEvent(payload)
|
|
68
|
+
]
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
exports.default = action;
|
|
73
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/metronome/sendEvent/index.ts"],"names":[],"mappings":";;;;;AAGA,+DAAsC;AAEtC,SAAS,cAAc,CAAC,KAAc;IACpC,OAAO;QACL,GAAG,KAAK;QAWR,SAAS,EAAE,eAAK,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;KACpD,CAAA;AACH,CAAC;AAED,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,4BAA4B;IACzC,MAAM,EAAE;QACN,cAAc,EAAE;YACd,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,gBAAgB;YACvB,WAAW,EAAE,+GAA+G;YAC5H,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,iFAAiF;YAC9F,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,mBAAmB;aAC7B;SACF;QACD,SAAS,EAAE;YACT,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,6BAA6B;YAC1C,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,SAAS;aACnB;SACF;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,cAAc;aACxB;SACF;KACF;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAEhC,OAAO,OAAO,CAAC,wCAAwC,EAAE;YACvD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,cAAc,CAAC,OAAO,CAAC;aACxB;SACF,CAAC,CAAA;IACJ,CAAC;CAOF,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.27.1",
|
|
4
|
+
"version": "3.27.3-alpha.1",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@amplitude/ua-parser-js": "^0.7.25",
|
|
41
|
-
"@segment/actions-core": "^3.19.
|
|
41
|
+
"@segment/actions-core": "^3.19.1",
|
|
42
42
|
"dayjs": "^1.10.7",
|
|
43
43
|
"lodash": "^4.17.21",
|
|
44
44
|
"mustache": "^4.2.0"
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"<rootDir>/test/setup-after-env.ts"
|
|
59
59
|
]
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "e9ec13f693138a347ae77ed6f5b3fbb19659a3c7"
|
|
62
62
|
}
|