@segment/action-destinations 3.258.0-staging-52cd499a1 → 3.258.0-staging-cb8ec120e
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/blackbaud-raisers-edge-nxt/utils/index.d.ts +1 -1
- package/dist/destinations/customerio/test-helper.d.ts +1 -1
- package/dist/destinations/customerio/utils.d.ts +1 -1
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.d.ts +2 -5
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js +18 -98
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js.map +1 -1
- package/dist/destinations/engage/utils/EngageActionPerformer.d.ts +1 -1
- package/dist/destinations/engage/utils/EngageActionPerformer.js +4 -0
- package/dist/destinations/engage/utils/EngageActionPerformer.js.map +1 -1
- package/dist/destinations/kafka/index.js +14 -7
- package/dist/destinations/kafka/index.js.map +1 -1
- package/dist/destinations/kafka/utils.d.ts +4 -0
- package/dist/destinations/kafka/utils.js +39 -1
- package/dist/destinations/kafka/utils.js.map +1 -1
- package/dist/destinations/liveramp-audiences/audienceEntered/generated-types.d.ts +13 -0
- package/dist/destinations/liveramp-audiences/audienceEntered/generated-types.js.map +1 -0
- package/dist/destinations/liveramp-audiences/audienceEntered/index.js +95 -0
- package/dist/destinations/liveramp-audiences/audienceEntered/index.js.map +1 -0
- package/dist/destinations/liveramp-audiences/audienceEntered/s3.d.ts +6 -0
- package/dist/destinations/liveramp-audiences/audienceEntered/s3.js +37 -0
- package/dist/destinations/liveramp-audiences/audienceEntered/s3.js.map +1 -0
- package/dist/destinations/liveramp-audiences/audienceEntered/sftp.d.ts +7 -0
- package/dist/destinations/liveramp-audiences/audienceEntered/sftp.js +52 -0
- package/dist/destinations/liveramp-audiences/audienceEntered/sftp.js.map +1 -0
- package/dist/destinations/mixpanel/utils.d.ts +13 -0
- package/dist/destinations/mixpanel/utils.js +117 -0
- package/dist/destinations/mixpanel/utils.js.map +1 -0
- package/package.json +2 -2
- package/dist/destinations/responsys/asyncMergePetRecords/generated-types.d.ts +0 -14
- package/dist/destinations/responsys/asyncMergePetRecords/generated-types.js.map +0 -1
- package/dist/destinations/responsys/asyncMergePetRecords/index.js +0 -113
- package/dist/destinations/responsys/asyncMergePetRecords/index.js.map +0 -1
- package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.d.ts +0 -20
- package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.js +0 -3
- package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.js.map +0 -1
- package/dist/destinations/responsys/asyncMergeProfileListMembers/index.d.ts +0 -5
- package/dist/destinations/responsys/asyncMergeProfileListMembers/index.js +0 -174
- package/dist/destinations/responsys/asyncMergeProfileListMembers/index.js.map +0 -1
- package/dist/destinations/responsys/rsp-operations.d.ts +0 -14
- package/dist/destinations/responsys/rsp-operations.js +0 -33
- package/dist/destinations/responsys/rsp-operations.js.map +0 -1
- package/dist/destinations/responsys/rsp-properties.d.ts +0 -4
- package/dist/destinations/responsys/rsp-properties.js +0 -27
- package/dist/destinations/responsys/rsp-properties.js.map +0 -1
- package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.d.ts +0 -1
- package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.js +0 -381
- package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.js.map +0 -1
- package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.d.ts +0 -1
- package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.js +0 -581
- package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.js.map +0 -1
- package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.d.ts +0 -4
- package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.js +0 -97
- package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.js.map +0 -1
- package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.d.ts +0 -3
- package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.js +0 -43
- package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.js.map +0 -1
- /package/dist/destinations/{responsys/asyncMergePetRecords → liveramp-audiences/audienceEntered}/generated-types.js +0 -0
- /package/dist/destinations/{responsys/asyncMergePetRecords → liveramp-audiences/audienceEntered}/index.d.ts +0 -0
|
@@ -9,7 +9,7 @@ export declare const dateStringToFuzzyDate: (dateString: string | number) => fal
|
|
|
9
9
|
y: string;
|
|
10
10
|
};
|
|
11
11
|
export declare const augmentFieldsWithConstituentFields: (fields: Record<string, InputField>) => Record<string, InputField>;
|
|
12
|
-
export declare const splitConstituentPayload: (payload: CreateOrUpdateIndividualConstituentPayload) => (Partial<
|
|
12
|
+
export declare const splitConstituentPayload: (payload: CreateOrUpdateIndividualConstituentPayload) => (Partial<Phone> | Partial<Constituent> | Partial<Address> | Partial<OnlinePresence>)[];
|
|
13
13
|
export declare const buildConstituentPayloadFromPayload: (payload: StringIndexedObject) => Partial<CreateOrUpdateIndividualConstituentPayload>;
|
|
14
14
|
export declare const buildGiftDataFromPayload: (constituentId: string, payload: CreateGiftPayload) => Partial<Gift>;
|
|
15
15
|
export declare const buildConstituentActionDataFromPayload: (constituentId: string, payload: CreateConstituentAction) => Partial<ConstituentAction>;
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
import nock from 'nock';
|
|
3
3
|
import { AccountRegion } from './utils';
|
|
4
4
|
export declare const nockTrackInternalEndpoint: (region: AccountRegion) => nock.Scope;
|
|
5
|
-
export declare function getDefaultMappings(action: string): import("lodash").Dictionary<import("@segment/actions-core/destination-
|
|
5
|
+
export declare function getDefaultMappings(action: string): import("lodash").Dictionary<import("@segment/actions-core/src/destination-kit/types").FieldValue | undefined>;
|
|
6
6
|
export declare function testRunner(fn: Function): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const trackApiEndpoint: ({ accountRegion }: {
|
|
2
2
|
accountRegion?: string | undefined;
|
|
3
|
-
}) => "https://track
|
|
3
|
+
}) => "https://track.customer.io" | "https://track-eu.customer.io";
|
|
4
4
|
export declare enum AccountRegion {
|
|
5
5
|
US = "US \uD83C\uDDFA\uD83C\uDDF8",
|
|
6
6
|
EU = "EU \uD83C\uDDEA\uD83C\uDDFA"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InputField } from '@segment/actions-core';
|
|
2
2
|
import { RequestClient } from '@segment/actions-core';
|
|
3
|
-
import { Logger, StatsClient
|
|
3
|
+
import { Logger, StatsClient } from '@segment/actions-core/destination-kit';
|
|
4
4
|
import type { Settings } from '../generated-types';
|
|
5
5
|
import { Profile } from '../Profile';
|
|
6
6
|
export declare type ApiLookupConfig = {
|
|
@@ -13,9 +13,6 @@ export declare type ApiLookupConfig = {
|
|
|
13
13
|
headers?: object | undefined;
|
|
14
14
|
responseType: string;
|
|
15
15
|
};
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const getCachedResponse: ({ responseType }: ApiLookupConfig, requestId: string, dataFeedCache: DataFeedCache, datafeedTags: string[]) => Promise<any>;
|
|
18
|
-
export declare const performApiLookup: (request: RequestClient, apiLookupConfig: ApiLookupConfig, profile: Profile, statsClient: StatsClient | undefined, tags: string[], settings: Settings, logger?: Logger | undefined, dataFeedCache?: DataFeedCache | undefined) => Promise<any>;
|
|
16
|
+
export declare const performApiLookup: (request: RequestClient, { id, url, method, body, headers }: ApiLookupConfig, profile: Profile, statsClient: StatsClient | undefined, tags: string[], settings: Settings, logger?: Logger | undefined) => Promise<unknown>;
|
|
19
17
|
export declare const apiLookupActionFields: Record<string, InputField>;
|
|
20
18
|
export declare const apiLookupLiquidKey = "lookups";
|
|
21
|
-
export declare const FLAGON_NAME_DATA_FEEDS = "is-datafeeds-enabled";
|
|
@@ -1,125 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const crypto_1 = require("crypto");
|
|
3
|
+
exports.apiLookupLiquidKey = exports.apiLookupActionFields = exports.performApiLookup = void 0;
|
|
5
4
|
const actions_core_1 = require("@segment/actions-core");
|
|
6
5
|
const liquidjs_1 = require("liquidjs");
|
|
7
6
|
const Liquid = new liquidjs_1.Liquid();
|
|
8
|
-
const
|
|
9
|
-
const renderLiquidFields = async ({ id, url, body }, profile, datafeedTags, settings, logger) => {
|
|
7
|
+
const performApiLookup = async (request, { id, url, method, body, headers }, profile, statsClient, tags, settings, logger) => {
|
|
10
8
|
let renderedUrl;
|
|
11
9
|
let renderedBody;
|
|
12
10
|
try {
|
|
13
11
|
renderedUrl = await Liquid.parseAndRender(url, { profile });
|
|
14
12
|
}
|
|
15
13
|
catch (error) {
|
|
16
|
-
logger?.error(`TE Messaging: Email
|
|
17
|
-
|
|
14
|
+
logger?.error(`TE Messaging: Email api lookup url parse failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
|
|
15
|
+
tags.push('reason:parse_apilookup_url');
|
|
16
|
+
statsClient?.incr('actions-personas-messaging-sendgrid-error', 1, tags);
|
|
18
17
|
throw new actions_core_1.IntegrationError('Unable to parse email api lookup url', 'api lookup url parse failure', 400);
|
|
19
18
|
}
|
|
20
19
|
try {
|
|
21
20
|
renderedBody = body ? await Liquid.parseAndRender(body, { profile }) : undefined;
|
|
22
21
|
}
|
|
23
22
|
catch (error) {
|
|
24
|
-
logger?.error(`TE Messaging: Email
|
|
25
|
-
|
|
23
|
+
logger?.error(`TE Messaging: Email api lookup body parse failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
|
|
24
|
+
tags.push('reason:parse_apilookup_body');
|
|
25
|
+
statsClient?.incr('actions-personas-messaging-sendgrid-error', 1, tags);
|
|
26
26
|
throw new actions_core_1.IntegrationError('Unable to parse email api lookup body', 'api lookup body parse failure', 400);
|
|
27
27
|
}
|
|
28
|
-
return {
|
|
29
|
-
renderedUrl,
|
|
30
|
-
renderedBody
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
const getRequestId = ({ method, url, body, headers }) => {
|
|
34
|
-
const requestHash = crypto_1.createHash('sha256');
|
|
35
|
-
requestHash.update(`${method}${url}${body}${JSON.stringify(headers)}`);
|
|
36
|
-
const requestId = requestHash.digest('hex');
|
|
37
|
-
return requestId;
|
|
38
|
-
};
|
|
39
|
-
exports.getRequestId = getRequestId;
|
|
40
|
-
const getCachedResponse = async ({ responseType }, requestId, dataFeedCache, datafeedTags) => {
|
|
41
|
-
const cachedResponse = await dataFeedCache?.getRequestResponse(requestId);
|
|
42
|
-
if (!cachedResponse) {
|
|
43
|
-
datafeedTags.push('cache_hit:false');
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
datafeedTags.push('cache_hit:true');
|
|
47
|
-
if (responseType === 'json') {
|
|
48
|
-
return JSON.parse(cachedResponse);
|
|
49
|
-
}
|
|
50
|
-
return cachedResponse;
|
|
51
|
-
};
|
|
52
|
-
exports.getCachedResponse = getCachedResponse;
|
|
53
|
-
const performApiLookup = async (request, apiLookupConfig, profile, statsClient, tags, settings, logger, dataFeedCache) => {
|
|
54
|
-
const { id, method, headers, cacheTtl, name } = apiLookupConfig;
|
|
55
|
-
const datafeedTags = [
|
|
56
|
-
...tags,
|
|
57
|
-
`datafeed_id:${id}`,
|
|
58
|
-
`datafeed_name:${name}`,
|
|
59
|
-
`space_id:${settings.spaceId}`,
|
|
60
|
-
`cache_ttl_greater_than_0:${cacheTtl > 0}`
|
|
61
|
-
];
|
|
62
28
|
try {
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
let data;
|
|
73
|
-
try {
|
|
74
|
-
const res = await request(renderedUrl, {
|
|
75
|
-
headers: headers ?? undefined,
|
|
76
|
-
timeout: 3000,
|
|
77
|
-
method: method,
|
|
78
|
-
body: renderedBody,
|
|
79
|
-
skipResponseCloning: true
|
|
80
|
-
});
|
|
81
|
-
data = await res.data;
|
|
82
|
-
}
|
|
83
|
-
catch (error) {
|
|
84
|
-
const respError = error.response;
|
|
85
|
-
logger?.error(`TE Messaging: Email api lookup failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
|
|
86
|
-
datafeedTags.push(`error:true`, `error_message:${error.message}`, `error_status:${respError?.status}`, 'reason:api_call_failure');
|
|
87
|
-
throw error;
|
|
88
|
-
}
|
|
89
|
-
const dataString = JSON.stringify(data);
|
|
90
|
-
const size = Buffer.byteLength(dataString, 'utf-8');
|
|
91
|
-
datafeedTags.push(`response_size_greater_than_mb:${size > maxResponseSizeBytes}`);
|
|
92
|
-
if (cacheTtl > 0) {
|
|
93
|
-
if (size <= maxResponseSizeBytes) {
|
|
94
|
-
try {
|
|
95
|
-
await dataFeedCache?.setRequestResponse(requestId, dataString, cacheTtl / 1000);
|
|
96
|
-
datafeedTags.push('cache_set:true');
|
|
97
|
-
}
|
|
98
|
-
catch (err) {
|
|
99
|
-
logger?.error(`TE Messaging: Email api lookup cache set failure - api lookup id: ${id} - ${settings.spaceId} - [${err}]`);
|
|
100
|
-
datafeedTags.push('cache_set:false');
|
|
101
|
-
datafeedTags.push('error:true', 'reason:cache_set_failure', `error_message:${err?.message}`);
|
|
102
|
-
throw err;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
datafeedTags.push('cache_set:false');
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return data;
|
|
29
|
+
const res = await request(renderedUrl, {
|
|
30
|
+
headers: headers ?? undefined,
|
|
31
|
+
timeout: 10000,
|
|
32
|
+
method: method,
|
|
33
|
+
body: renderedBody,
|
|
34
|
+
skipResponseCloning: true
|
|
35
|
+
});
|
|
36
|
+
return res.data;
|
|
110
37
|
}
|
|
111
38
|
catch (error) {
|
|
112
|
-
const isErrorCapturedInTags = datafeedTags.find((str) => str.includes('error:true'));
|
|
113
|
-
if (!isErrorCapturedInTags) {
|
|
114
|
-
datafeedTags.push('error:true', `error_message:${error?.message}`, 'reason:unknown');
|
|
115
|
-
}
|
|
116
|
-
tags.push('reason:datafeed_failure');
|
|
117
39
|
logger?.error(`TE Messaging: Email api lookup failure - api lookup id: ${id} - ${settings.spaceId} - [${error}]`);
|
|
40
|
+
tags.push('reason:apilookup_failure');
|
|
41
|
+
statsClient?.incr('actions-personas-messaging-sendgrid-error', 1, tags);
|
|
118
42
|
throw error;
|
|
119
43
|
}
|
|
120
|
-
finally {
|
|
121
|
-
statsClient?.incr('datafeed-execution', 1, datafeedTags);
|
|
122
|
-
}
|
|
123
44
|
};
|
|
124
45
|
exports.performApiLookup = performApiLookup;
|
|
125
46
|
exports.apiLookupActionFields = {
|
|
@@ -170,5 +91,4 @@ exports.apiLookupActionFields = {
|
|
|
170
91
|
}
|
|
171
92
|
};
|
|
172
93
|
exports.apiLookupLiquidKey = 'lookups';
|
|
173
|
-
exports.FLAGON_NAME_DATA_FEEDS = 'is-datafeeds-enabled';
|
|
174
94
|
//# sourceMappingURL=api-lookups.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-lookups.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/sendgrid/previewApiLookup/api-lookups.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"api-lookups.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/sendgrid/previewApiLookup/api-lookups.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AAKxD,uCAA6C;AAG7C,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AActB,MAAM,gBAAgB,GAAG,KAAK,EACnC,OAAsB,EACtB,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAmB,EACnD,OAAgB,EAChB,WAAoC,EACpC,IAAc,EACd,QAAkB,EAClB,MAA2B,EAC3B,EAAE;IACF,IAAI,WAAmB,CAAA;IACvB,IAAI,YAAgC,CAAA;IACpC,IAAI;QACF,WAA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AS,CAAA"}
|
|
@@ -12,7 +12,7 @@ export declare abstract class EngageActionPerformer<TSettings = any, TPayload =
|
|
|
12
12
|
readonly executeInput: ExecuteInput<TSettings, TPayload>;
|
|
13
13
|
readonly logger: EngageLogger;
|
|
14
14
|
readonly statsClient: EngageStats;
|
|
15
|
-
readonly dataFeedCache: import("@segment/actions-core/destination-kit").DataFeedCache | undefined;
|
|
15
|
+
readonly dataFeedCache: import("@segment/actions-core/src/destination-kit").DataFeedCache | undefined;
|
|
16
16
|
readonly currentOperation: OperationContext | undefined;
|
|
17
17
|
readonly payload: TPayload;
|
|
18
18
|
readonly settings: TSettings;
|
|
@@ -17,6 +17,7 @@ const isDestinationActionService_1 = require("./isDestinationActionService");
|
|
|
17
17
|
const ResponseError_1 = require("./ResponseError");
|
|
18
18
|
const IntegrationErrorWrapper_1 = require("./IntegrationErrorWrapper");
|
|
19
19
|
const truncate_1 = __importDefault(require("lodash/truncate"));
|
|
20
|
+
const _1 = require("@segment/actions-core/*");
|
|
20
21
|
class EngageActionPerformer {
|
|
21
22
|
constructor(requestClient, executeInput) {
|
|
22
23
|
this.requestClient = requestClient;
|
|
@@ -61,6 +62,9 @@ class EngageActionPerformer {
|
|
|
61
62
|
catch (e) {
|
|
62
63
|
op.logs.push(`Error in onResponse: ${e}`);
|
|
63
64
|
}
|
|
65
|
+
if (isTimeoutError) {
|
|
66
|
+
throw new _1.RetryableError('Timeout error, retrying...', 408);
|
|
67
|
+
}
|
|
64
68
|
}
|
|
65
69
|
else {
|
|
66
70
|
const resp = op?.result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngageActionPerformer.js","sourceRoot":"","sources":["../../../../src/destinations/engage/utils/EngageActionPerformer.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,iDAA6C;AAC7C,+CAA2C;AAC3C,mCAAiD;AACjD,6EAAyE;AACzE,mDAAgE;AAGhE,uEAAmE;AAEnE,+DAAsC;
|
|
1
|
+
{"version":3,"file":"Engage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,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAA;IAC9E,CAAC;CACF;AA1IC;IADC,aAAK,EAAE;oDAIP;AAiBD;IAJC,aAAK,CAAC;QACL,KAAK,EAAE,WAAW;QAClB,SAAS,EAAE,WAAW;KACvB,CAAC;oDAoDD;AAxFH,sDA2JC;AAED,SAAS,WAAW,CAAC,GAAQ;IAE3B,MAAM,OAAO,GAAG,GAAuB,CAAA;IACvC,MAAM,MAAM,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAA;IAChC,IAAI,OAAO,CAAC,IAAI,IAAI,MAAM,EAAE;QAC1B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAQ,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;KACpD;AACH,CAAC"}
|
|
@@ -44,31 +44,36 @@ const destination = {
|
|
|
44
44
|
label: 'Username',
|
|
45
45
|
description: 'The username for your Kafka instance. Should be populated only if using PLAIN or SCRAM Authentication Mechanisms.',
|
|
46
46
|
type: 'string',
|
|
47
|
-
required: false
|
|
47
|
+
required: false,
|
|
48
|
+
depends_on: utils_1.DEPENDS_ON_PLAIN_OR_SCRAM
|
|
48
49
|
},
|
|
49
50
|
password: {
|
|
50
51
|
label: 'Password',
|
|
51
52
|
description: 'The password for your Kafka instance. Should only be populated if using PLAIN or SCRAM Authentication Mechanisms.',
|
|
52
53
|
type: 'password',
|
|
53
|
-
required: false
|
|
54
|
+
required: false,
|
|
55
|
+
depends_on: utils_1.DEPENDS_ON_PLAIN_OR_SCRAM
|
|
54
56
|
},
|
|
55
57
|
accessKeyId: {
|
|
56
58
|
label: 'AWS Access Key ID',
|
|
57
59
|
description: 'The Access Key ID for your AWS IAM instance. Must be populated if using AWS IAM Authentication Mechanism.',
|
|
58
60
|
type: 'string',
|
|
59
|
-
required: false
|
|
61
|
+
required: false,
|
|
62
|
+
depends_on: utils_1.DEPEONDS_ON_AWS
|
|
60
63
|
},
|
|
61
64
|
secretAccessKey: {
|
|
62
65
|
label: 'AWS Secret Key',
|
|
63
66
|
description: 'The Secret Key for your AWS IAM instance. Must be populated if using AWS IAM Authentication Mechanism.',
|
|
64
67
|
type: 'password',
|
|
65
|
-
required: false
|
|
68
|
+
required: false,
|
|
69
|
+
depends_on: utils_1.DEPEONDS_ON_AWS
|
|
66
70
|
},
|
|
67
71
|
authorizationIdentity: {
|
|
68
72
|
label: 'AWS Authorization Identity',
|
|
69
73
|
description: 'AWS IAM role ARN used for authorization. This field is optional, and should only be populated if using the AWS IAM Authentication Mechanism.',
|
|
70
74
|
type: 'string',
|
|
71
|
-
required: false
|
|
75
|
+
required: false,
|
|
76
|
+
depends_on: utils_1.DEPEONDS_ON_AWS
|
|
72
77
|
},
|
|
73
78
|
ssl_enabled: {
|
|
74
79
|
label: 'SSL Enabled',
|
|
@@ -87,13 +92,15 @@ const destination = {
|
|
|
87
92
|
label: 'SSL Client Key',
|
|
88
93
|
description: 'The Client Key for your Kafka instance. Exclude the first and last lines from the file. i.e `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----`.',
|
|
89
94
|
type: 'string',
|
|
90
|
-
required: false
|
|
95
|
+
required: false,
|
|
96
|
+
depends_on: utils_1.DEPENDS_ON_CLIENT_CERT
|
|
91
97
|
},
|
|
92
98
|
ssl_cert: {
|
|
93
99
|
label: 'SSL Client Certificate',
|
|
94
100
|
description: 'The Certificate Authority for your Kafka instance. Exclude the first and last lines from the file. i.e `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----`.',
|
|
95
101
|
type: 'string',
|
|
96
|
-
required: false
|
|
102
|
+
required: false,
|
|
103
|
+
depends_on: utils_1.DEPENDS_ON_CLIENT_CERT
|
|
97
104
|
},
|
|
98
105
|
ssl_reject_unauthorized_ca: {
|
|
99
106
|
label: 'SSL - Reject Unauthorized Certificate Authority',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/kafka/index.ts"],"names":[],"mappings":";;;;;AAEA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/kafka/index.ts"],"names":[],"mappings":";;;;;AAEA,mCAAiH;AACjH,kDAAyB;AAEzB,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,4BAA4B;IACzC,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,KAAK,EAAE,WAAW;gBAClB,WAAW,EAAE,sFAAsF;gBACnG,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,gCAAgC;aAC1C;YACD,OAAO,EAAE;gBACP,KAAK,EAAE,SAAS;gBAChB,WAAW,EACT,2HAA2H;gBAC7H,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,SAAS,EAAE;gBACT,KAAK,EAAE,0BAA0B;gBACjC,WAAW,EACT,sRAAsR;gBACxR,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;oBAClC,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,EAAE;oBAClD,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,EAAE;oBAClD,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE;oBAClC,EAAE,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,kBAAkB,EAAE;iBAC3D;gBACD,OAAO,EAAE,OAAO;aACjB;YACD,QAAQ,EAAE;gBACR,KAAK,EAAE,UAAU;gBACjB,WAAW,EACT,mHAAmH;gBACrH,IAAI,EAAE,QAAQ;gBACd,Q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f,UAAU,EAAE,8BAAsB;aACnC;YACD,0BAA0B,EAAE;gBAC1B,KAAK,EAAE,iDAAiD;gBACxD,WAAW,EACT,6GAA6G;gBAC/G,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,IAAI;aACd;SACF;QACD,kBAAkB,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YAC5C,gBAAQ,CAAC,QAAQ,CAAC,CAAA;YAClB,OAAO,MAAM,iBAAS,CAAC,QAAQ,CAAC,CAAA;QAClC,CAAC;KACF;IACD,OAAO,EAAE;QACP,IAAI,EAAJ,cAAI;KACL;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { DynamicFieldResponse } from '@segment/actions-core';
|
|
2
2
|
import type { Settings } from './generated-types';
|
|
3
3
|
import type { Payload } from './send/generated-types';
|
|
4
|
+
import { DependsOnConditions } from '@segment/actions-core/destination-kittypes';
|
|
4
5
|
export declare const DEFAULT_PARTITIONER = "DefaultPartitioner";
|
|
6
|
+
export declare const DEPENDS_ON_PLAIN_OR_SCRAM: DependsOnConditions;
|
|
7
|
+
export declare const DEPEONDS_ON_AWS: DependsOnConditions;
|
|
8
|
+
export declare const DEPENDS_ON_CLIENT_CERT: DependsOnConditions;
|
|
5
9
|
export declare const getTopics: (settings: Settings) => Promise<DynamicFieldResponse>;
|
|
6
10
|
export declare const validate: (settings: Settings) => void;
|
|
7
11
|
export declare const sendData: (settings: Settings, payload: Payload[]) => Promise<void>;
|
|
@@ -1,9 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sendData = exports.validate = exports.getTopics = exports.DEFAULT_PARTITIONER = void 0;
|
|
3
|
+
exports.sendData = exports.validate = exports.getTopics = exports.DEPENDS_ON_CLIENT_CERT = exports.DEPEONDS_ON_AWS = exports.DEPENDS_ON_PLAIN_OR_SCRAM = exports.DEFAULT_PARTITIONER = void 0;
|
|
4
4
|
const kafkajs_1 = require("kafkajs");
|
|
5
5
|
const actions_core_1 = require("@segment/actions-core");
|
|
6
6
|
exports.DEFAULT_PARTITIONER = 'DefaultPartitioner';
|
|
7
|
+
exports.DEPENDS_ON_PLAIN_OR_SCRAM = {
|
|
8
|
+
match: 'any',
|
|
9
|
+
conditions: [
|
|
10
|
+
{
|
|
11
|
+
fieldKey: 'mechanism',
|
|
12
|
+
operator: 'is',
|
|
13
|
+
value: 'plain'
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
fieldKey: 'mechanism',
|
|
17
|
+
operator: 'is',
|
|
18
|
+
value: 'scram-sha-256'
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
fieldKey: 'mechanism',
|
|
22
|
+
operator: 'is',
|
|
23
|
+
value: 'scram-sha-512'
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
};
|
|
27
|
+
exports.DEPEONDS_ON_AWS = {
|
|
28
|
+
conditions: [
|
|
29
|
+
{
|
|
30
|
+
fieldKey: 'mechanism',
|
|
31
|
+
operator: 'is',
|
|
32
|
+
value: 'aws'
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
};
|
|
36
|
+
exports.DEPENDS_ON_CLIENT_CERT = {
|
|
37
|
+
conditions: [
|
|
38
|
+
{
|
|
39
|
+
fieldKey: 'mechanism',
|
|
40
|
+
operator: 'is',
|
|
41
|
+
value: 'client-cert-auth'
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
};
|
|
7
45
|
const getTopics = async (settings) => {
|
|
8
46
|
const kafka = getKafka(settings);
|
|
9
47
|
const admin = kafka.admin();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/destinations/kafka/utils.ts"],"names":[],"mappings":";;;AAAA,qCAAqG;AACrG,wDAA8E;
|
|
1
|
+
{"version":3,"file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,EAAE,OAAO,CAAC,GAAG;YAChB,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,SAAS;YACtC,SAAS,EAAE,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,iBAAiB,IAAI,SAAS;YACxE,eAAe,EAAE,2BAAmB;SACzB,CAAA,CAChB;KACF,CAAC,CAAC,CAAA;IAEH,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAA;IAEtC,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAA;IAExB,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE;QAChC,IAAI;YACF,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAsB,CAAC,CAAA;SAC5C;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,+BAAgB,CACxB,yBAA0B,KAAsB,CAAC,OAAO,EAAE,EAC1D,sBAAsB,EACtB,GAAG,CACJ,CAAA;SACF;KACF;IAED,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAA;AAC7B,CAAC,CAAA;AA5CY,QAAA,QAAQ,YA4CpB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
audience_key: string;
|
|
3
|
+
identifier_data?: {
|
|
4
|
+
[k: string]: unknown;
|
|
5
|
+
};
|
|
6
|
+
unhashed_identifier_data?: {
|
|
7
|
+
[k: string]: unknown;
|
|
8
|
+
};
|
|
9
|
+
delimiter: string;
|
|
10
|
+
filename: string;
|
|
11
|
+
enable_batching: boolean;
|
|
12
|
+
batch_size?: number;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/liveramp-audiences/audienceEntered/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
4
|
+
const s3_1 = require("./s3");
|
|
5
|
+
const sftp_1 = require("./sftp");
|
|
6
|
+
const operations_1 = require("../operations");
|
|
7
|
+
const action = {
|
|
8
|
+
title: 'Audience Entered',
|
|
9
|
+
description: 'Uploads audience membership data to a file for LiveRamp ingestion.',
|
|
10
|
+
defaultSubscription: 'event = "Audience Entered"',
|
|
11
|
+
fields: {
|
|
12
|
+
audience_key: {
|
|
13
|
+
label: 'Audience Key',
|
|
14
|
+
description: 'Identifies the user within the entered audience.',
|
|
15
|
+
type: 'string',
|
|
16
|
+
required: true,
|
|
17
|
+
default: { '@path': '$.userId' }
|
|
18
|
+
},
|
|
19
|
+
identifier_data: {
|
|
20
|
+
label: 'Identifier Data',
|
|
21
|
+
description: `Additional data pertaining to the user to be written to the file.`,
|
|
22
|
+
type: 'object',
|
|
23
|
+
required: false,
|
|
24
|
+
defaultObjectUI: 'keyvalue:only'
|
|
25
|
+
},
|
|
26
|
+
unhashed_identifier_data: {
|
|
27
|
+
label: 'Hashable Identifier Data',
|
|
28
|
+
description: `Additional data pertaining to the user to be hashed before written to the file`,
|
|
29
|
+
type: 'object',
|
|
30
|
+
required: false,
|
|
31
|
+
defaultObjectUI: 'keyvalue:only'
|
|
32
|
+
},
|
|
33
|
+
delimiter: {
|
|
34
|
+
label: 'Delimeter',
|
|
35
|
+
description: `Character used to separate tokens in the resulting file.`,
|
|
36
|
+
type: 'string',
|
|
37
|
+
required: true,
|
|
38
|
+
default: ','
|
|
39
|
+
},
|
|
40
|
+
filename: {
|
|
41
|
+
label: 'Filename',
|
|
42
|
+
description: `Name of the CSV file to upload for LiveRamp ingestion.`,
|
|
43
|
+
type: 'string',
|
|
44
|
+
required: true,
|
|
45
|
+
default: { '@template': '{{properties.audience_key}}_PII_{{timestamp}}.csv' }
|
|
46
|
+
},
|
|
47
|
+
enable_batching: {
|
|
48
|
+
type: 'boolean',
|
|
49
|
+
label: 'Batch data',
|
|
50
|
+
description: 'Receive events in a batch payload. This is required for LiveRamp audiences ingestion.',
|
|
51
|
+
required: true,
|
|
52
|
+
default: true
|
|
53
|
+
},
|
|
54
|
+
batch_size: {
|
|
55
|
+
label: 'Batch Size',
|
|
56
|
+
description: 'Maximum number of events to include in each batch. Actual batch sizes may be lower.',
|
|
57
|
+
type: 'number',
|
|
58
|
+
required: false,
|
|
59
|
+
default: 1000000
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
perform: async (request, { settings, payload }) => {
|
|
63
|
+
return processData(request, settings, [payload]);
|
|
64
|
+
},
|
|
65
|
+
performBatch: (request, { settings, payload }) => {
|
|
66
|
+
return processData(request, settings, payload);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
async function processData(request, settings, payloads) {
|
|
70
|
+
const LIVERAMP_MIN_RECORD_COUNT = 25;
|
|
71
|
+
if (payloads.length < LIVERAMP_MIN_RECORD_COUNT) {
|
|
72
|
+
throw new actions_core_1.PayloadValidationError(`received payload count below LiveRamp's ingestion limits. expected: >=${LIVERAMP_MIN_RECORD_COUNT} actual: ${payloads.length}`);
|
|
73
|
+
}
|
|
74
|
+
switch (settings.upload_mode) {
|
|
75
|
+
case 'S3':
|
|
76
|
+
s3_1.validateS3(settings);
|
|
77
|
+
break;
|
|
78
|
+
case 'SFTP':
|
|
79
|
+
sftp_1.validateSFTP(settings);
|
|
80
|
+
break;
|
|
81
|
+
default:
|
|
82
|
+
throw new actions_core_1.InvalidAuthenticationError(`Unexpected upload mode: ${settings.upload_mode}`);
|
|
83
|
+
}
|
|
84
|
+
const { filename, fileContent } = operations_1.generateFile(payloads);
|
|
85
|
+
switch (settings.upload_mode) {
|
|
86
|
+
case 'S3':
|
|
87
|
+
return s3_1.uploadS3(settings, filename, fileContent, request);
|
|
88
|
+
case 'SFTP': {
|
|
89
|
+
const sftpClient = new sftp_1.Client();
|
|
90
|
+
return sftp_1.uploadSFTP(sftpClient, settings, filename, fileContent);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.default = action;
|
|
95
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/liveramp-audiences/audienceEntered/index.ts"],"names":[],"mappings":";;AAAA,wDAK8B;AAG9B,6BAA2C;AAC3C,iCAAuE;AACvE,8CAA4C;AAE5C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kBAAkB;IACzB,WAAW,EAAE,oEAAoE;IACjF,mBAAmB,EAAE,4BAA4B;IACjD,MAAM,EAAE;QACN,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,kDAAkD;YAC/D,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;SACjC;QACD,eAAe,EAAE;YACf,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,mEAAmE;YAChF,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,eAAe,EAAE,eAAe;SACjC;QACD,wBAAwB,EAAE;YACxB,KAAK,EAAE,0BAA0B;YACjC,WAAW,EAAE,gFAAgF;YAC7F,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,eAAe,EAAE,eAAe;SACjC;QACD,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,0DAA0D;YACvE,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,GAAG;SACb;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,wDAAwD;YACrE,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE,WAAW,EAAE,mDAAmD,EAAE;SAC9E;QACD,eAAe,EAAE;YACf,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,uFAAuF;YACpG,QAAQ,E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E,WAAW,EAAE,OAAO,CAAC,CAAA;QAC3D,KAAK,MAAM,CAAC,CAAC;YACX,MAAM,UAAU,GAAG,IAAI,aAAU,EAAE,CAAA;YACnC,OAAO,iBAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAA;SAC/D;KACF;AACH,CAAC;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ModifiedResponse, RequestOptions } from '@segment/actions-core';
|
|
3
|
+
import { Settings } from '../generated-types';
|
|
4
|
+
declare function validateS3(settings: Settings): void;
|
|
5
|
+
declare function uploadS3(settings: Settings, filename: string, fileContent: Buffer, request: <Data = unknown>(url: string, options?: RequestOptions) => Promise<ModifiedResponse<Data>>): Promise<ModifiedResponse<unknown>>;
|
|
6
|
+
export { validateS3, uploadS3 };
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
exports.uploadS3 = exports.validateS3 = void 0;
|
|
7
|
+
const s3_1 = __importDefault(require("../../../lib/AWS/s3"));
|
|
8
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
9
|
+
function validateS3(settings) {
|
|
10
|
+
if (!settings.s3_aws_access_key) {
|
|
11
|
+
throw new actions_core_1.InvalidAuthenticationError('Selected S3 upload mode, but missing AWS Access Key');
|
|
12
|
+
}
|
|
13
|
+
if (!settings.s3_aws_secret_key) {
|
|
14
|
+
throw new actions_core_1.InvalidAuthenticationError('Selected S3 upload mode, but missing AWS Secret Key');
|
|
15
|
+
}
|
|
16
|
+
if (!settings.s3_aws_bucket_name) {
|
|
17
|
+
throw new actions_core_1.InvalidAuthenticationError('Selected S3 upload mode, but missing AWS S3 bucket name');
|
|
18
|
+
}
|
|
19
|
+
if (!settings.s3_aws_region) {
|
|
20
|
+
throw new actions_core_1.InvalidAuthenticationError('Selected S3 upload mode, but missing AWS Region');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.validateS3 = validateS3;
|
|
24
|
+
async function uploadS3(settings, filename, fileContent, request) {
|
|
25
|
+
const method = 'PUT';
|
|
26
|
+
const opts = await s3_1.default(settings.s3_aws_bucket_name, settings.s3_aws_region, filename, method, fileContent, settings.s3_aws_access_key, settings.s3_aws_secret_key);
|
|
27
|
+
if (!opts.headers || !opts.method || !opts.host || !opts.path) {
|
|
28
|
+
throw new actions_core_1.InvalidAuthenticationError('Unable to generate signature header for AWS S3 request.');
|
|
29
|
+
}
|
|
30
|
+
return await request(`https://${opts.host}/${opts.path}`, {
|
|
31
|
+
headers: opts.headers,
|
|
32
|
+
method,
|
|
33
|
+
body: opts.body
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
exports.uploadS3 = uploadS3;
|
|
37
|
+
//# sourceMappingURL=s3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s3.js","sourceRoot":"","sources":["../../../../src/destinations/liveramp-audiences/audienceEntered/s3.ts"],"names":[],"mappings":";;;;;;AAAA,6DAA0D;AAC1D,wDAAoG;AAGpG,SAAS,UAAU,CAAC,QAAkB;IACpC,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAAE;QAC/B,MAAM,IAAI,yCAA0B,CAAC,qDAAqD,CAAC,CAAA;KAC5F;IAED,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAAE;QAC/B,MAAM,IAAI,yCAA0B,CAAC,qDAAqD,CAAC,CAAA;KAC5F;IAED,IAAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE;QAChC,MAAM,IAAI,yCAA0B,CAAC,yDAAyD,CAAC,CAAA;KAChG;IAED,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE;QAC3B,MAAM,IAAI,yCAA0B,CAAC,iDAAiD,CAAC,CAAA;KACxF;AACH,CAAC;AA6BQ,gCAAU;AA3BnB,KAAK,UAAU,QAAQ,CACrB,QAAkB,EAClB,QAAgB,EAChB,WAAmB,EACnB,OAAmG;IAEnG,MAAM,MAAM,GAAG,KAAK,CAAA;IACpB,MAAM,IAAI,GAAG,MAAM,YAAwB,CACzC,QAAQ,CAAC,kBAA4B,EACrC,QAAQ,CAAC,aAAuB,EAChC,QAAQ,EACR,MAAM,EACN,WAAW,EACX,QAAQ,CAAC,iBAA2B,EACpC,QAAQ,CAAC,iBAA2B,CACrC,CAAA;IACD,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;QAC7D,MAAM,IAAI,yCAA0B,CAAC,yDAAyD,CAAC,CAAA;KAChG;IAED,OAAO,MAAM,OAAO,CAAC,WAAW,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE;QACxD,OAAO,EAAE,IAAI,CAAC,OAAiC;QAC/C,MAAM;QACN,IAAI,EAAE,IAAI,CAAC,IAAI;KAChB,CAAC,CAAA;AACJ,CAAC;AAEoB,4BAAQ"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import Client from 'ssh2-sftp-client';
|
|
3
|
+
import { Settings } from '../generated-types';
|
|
4
|
+
declare function validateSFTP(settings: Settings): void;
|
|
5
|
+
declare function uploadSFTP(sftp: Client, settings: Settings, filename: string, fileContent: Buffer): Promise<unknown>;
|
|
6
|
+
declare function testAuthenticationSFTP(sftp: Client, settings: Settings): Promise<unknown>;
|
|
7
|
+
export { validateSFTP, uploadSFTP, testAuthenticationSFTP, Client };
|