@segment/action-destinations 3.419.0 → 3.420.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.
- package/dist/destinations/amazon-eventbridge/generated-types.d.ts +2 -4
- package/dist/destinations/amazon-eventbridge/index.js +4 -32
- package/dist/destinations/amazon-eventbridge/index.js.map +1 -1
- package/dist/destinations/amazon-eventbridge/send/constants.d.ts +26 -0
- package/dist/destinations/amazon-eventbridge/send/constants.js +27 -0
- package/dist/destinations/amazon-eventbridge/send/constants.js.map +1 -0
- package/dist/destinations/amazon-eventbridge/send/functions.d.ts +5 -0
- package/dist/destinations/amazon-eventbridge/send/functions.js +104 -0
- package/dist/destinations/amazon-eventbridge/send/functions.js.map +1 -0
- package/dist/destinations/amazon-eventbridge/send/generated-types.d.ts +11 -1
- package/dist/destinations/amazon-eventbridge/send/hooks.d.ts +8 -0
- package/dist/destinations/amazon-eventbridge/send/hooks.js +115 -0
- package/dist/destinations/amazon-eventbridge/send/hooks.js.map +1 -0
- package/dist/destinations/amazon-eventbridge/send/index.js +20 -25
- package/dist/destinations/amazon-eventbridge/send/index.js.map +1 -1
- package/dist/destinations/amazon-eventbridge/send/types.d.ts +27 -0
- package/dist/destinations/amazon-eventbridge/{sendV2/generated-types.js → send/types.js} +1 -1
- package/dist/destinations/amazon-eventbridge/send/types.js.map +1 -0
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/functions.js +3 -3
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/functions.js.map +1 -1
- package/dist/destinations/stackadapt-audiences/forwardProfile/functions.js +2 -2
- package/dist/destinations/stackadapt-audiences/forwardProfile/functions.js.map +1 -1
- package/dist/destinations/stackadapt-audiences/functions.d.ts +1 -0
- package/dist/destinations/stackadapt-audiences/functions.js +8 -2
- package/dist/destinations/stackadapt-audiences/functions.js.map +1 -1
- package/package.json +4 -4
- package/dist/destinations/amazon-eventbridge/functions.d.ts +0 -3
- package/dist/destinations/amazon-eventbridge/functions.js +0 -53
- package/dist/destinations/amazon-eventbridge/functions.js.map +0 -1
- package/dist/destinations/amazon-eventbridge/functionsv2.d.ts +0 -4
- package/dist/destinations/amazon-eventbridge/functionsv2.js +0 -68
- package/dist/destinations/amazon-eventbridge/functionsv2.js.map +0 -1
- package/dist/destinations/amazon-eventbridge/sendV2/generated-types.d.ts +0 -11
- package/dist/destinations/amazon-eventbridge/sendV2/generated-types.js.map +0 -1
- package/dist/destinations/amazon-eventbridge/sendV2/index.d.ts +0 -5
- package/dist/destinations/amazon-eventbridge/sendV2/index.js +0 -90
- package/dist/destinations/amazon-eventbridge/sendV2/index.js.map +0 -1
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const actions_core_1 = require("@segment/actions-core");
|
|
7
7
|
const send_1 = __importDefault(require("./send"));
|
|
8
|
-
const sendV2_1 = __importDefault(require("./sendV2"));
|
|
9
8
|
const destination = {
|
|
10
9
|
name: 'Amazon Eventbridge',
|
|
11
10
|
slug: 'actions-amazon-eventbridge',
|
|
@@ -14,18 +13,16 @@ const destination = {
|
|
|
14
13
|
authentication: {
|
|
15
14
|
scheme: 'custom',
|
|
16
15
|
fields: {
|
|
17
|
-
|
|
16
|
+
accountId: {
|
|
18
17
|
type: 'string',
|
|
19
18
|
label: 'AWS Account ID',
|
|
20
|
-
description: `The AWS Account ID that the event bus belongs to.
|
|
21
|
-
This is used to generate the ARN for the event bus.`,
|
|
19
|
+
description: `The AWS Account ID that the event bus belongs to. This is used to generate the ARN for the event bus.`,
|
|
22
20
|
required: true
|
|
23
21
|
},
|
|
24
|
-
|
|
22
|
+
region: {
|
|
25
23
|
type: 'string',
|
|
26
24
|
label: 'AWS Region',
|
|
27
25
|
description: 'The AWS region that the event bus belongs to.',
|
|
28
|
-
disabledInputMethods: ['enrichment', 'function', 'variable'],
|
|
29
26
|
required: true,
|
|
30
27
|
choices: [
|
|
31
28
|
{ label: 'us-east-1', value: 'us-east-1' },
|
|
@@ -44,30 +41,6 @@ const destination = {
|
|
|
44
41
|
{ label: 'ca-central-1', value: 'ca-central-1' },
|
|
45
42
|
{ label: 'eu-central-1', value: 'eu-central-1' }
|
|
46
43
|
]
|
|
47
|
-
},
|
|
48
|
-
partnerEventSourceName: {
|
|
49
|
-
type: 'string',
|
|
50
|
-
label: 'Partner Event Source Name',
|
|
51
|
-
description: 'The name of the partner event source to use for the event bus.',
|
|
52
|
-
required: true,
|
|
53
|
-
default: 'segment.com',
|
|
54
|
-
choices: [
|
|
55
|
-
{ label: 'segment.com', value: 'aws.partner/segment.com' },
|
|
56
|
-
{ label: 'segment.com.test', value: 'aws.partner/segment.com.test' }
|
|
57
|
-
]
|
|
58
|
-
},
|
|
59
|
-
createPartnerEventSource: {
|
|
60
|
-
type: 'boolean',
|
|
61
|
-
label: 'Create Partner Event Source',
|
|
62
|
-
description: `If enabled, Segment will check whether Partner Source identified by Segment source ID
|
|
63
|
-
exists in EventBridge.
|
|
64
|
-
If Partner Source does not exist, Segment will create a new Partner Source.`,
|
|
65
|
-
default: false
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
testAuthentication: async (_request, { settings }) => {
|
|
69
|
-
if (!settings.awsAccountId || !settings.awsRegion) {
|
|
70
|
-
throw new Error('AWS Account ID and Region are required.');
|
|
71
44
|
}
|
|
72
45
|
}
|
|
73
46
|
},
|
|
@@ -77,8 +50,7 @@ const destination = {
|
|
|
77
50
|
};
|
|
78
51
|
},
|
|
79
52
|
actions: {
|
|
80
|
-
send: send_1.default
|
|
81
|
-
sendV2: sendV2_1.default
|
|
53
|
+
send: send_1.default
|
|
82
54
|
}
|
|
83
55
|
};
|
|
84
56
|
exports.default = destination;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/amazon-eventbridge/index.ts"],"names":[],"mappings":";;;;;AAEA,wDAA+D;
|
|
1
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AAgB,EAAE,KAAK,EAAE,gBAAgB,EAAE;oBACpD,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,gBAAgB,EAAE;oBACpD,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;oBAC5C,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,EAAE;oBAChD,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,EAAE;iBACjD;aACF;SACF;KACF;IACD,aAAa;QACX,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,KAAM,EAAE,sCAAuB,CAAC;SACnD,CAAA;IACH,CAAC;IACD,OAAO,EAAE;QACP,IAAI,EAAJ,cAAI;KACL;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const SEGMENT_PARTNER_NAME = "aws.partner/segment.com";
|
|
2
|
+
export declare const EBNotRetryableErrors: {
|
|
3
|
+
readonly LimitExceededException: "NON_RETRYABLE";
|
|
4
|
+
readonly OperationDisabledException: "NON_RETRYABLE";
|
|
5
|
+
readonly AccessDeniedException: "NON_RETRYABLE";
|
|
6
|
+
readonly NotAuthorized: "NON_RETRYABLE";
|
|
7
|
+
readonly IncompleteSignature: "NON_RETRYABLE";
|
|
8
|
+
readonly InvalidAction: "NON_RETRYABLE";
|
|
9
|
+
readonly InvalidClientTokenId: "NON_RETRYABLE";
|
|
10
|
+
readonly OptInRequired: "NON_RETRYABLE";
|
|
11
|
+
readonly RequestExpired: "NON_RETRYABLE";
|
|
12
|
+
readonly ValidationError: "NON_RETRYABLE";
|
|
13
|
+
};
|
|
14
|
+
export declare const EBRetryableErrors: {
|
|
15
|
+
readonly ConcurrentModificationException: "RETRYABLE";
|
|
16
|
+
readonly InternalException: "RETRYABLE";
|
|
17
|
+
readonly InternalFailure: "RETRYABLE";
|
|
18
|
+
readonly ThrottlingException: "RETRYABLE";
|
|
19
|
+
readonly ServiceUnavailable: "RETRYABLE";
|
|
20
|
+
};
|
|
21
|
+
export declare const EBNotErrors: {
|
|
22
|
+
readonly ResourceAlreadyExistsException: "NOT_AN_ERROR";
|
|
23
|
+
};
|
|
24
|
+
export type RetryableErrorType = keyof typeof EBRetryableErrors;
|
|
25
|
+
export type NonRetryableErrorType = keyof typeof EBNotRetryableErrors;
|
|
26
|
+
export type NotAnErrorType = keyof typeof EBNotErrors;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EBNotErrors = exports.EBRetryableErrors = exports.EBNotRetryableErrors = exports.SEGMENT_PARTNER_NAME = void 0;
|
|
4
|
+
exports.SEGMENT_PARTNER_NAME = 'aws.partner/segment.com';
|
|
5
|
+
exports.EBNotRetryableErrors = {
|
|
6
|
+
LimitExceededException: 'NON_RETRYABLE',
|
|
7
|
+
OperationDisabledException: 'NON_RETRYABLE',
|
|
8
|
+
AccessDeniedException: 'NON_RETRYABLE',
|
|
9
|
+
NotAuthorized: 'NON_RETRYABLE',
|
|
10
|
+
IncompleteSignature: 'NON_RETRYABLE',
|
|
11
|
+
InvalidAction: 'NON_RETRYABLE',
|
|
12
|
+
InvalidClientTokenId: 'NON_RETRYABLE',
|
|
13
|
+
OptInRequired: 'NON_RETRYABLE',
|
|
14
|
+
RequestExpired: 'NON_RETRYABLE',
|
|
15
|
+
ValidationError: 'NON_RETRYABLE'
|
|
16
|
+
};
|
|
17
|
+
exports.EBRetryableErrors = {
|
|
18
|
+
ConcurrentModificationException: 'RETRYABLE',
|
|
19
|
+
InternalException: 'RETRYABLE',
|
|
20
|
+
InternalFailure: 'RETRYABLE',
|
|
21
|
+
ThrottlingException: 'RETRYABLE',
|
|
22
|
+
ServiceUnavailable: 'RETRYABLE'
|
|
23
|
+
};
|
|
24
|
+
exports.EBNotErrors = {
|
|
25
|
+
ResourceAlreadyExistsException: 'NOT_AN_ERROR'
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/destinations/amazon-eventbridge/send/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,yBAAyB,CAAA;AAEhD,QAAA,oBAAoB,GAAG;IAClC,sBAAsB,EAAE,eAAe;IACvC,0BAA0B,EAAE,eAAe;IAC3C,qBAAqB,EAAE,eAAe;IACtC,aAAa,EAAE,eAAe;IAC9B,mBAAmB,EAAE,eAAe;IACpC,aAAa,EAAE,eAAe;IAC9B,oBAAoB,EAAE,eAAe;IACrC,aAAa,EAAE,eAAe;IAC9B,cAAc,EAAE,eAAe;IAC/B,eAAe,EAAE,eAAe;CACxB,CAAA;AAEG,QAAA,iBAAiB,GAAG;IAC/B,+BAA+B,EAAE,WAAW;IAC5C,iBAAiB,EAAE,WAAW;IAC9B,eAAe,EAAE,WAAW;IAC5B,mBAAmB,EAAE,WAAW;IAChC,kBAAkB,EAAE,WAAW;CACvB,CAAA;AAEG,QAAA,WAAW,GAAG;IACzB,8BAA8B,EAAE,cAAc;CACtC,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Payload } from './generated-types';
|
|
2
|
+
import { Settings } from '../generated-types';
|
|
3
|
+
import { MultiStatusResponse } from '@segment/actions-core';
|
|
4
|
+
import { HookOutputs } from './types';
|
|
5
|
+
export declare function send(payloads: Payload[], settings: Settings, hookOutputs?: HookOutputs): Promise<MultiStatusResponse>;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.send = send;
|
|
4
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
const client_eventbridge_1 = require("@aws-sdk/client-eventbridge");
|
|
7
|
+
async function send(payloads, settings, hookOutputs) {
|
|
8
|
+
const sourceId = getSourceId(payloads, hookOutputs);
|
|
9
|
+
const { region } = settings;
|
|
10
|
+
const client = new client_eventbridge_1.EventBridgeClient({ region });
|
|
11
|
+
const commandJSON = createCommandJSON(payloads, sourceId);
|
|
12
|
+
const command = new client_eventbridge_1.PutPartnerEventsCommand(commandJSON);
|
|
13
|
+
let response;
|
|
14
|
+
try {
|
|
15
|
+
response = await client.send(command);
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
throwError(error, `client.send`);
|
|
19
|
+
}
|
|
20
|
+
return buildMultiStatusResponse(response, payloads);
|
|
21
|
+
}
|
|
22
|
+
function getSourceId(payloads, hookOutputs) {
|
|
23
|
+
const payloadSourceId = payloads[0].sourceId;
|
|
24
|
+
const hookSourceId = hookOutputs?.onMappingSave?.sourceId ?? hookOutputs?.retlOnMappingSave?.sourceId;
|
|
25
|
+
if (!payloadSourceId) {
|
|
26
|
+
throw new actions_core_1.PayloadValidationError('Source ID is required. Source ID not found in payload. It should be present at $.context.protocols.sourceId or $.projectId in the payload.');
|
|
27
|
+
}
|
|
28
|
+
if (!hookSourceId) {
|
|
29
|
+
throw new actions_core_1.PayloadValidationError('Source ID is required. Source ID not found in hook outputs.');
|
|
30
|
+
}
|
|
31
|
+
if (hookSourceId !== payloadSourceId) {
|
|
32
|
+
throw new actions_core_1.PayloadValidationError('Mismatch between payload and hook source ID values.');
|
|
33
|
+
}
|
|
34
|
+
return payloadSourceId;
|
|
35
|
+
}
|
|
36
|
+
function buildMultiStatusResponse(response, payloads) {
|
|
37
|
+
const entries = response.Entries ?? [];
|
|
38
|
+
const multiStatusResponse = new actions_core_1.MultiStatusResponse();
|
|
39
|
+
console.log('Entries' + entries);
|
|
40
|
+
payloads.forEach((event, index) => {
|
|
41
|
+
const entry = entries[index] ?? {};
|
|
42
|
+
if (entry.ErrorCode || entry.ErrorMessage) {
|
|
43
|
+
multiStatusResponse.setErrorResponseAtIndex(index, {
|
|
44
|
+
status: 400,
|
|
45
|
+
errormessage: entry.ErrorMessage ?? 'Unknown Error',
|
|
46
|
+
sent: JSON.stringify(event),
|
|
47
|
+
body: JSON.stringify(entry)
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
multiStatusResponse.setSuccessResponseAtIndex(index, {
|
|
52
|
+
status: 200,
|
|
53
|
+
body: 'Event sent successfully',
|
|
54
|
+
sent: JSON.stringify(event)
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return multiStatusResponse;
|
|
59
|
+
}
|
|
60
|
+
function createCommandJSON(payloads, sourceId) {
|
|
61
|
+
return {
|
|
62
|
+
Entries: payloads.map((event) => ({
|
|
63
|
+
Source: `${constants_1.SEGMENT_PARTNER_NAME}/${sourceId}`,
|
|
64
|
+
DetailType: event.detailType,
|
|
65
|
+
Detail: JSON.stringify(event.data),
|
|
66
|
+
Resources: Array.isArray(event.resources)
|
|
67
|
+
? event.resources
|
|
68
|
+
: typeof event.resources === 'string'
|
|
69
|
+
? [event.resources]
|
|
70
|
+
: [],
|
|
71
|
+
Time: event.time ? new Date(event.time) : new Date()
|
|
72
|
+
}))
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function isRetryableError(error) {
|
|
76
|
+
if (typeof error === 'object' && error !== null && 'name' in error) {
|
|
77
|
+
const err = error;
|
|
78
|
+
return !(err.name in constants_1.EBRetryableErrors);
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
function isNotRetryableError(error) {
|
|
83
|
+
if (typeof error === 'object' && error !== null && 'name' in error) {
|
|
84
|
+
const err = error;
|
|
85
|
+
return !(err.name in constants_1.EBNotRetryableErrors);
|
|
86
|
+
}
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
function throwError(error, context) {
|
|
90
|
+
if (isRetryableError(error)) {
|
|
91
|
+
const err = error;
|
|
92
|
+
const message = err.message ?? 'No error message returned';
|
|
93
|
+
throw new actions_core_1.RetryableError(`Retryable error ${err.name} in ${context}. Message: ${message}`);
|
|
94
|
+
}
|
|
95
|
+
else if (isNotRetryableError(error)) {
|
|
96
|
+
const err = error;
|
|
97
|
+
const message = err.message ?? 'No error message returned';
|
|
98
|
+
throw new actions_core_1.IntegrationError(`Non-retryable error ${err.name} in ${context}. Message: ${message}`, err.name, 400);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
throw new actions_core_1.IntegrationError(`Unknown error in ${context}: ${JSON.stringify(error)}`, 'UnknownError', 400);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../../src/destinations/amazon-eventbridge/send/functions.ts"],"names":[],"mappings":";;AAYA,oBAwBC;AAlCD,wDAAqH;AACrH,2CAA2F;AAC3F,oEAKoC;AAG7B,KAAK,UAAU,IAAI,CACxB,QAAmB,EACnB,QAAkB,EAClB,WAAyB;IAEzB,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAA;IAEnD,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAA;IAE3B,MAAM,MAAM,GAAG,IAAI,sCAAiB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;IAEhD,MAAM,WAAW,GAAG,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAEzD,MAAM,OAAO,GAAG,IAAI,4CAAuB,CAAC,WAAW,CAAC,CAAA;IAExD,IAAI,QAAuC,CAAA;IAE3C,IAAI,CAAC;QACH,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACvC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,UAAU,CAAC,KAAK,EAAE,aAAa,CAAC,CAAA;IAClC,CAAC;IAED,OAAO,wBAAwB,CAAC,QAAQ,EAAE,QAAQ,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string[];
|
|
8
8
|
time?: string;
|
|
9
9
|
enable_batching: boolean;
|
|
10
10
|
batch_size?: number;
|
|
11
11
|
}
|
|
12
|
+
export interface RetlOnMappingSaveInputs {
|
|
13
|
+
}
|
|
14
|
+
export interface RetlOnMappingSaveOutputs {
|
|
15
|
+
sourceId: string;
|
|
16
|
+
}
|
|
17
|
+
export interface OnMappingSaveInputs {
|
|
18
|
+
}
|
|
19
|
+
export interface OnMappingSaveOutputs {
|
|
20
|
+
sourceId: string;
|
|
21
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionHookDefinition } from '@segment/actions-core/destination-kit';
|
|
2
|
+
import { HookError, HookSuccess } from './types';
|
|
3
|
+
import { EventBridgeClient } from '@aws-sdk/client-eventbridge';
|
|
4
|
+
import { Settings } from '../generated-types';
|
|
5
|
+
import type { OnMappingSaveInputs, OnMappingSaveOutputs, Payload } from './generated-types';
|
|
6
|
+
export declare const ensureSourceIdHook: ActionHookDefinition<Settings, Payload, any, OnMappingSaveInputs, OnMappingSaveOutputs>;
|
|
7
|
+
export declare function ensurePartnerSource(client: EventBridgeClient, awsAccountId: string, sourceId: string): Promise<HookSuccess | HookError>;
|
|
8
|
+
export declare function getFullSourceName(sourceId: string): string;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ensureSourceIdHook = void 0;
|
|
4
|
+
exports.ensurePartnerSource = ensurePartnerSource;
|
|
5
|
+
exports.getFullSourceName = getFullSourceName;
|
|
6
|
+
const constants_1 = require("./constants");
|
|
7
|
+
const constants_2 = require("./constants");
|
|
8
|
+
const client_eventbridge_1 = require("@aws-sdk/client-eventbridge");
|
|
9
|
+
exports.ensureSourceIdHook = {
|
|
10
|
+
label: 'EnsureSourceId',
|
|
11
|
+
description: 'Connect to an existing data extension or create a new one in Salesforce Marketing Cloud.',
|
|
12
|
+
inputFields: {},
|
|
13
|
+
performHook: async (_, { settings, subscriptionMetadata }) => {
|
|
14
|
+
const validation = validate(settings, subscriptionMetadata);
|
|
15
|
+
if ('error' in validation) {
|
|
16
|
+
return validation;
|
|
17
|
+
}
|
|
18
|
+
const { sourceId, region, accountId } = validation;
|
|
19
|
+
const client = new client_eventbridge_1.EventBridgeClient({ region });
|
|
20
|
+
return await ensurePartnerSource(client, accountId, sourceId);
|
|
21
|
+
},
|
|
22
|
+
outputTypes: {
|
|
23
|
+
sourceId: {
|
|
24
|
+
label: 'Source ID',
|
|
25
|
+
description: 'The identifier for the source.',
|
|
26
|
+
type: 'string',
|
|
27
|
+
required: true
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
function validate(settings, subscriptionMetadata) {
|
|
32
|
+
const sourceId = subscriptionMetadata?.sourceId;
|
|
33
|
+
const { region, accountId } = settings;
|
|
34
|
+
if (typeof sourceId !== 'string' || !sourceId) {
|
|
35
|
+
return { error: { message: 'Source ID required', code: 'ERROR' } };
|
|
36
|
+
}
|
|
37
|
+
if (typeof region !== 'string' || !region) {
|
|
38
|
+
return {
|
|
39
|
+
error: {
|
|
40
|
+
message: "Hook call to ensure Source ID failed. Region required. Ensure 'AWS Region' Settings field is populated.",
|
|
41
|
+
code: 'ERROR'
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
if (typeof accountId !== 'string' || !accountId) {
|
|
46
|
+
return {
|
|
47
|
+
error: {
|
|
48
|
+
message: "Hook call to ensure Source ID failed. Account ID required. Ensure 'AWS Account ID' Settings field is populated.",
|
|
49
|
+
code: 'ERROR'
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return { sourceId, region, accountId };
|
|
54
|
+
}
|
|
55
|
+
async function ensurePartnerSource(client, awsAccountId, sourceId) {
|
|
56
|
+
let hookResponse = await findSource(client, sourceId);
|
|
57
|
+
if (hookResponse === undefined) {
|
|
58
|
+
hookResponse = await createSource(client, awsAccountId, sourceId);
|
|
59
|
+
}
|
|
60
|
+
return hookResponse;
|
|
61
|
+
}
|
|
62
|
+
async function findSource(client, sourceId) {
|
|
63
|
+
try {
|
|
64
|
+
const command = new client_eventbridge_1.ListPartnerEventSourcesCommand({ NamePrefix: getFullSourceName(sourceId) });
|
|
65
|
+
const response = await client.send(command);
|
|
66
|
+
return (response.PartnerEventSources?.length ?? 0) > 0
|
|
67
|
+
? {
|
|
68
|
+
successMessage: 'SourceId found',
|
|
69
|
+
savedData: {
|
|
70
|
+
sourceId
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
: undefined;
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
return returnError(error, 'findSource');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
async function createSource(client, accountId, sourceId) {
|
|
80
|
+
const fullSourceName = getFullSourceName(sourceId);
|
|
81
|
+
const command = new client_eventbridge_1.CreatePartnerEventSourceCommand({ Account: accountId, Name: fullSourceName });
|
|
82
|
+
try {
|
|
83
|
+
await client.send(command);
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
if (isAnError(error)) {
|
|
87
|
+
return returnError(error, `createSource(${fullSourceName})`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
successMessage: 'SourceId created',
|
|
92
|
+
savedData: {
|
|
93
|
+
sourceId
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function getFullSourceName(sourceId) {
|
|
98
|
+
return `${constants_1.SEGMENT_PARTNER_NAME}/${sourceId}`;
|
|
99
|
+
}
|
|
100
|
+
function isAnError(error) {
|
|
101
|
+
if (typeof error === 'object' && error !== null && 'name' in error) {
|
|
102
|
+
const err = error;
|
|
103
|
+
return !(err.name in constants_2.EBNotErrors);
|
|
104
|
+
}
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
function returnError(error, context) {
|
|
108
|
+
return {
|
|
109
|
+
error: {
|
|
110
|
+
message: `Hook error: ${context}: ${JSON.stringify(error)}`,
|
|
111
|
+
code: 'ERROR'
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../../src/destinations/amazon-eventbridge/send/hooks.ts"],"names":[],"mappings":";;;AA6EA,kDAYC;AAyCD,8CAEC;AAnID,2CAAkD;AAClD,2CAAyC;AAEzC,oEAIoC;AAIvB,QAAA,kBAAkB,GAM3B;IACF,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,0FAA0F;IACvG,WAAW,EAAE,EAAE;IACf,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,oBAAoB,EAAE,EAAE,EAAE;QAC3D,MAAM,UAAU,GAAG,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAA;QAE3D,IAAI,OAAO,IAAI,UAAU,EAAE,CAAC;YAC1B,OAAO,UAAU,CAAA;QACnB,CAAC;QAED,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,UAAU,CAAA;QAClD,MAAM,MAAM,GAAG,IAAI,sCAAiB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;QAChD,OAAO,MAAM,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAA;IAC/D,CAAC;IACD,WAAW,EAAE;QACX,QAAQ,EAAE;YACR,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,gCAAgC;YAC7C,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;KACF;CACF,CAAA;AAED,SAAS,QAAQ,CACf,QAAkB,EAClB,oBAAuD;IAEvD,MAAM,QAAQ,GAAG,oBAAoB,EAAE,QAAQ,CAAA;IAC/C,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,Q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AC,KAAc,EAAE,OAAe;IAClD,OAAO;QACL,KAAK,EAAE;YACL,OAAO,EAAE,eAAe,OAAO,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;YAC3D,IAAI,EAAE,OAAO;SACd;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const functions_1 = require("
|
|
4
|
-
const
|
|
3
|
+
const functions_1 = require("./functions");
|
|
4
|
+
const hooks_1 = require("./hooks");
|
|
5
5
|
const action = {
|
|
6
6
|
title: 'Send',
|
|
7
|
-
description: 'Send
|
|
7
|
+
description: 'Send event data to Amazon EventBridge.',
|
|
8
8
|
fields: {
|
|
9
9
|
data: {
|
|
10
10
|
label: 'Detail',
|
|
@@ -15,8 +15,7 @@ const action = {
|
|
|
15
15
|
},
|
|
16
16
|
detailType: {
|
|
17
17
|
label: 'Detail Type',
|
|
18
|
-
description: `Detail Type of the event. Used to determine what fields to expect in the event Detail.
|
|
19
|
-
Value cannot be longer than 128 characters.`,
|
|
18
|
+
description: `Detail Type of the event. Used to determine what fields to expect in the event Detail. Value cannot be longer than 128 characters.`,
|
|
20
19
|
type: 'string',
|
|
21
20
|
maximum: 128,
|
|
22
21
|
default: { '@path': '$.type' },
|
|
@@ -38,23 +37,16 @@ const action = {
|
|
|
38
37
|
},
|
|
39
38
|
resources: {
|
|
40
39
|
label: 'Resources',
|
|
41
|
-
description: `AWS resources, identified by Amazon Resource Name (ARN),
|
|
42
|
-
which the event primarily concerns. Any number,
|
|
43
|
-
including zero, may be present.`,
|
|
40
|
+
description: `AWS resources, identified by Amazon Resource Name (ARN), which the event primarily concerns. Any number, including zero, may be present.`,
|
|
44
41
|
type: 'string',
|
|
45
|
-
|
|
46
|
-
'@if': {
|
|
47
|
-
exists: { '@path': '$.userId' },
|
|
48
|
-
then: { '@path': '$.userId' },
|
|
49
|
-
else: { '@path': '$.anonymousId' }
|
|
50
|
-
}
|
|
51
|
-
},
|
|
42
|
+
multiple: true,
|
|
52
43
|
required: false
|
|
53
44
|
},
|
|
54
45
|
time: {
|
|
55
46
|
label: 'Time',
|
|
56
|
-
description: 'The timestamp the event occurred.',
|
|
47
|
+
description: 'The timestamp the event occurred. Accepts a date in ISO 8601 format.',
|
|
57
48
|
type: 'string',
|
|
49
|
+
format: 'date-time',
|
|
58
50
|
default: { '@path': '$.timestamp' },
|
|
59
51
|
required: false
|
|
60
52
|
},
|
|
@@ -78,16 +70,19 @@ const action = {
|
|
|
78
70
|
maximum: 20
|
|
79
71
|
}
|
|
80
72
|
},
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (features?.['amazon-eventbridge-v2']) {
|
|
88
|
-
return (0, functionsv2_1.send)(payload, settings);
|
|
73
|
+
hooks: {
|
|
74
|
+
retlOnMappingSave: {
|
|
75
|
+
...hooks_1.ensureSourceIdHook
|
|
76
|
+
},
|
|
77
|
+
onMappingSave: {
|
|
78
|
+
...hooks_1.ensureSourceIdHook
|
|
89
79
|
}
|
|
90
|
-
|
|
80
|
+
},
|
|
81
|
+
perform: (_, { payload, settings, hookOutputs }) => {
|
|
82
|
+
return (0, functions_1.send)([payload], settings, hookOutputs);
|
|
83
|
+
},
|
|
84
|
+
performBatch: (_, { payload, settings, hookOutputs }) => {
|
|
85
|
+
return (0, functions_1.send)(payload, settings, hookOutputs);
|
|
91
86
|
}
|
|
92
87
|
};
|
|
93
88
|
exports.default = action;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/amazon-eventbridge/send/index.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/amazon-eventbridge/send/index.ts"],"names":[],"mappings":";;AAGA,2CAAkC;AAClC,mCAA4C;AAE5C,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AC9B,aAAa,EAAE,KAAK;YACpB,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,IAAI;SACd;QACD,UAAU,EAAE;YACV,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE;qDACkC;YAC/C,IAAI,EAAE,QAAQ;YACd,aAAa,EAAE,IAAI;YACnB,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,EAAE;SACZ;KACF;IACD,KAAK,EAAE;QACL,iBAAiB,EAAE;YACjB,GAAG,0BAAkB;SACtB;QACD,aAAa,EAAE;YACb,GAAG,0BAAkB;SACtB;KACF;IACD,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,EAAE;QACjD,OAAO,IAAA,gBAAI,EAAC,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAA;IAC/C,CAAC;IACD,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,EAAE;QACtD,OAAO,IAAA,gBAAI,EAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAA;IAC7C,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { OnMappingSaveOutputs, RetlOnMappingSaveOutputs } from './generated-types';
|
|
2
|
+
export interface PutPartnerEventsCommandJSON {
|
|
3
|
+
Entries: Array<EntryItem>;
|
|
4
|
+
}
|
|
5
|
+
export interface EntryItem {
|
|
6
|
+
Time: Date;
|
|
7
|
+
Source: string;
|
|
8
|
+
Resources: string[];
|
|
9
|
+
DetailType: string;
|
|
10
|
+
Detail: string;
|
|
11
|
+
}
|
|
12
|
+
export interface HookError {
|
|
13
|
+
error: {
|
|
14
|
+
message: string;
|
|
15
|
+
code: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface HookSuccess {
|
|
19
|
+
successMessage: string;
|
|
20
|
+
savedData: {
|
|
21
|
+
sourceId: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface HookOutputs {
|
|
25
|
+
onMappingSave?: OnMappingSaveOutputs;
|
|
26
|
+
retlOnMappingSave?: RetlOnMappingSaveOutputs;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/destinations/amazon-eventbridge/send/types.ts"],"names":[],"mappings":""}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.performForwardAudienceEvents = performForwardAudienceEvents;
|
|
4
4
|
const functions_1 = require("../functions");
|
|
5
|
-
const audienceMapping = (0, functions_1.
|
|
5
|
+
const audienceMapping = (0, functions_1.stringifyMappingSchemaForGraphQL)([
|
|
6
6
|
{
|
|
7
7
|
incomingKey: 'audienceId',
|
|
8
8
|
destinationKey: 'external_id',
|
|
@@ -18,7 +18,7 @@ const audienceMapping = (0, functions_1.stringifyJsonWithEscapedQuotes)([
|
|
|
18
18
|
isPii: false,
|
|
19
19
|
}
|
|
20
20
|
]);
|
|
21
|
-
const profileMapping = (0, functions_1.
|
|
21
|
+
const profileMapping = (0, functions_1.stringifyMappingSchemaForGraphQL)([
|
|
22
22
|
{
|
|
23
23
|
incomingKey: 'userId',
|
|
24
24
|
destinationKey: 'external_id',
|
|
@@ -57,7 +57,7 @@ async function performForwardAudienceEvents(request, events) {
|
|
|
57
57
|
input: {
|
|
58
58
|
advertiserId: ${advertiserId},
|
|
59
59
|
mappingSchemaV2: ${profileMapping},
|
|
60
|
-
mappableType: "${functions_1.EXTERNAL_PROVIDER}"
|
|
60
|
+
mappableType: "${functions_1.EXTERNAL_PROVIDER}"
|
|
61
61
|
}
|
|
62
62
|
) {
|
|
63
63
|
userErrors {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../../src/destinations/stackadapt-audiences/forwardAudienceEvent/functions.ts"],"names":[],"mappings":";;AAgCA,oEAsDC;AApFD,
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../../src/destinations/stackadapt-audiences/forwardAudienceEvent/functions.ts"],"names":[],"mappings":";;AAgCA,oEAsDC;AApFD,4CAA4I;AAE5I,MAAM,eAAe,GAAG,IAAA,4CAAgC,EAAC;IACvD;QACE,WAAW,EAAE,YAAY;QACzB,cAAc,EAAE,aAAa;QAC7B,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,sBAAsB;QAC7B,KAAK,EAAE,KAAK;KACb;IACD;QACE,WAAW,EAAE,cAAc;QAC3B,cAAc,EAAE,MAAM;QACtB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,wBAAwB;QAC/B,KAAK,EAAE,KAAK;KAEb;CACF,CAAC,CAAA;AAEF,MAAM,cAAc,GAAG,IAAA,4CAAgC,EAAC;IACtD;QACE,WAAW,EAAE,QAAQ;QACrB,cAAc,EAAE,aAAa;QAC7B,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,qBAAqB;KAC7B;CACF,CAAC,CAAA;AAEK,KAAK,UAAU,4BAA4B,CAAC,OAAsB,EAAE,MAAiB;IAC1F,MAAM,YAAY,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAA;IAC5C,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAC1C,MAAM,EAAE,uBAAuB,EAAE,WAAW,EAAE,sBAAsB,EAAE,UAAU,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,KAAK,CAAA;QAEpH,MAAM,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,eAAe,CAAA;QACjD,OAAO;YACL,MAAM,EAAE,OAAO;YACf,UAAU;YACV,YAAY,EAAE,WAAW;YACzB,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;SAClC,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,MAAM,QAAQ,GAAG,IAAA,0CAA8B,EAAC,cAAc,CAAC,CAAA;IAC/D,MAAM,QAAQ,GAAG;;;0BAGO,YAAY;+BACP,6BAAiB;qBAC3B,IAAA,sBAAU,EAAC,QAAQ,CAAC;uBAClB,QAAQ;;;;;;;;;0BASL,YAAY;6BACT,cAAc;2BAChB,6BAAiB;;;;;;;;;0BASlB,YAAY;2BACX,eAAe;2BACf,6BAAiB;;;;;;;MAOtC,CAAA;IACJ,OAAO,MAAM,OAAO,CAAC,wBAAY,EAAE;QACjC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;KAC1C,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -66,7 +66,7 @@ async function performForwardProfiles(request, events) {
|
|
|
66
66
|
input: {
|
|
67
67
|
advertiserId: ${advertiserId},
|
|
68
68
|
mappingSchemaV2: ${getProfileMappings(Array.from(fieldsToMap), fieldTypes)},
|
|
69
|
-
mappableType: "${functions_1.EXTERNAL_PROVIDER}"
|
|
69
|
+
mappableType: "${functions_1.EXTERNAL_PROVIDER}"
|
|
70
70
|
}
|
|
71
71
|
) {
|
|
72
72
|
userErrors {
|
|
@@ -108,7 +108,7 @@ function getProfileMappings(customFields, fieldTypes) {
|
|
|
108
108
|
isPii: false
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
|
-
return (0, functions_1.
|
|
111
|
+
return (0, functions_1.stringifyMappingSchemaForGraphQL)(mappingSchema);
|
|
112
112
|
}
|
|
113
113
|
function generateLabel(field) {
|
|
114
114
|
let label = field
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../../src/destinations/stackadapt-audiences/forwardProfile/functions.ts"],"names":[],"mappings":";;;;;AAiCA,wDA2EC;AA3GD,iEAAwC;AACxC,6DAAoC;AAEpC,
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../../src/destinations/stackadapt-audiences/forwardProfile/functions.ts"],"names":[],"mappings":";;;;;AAiCA,wDA2EC;AA3GD,iEAAwC;AACxC,6DAAoC;AAEpC,4CAA4I;AAE5I,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,OAAO;IACP,WAAW;IACX,UAAU;IACV,OAAO;IACP,iBAAiB;IACjB,SAAS;IACT,QAAQ;IACR,MAAM;IACN,OAAO;IACP,SAAS;IACT,UAAU;IACV,YAAY;IACZ,UAAU;IACV,YAAY;IACZ,SAAS;IACT,YAAY;CACb,CAAC,CAAA;AAUK,KAAK,UAAU,sBAAsB,CAAC,OAAsB,EAAE,MAAiB;IACpF,MAAM,WAAW,GAAgB,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAA;IACpD,MAAM,UAAU,GAA2B,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAA;IAC/D,MAAM,YAAY,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAA;IAC5C,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QAC9C,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAAA;QAC1D,MAAM,OAAO,GAAgD;YAC3D,MAAM,EAAE,OAAO;SAChB,CAAA;QACD,IAAI,UAAU,KAAK,OAAO,EAAE,CAAC;YAC3B,OAAO,CAAC,UAAU,GAAG,WAAW,CAAA;QAClC,CAAC;aAAM,IAAI,IAAA,iBAAO,EAAC,MAAM,CAAC,EAAE,CAAC;YAE3B,OAAO,EAAE,CAAA;QACX,CAAC;QACD,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,IAAI,EAAE,CAAA;QAC1C,IAAI,QAAQ,EAAE,CAA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C,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QACjC,KAAK,GAAG,YAAY,KAAK,EAAE,CAAA;IAC7B,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAC7B,IAAI,SAAS,CAAC,KAAK,CAAC;QAAE,OAAO,MAAM,CAAA;IACnC,OAAO,CAAC,OAAO,KAAK,CAAC,CAAC,WAAW,EAAE,CAAA;AACrC,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;AAC/D,CAAC"}
|
|
@@ -4,3 +4,4 @@ export declare const GQL_ENDPOINT = "https://api.stackadapt.com/graphql";
|
|
|
4
4
|
export declare function advertiserIdFieldImplementation(request: ReturnType<typeof createRequestClient>): Promise<DynamicFieldResponse>;
|
|
5
5
|
export declare function sha256hash(data: string): string;
|
|
6
6
|
export declare function stringifyJsonWithEscapedQuotes(value: unknown): string;
|
|
7
|
+
export declare function stringifyMappingSchemaForGraphQL(value: unknown): string;
|
|
@@ -4,6 +4,7 @@ exports.GQL_ENDPOINT = exports.EXTERNAL_PROVIDER = void 0;
|
|
|
4
4
|
exports.advertiserIdFieldImplementation = advertiserIdFieldImplementation;
|
|
5
5
|
exports.sha256hash = sha256hash;
|
|
6
6
|
exports.stringifyJsonWithEscapedQuotes = stringifyJsonWithEscapedQuotes;
|
|
7
|
+
exports.stringifyMappingSchemaForGraphQL = stringifyMappingSchemaForGraphQL;
|
|
7
8
|
const crypto_1 = require("crypto");
|
|
8
9
|
exports.EXTERNAL_PROVIDER = 'segment_io';
|
|
9
10
|
exports.GQL_ENDPOINT = 'https://api.stackadapt.com/graphql';
|
|
@@ -49,8 +50,13 @@ function sha256hash(data) {
|
|
|
49
50
|
return hash.digest('hex');
|
|
50
51
|
}
|
|
51
52
|
function stringifyJsonWithEscapedQuotes(value) {
|
|
52
|
-
|
|
53
|
-
jsonString = jsonString.replace(/"type":"([^"]+)"/g, (_, typeValue) => `"type":${typeValue.toUpperCase()}`);
|
|
53
|
+
const jsonString = JSON.stringify(value);
|
|
54
54
|
return jsonString.replace(/"/g, '\\"');
|
|
55
55
|
}
|
|
56
|
+
function stringifyMappingSchemaForGraphQL(value) {
|
|
57
|
+
let jsonString = JSON.stringify(value);
|
|
58
|
+
jsonString = jsonString.replace(/"type":"([^"]+)"/g, (_, typeValue) => `type:${typeValue.toUpperCase()}`);
|
|
59
|
+
jsonString = jsonString.replace(/"([a-zA-Z_][a-zA-Z0-9_]*)"\s*:/g, '$1:');
|
|
60
|
+
return jsonString;
|
|
61
|
+
}
|
|
56
62
|
//# sourceMappingURL=functions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/destinations/stackadapt-audiences/functions.ts"],"names":[],"mappings":";;;AA6BA,0EAoCC;AAED,gCAIC;AAGD,
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/destinations/stackadapt-audiences/functions.ts"],"names":[],"mappings":";;;AA6BA,0EAoCC;AAED,gCAIC;AAGD,wEAKC;AAGD,4EAWC;AA3FD,mCAAmC;AAwBtB,QAAA,iBAAiB,GAAG,YAAY,CAAA;AAChC,QAAA,YAAY,GAAG,oCAAoC,CAAA;AAEzD,KAAK,UAAU,+BAA+B,CACnD,OAA+C;IAE/C,IAAI,CAAC;QACH,MAAM,KAAK,GAAG;;;;;;;;;;;;QAYV,CAAA;QACJ,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAoB,oBAAY,EAAE;YAC9D,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC;SAChC,CAAC,CAAA;QACF,MAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAA;QAC1E,MAAM,OAAO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C;IAGvC,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC,EAAE,SAAiB,EAAE,EAAE,CAC5E,QAAQ,SAAS,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAGrC,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;IAE1E,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
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.
|
|
4
|
+
"version": "3.420.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"@aws-sdk/client-s3": "^3.600.0",
|
|
46
46
|
"@bufbuild/protobuf": "^2.2.3",
|
|
47
47
|
"@segment/a1-notation": "^2.1.4",
|
|
48
|
-
"@segment/actions-core": "^3.
|
|
49
|
-
"@segment/actions-shared": "^1.
|
|
48
|
+
"@segment/actions-core": "^3.159.0",
|
|
49
|
+
"@segment/actions-shared": "^1.140.0",
|
|
50
50
|
"@types/node": "^22.13.1",
|
|
51
51
|
"ajv-formats": "^2.1.1",
|
|
52
52
|
"aws4": "^1.12.0",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"__tests__/__helpers__/"
|
|
91
91
|
]
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "bbc92378d89472a186e8e7f7fe23e2f24269b22d"
|
|
94
94
|
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.send = send;
|
|
4
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
5
|
-
const client_eventbridge_1 = require("@aws-sdk/client-eventbridge");
|
|
6
|
-
async function send(payloads, settings) {
|
|
7
|
-
await process_data(payloads, settings);
|
|
8
|
-
}
|
|
9
|
-
async function process_data(events, settings) {
|
|
10
|
-
const client = new client_eventbridge_1.EventBridgeClient({ region: settings.awsRegion });
|
|
11
|
-
const awsAccountId = settings.awsAccountId;
|
|
12
|
-
await ensurePartnerSourceExists(client, awsAccountId, events[0].sourceId, settings.createPartnerEventSource || false, settings.partnerEventSourceName);
|
|
13
|
-
const eb_payload = {
|
|
14
|
-
Entries: events.map((event) => ({
|
|
15
|
-
EventBusName: event.sourceId,
|
|
16
|
-
Source: `${settings.partnerEventSourceName}/${event.sourceId}`,
|
|
17
|
-
DetailType: String(event.detailType),
|
|
18
|
-
Detail: JSON.stringify(event.data),
|
|
19
|
-
Resources: event.resources ? [event.resources] : []
|
|
20
|
-
}))
|
|
21
|
-
};
|
|
22
|
-
const command = new client_eventbridge_1.PutPartnerEventsCommand(eb_payload);
|
|
23
|
-
const response = await client.send(command);
|
|
24
|
-
if (response?.FailedEntryCount && response.FailedEntryCount > 0) {
|
|
25
|
-
const errors = response.Entries?.filter((entry) => entry.ErrorCode || entry.ErrorMessage);
|
|
26
|
-
const errorMessage = errors?.map((err) => `Error: ${err.ErrorCode}, Message: ${err.ErrorMessage}`).join('; ');
|
|
27
|
-
throw new actions_core_1.IntegrationError(`EventBridge failed with ${response.FailedEntryCount} errors: ${errorMessage}`, 'EVENTBRIDGE_ERROR', 400);
|
|
28
|
-
}
|
|
29
|
-
return response;
|
|
30
|
-
}
|
|
31
|
-
async function ensurePartnerSourceExists(client, awsAccountId, sourceId, createPartnerEventSource, partnerEventSourceName) {
|
|
32
|
-
const namePrefix = `${partnerEventSourceName}/${sourceId}`;
|
|
33
|
-
const listCommand = new client_eventbridge_1.ListPartnerEventSourcesCommand({ NamePrefix: namePrefix });
|
|
34
|
-
const listResponse = await client.send(listCommand);
|
|
35
|
-
if (listResponse?.PartnerEventSources && listResponse.PartnerEventSources.length > 0) {
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
if (createPartnerEventSource) {
|
|
39
|
-
await create_partner_source(client, awsAccountId, namePrefix);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
throw new actions_core_1.IntegrationError(`Partner Event Source ${namePrefix} does not exist.`, 'PARTNER_EVENT_SOURCE_NOT_FOUND', 400);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
async function create_partner_source(client, aws_account_id, partnerEventSourceName) {
|
|
46
|
-
const command = new client_eventbridge_1.CreatePartnerEventSourceCommand({
|
|
47
|
-
Account: aws_account_id,
|
|
48
|
-
Name: partnerEventSourceName
|
|
49
|
-
});
|
|
50
|
-
const response = await client.send(command);
|
|
51
|
-
return response;
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=functions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/destinations/amazon-eventbridge/functions.ts"],"names":[],"mappings":";;AAUA,oBAEC;AAVD,wDAAwD;AACxD,oEAKoC;AAE7B,KAAK,UAAU,IAAI,CAAC,QAAmB,EAAE,QAAkB;IAChE,MAAM,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;AACxC,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,MAAiB,EAAE,QAAkB;IAC/D,MAAM,MAAM,GAAG,IAAI,sCAAiB,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAA;IACpE,MAAM,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAA;IAG1C,MAAM,yBAAyB,CAC7B,MAAM,EACN,YAAY,EACZ,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,EAClB,QAAQ,CAAC,wBAAwB,IAAI,KAAK,EAC1C,QAAQ,CAAC,sBAAsB,CAChC,CAAA;IAED,MAAM,UAAU,GAAG;QACjB,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,C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U,GAAG,GAAG,sBAAsB,IAAI,QAAQ,EAAE,CAAA;IAE1D,MAAM,WAAW,GAAG,IAAI,mDAA8B,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAA;IAClF,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;IAEnD,IAAI,YAAY,EAAE,mBAAmB,IAAI,YAAY,CAAC,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrF,OAAO,IAAI,CAAA;IACb,CAAC;IAGD,IAAI,wBAAwB,EAAE,CAAC;QAC7B,MAAM,qBAAqB,CAAC,MAAM,EAAE,YAAY,EAAE,UAAU,CAAC,CAAA;IAC/D,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,+BAAgB,CACxB,wBAAwB,UAAU,kBAAkB,EACpD,gCAAgC,EAChC,GAAG,CACJ,CAAA;IACH,CAAC;AACH,CAAC;AAED,KAAK,UAAU,qBAAqB,CAClC,MAAyB,EACzB,cAAkC,EAClC,sBAA8B;IAE9B,MAAM,OAAO,GAAG,IAAI,oDAA+B,CAAC;QAClD,OAAO,EAAE,cAAc;QACvB,IAAI,EAAE,sBAAsB;KAC7B,CAAC,CAAA;IACF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC3C,OAAO,QAAQ,CAAA;AACjB,CAAC"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.send = send;
|
|
4
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
5
|
-
const client_eventbridge_1 = require("@aws-sdk/client-eventbridge");
|
|
6
|
-
async function send(payloads, settings) {
|
|
7
|
-
return await process_data(payloads, settings);
|
|
8
|
-
}
|
|
9
|
-
async function process_data(events, settings) {
|
|
10
|
-
const client = new client_eventbridge_1.EventBridgeClient({ region: settings.awsRegion });
|
|
11
|
-
const awsAccountId = settings.awsAccountId;
|
|
12
|
-
await ensurePartnerSourceExists(client, awsAccountId, events[0].sourceId, settings.createPartnerEventSource || false, settings.partnerEventSourceName);
|
|
13
|
-
const ebPayload = {
|
|
14
|
-
Entries: events.map((event) => ({
|
|
15
|
-
EventBusName: event.sourceId,
|
|
16
|
-
Source: `${settings.partnerEventSourceName}/${event.sourceId}`,
|
|
17
|
-
DetailType: String(event.detailType),
|
|
18
|
-
Detail: JSON.stringify(event.data),
|
|
19
|
-
Resources: event.resources ? [event.resources] : []
|
|
20
|
-
}))
|
|
21
|
-
};
|
|
22
|
-
const command = new client_eventbridge_1.PutPartnerEventsCommand(ebPayload);
|
|
23
|
-
const response = await client.send(command);
|
|
24
|
-
const entries = response.Entries ?? [];
|
|
25
|
-
const multiStatusResponse = new actions_core_1.MultiStatusResponse();
|
|
26
|
-
events.forEach((event, index) => {
|
|
27
|
-
const entry = entries[index] ?? {};
|
|
28
|
-
if (entry.ErrorCode || entry.ErrorMessage) {
|
|
29
|
-
multiStatusResponse.setErrorResponseAtIndex(index, {
|
|
30
|
-
status: 400,
|
|
31
|
-
errormessage: entry.ErrorMessage ?? 'Unknown Error',
|
|
32
|
-
sent: JSON.stringify(event),
|
|
33
|
-
body: JSON.stringify(entry)
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
multiStatusResponse.setSuccessResponseAtIndex(index, {
|
|
38
|
-
status: 200,
|
|
39
|
-
body: 'Event sent successfully',
|
|
40
|
-
sent: JSON.stringify(event)
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
return multiStatusResponse;
|
|
45
|
-
}
|
|
46
|
-
async function ensurePartnerSourceExists(client, awsAccountId, sourceId, createPartnerEventSource, partnerEventSourceName) {
|
|
47
|
-
const namePrefix = `${partnerEventSourceName}/${sourceId}`;
|
|
48
|
-
const listCommand = new client_eventbridge_1.ListPartnerEventSourcesCommand({ NamePrefix: namePrefix });
|
|
49
|
-
const listResponse = await client.send(listCommand);
|
|
50
|
-
if (listResponse?.PartnerEventSources && listResponse.PartnerEventSources.length > 0) {
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
if (createPartnerEventSource) {
|
|
54
|
-
await create_partner_source(client, awsAccountId, namePrefix);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
throw new actions_core_1.IntegrationError(`Partner Event Source ${namePrefix} does not exist.`, 'PARTNER_EVENT_SOURCE_NOT_FOUND', 400);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
async function create_partner_source(client, aws_account_id, partnerEventSourceName) {
|
|
61
|
-
const command = new client_eventbridge_1.CreatePartnerEventSourceCommand({
|
|
62
|
-
Account: aws_account_id,
|
|
63
|
-
Name: partnerEventSourceName
|
|
64
|
-
});
|
|
65
|
-
const response = await client.send(command);
|
|
66
|
-
return response;
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=functionsv2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functionsv2.js","sourceRoot":"","sources":["../../../src/destinations/amazon-eventbridge/functionsv2.ts"],"names":[],"mappings":";;AAWA,oBAEC;AAXD,wDAA6E;AAC7E,oEAMoC;AAE7B,KAAK,UAAU,IAAI,CAAC,QAAmB,EAAE,QAAkB;IAChE,OAAO,MAAM,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;AAC/C,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,MAAiB,EAAE,QAAkB;IAC/D,MAAM,MAAM,GAAG,IAAI,sCAAiB,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAA;IACpE,MAAM,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAA;IAG1C,MAAM,yBAAyB,CAC7B,MAAM,EACN,YAAY,EACZ,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,EAClB,QAAQ,CAAC,wBAAwB,IAAI,KAAK,EAC1C,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CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/amazon-eventbridge/sendV2/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const functionsv2_1 = require("../functionsv2");
|
|
4
|
-
const action = {
|
|
5
|
-
title: 'SendV2',
|
|
6
|
-
description: 'Send an event to Amazon EventBridge.',
|
|
7
|
-
fields: {
|
|
8
|
-
data: {
|
|
9
|
-
label: 'Detail',
|
|
10
|
-
description: 'The event data to send to Amazon EventBridge.',
|
|
11
|
-
type: 'object',
|
|
12
|
-
default: { '@path': '$.' },
|
|
13
|
-
required: true
|
|
14
|
-
},
|
|
15
|
-
detailType: {
|
|
16
|
-
label: 'Detail Type',
|
|
17
|
-
description: `Detail Type of the event. Used to determine what fields to expect in the event Detail.
|
|
18
|
-
Value cannot be longer than 128 characters.`,
|
|
19
|
-
type: 'string',
|
|
20
|
-
maximum: 128,
|
|
21
|
-
default: { '@path': '$.type' },
|
|
22
|
-
required: true
|
|
23
|
-
},
|
|
24
|
-
sourceId: {
|
|
25
|
-
label: 'Source ID',
|
|
26
|
-
description: 'The source ID for the event. HIDDEN FIELD',
|
|
27
|
-
type: 'string',
|
|
28
|
-
unsafe_hidden: true,
|
|
29
|
-
default: {
|
|
30
|
-
'@if': {
|
|
31
|
-
exists: { '@path': '$.context.protocols.sourceId' },
|
|
32
|
-
then: { '@path': '$.context.protocols.sourceId' },
|
|
33
|
-
else: { '@path': '$.projectId' }
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
required: true
|
|
37
|
-
},
|
|
38
|
-
resources: {
|
|
39
|
-
label: 'Resources',
|
|
40
|
-
description: `AWS resources, identified by Amazon Resource Name (ARN),
|
|
41
|
-
which the event primarily concerns. Any number,
|
|
42
|
-
including zero, may be present.`,
|
|
43
|
-
type: 'string',
|
|
44
|
-
default: {
|
|
45
|
-
'@if': {
|
|
46
|
-
exists: { '@path': '$.userId' },
|
|
47
|
-
then: { '@path': '$.userId' },
|
|
48
|
-
else: { '@path': '$.anonymousId' }
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
required: false
|
|
52
|
-
},
|
|
53
|
-
time: {
|
|
54
|
-
label: 'Time',
|
|
55
|
-
description: 'The timestamp the event occurred.',
|
|
56
|
-
type: 'string',
|
|
57
|
-
default: { '@path': '$.timestamp' },
|
|
58
|
-
required: false
|
|
59
|
-
},
|
|
60
|
-
enable_batching: {
|
|
61
|
-
type: 'boolean',
|
|
62
|
-
label: 'Enable Batching',
|
|
63
|
-
description: 'Enable Batching',
|
|
64
|
-
unsafe_hidden: false,
|
|
65
|
-
required: true,
|
|
66
|
-
default: true
|
|
67
|
-
},
|
|
68
|
-
batch_size: {
|
|
69
|
-
label: 'Batch Size',
|
|
70
|
-
description: `Maximum number of events to include in each batch.
|
|
71
|
-
Actual batch sizes may be lower.`,
|
|
72
|
-
type: 'number',
|
|
73
|
-
unsafe_hidden: true,
|
|
74
|
-
required: false,
|
|
75
|
-
default: 20,
|
|
76
|
-
minimum: 1,
|
|
77
|
-
maximum: 20
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
perform: (_, data) => {
|
|
81
|
-
const { payload, settings } = data;
|
|
82
|
-
return (0, functionsv2_1.send)([payload], settings);
|
|
83
|
-
},
|
|
84
|
-
performBatch: (_, data) => {
|
|
85
|
-
const { payload, settings } = data;
|
|
86
|
-
return (0, functionsv2_1.send)(payload, settings);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
exports.default = action;
|
|
90
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/amazon-eventbridge/sendV2/index.ts"],"names":[],"mappings":";;AAGA,gDAAqC;AAErC,MAAM,MAAM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