@segment/action-destinations 3.312.1-staging-47c2f8635.0 → 3.312.1-staging-96fa613b5.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.
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { DestinationDefinition } from '@segment/actions-core';
|
|
2
2
|
import type { Settings } from './generated-types';
|
|
3
|
-
declare
|
|
3
|
+
declare type SettingsWithDynamicAuth = Settings & {
|
|
4
|
+
dynamicAuthSettings: any;
|
|
5
|
+
};
|
|
6
|
+
declare const destination: DestinationDefinition<SettingsWithDynamicAuth>;
|
|
4
7
|
export default destination;
|
|
@@ -16,45 +16,23 @@ const destination = {
|
|
|
16
16
|
type: 'string',
|
|
17
17
|
label: 'Shared Secret',
|
|
18
18
|
description: 'If set, Segment will sign requests with an HMAC in the "X-Signature" request header. The HMAC is a hex-encoded SHA1 hash generated using this shared secret and the request body.'
|
|
19
|
-
},
|
|
20
|
-
client_id: {
|
|
21
|
-
label: 'Client ID',
|
|
22
|
-
description: 'Your client ID.',
|
|
23
|
-
type: 'string',
|
|
24
|
-
required: true
|
|
25
|
-
},
|
|
26
|
-
client_secret: {
|
|
27
|
-
label: 'Client Secret',
|
|
28
|
-
description: 'Your client secret.',
|
|
29
|
-
type: 'password',
|
|
30
|
-
required: true
|
|
31
|
-
},
|
|
32
|
-
authenticationUrl: {
|
|
33
|
-
label: 'Authentication URL',
|
|
34
|
-
description: 'The URL to authenticate the client.',
|
|
35
|
-
type: 'string',
|
|
36
|
-
required: true
|
|
37
|
-
},
|
|
38
|
-
refreshTokenUrl: {
|
|
39
|
-
label: 'Refresh Token URL',
|
|
40
|
-
description: 'The URL to refresh the access token.',
|
|
41
|
-
type: 'string',
|
|
42
|
-
required: true
|
|
43
19
|
}
|
|
44
20
|
},
|
|
45
|
-
refreshAccessToken: async (request, { settings }) => {
|
|
46
|
-
const res = await request(settings.refreshTokenUrl, {
|
|
21
|
+
refreshAccessToken: async (request, { settings, auth }) => {
|
|
22
|
+
const res = await request(settings.dynamicAuthSettings.oauth.refreshTokenUrl, {
|
|
47
23
|
method: 'POST',
|
|
48
24
|
headers: {
|
|
49
25
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
50
|
-
Authorization: `Basic ${Buffer.from(
|
|
26
|
+
Authorization: `Basic ${Buffer.from(auth.clientId + ':' + auth.clientSecret).toString('base64')}`
|
|
51
27
|
},
|
|
52
28
|
body: '{"grant_type":"client_credentials"}'
|
|
53
29
|
});
|
|
54
30
|
return { accessToken: res.data.access_token };
|
|
55
31
|
}
|
|
56
32
|
},
|
|
57
|
-
extendRequest: ({ settings, payload
|
|
33
|
+
extendRequest: ({ settings, payload }) => {
|
|
34
|
+
const { dynamicAuthSettings } = settings;
|
|
35
|
+
const accessToken = dynamicAuthSettings?.oauth?.access?.access_token;
|
|
58
36
|
if (!payload) {
|
|
59
37
|
payload = {};
|
|
60
38
|
}
|
|
@@ -66,7 +44,7 @@ const destination = {
|
|
|
66
44
|
return {
|
|
67
45
|
headers: {
|
|
68
46
|
'X-Signature': digest,
|
|
69
|
-
authorization: `Bearer ${
|
|
47
|
+
authorization: `Bearer ${accessToken}`
|
|
70
48
|
}
|
|
71
49
|
};
|
|
72
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/webhook-extensible/index.ts"],"names":[],"mappings":";;;;;AAEA,mCAAmC;AAGnC,kDAAyB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/webhook-extensible/index.ts"],"names":[],"mappings":";;;;;AAEA,mCAAmC;AAGnC,kDAAyB;AAKzB,MAAM,WAAW,GAAmD;IAClE,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,4BAA4B;IAClC,IAAI,EAAE,OAAO;IACb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,YAAY,EAAE;gBACZ,IAAI,E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C;iBAC/C,MAAM,CAAC,KAAK,CAAC,CAAA;YAChB,OAAO;gBACL,OAAO,EAAE;oBACP,aAAa,EAAE,MAAM;oBACrB,aAAa,EAAE,UAAU,WAAW,EAAE;iBACvC;aACF,CAAA;SACF;QACD,OAAO,EAAE,CAAA;IACX,CAAC;IACD,OAAO,EAAE;QACP,IAAI,EAAJ,cAAI;KACL;CACF,CAAA;AAED,kBAAe,WAAW,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.312.1-staging-
|
|
4
|
+
"version": "3.312.1-staging-96fa613b5.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"@bufbuild/protobuf": "^1.4.2",
|
|
45
45
|
"@bufbuild/protoc-gen-es": "^1.4.2",
|
|
46
46
|
"@segment/a1-notation": "^2.1.4",
|
|
47
|
-
"@segment/actions-core": "3.129.1-staging-
|
|
48
|
-
"@segment/actions-shared": "1.110.1-staging-
|
|
47
|
+
"@segment/actions-core": "3.129.1-staging-96fa613b5.0",
|
|
48
|
+
"@segment/actions-shared": "1.110.1-staging-96fa613b5.0",
|
|
49
49
|
"@types/node": "^18.11.15",
|
|
50
50
|
"ajv-formats": "^2.1.1",
|
|
51
51
|
"aws4": "^1.12.0",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"__tests__/__helpers__/"
|
|
88
88
|
]
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "c62cc64b3fef54f33c25f06e846bca9a4068faaa"
|
|
91
91
|
}
|