@segment/action-destinations 3.437.1-staging-9ba83a8de.0 → 3.437.1-staging-102ce3a44.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/sftp/client.d.ts +5 -13
- package/dist/destinations/sftp/client.js +85 -93
- package/dist/destinations/sftp/client.js.map +1 -1
- package/dist/destinations/sftp/fields.js +4 -4
- package/dist/destinations/sftp/fields.js.map +1 -1
- package/dist/destinations/sftp/functions.js +2 -2
- package/dist/destinations/sftp/index.js +2 -2
- package/dist/destinations/sftp/sftp-wrapper.d.ts +14 -0
- package/dist/destinations/sftp/sftp-wrapper.js +115 -0
- package/dist/destinations/sftp/sftp-wrapper.js.map +1 -0
- package/package.json +2 -2
- package/dist/destinations/sftp/upload.d.ts +0 -6
- package/dist/destinations/sftp/upload.js +0 -101
- package/dist/destinations/sftp/upload.js.map +0 -1
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { Logger } from '@segment/actions-core';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
private readonly logger?;
|
|
8
|
-
constructor(name?: string, logger?: Logger);
|
|
9
|
-
connect(options: Client.ConnectOptions): Promise<ssh2.SFTPWrapper>;
|
|
10
|
-
put(buffer: Buffer, remoteFilePath: string, options?: Client.TransferOptions): Promise<string>;
|
|
11
|
-
fastPutFromBuffer(input: Buffer, remoteFilePath: string, options?: Client.FastPutTransferOptions): Promise<void>;
|
|
12
|
-
private _fastXferFromBuffer;
|
|
13
|
-
end(): Promise<void>;
|
|
14
|
-
}
|
|
2
|
+
import { Settings } from './generated-types';
|
|
3
|
+
declare function uploadSFTP(settings: Settings, sftpFolderPath: string, filename: string, fileContent: Buffer, useConcurrentWrites?: boolean, logger?: Logger, signal?: AbortSignal): Promise<string | void>;
|
|
4
|
+
declare function normalizeSSHKey(key?: string): string;
|
|
5
|
+
declare function testSFTPConnection(settings: Settings): Promise<unknown>;
|
|
6
|
+
export { normalizeSSHKey, testSFTPConnection, uploadSFTP };
|
|
@@ -3,106 +3,98 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.normalizeSSHKey = normalizeSSHKey;
|
|
7
|
+
exports.testSFTPConnection = testSFTPConnection;
|
|
8
|
+
exports.uploadSFTP = uploadSFTP;
|
|
9
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
7
11
|
const ssh2_sftp_client_1 = __importDefault(require("ssh2-sftp-client"));
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
const constants_1 = require("./constants");
|
|
13
|
+
const sftp_wrapper_1 = require("./sftp-wrapper");
|
|
14
|
+
var SFTPErrorCode;
|
|
15
|
+
(function (SFTPErrorCode) {
|
|
16
|
+
SFTPErrorCode[SFTPErrorCode["NO_SUCH_FILE"] = 2] = "NO_SUCH_FILE";
|
|
17
|
+
})(SFTPErrorCode || (SFTPErrorCode = {}));
|
|
18
|
+
async function uploadSFTP(settings, sftpFolderPath, filename, fileContent, useConcurrentWrites, logger, signal) {
|
|
19
|
+
const sftp = new sftp_wrapper_1.SFTPWrapper('uploadSFTP', logger);
|
|
20
|
+
signal?.throwIfAborted();
|
|
21
|
+
const abortListener = () => {
|
|
22
|
+
sftp.end().catch(() => {
|
|
23
|
+
logger?.warn('Failed to close SFTP connection');
|
|
24
|
+
});
|
|
25
|
+
throw new actions_core_1.RequestTimeoutError();
|
|
26
|
+
};
|
|
27
|
+
signal?.addEventListener('abort', abortListener, { once: true });
|
|
28
|
+
try {
|
|
29
|
+
await sftp.connect(createConnectionConfig(settings));
|
|
30
|
+
const remoteFilePath = path_1.default.posix.join(sftpFolderPath, filename);
|
|
31
|
+
if (useConcurrentWrites) {
|
|
32
|
+
return await sftp.fastPutFromBuffer(fileContent, remoteFilePath);
|
|
17
33
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
throw error;
|
|
34
|
+
else {
|
|
35
|
+
return await sftp.put(fileContent, remoteFilePath);
|
|
21
36
|
}
|
|
22
37
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
throw new Error('SFTP Client not connected. Call connect first.');
|
|
26
|
-
}
|
|
27
|
-
try {
|
|
28
|
-
return await this.sftp.put(buffer, remoteFilePath, options);
|
|
29
|
-
}
|
|
30
|
-
catch (error) {
|
|
31
|
-
this.logger?.error('Error uploading file to SFTP server:', String(error));
|
|
32
|
-
throw error;
|
|
33
|
-
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
formatAndThrowError(e, sftpFolderPath);
|
|
34
40
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}) {
|
|
39
|
-
if (!this.client) {
|
|
40
|
-
throw new Error('SFTP Client not connected. Call connect first.');
|
|
41
|
-
}
|
|
42
|
-
try {
|
|
43
|
-
return this._fastXferFromBuffer(input, remoteFilePath, options);
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
this.logger?.error('Error uploading buffer to SFTP server:', String(error));
|
|
47
|
-
throw error;
|
|
48
|
-
}
|
|
41
|
+
finally {
|
|
42
|
+
await sftp.end();
|
|
43
|
+
signal?.removeEventListener('abort', abortListener);
|
|
49
44
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
await Promise.all(writeRequests);
|
|
89
|
-
};
|
|
90
|
-
processWrites()
|
|
91
|
-
.then(() => resolve())
|
|
92
|
-
.catch((err) => reject(err))
|
|
93
|
-
.finally(() => {
|
|
94
|
-
this.client.close(handle, (closeErr) => {
|
|
95
|
-
if (closeErr) {
|
|
96
|
-
this.logger?.warn('Error closing remote file handle:', String(closeErr.message));
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
});
|
|
45
|
+
}
|
|
46
|
+
function createConnectionConfig(settings) {
|
|
47
|
+
const { auth_type, sftp_ssh_key, sftp_password } = settings;
|
|
48
|
+
const credentialKey = auth_type === 'ssh_key' ? 'privateKey' : 'password';
|
|
49
|
+
const credentialValue = auth_type === 'ssh_key' ? normalizeSSHKey(sftp_ssh_key) : sftp_password;
|
|
50
|
+
return {
|
|
51
|
+
host: settings.sftp_host,
|
|
52
|
+
port: settings.sftp_port || constants_1.SFTP_DEFAULT_PORT,
|
|
53
|
+
username: settings.sftp_username,
|
|
54
|
+
[credentialKey]: credentialValue
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function normalizeSSHKey(key = '') {
|
|
58
|
+
if (!key)
|
|
59
|
+
return key;
|
|
60
|
+
const normalizedKey = key.trim().replace(/\r\n/g, '\n').replace(/\r/g, '\n');
|
|
61
|
+
const properFormat = /-----BEGIN [A-Z\s]+PRIVATE KEY-----\n[\s\S]*?\n-----END [A-Z\s]+PRIVATE KEY-----/;
|
|
62
|
+
const hasProperFormat = properFormat.test(normalizedKey);
|
|
63
|
+
if (hasProperFormat)
|
|
64
|
+
return normalizedKey;
|
|
65
|
+
const headerMatch = normalizedKey.match(/(-----BEGIN [A-Z\s]+PRIVATE KEY-----)/);
|
|
66
|
+
const footerMatch = normalizedKey.match(/(-----END [A-Z\s]+PRIVATE KEY-----)/);
|
|
67
|
+
if (headerMatch && footerMatch) {
|
|
68
|
+
const header = headerMatch[1];
|
|
69
|
+
const footer = footerMatch[1];
|
|
70
|
+
const keyContent = normalizedKey.replace(header, '').replace(footer, '').replace(/\s/g, '');
|
|
71
|
+
const formattedContent = keyContent.replace(/.{64}/g, '$&\n').replace(/\n$/, '');
|
|
72
|
+
return `${header}\n${formattedContent}\n${footer}`;
|
|
73
|
+
}
|
|
74
|
+
return normalizedKey;
|
|
75
|
+
}
|
|
76
|
+
async function testSFTPConnection(settings) {
|
|
77
|
+
const sftp = new ssh2_sftp_client_1.default();
|
|
78
|
+
let res;
|
|
79
|
+
try {
|
|
80
|
+
await sftp.connect(createConnectionConfig(settings));
|
|
81
|
+
res = await sftp.list('/');
|
|
102
82
|
}
|
|
103
|
-
|
|
104
|
-
|
|
83
|
+
catch (e) {
|
|
84
|
+
formatAndThrowError(e);
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
await sftp.end();
|
|
88
|
+
}
|
|
89
|
+
return res;
|
|
90
|
+
}
|
|
91
|
+
function formatAndThrowError(e, path = '/') {
|
|
92
|
+
const sftpError = e;
|
|
93
|
+
if (sftpError) {
|
|
94
|
+
if (sftpError.code === SFTPErrorCode.NO_SUCH_FILE) {
|
|
95
|
+
throw new actions_core_1.PayloadValidationError(`Could not find path: ${path}`);
|
|
96
|
+
}
|
|
105
97
|
}
|
|
98
|
+
throw new actions_core_1.IntegrationError(`SFTP Error: ${e.message || 'Unknown error'}`, 'SFTP_ERROR', 500);
|
|
106
99
|
}
|
|
107
|
-
exports.SFTPWrapper = SFTPWrapper;
|
|
108
100
|
//# sourceMappingURL=client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/destinations/sftp/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/destinations/sftp/client.ts"],"names":[],"mappings":";;;;;AAwLS,0CAAe;AAAE,gDAAkB;AAAE,gCAAU;AAxLxD,wDAA6G;AAC7G,gDAAuB;AACvB,wEAAqC;AACrC,2CAA+C;AAG/C,iDAA4C;AAE5C,IAAK,aAEJ;AAFD,WAAK,aAAa;IAChB,iEAAgB,CAAA;AAClB,CAAC,EAFI,aAAa,KAAb,aAAa,QAEjB;AAeD,KAAK,UAAU,UAAU,CACvB,QAAkB,EAClB,cAAsB,EACtB,QAAgB,EAChB,WAAmB,EACnB,mBAA6B,EAC7B,MAAe,EACf,MAAoB;IAEpB,MAAM,IAAI,GAAG,IAAI,0BAAW,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;IAClD,MAAM,EAAE,cAAc,EAAE,CAAA;IAExB,MAAM,aAAa,GAAG,GAAG,EAAE;QACzB,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE;YACpB,MAAM,EAAE,IAAI,CAAC,iCAAiC,CAAC,CAAA;QACjD,CAAC,CAAC,CAAA;QACF,MAAM,IAAI,kCAAmB,EAAE,CAAA;IACjC,CAAC,CAAA;IACD,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;IAChE,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC,CAAA;QACpD,MAAM,cAAc,GAAG,cAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAA;QAChE,IAAI,mBAAmB,EAAE,CAAC;YACxB,OAAO,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAA;QAClE,CAAC;aAAM,CAAC;YACN,OAAO,MAAM,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AI,SAAS,EAAE,CAAC;QACd,IAAI,SAAS,CAAC,IAAI,KAAK,aAAa,CAAC,YAAY,EAAE,CAAC;YAClD,MAAM,IAAI,qCAAsB,CAAC,wBAAwB,IAAI,EAAE,CAAC,CAAA;QAClE,CAAC;IACH,CAAC;IACD,MAAM,IAAI,+BAAgB,CAAC,eAAe,CAAC,CAAC,OAAO,IAAI,eAAe,EAAE,EAAE,YAAY,EAAE,GAAG,CAAC,CAAA;AAC9F,CAAC"}
|
|
@@ -242,12 +242,12 @@ const audienceFields = {
|
|
|
242
242
|
traits_or_props,
|
|
243
243
|
computation_key
|
|
244
244
|
};
|
|
245
|
-
const
|
|
245
|
+
const useConcurrentWrites = {
|
|
246
246
|
label: 'Use Concurrent Writes',
|
|
247
|
-
description: 'Enable concurrent writes when uploading files to SFTP.
|
|
247
|
+
description: 'Enable concurrent writes when uploading files to SFTP. This can improve upload performance for large files. However, it may not be supported by all SFTP servers. Test with your server for compatibility.',
|
|
248
248
|
type: 'boolean',
|
|
249
249
|
required: false,
|
|
250
|
-
default:
|
|
250
|
+
default: false
|
|
251
251
|
};
|
|
252
252
|
exports.baseFields = {
|
|
253
253
|
columns: columnsNoDefaultMappings,
|
|
@@ -258,7 +258,7 @@ exports.baseFields = {
|
|
|
258
258
|
enable_batching,
|
|
259
259
|
batch_size,
|
|
260
260
|
batch_size_column_name,
|
|
261
|
-
useConcurrentWrites
|
|
261
|
+
useConcurrentWrites
|
|
262
262
|
};
|
|
263
263
|
exports.commonFields = {
|
|
264
264
|
...exports.baseFields,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../src/destinations/sftp/fields.ts"],"names":[],"mappings":";;;AAEA,MAAM,sBAAsB,GAAe;IACzC,KAAK,EAAE,wBAAwB;IAC/B,WAAW,EACT,sHAAsH;IACxH,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,KAAK;IACf,oBAAoB,EAAE,CAAC,UAAU,EAAE,UAA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,KAAK;IACf,OAAO,EAAE,KAAK;CACf,CAAA;AACY,QAAA,UAAU,GAA+B;IACpD,OAAO,EAAE,wBAAwB;IACjC,eAAe;IACf,cAAc;IACd,SAAS;IACT,gBAAgB;IAChB,eAAe;IACf,UAAU;IACV,sBAAsB;IACtB,mBAAmB;CACpB,CAAA;AACY,QAAA,YAAY,GAA+B;IACtD,GAAG,kBAAU;IACb,OAAO,EAAE,0BAA0B;IACnC,GAAG,cAAc;CAClB,CAAA"}
|
|
@@ -9,7 +9,7 @@ exports.getAudienceAction = getAudienceAction;
|
|
|
9
9
|
exports.processField = processField;
|
|
10
10
|
exports.send = send;
|
|
11
11
|
const actions_core_1 = require("@segment/actions-core");
|
|
12
|
-
const
|
|
12
|
+
const client_1 = require("./client");
|
|
13
13
|
async function send(payloads, settings, rawMapping, logger, signal) {
|
|
14
14
|
const { delimiter, audience_action_column_name, batch_size_column_name, filename_prefix, file_extension, sftp_folder_path, useConcurrentWrites } = payloads[0];
|
|
15
15
|
const headers = createHeaders(rawMapping, delimiter, audience_action_column_name, batch_size_column_name);
|
|
@@ -18,7 +18,7 @@ async function send(payloads, settings, rawMapping, logger, signal) {
|
|
|
18
18
|
const filename = createFilename(filename_prefix, file_extension);
|
|
19
19
|
const msResponse = new actions_core_1.MultiStatusResponse();
|
|
20
20
|
try {
|
|
21
|
-
await (0,
|
|
21
|
+
await (0, client_1.uploadSFTP)(settings, sftp_folder_path, filename, fileContent, useConcurrentWrites, logger, signal);
|
|
22
22
|
payloads.forEach((payload, index) => {
|
|
23
23
|
const row = rowsObservabilityArray[index] ?? '';
|
|
24
24
|
msResponse.setSuccessResponseAtIndex(index, {
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const client_1 = require("./client");
|
|
7
7
|
const constants_1 = require("./constants");
|
|
8
8
|
const syncEvents_1 = __importDefault(require("./syncEvents"));
|
|
9
9
|
const syncModelToSFTP_1 = __importDefault(require("./syncModelToSFTP"));
|
|
@@ -92,7 +92,7 @@ const destination = {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
},
|
|
95
|
-
testAuthentication: async (_, { settings }) => await (0,
|
|
95
|
+
testAuthentication: async (_, { settings }) => await (0, client_1.testSFTPConnection)(settings)
|
|
96
96
|
},
|
|
97
97
|
actions: {
|
|
98
98
|
syncEvents: syncEvents_1.default,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Logger } from '@segment/actions-core';
|
|
2
|
+
import Client from 'ssh2-sftp-client';
|
|
3
|
+
import ssh2 from 'ssh2';
|
|
4
|
+
export declare class SFTPWrapper {
|
|
5
|
+
private readonly sftp;
|
|
6
|
+
private client?;
|
|
7
|
+
private readonly logger?;
|
|
8
|
+
constructor(name?: string, logger?: Logger);
|
|
9
|
+
connect(options: Client.ConnectOptions): Promise<ssh2.SFTPWrapper>;
|
|
10
|
+
put(buffer: Buffer, remoteFilePath: string, options?: Client.TransferOptions): Promise<string>;
|
|
11
|
+
fastPutFromBuffer(input: Buffer, remoteFilePath: string, options?: Client.FastPutTransferOptions): Promise<void>;
|
|
12
|
+
private _fastXferFromBuffer;
|
|
13
|
+
end(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
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.SFTPWrapper = void 0;
|
|
7
|
+
const ssh2_sftp_client_1 = __importDefault(require("ssh2-sftp-client"));
|
|
8
|
+
class SFTPWrapper {
|
|
9
|
+
constructor(name, logger) {
|
|
10
|
+
this.sftp = new ssh2_sftp_client_1.default(name);
|
|
11
|
+
this.logger = logger;
|
|
12
|
+
}
|
|
13
|
+
async connect(options) {
|
|
14
|
+
try {
|
|
15
|
+
this.client = await this.sftp.connect(options);
|
|
16
|
+
return this.client;
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
this.logger?.error('Error connecting to SFTP server:', String(error));
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async put(buffer, remoteFilePath, options = {}) {
|
|
24
|
+
if (!this.client) {
|
|
25
|
+
throw new Error('SFTP Client not connected. Call connect first.');
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
return await this.sftp.put(buffer, remoteFilePath, options);
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
this.logger?.error('Error uploading file to SFTP server:', String(error));
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async fastPutFromBuffer(input, remoteFilePath, options = {
|
|
36
|
+
concurrency: 64,
|
|
37
|
+
chunkSize: 32768
|
|
38
|
+
}) {
|
|
39
|
+
if (!this.client) {
|
|
40
|
+
throw new Error('SFTP Client not connected. Call connect first.');
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
return this._fastXferFromBuffer(input, remoteFilePath, options);
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
this.logger?.error('Error uploading buffer to SFTP server:', String(error));
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async _fastXferFromBuffer(input, remoteFilePath, options) {
|
|
51
|
+
const fsize = input.length;
|
|
52
|
+
return new Promise((resolve, reject) => {
|
|
53
|
+
this.client?.open(remoteFilePath, 'w', (err, handle) => {
|
|
54
|
+
if (err) {
|
|
55
|
+
return reject(new Error(`Error opening remote file: ${err.message}`));
|
|
56
|
+
}
|
|
57
|
+
const concurrency = options.concurrency || 64;
|
|
58
|
+
const chunkSize = options.chunkSize || 32768;
|
|
59
|
+
const readBuffer = input;
|
|
60
|
+
let position = 0;
|
|
61
|
+
let writeRequests = [];
|
|
62
|
+
const writeChunk = (chunkPos) => {
|
|
63
|
+
return new Promise((chunkResolve, chunkReject) => {
|
|
64
|
+
const bytesToWrite = Math.min(chunkSize, fsize - chunkPos);
|
|
65
|
+
if (bytesToWrite <= 0) {
|
|
66
|
+
return chunkResolve();
|
|
67
|
+
}
|
|
68
|
+
this.client?.write(handle, readBuffer, chunkPos, bytesToWrite, chunkPos, (writeErr) => {
|
|
69
|
+
if (writeErr) {
|
|
70
|
+
return chunkReject(new Error(`Error writing to remote file: ${writeErr.message}`));
|
|
71
|
+
}
|
|
72
|
+
chunkResolve();
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
const processWrites = async () => {
|
|
77
|
+
while (position < fsize) {
|
|
78
|
+
writeRequests.push(writeChunk(position));
|
|
79
|
+
position += chunkSize;
|
|
80
|
+
if (writeRequests.length >= concurrency) {
|
|
81
|
+
await Promise.all(writeRequests);
|
|
82
|
+
writeRequests = [];
|
|
83
|
+
options?.step?.(Math.min(position, fsize), chunkSize, fsize);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
await Promise.all(writeRequests);
|
|
87
|
+
};
|
|
88
|
+
const closeHandle = () => {
|
|
89
|
+
return new Promise((closeResolve) => {
|
|
90
|
+
this.client?.close(handle, (closeErr) => {
|
|
91
|
+
if (closeErr) {
|
|
92
|
+
this.logger?.warn('Error closing remote file handle:', String(closeErr.message));
|
|
93
|
+
}
|
|
94
|
+
closeResolve();
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
processWrites()
|
|
99
|
+
.then(async () => {
|
|
100
|
+
await closeHandle();
|
|
101
|
+
resolve();
|
|
102
|
+
})
|
|
103
|
+
.catch(async (err) => {
|
|
104
|
+
await closeHandle();
|
|
105
|
+
reject(err);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
async end() {
|
|
111
|
+
return this.sftp.end();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
exports.SFTPWrapper = SFTPWrapper;
|
|
115
|
+
//# sourceMappingURL=sftp-wrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sftp-wrapper.js","sourceRoot":"","sources":["../../../src/destinations/sftp/sftp-wrapper.ts"],"names":[],"mappings":";;;;;;AAGA,wEAAqC;AAIrC,MAAa,WAAW;IAKtB,YAAY,IAAa,EAAE,MAAe;QACxC,IAAI,CAAC,IAAI,GAAG,IAAI,0BAAM,CAAC,IAAI,CAAC,CAAA;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAA8B;QAC1C,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;YAC9C,OAAO,IAAI,CAAC,MAAM,CAAA;QACpB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,kCAAkC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;YACrE,MAAM,KAAK,CAAA;QACb,CAAC;IACH,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,MAAc,EAAE,cAAsB,EAAE,UAAkC,EAAE;QACpF,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAA;QACnE,CAAC;QAED,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,CAAC,CAAA;QAC7D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,sCAAsC,EAAE,MAAM,CAAC,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WAAW,GAAG,GAAkB,EAAE;oBACtC,OAAO,IAAI,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE;wBAClC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE;4BACtC,IAAI,QAAQ,EAAE,CAAC;gCACb,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,mCAAmC,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAA;4BAClF,CAAC;4BACD,YAAY,EAAE,CAAA;wBAChB,CAAC,CAAC,CAAA;oBACJ,CAAC,CAAC,CAAA;gBACJ,CAAC,CAAA;gBAED,aAAa,EAAE;qBACZ,IAAI,CAAC,KAAK,IAAI,EAAE;oBACf,MAAM,WAAW,EAAE,CAAA;oBACnB,OAAO,EAAE,CAAA;gBACX,CAAC,CAAC;qBACD,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;oBACnB,MAAM,WAAW,EAAE,CAAA;oBACnB,MAAM,CAAC,GAAG,CAAC,CAAA;gBACb,CAAC,CAAC,CAAA;YACN,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,GAAG;QACP,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAA;IACxB,CAAC;CACF;AA5HD,kCA4HC"}
|
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.437.1-staging-
|
|
4
|
+
"version": "3.437.1-staging-102ce3a44.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"__tests__/__helpers__/"
|
|
92
92
|
]
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "43ef8699f2dd2d53b2decfca4baf5b06310641c9"
|
|
95
95
|
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Settings } from './generated-types';
|
|
2
|
-
import { Logger } from '@segment/actions-core';
|
|
3
|
-
declare function uploadSFTP(settings: Settings, sftpFolderPath: string, filename: string, fileContent: Buffer, useConcurrentWrites?: boolean, logger?: Logger, signal?: AbortSignal): Promise<string | void>;
|
|
4
|
-
declare function normalizeSSHKey(key?: string): string;
|
|
5
|
-
declare function testSFTPConnection(settings: Settings): Promise<unknown>;
|
|
6
|
-
export { normalizeSSHKey, testSFTPConnection, uploadSFTP };
|
|
@@ -1,101 +0,0 @@
|
|
|
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.normalizeSSHKey = normalizeSSHKey;
|
|
7
|
-
exports.testSFTPConnection = testSFTPConnection;
|
|
8
|
-
exports.uploadSFTP = uploadSFTP;
|
|
9
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
10
|
-
const path_1 = __importDefault(require("path"));
|
|
11
|
-
const ssh2_sftp_client_1 = __importDefault(require("ssh2-sftp-client"));
|
|
12
|
-
const constants_1 = require("./constants");
|
|
13
|
-
const client_1 = require("./client");
|
|
14
|
-
const _1 = require("@segment/actions-core/*");
|
|
15
|
-
var SFTPErrorCode;
|
|
16
|
-
(function (SFTPErrorCode) {
|
|
17
|
-
SFTPErrorCode[SFTPErrorCode["NO_SUCH_FILE"] = 2] = "NO_SUCH_FILE";
|
|
18
|
-
})(SFTPErrorCode || (SFTPErrorCode = {}));
|
|
19
|
-
async function uploadSFTP(settings, sftpFolderPath, filename, fileContent, useConcurrentWrites, logger, signal) {
|
|
20
|
-
const sftp = new client_1.SFTPWrapper('uploadSFTP', logger);
|
|
21
|
-
signal?.throwIfAborted();
|
|
22
|
-
const abortListener = () => {
|
|
23
|
-
sftp.end().catch(() => {
|
|
24
|
-
logger?.warn('Failed to close SFTP connection');
|
|
25
|
-
});
|
|
26
|
-
throw new actions_core_1.RequestTimeoutError();
|
|
27
|
-
};
|
|
28
|
-
signal?.addEventListener('abort', abortListener, { once: true });
|
|
29
|
-
try {
|
|
30
|
-
await sftp.connect(createConnectionConfig(settings));
|
|
31
|
-
const remoteFilePath = path_1.default.posix.join(sftpFolderPath, filename);
|
|
32
|
-
if (useConcurrentWrites) {
|
|
33
|
-
return await sftp.fastPutFromBuffer(fileContent, remoteFilePath);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
return await sftp.put(fileContent, remoteFilePath);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
catch (e) {
|
|
40
|
-
formatAndThrowError(e, sftpFolderPath);
|
|
41
|
-
}
|
|
42
|
-
finally {
|
|
43
|
-
await sftp.end();
|
|
44
|
-
signal?.removeEventListener('abort', abortListener);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function createConnectionConfig(settings) {
|
|
48
|
-
const { auth_type, sftp_ssh_key, sftp_password } = settings;
|
|
49
|
-
const credentialKey = auth_type === 'ssh_key' ? 'privateKey' : 'password';
|
|
50
|
-
const credentialValue = auth_type === 'ssh_key' ? normalizeSSHKey(sftp_ssh_key) : sftp_password;
|
|
51
|
-
return {
|
|
52
|
-
host: settings.sftp_host,
|
|
53
|
-
port: settings.sftp_port || constants_1.SFTP_DEFAULT_PORT,
|
|
54
|
-
username: settings.sftp_username,
|
|
55
|
-
[credentialKey]: credentialValue
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
function normalizeSSHKey(key = '') {
|
|
59
|
-
if (!key)
|
|
60
|
-
return key;
|
|
61
|
-
const normalizedKey = key.trim().replace(/\r\n/g, '\n').replace(/\r/g, '\n');
|
|
62
|
-
const properFormat = /-----BEGIN [A-Z\s]+PRIVATE KEY-----\n[\s\S]*?\n-----END [A-Z\s]+PRIVATE KEY-----/;
|
|
63
|
-
const hasProperFormat = properFormat.test(normalizedKey);
|
|
64
|
-
if (hasProperFormat)
|
|
65
|
-
return normalizedKey;
|
|
66
|
-
const headerMatch = normalizedKey.match(/(-----BEGIN [A-Z\s]+PRIVATE KEY-----)/);
|
|
67
|
-
const footerMatch = normalizedKey.match(/(-----END [A-Z\s]+PRIVATE KEY-----)/);
|
|
68
|
-
if (headerMatch && footerMatch) {
|
|
69
|
-
const header = headerMatch[1];
|
|
70
|
-
const footer = footerMatch[1];
|
|
71
|
-
const keyContent = normalizedKey.replace(header, '').replace(footer, '').replace(/\s/g, '');
|
|
72
|
-
const formattedContent = keyContent.replace(/.{64}/g, '$&\n').replace(/\n$/, '');
|
|
73
|
-
return `${header}\n${formattedContent}\n${footer}`;
|
|
74
|
-
}
|
|
75
|
-
return normalizedKey;
|
|
76
|
-
}
|
|
77
|
-
async function testSFTPConnection(settings) {
|
|
78
|
-
const sftp = new ssh2_sftp_client_1.default();
|
|
79
|
-
let res;
|
|
80
|
-
try {
|
|
81
|
-
await sftp.connect(createConnectionConfig(settings));
|
|
82
|
-
res = await sftp.list('/');
|
|
83
|
-
}
|
|
84
|
-
catch (e) {
|
|
85
|
-
formatAndThrowError(e);
|
|
86
|
-
}
|
|
87
|
-
finally {
|
|
88
|
-
await sftp.end();
|
|
89
|
-
}
|
|
90
|
-
return res;
|
|
91
|
-
}
|
|
92
|
-
function formatAndThrowError(e, path = '/') {
|
|
93
|
-
const sftpError = e;
|
|
94
|
-
if (sftpError) {
|
|
95
|
-
if (sftpError.code === SFTPErrorCode.NO_SUCH_FILE) {
|
|
96
|
-
throw new actions_core_1.PayloadValidationError(`Could not find path: ${path}`);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
throw new _1.IntegrationError(`SFTP Error: ${e.message}`, 'SFTP_ERROR', 500);
|
|
100
|
-
}
|
|
101
|
-
//# sourceMappingURL=upload.js.map
|
|
@@ -1 +0,0 @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