@segment/action-destinations 3.39.1 → 3.39.2
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.
|
@@ -11,7 +11,7 @@ const timestamp = new Date().toISOString();
|
|
|
11
11
|
describe('Webhook', () => {
|
|
12
12
|
describe('send', () => {
|
|
13
13
|
it('should work with default mapping', async () => {
|
|
14
|
-
const url = 'https://
|
|
14
|
+
const url = 'https://example.com';
|
|
15
15
|
const event = actions_core_1.createTestEvent({
|
|
16
16
|
timestamp,
|
|
17
17
|
event: 'Test Event'
|
|
@@ -30,7 +30,7 @@ describe('Webhook', () => {
|
|
|
30
30
|
expect(responses[0].status).toBe(200);
|
|
31
31
|
});
|
|
32
32
|
it('supports customizations', async () => {
|
|
33
|
-
const url = 'https://
|
|
33
|
+
const url = 'https://example.build';
|
|
34
34
|
const event = actions_core_1.createTestEvent({
|
|
35
35
|
timestamp,
|
|
36
36
|
event: 'Test Event'
|
|
@@ -49,7 +49,7 @@ describe('Webhook', () => {
|
|
|
49
49
|
expect(responses[0].status).toBe(200);
|
|
50
50
|
});
|
|
51
51
|
it('supports customizations', async () => {
|
|
52
|
-
const url = 'https://
|
|
52
|
+
const url = 'https://example.build';
|
|
53
53
|
const event = actions_core_1.createTestEvent({
|
|
54
54
|
timestamp,
|
|
55
55
|
event: 'Test Event'
|
|
@@ -67,32 +67,6 @@ describe('Webhook', () => {
|
|
|
67
67
|
expect(responses.length).toBe(1);
|
|
68
68
|
expect(responses[0].status).toBe(200);
|
|
69
69
|
});
|
|
70
|
-
it('restricts usage to mme-e2e urls', async () => {
|
|
71
|
-
const url = 'https://api.acme.com/webhook';
|
|
72
|
-
const event = actions_core_1.createTestEvent({
|
|
73
|
-
timestamp,
|
|
74
|
-
event: 'Test Event'
|
|
75
|
-
});
|
|
76
|
-
const data = { cool: true };
|
|
77
|
-
nock_1.default(url).put('/', data).reply(200);
|
|
78
|
-
try {
|
|
79
|
-
await testDestination.testAction('send', {
|
|
80
|
-
event,
|
|
81
|
-
mapping: {
|
|
82
|
-
url,
|
|
83
|
-
method: 'PUT',
|
|
84
|
-
data: { cool: true }
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
fail('expected testAction to reject');
|
|
88
|
-
}
|
|
89
|
-
catch (err) {
|
|
90
|
-
const error = err;
|
|
91
|
-
expect(error.status).toBe(400);
|
|
92
|
-
expect(error.code).toBe('Bad Request');
|
|
93
|
-
expect(error.message).toBe("invalid url 'https://api.acme.com/webhook'");
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
70
|
});
|
|
97
71
|
});
|
|
98
72
|
//# sourceMappingURL=webhook.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.test.js","sourceRoot":"","sources":["../../../../src/destinations/webhook/__test__/webhook.test.ts"],"names":[],"mappings":";;;;;AAAA,gDAAuB;AACvB,
|
|
1
|
+
{"version":3,"file":"webhook.test.js","sourceRoot":"","sources":["../../../../src/destinations/webhook/__test__/webhook.test.ts"],"names":[],"mappings":";;;;;AAAA,gDAAuB;AACvB,wDAA8E;AAC9E,qDAA8B;AAE9B,MAAM,eAAe,GAAG,oCAAqB,CAAC,eAAO,CAAC,CAAA;AACtD,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;AAE1C,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;QACpB,EAAE,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;YAChD,MAAM,GAAG,GAAG,qBAAqB,CAAA;YACjC,MAAM,KAAK,GAAG,8BAAe,CAAC;gBAC5B,SAAS;gBACT,KAAK,EAAE,YAAY;aACpB,CAAC,CAAA;YAEF,cAAI,CAAC,GAAG,CAAC;iBACN,IAAI,CAAC,GAAG,EAAE,KAAY,CAAC;iBACvB,KAAK,CAAC,GAAG,CAAC,CAAA;YAEb,MAAM,SAAS,GAAG,M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;gBACT,KAAK,EAAE,YAAY;aACpB,CAAC,CAAA;YACF,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;YAE3B,cAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAEnC,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC,UAAU,CAAC,MAAM,EAAE;gBACzD,KAAK;gBACL,OAAO,EAAE;oBACP,GAAG;oBACH,MAAM,EAAE,KAAK;oBACb,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;iBACrB;aACF,CAAC,CAAA;YAEF,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YAChC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACvC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
4
|
-
const MME_E2E_URLS = [
|
|
5
|
-
'https://mme-e2e.segment.com',
|
|
6
|
-
'https://mme-e2e.segment.build'
|
|
7
|
-
];
|
|
8
3
|
const action = {
|
|
9
4
|
title: 'Send',
|
|
10
5
|
description: 'Send an HTTP request.',
|
|
@@ -38,9 +33,6 @@ const action = {
|
|
|
38
33
|
}
|
|
39
34
|
},
|
|
40
35
|
perform: (request, { payload }) => {
|
|
41
|
-
if (!MME_E2E_URLS.includes(payload.url)) {
|
|
42
|
-
throw new actions_core_1.IntegrationError(`invalid url '${payload.url}'`, 'Bad Request', 400);
|
|
43
|
-
}
|
|
44
36
|
return request(payload.url, {
|
|
45
37
|
method: payload.method,
|
|
46
38
|
json: payload.data
|
|
@@ -48,9 +40,6 @@ const action = {
|
|
|
48
40
|
},
|
|
49
41
|
performBatch: (request, { payload }) => {
|
|
50
42
|
const { url, method } = payload[0];
|
|
51
|
-
if (!MME_E2E_URLS.includes(url)) {
|
|
52
|
-
throw new actions_core_1.IntegrationError(`invalid url '${url}'`, 'Bad Request', 400);
|
|
53
|
-
}
|
|
54
43
|
return request(url, {
|
|
55
44
|
method: method,
|
|
56
45
|
json: payload.map(({ data }) => data)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/webhook/send/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/webhook/send/index.ts"],"names":[],"mappings":";;AAMA,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,MAAM;IACb,WAAW,EAAE,uBAAuB;IACpC,MAAM,EAAE;QACN,GAAG,EAAE;YACH,KAAK,EAAE,KAAK;YACZ,WAAW,EAAE,yBAAyB;YACtC,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,KAAK;SACd;QACD,MAAM,EAAE;YACN,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,qBAAqB;YAClC,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;gBAChC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;gBAC9B,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;gBAClC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;gBACpC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;aAC/B;YACD,OAAO,EAAE,MAAM;YACf,QAAQ,EAAE,IAAI;SACf;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,mDAAmD;YAChE,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;SAC3B;KACF;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE;YAC1B,MAAM,EAAE,OAAO,CAAC,MAAuB;YACvC,IAAI,EAAE,OAAO,CAAC,IAAI;SACnB,CAAC,CAAA;IACJ,CAAC;IACD,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAErC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;QAElC,OAAO,OAAO,CAAC,GAAG,EAAE;YAClB,MAAM,EAAE,MAAuB;YAC/B,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC;SACtC,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.39.
|
|
4
|
+
"version": "3.39.2",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"<rootDir>/test/setup-after-env.ts"
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "46a86451861e094e2ac523debe3dbd8db44d07df"
|
|
64
64
|
}
|