@activepieces/piece-sftp 0.5.1 → 0.5.3
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/package.json +7 -19
- package/src/index.js +39 -47
- package/src/index.d.ts +0 -13
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/actions/common.d.ts +0 -7
- package/src/lib/actions/common.d.ts.map +0 -1
- package/src/lib/actions/common.js +0 -138
- package/src/lib/actions/common.js.map +0 -1
- package/src/lib/actions/create-file.d.ts +0 -15
- package/src/lib/actions/create-file.d.ts.map +0 -1
- package/src/lib/actions/create-file.js +0 -92
- package/src/lib/actions/create-file.js.map +0 -1
- package/src/lib/actions/create-folder.d.ts +0 -15
- package/src/lib/actions/create-folder.d.ts.map +0 -1
- package/src/lib/actions/create-folder.js +0 -72
- package/src/lib/actions/create-folder.js.map +0 -1
- package/src/lib/actions/delete-file.d.ts +0 -14
- package/src/lib/actions/delete-file.d.ts.map +0 -1
- package/src/lib/actions/delete-file.js +0 -74
- package/src/lib/actions/delete-file.js.map +0 -1
- package/src/lib/actions/delete-folder.d.ts +0 -15
- package/src/lib/actions/delete-folder.d.ts.map +0 -1
- package/src/lib/actions/delete-folder.js +0 -87
- package/src/lib/actions/delete-folder.js.map +0 -1
- package/src/lib/actions/list-files.d.ts +0 -14
- package/src/lib/actions/list-files.d.ts.map +0 -1
- package/src/lib/actions/list-files.js +0 -94
- package/src/lib/actions/list-files.js.map +0 -1
- package/src/lib/actions/read-file.d.ts +0 -14
- package/src/lib/actions/read-file.d.ts.map +0 -1
- package/src/lib/actions/read-file.js +0 -92
- package/src/lib/actions/read-file.js.map +0 -1
- package/src/lib/actions/rename-file-or-folder.d.ts +0 -16
- package/src/lib/actions/rename-file-or-folder.d.ts.map +0 -1
- package/src/lib/actions/rename-file-or-folder.js +0 -88
- package/src/lib/actions/rename-file-or-folder.js.map +0 -1
- package/src/lib/actions/upload-file.d.ts +0 -15
- package/src/lib/actions/upload-file.d.ts.map +0 -1
- package/src/lib/actions/upload-file.js +0 -90
- package/src/lib/actions/upload-file.js.map +0 -1
- package/src/lib/auth.d.ts +0 -12
- package/src/lib/auth.d.ts.map +0 -1
- package/src/lib/auth.js +0 -121
- package/src/lib/auth.js.map +0 -1
- package/src/lib/common.d.ts +0 -17
- package/src/lib/common.d.ts.map +0 -1
- package/src/lib/common.js +0 -116
- package/src/lib/common.js.map +0 -1
- package/src/lib/triggers/new-modified-file.d.ts +0 -55
- package/src/lib/triggers/new-modified-file.d.ts.map +0 -1
- package/src/lib/triggers/new-modified-file.js +0 -82
- package/src/lib/triggers/new-modified-file.js.map +0 -1
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.listFolderContentsAction = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const auth_1 = require("../auth");
|
|
6
|
-
const common_1 = require("../common");
|
|
7
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
8
|
-
const basic_ftp_1 = require("basic-ftp");
|
|
9
|
-
const common_2 = require("./common");
|
|
10
|
-
function listSFTP(client, directoryPath) {
|
|
11
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
12
|
-
const contents = yield client.list(directoryPath);
|
|
13
|
-
yield client.end();
|
|
14
|
-
return contents;
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
function listFTP(client, directoryPath) {
|
|
18
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
const contents = yield client.list(directoryPath);
|
|
20
|
-
return contents.map(item => ({
|
|
21
|
-
type: item.type === 1 ? 'd' : '-',
|
|
22
|
-
name: item.name,
|
|
23
|
-
size: item.size,
|
|
24
|
-
modifyTime: item.modifiedAt,
|
|
25
|
-
accessTime: item.modifiedAt, // FTP doesn't provide access time
|
|
26
|
-
rights: {
|
|
27
|
-
user: item.permissions || '',
|
|
28
|
-
group: '',
|
|
29
|
-
other: ''
|
|
30
|
-
},
|
|
31
|
-
owner: '',
|
|
32
|
-
group: ''
|
|
33
|
-
}));
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
exports.listFolderContentsAction = (0, pieces_framework_1.createAction)({
|
|
37
|
-
audience: 'human',
|
|
38
|
-
auth: auth_1.sftpAuth,
|
|
39
|
-
name: 'listFolderContents',
|
|
40
|
-
displayName: 'List Folder Contents',
|
|
41
|
-
description: 'Lists the contents of a given folder.',
|
|
42
|
-
props: {
|
|
43
|
-
directoryPath: pieces_framework_1.Property.ShortText({
|
|
44
|
-
displayName: 'Directory Path',
|
|
45
|
-
required: true,
|
|
46
|
-
description: 'The path of the folder to list e.g. `./myfolder`',
|
|
47
|
-
}),
|
|
48
|
-
},
|
|
49
|
-
run(context) {
|
|
50
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
const client = yield (0, common_1.getClient)(context.auth.props);
|
|
52
|
-
const directoryPath = context.propsValue.directoryPath;
|
|
53
|
-
const protocolBackwardCompatibility = yield (0, common_1.getProtocolBackwardCompatibility)(context.auth.props.protocol);
|
|
54
|
-
try {
|
|
55
|
-
let contents;
|
|
56
|
-
switch (protocolBackwardCompatibility) {
|
|
57
|
-
case 'ftps':
|
|
58
|
-
case 'ftp':
|
|
59
|
-
contents = yield listFTP(client, directoryPath);
|
|
60
|
-
break;
|
|
61
|
-
default:
|
|
62
|
-
case 'sftp':
|
|
63
|
-
contents = yield listSFTP(client, directoryPath);
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
return {
|
|
67
|
-
status: 'success',
|
|
68
|
-
contents: contents,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
catch (err) {
|
|
72
|
-
if (err instanceof basic_ftp_1.FTPError) {
|
|
73
|
-
console.error((0, common_2.getSftpError)(err.code));
|
|
74
|
-
return {
|
|
75
|
-
status: 'error',
|
|
76
|
-
content: null,
|
|
77
|
-
error: (0, common_2.getSftpError)(err.code),
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
return {
|
|
82
|
-
status: 'error',
|
|
83
|
-
content: null,
|
|
84
|
-
error: err
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
finally {
|
|
89
|
-
yield (0, common_1.endClient)(client, context.auth.props.protocol);
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
},
|
|
93
|
-
});
|
|
94
|
-
//# sourceMappingURL=list-files.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list-files.js","sourceRoot":"","sources":["../../../../src/lib/actions/list-files.ts"],"names":[],"mappings":";;;;AAAA,kCAAmC;AACnC,sCAAmF;AACnF,qEAAwE;AAExE,yCAA0D;AAC1D,qCAAwC;AAGxC,SAAe,QAAQ,CAAC,MAAc,EAAE,aAAqB;;QAC3D,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAClD,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC;QACnB,OAAO,QAAQ,CAAC;IAClB,CAAC;CAAA;AAED,SAAe,OAAO,CAAC,MAAiB,EAAE,aAAqB;;QAC7D,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAClD,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC3B,IAAI,EAAE,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;YACjC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,UAAU,EAAE,IAAI,CAAC,UAAU,EAAG,kCAAkC;YAChE,MAAM,EAAE;gBACN,IAAI,EAAE,IAAI,CAAC,WAAW,IAA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,YAAY,oBAAQ,EAAE,CAAC;oBAC5B,OAAO,CAAC,KAAK,CAAC,IAAA,qBAAY,EAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;oBACtC,OAAO;wBACL,MAAM,EAAE,OAAO;wBACf,OAAO,EAAE,IAAI;wBACb,KAAK,EAAE,IAAA,qBAAY,EAAC,GAAG,CAAC,IAAI,CAAC;qBAC9B,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,OAAO;wBACL,MAAM,EAAE,OAAO;wBACf,OAAO,EAAE,IAAI;wBACb,KAAK,EAAE,GAAG;qBACX,CAAA;gBACH,CAAC;YACH,CAAC;oBAAS,CAAC;gBACT,MAAM,IAAA,kBAAS,EAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACvD,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare const readFileContent: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
protocol: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
3
|
-
allow_unauthorized_certificates: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
4
|
-
allow_anonymous_login: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
5
|
-
host: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
port: import("@activepieces/pieces-framework").NumberProperty<true>;
|
|
7
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
8
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
9
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
10
|
-
algorithm: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, false>;
|
|
11
|
-
}>, {
|
|
12
|
-
filePath: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
|
-
}>;
|
|
14
|
-
//# sourceMappingURL=read-file.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"read-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/read-file.ts"],"names":[],"mappings":"AA0BA,eAAO,MAAM,eAAe;;;;;;;;;;;;EAwD1B,CAAC"}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readFileContent = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const auth_1 = require("../auth");
|
|
6
|
-
const common_1 = require("../common");
|
|
7
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
8
|
-
const basic_ftp_1 = require("basic-ftp");
|
|
9
|
-
const stream_1 = require("stream");
|
|
10
|
-
const common_2 = require("./common");
|
|
11
|
-
function readFTP(client, filePath) {
|
|
12
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
13
|
-
const chunks = [];
|
|
14
|
-
const writeStream = new stream_1.Writable({
|
|
15
|
-
write(chunk, _encoding, callback) {
|
|
16
|
-
chunks.push(chunk);
|
|
17
|
-
callback();
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
yield client.downloadTo(writeStream, filePath);
|
|
21
|
-
return Buffer.concat(chunks);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
function readSFTP(client, filePath) {
|
|
25
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
const fileContent = yield client.get(filePath);
|
|
27
|
-
yield client.end();
|
|
28
|
-
return fileContent;
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
exports.readFileContent = (0, pieces_framework_1.createAction)({
|
|
32
|
-
audience: 'human',
|
|
33
|
-
auth: auth_1.sftpAuth,
|
|
34
|
-
name: 'read_file_content',
|
|
35
|
-
displayName: 'Read File Content',
|
|
36
|
-
description: 'Read the content of a file.',
|
|
37
|
-
props: {
|
|
38
|
-
filePath: pieces_framework_1.Property.ShortText({
|
|
39
|
-
displayName: 'File Path',
|
|
40
|
-
required: true,
|
|
41
|
-
}),
|
|
42
|
-
},
|
|
43
|
-
run(context) {
|
|
44
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
var _a;
|
|
46
|
-
const client = yield (0, common_1.getClient)(context.auth.props);
|
|
47
|
-
const filePath = context.propsValue['filePath'];
|
|
48
|
-
const fileName = (_a = filePath.split('/').pop()) !== null && _a !== void 0 ? _a : filePath;
|
|
49
|
-
const protocolBackwardCompatibility = yield (0, common_1.getProtocolBackwardCompatibility)(context.auth.props.protocol);
|
|
50
|
-
try {
|
|
51
|
-
let fileContent;
|
|
52
|
-
switch (protocolBackwardCompatibility) {
|
|
53
|
-
case 'ftps':
|
|
54
|
-
case 'ftp':
|
|
55
|
-
fileContent = yield readFTP(client, filePath);
|
|
56
|
-
break;
|
|
57
|
-
default:
|
|
58
|
-
case 'sftp':
|
|
59
|
-
fileContent = yield readSFTP(client, filePath);
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
file: yield context.files.write({
|
|
64
|
-
fileName: fileName,
|
|
65
|
-
data: fileContent,
|
|
66
|
-
}),
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
catch (err) {
|
|
70
|
-
if (err instanceof basic_ftp_1.FTPError) {
|
|
71
|
-
console.error((0, common_2.getSftpError)(err.code));
|
|
72
|
-
return {
|
|
73
|
-
status: 'error',
|
|
74
|
-
content: null,
|
|
75
|
-
error: (0, common_2.getSftpError)(err.code),
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
return {
|
|
80
|
-
status: 'error',
|
|
81
|
-
content: null,
|
|
82
|
-
error: err
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
finally {
|
|
87
|
-
yield (0, common_1.endClient)(client, context.auth.props.protocol);
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
//# sourceMappingURL=read-file.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"read-file.js","sourceRoot":"","sources":["../../../../src/lib/actions/read-file.ts"],"names":[],"mappings":";;;;AAAA,kCAAmC;AACnC,sCAAmF;AACnF,qEAAwE;AAExE,yCAA0D;AAC1D,mCAAkC;AAClC,qCAAwC;AAExC,SAAe,OAAO,CAAC,MAAiB,EAAE,QAAgB;;QACxD,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,MAAM,WAAW,GAAG,IAAI,iBAAQ,CAAC;YAC/B,KAAK,CAAC,KAAa,EAAE,SAAiB,EAAE,QAAoB;gBAC1D,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACnB,QAAQ,EAAE,CAAC;YACb,CAAC;SACF,CAAC,CAAC;QACH,MAAM,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;CAAA;AAED,SAAe,QAAQ,CAAC,MAAc,EAAE,QAAgB;;QACtD,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC/C,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC;QACnB,OAAO,WAAqB,CAAC;IAC/B,CAAC;CAAA;AAEY,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC1C,QAAQ,EAAE,OAAO;IACjB,IAAI,EAAE,eAAQ;IACd,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,6BAA6B;IAC1C,KAAK,EAAE;QACL,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAA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AE,OAAO;wBACf,OAAO,EAAE,IAAI;wBACb,KAAK,EAAE,GAAG;qBACX,CAAA;gBACH,CAAC;YACH,CAAC;oBAAS,CAAC;gBACT,MAAM,IAAA,kBAAS,EAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACvD,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export declare const renameFileOrFolderAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
protocol: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
3
|
-
allow_unauthorized_certificates: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
4
|
-
allow_anonymous_login: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
5
|
-
host: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
port: import("@activepieces/pieces-framework").NumberProperty<true>;
|
|
7
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
8
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
9
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
10
|
-
algorithm: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, false>;
|
|
11
|
-
}>, {
|
|
12
|
-
information: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
13
|
-
oldPath: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
14
|
-
newPath: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
15
|
-
}>;
|
|
16
|
-
//# sourceMappingURL=rename-file-or-folder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rename-file-or-folder.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/rename-file-or-folder.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;EAgEnC,CAAC"}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.renameFileOrFolderAction = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const auth_1 = require("../auth");
|
|
6
|
-
const common_1 = require("../common");
|
|
7
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
8
|
-
const basic_ftp_1 = require("basic-ftp");
|
|
9
|
-
const shared_1 = require("@activepieces/shared");
|
|
10
|
-
const common_2 = require("./common");
|
|
11
|
-
function renameFTP(client, oldPath, newPath) {
|
|
12
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
13
|
-
yield client.rename(oldPath, newPath);
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
function renameSFTP(client, oldPath, newPath) {
|
|
17
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
yield client.rename(oldPath, newPath);
|
|
19
|
-
yield client.end();
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
exports.renameFileOrFolderAction = (0, pieces_framework_1.createAction)({
|
|
23
|
-
audience: 'human',
|
|
24
|
-
auth: auth_1.sftpAuth,
|
|
25
|
-
name: 'renameFileOrFolder',
|
|
26
|
-
displayName: 'Rename File or Folder',
|
|
27
|
-
description: 'Renames a file or folder at given path.',
|
|
28
|
-
props: {
|
|
29
|
-
information: pieces_framework_1.Property.MarkDown({
|
|
30
|
-
value: 'Depending on the server you can also use this to move a file to another directory, as long as the directory exists.',
|
|
31
|
-
variant: shared_1.MarkdownVariant.INFO,
|
|
32
|
-
}),
|
|
33
|
-
oldPath: pieces_framework_1.Property.ShortText({
|
|
34
|
-
displayName: 'Old Path',
|
|
35
|
-
required: true,
|
|
36
|
-
description: 'The path of the file or folder to rename e.g. `./myfolder/test.mp3`',
|
|
37
|
-
}),
|
|
38
|
-
newPath: pieces_framework_1.Property.ShortText({
|
|
39
|
-
displayName: 'New Path',
|
|
40
|
-
required: true,
|
|
41
|
-
description: 'The new path of the file or folder e.g. `./myfolder/new-name.mp3`',
|
|
42
|
-
}),
|
|
43
|
-
},
|
|
44
|
-
run(context) {
|
|
45
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
const client = yield (0, common_1.getClient)(context.auth.props);
|
|
47
|
-
const oldPath = context.propsValue.oldPath;
|
|
48
|
-
const newPath = context.propsValue.newPath;
|
|
49
|
-
const protocolBackwardCompatibility = yield (0, common_1.getProtocolBackwardCompatibility)(context.auth.props.protocol);
|
|
50
|
-
try {
|
|
51
|
-
switch (protocolBackwardCompatibility) {
|
|
52
|
-
case 'ftps':
|
|
53
|
-
case 'ftp':
|
|
54
|
-
yield renameFTP(client, oldPath, newPath);
|
|
55
|
-
break;
|
|
56
|
-
default:
|
|
57
|
-
case 'sftp':
|
|
58
|
-
yield renameSFTP(client, oldPath, newPath);
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
status: 'success',
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
catch (err) {
|
|
66
|
-
if (err instanceof basic_ftp_1.FTPError) {
|
|
67
|
-
console.error((0, common_2.getSftpError)(err.code));
|
|
68
|
-
return {
|
|
69
|
-
status: 'error',
|
|
70
|
-
content: null,
|
|
71
|
-
error: (0, common_2.getSftpError)(err.code),
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
return {
|
|
76
|
-
status: 'error',
|
|
77
|
-
content: null,
|
|
78
|
-
error: err
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
finally {
|
|
83
|
-
yield (0, common_1.endClient)(client, context.auth.props.protocol);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
//# sourceMappingURL=rename-file-or-folder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rename-file-or-folder.js","sourceRoot":"","sources":["../../../../src/lib/actions/rename-file-or-folder.ts"],"names":[],"mappings":";;;;AAAA,kCAAmC;AACnC,sCAAmF;AACnF,qEAAwE;AAExE,yCAA0D;AAC1D,iDAAuD;AACvD,qCAAwC;AAExC,SAAe,SAAS,CAAC,MAAiB,EAAE,OAAe,EAAE,OAAe;;QAC1E,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;CAAA;AAED,SAAe,UAAU,CAAC,MAAc,EAAE,OAAe,EAAE,OAAe;;QACxE,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACtC,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC;IACrB,CAAC;CAAA;AAEY,QAAA,wBAAwB,GAAG,IAAA,+BAAY,EAAC;IACnD,QAAQ,EAAE,OAAO;IACjB,IAAI,EAAE,eAAQ;IACd,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,uBAAuB;IACpC,WAAW,EAAE,yCAAyC;IACtD,KAAK,EAAE;QACL,WAAW,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC7B,KAAK,EAAE,qHAAqH;YAC5H,OAAO,EAAE,wBAAe,CAAC,IAAI;SAC9B,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,UAAU;YACvB,QAAQ,EAAE,IAAI;YACd,WAAW,EACT,qEAAqE;SACxE,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,UAAU;YACvB,QAAQ,EAAE,IAAI;YACd,WAAW,EACT,mEAAmE;SACtE,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAS,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;Y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
-
export declare const uploadFileAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
protocol: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
3
|
-
allow_unauthorized_certificates: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
4
|
-
allow_anonymous_login: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
5
|
-
host: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
port: import("@activepieces/pieces-framework").NumberProperty<true>;
|
|
7
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
8
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
9
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
10
|
-
algorithm: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, false>;
|
|
11
|
-
}>, {
|
|
12
|
-
fileName: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
|
-
fileContent: import("@activepieces/pieces-framework").FileProperty<true>;
|
|
14
|
-
}>;
|
|
15
|
-
//# sourceMappingURL=upload-file.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"upload-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/upload-file.ts"],"names":[],"mappings":"AAwBA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;EAyD3B,CAAC"}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uploadFileAction = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const basic_ftp_1 = require("basic-ftp");
|
|
7
|
-
const common_1 = require("../common");
|
|
8
|
-
const auth_1 = require("../auth");
|
|
9
|
-
const stream_1 = require("stream");
|
|
10
|
-
const common_2 = require("./common");
|
|
11
|
-
function uploadFileToFTP(client, fileName, fileContent) {
|
|
12
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
13
|
-
const remoteDirectory = fileName.substring(0, fileName.lastIndexOf('/'));
|
|
14
|
-
yield client.ensureDir(remoteDirectory);
|
|
15
|
-
yield client.uploadFrom(stream_1.Readable.from(fileContent.data), fileName);
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
function uploadFileToSFTP(client, fileName, fileContent) {
|
|
19
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const remotePathExists = yield client.exists(fileName);
|
|
21
|
-
if (!remotePathExists) {
|
|
22
|
-
const remoteDirectory = fileName.substring(0, fileName.lastIndexOf('/'));
|
|
23
|
-
yield client.mkdir(remoteDirectory, true);
|
|
24
|
-
}
|
|
25
|
-
yield client.put(fileContent.data, fileName);
|
|
26
|
-
yield client.end();
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
exports.uploadFileAction = (0, pieces_framework_1.createAction)({
|
|
30
|
-
audience: 'human',
|
|
31
|
-
auth: auth_1.sftpAuth,
|
|
32
|
-
name: 'upload_file',
|
|
33
|
-
displayName: 'Upload File',
|
|
34
|
-
description: 'Upload a file to the given path.',
|
|
35
|
-
props: {
|
|
36
|
-
fileName: pieces_framework_1.Property.ShortText({
|
|
37
|
-
displayName: 'File Path',
|
|
38
|
-
required: true,
|
|
39
|
-
description: 'The path on the sftp server to store the file. e.g. `./myfolder/test.mp3`',
|
|
40
|
-
}),
|
|
41
|
-
fileContent: pieces_framework_1.Property.File({
|
|
42
|
-
displayName: 'File content',
|
|
43
|
-
required: true,
|
|
44
|
-
}),
|
|
45
|
-
},
|
|
46
|
-
run(context) {
|
|
47
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
const client = yield (0, common_1.getClient)(context.auth.props);
|
|
49
|
-
const fileName = context.propsValue['fileName'];
|
|
50
|
-
const fileContent = context.propsValue['fileContent'];
|
|
51
|
-
const protocolBackwardCompatibility = yield (0, common_1.getProtocolBackwardCompatibility)(context.auth.props.protocol);
|
|
52
|
-
try {
|
|
53
|
-
switch (protocolBackwardCompatibility) {
|
|
54
|
-
case 'ftps':
|
|
55
|
-
case 'ftp':
|
|
56
|
-
yield uploadFileToFTP(client, fileName, fileContent);
|
|
57
|
-
break;
|
|
58
|
-
default:
|
|
59
|
-
case 'sftp':
|
|
60
|
-
yield uploadFileToSFTP(client, fileName, fileContent);
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
status: 'success',
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
catch (err) {
|
|
68
|
-
if (err instanceof basic_ftp_1.FTPError) {
|
|
69
|
-
console.error((0, common_2.getSftpError)(err.code));
|
|
70
|
-
return {
|
|
71
|
-
status: 'error',
|
|
72
|
-
content: null,
|
|
73
|
-
error: (0, common_2.getSftpError)(err.code),
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
return {
|
|
78
|
-
status: 'error',
|
|
79
|
-
content: null,
|
|
80
|
-
error: err
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
finally {
|
|
85
|
-
yield (0, common_1.endClient)(client, context.auth.props.protocol);
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
//# sourceMappingURL=upload-file.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"upload-file.js","sourceRoot":"","sources":["../../../../src/lib/actions/upload-file.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AAExE,yCAA0D;AAC1D,sCAAmF;AACnF,kCAAmC;AACnC,mCAAkC;AAClC,qCAAwC;AAExC,SAAe,eAAe,CAAC,MAAiB,EAAE,QAAgB,EAAE,WAA0B;;QAC5F,MAAM,eAAe,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,Q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H,CAAC;KAAA;CACF,CAAC,CAAC"}
|
package/src/lib/auth.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const sftpAuth: import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
protocol: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
3
|
-
allow_unauthorized_certificates: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
4
|
-
allow_anonymous_login: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
5
|
-
host: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
port: import("@activepieces/pieces-framework").NumberProperty<true>;
|
|
7
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
8
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
9
|
-
privateKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
10
|
-
algorithm: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, false>;
|
|
11
|
-
}>;
|
|
12
|
-
//# sourceMappingURL=auth.d.ts.map
|
package/src/lib/auth.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,QAAQ;;;;;;;;;;EAmHnB,CAAC"}
|
package/src/lib/auth.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sftpAuth = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const common_1 = require("./common");
|
|
7
|
-
exports.sftpAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
8
|
-
props: {
|
|
9
|
-
protocol: pieces_framework_1.Property.StaticDropdown({
|
|
10
|
-
displayName: 'Protocol',
|
|
11
|
-
description: 'The protocol to use',
|
|
12
|
-
required: false,
|
|
13
|
-
options: {
|
|
14
|
-
options: [
|
|
15
|
-
{ value: 'sftp', label: 'SFTP' },
|
|
16
|
-
{ value: 'ftp', label: 'FTP' },
|
|
17
|
-
{ value: 'ftps', label: 'FTPS' }
|
|
18
|
-
],
|
|
19
|
-
},
|
|
20
|
-
}),
|
|
21
|
-
allow_unauthorized_certificates: pieces_framework_1.Property.Checkbox({
|
|
22
|
-
displayName: 'Allow Unauthorized Certificates',
|
|
23
|
-
description: 'Allow connections to servers with self-signed certificates',
|
|
24
|
-
defaultValue: false,
|
|
25
|
-
required: false,
|
|
26
|
-
}),
|
|
27
|
-
allow_anonymous_login: pieces_framework_1.Property.Checkbox({
|
|
28
|
-
displayName: 'Allow Anonymous Login',
|
|
29
|
-
description: 'Allow anonymous login to FTP servers (only applicable for FTP/FTPS)',
|
|
30
|
-
defaultValue: false,
|
|
31
|
-
required: false,
|
|
32
|
-
}),
|
|
33
|
-
host: pieces_framework_1.Property.ShortText({
|
|
34
|
-
displayName: 'Host',
|
|
35
|
-
description: 'The host of the server',
|
|
36
|
-
required: true,
|
|
37
|
-
}),
|
|
38
|
-
port: pieces_framework_1.Property.Number({
|
|
39
|
-
displayName: 'Port',
|
|
40
|
-
description: 'The port of the server',
|
|
41
|
-
required: true,
|
|
42
|
-
defaultValue: 22,
|
|
43
|
-
}),
|
|
44
|
-
username: pieces_framework_1.Property.ShortText({
|
|
45
|
-
displayName: 'Username',
|
|
46
|
-
description: 'The username to authenticate with',
|
|
47
|
-
required: true,
|
|
48
|
-
}),
|
|
49
|
-
password: pieces_framework_1.PieceAuth.SecretText({
|
|
50
|
-
displayName: 'Password',
|
|
51
|
-
description: 'The password to authenticate with. Either this or private key is required. When using a private key, this field is used as the passphrase to decrypt the key.',
|
|
52
|
-
required: false,
|
|
53
|
-
}),
|
|
54
|
-
privateKey: pieces_framework_1.PieceAuth.SecretText({
|
|
55
|
-
displayName: 'Private Key',
|
|
56
|
-
description: 'The private key to authenticate with. Either this or password is required.',
|
|
57
|
-
required: false,
|
|
58
|
-
}),
|
|
59
|
-
algorithm: pieces_framework_1.Property.StaticMultiSelectDropdown({
|
|
60
|
-
displayName: 'Host Key Algorithm',
|
|
61
|
-
description: 'The host key algorithm to use for SFTP connection. Only needed if you want to override the default algorithms (e.g., to support ssh-dss).',
|
|
62
|
-
required: false,
|
|
63
|
-
options: {
|
|
64
|
-
options: [
|
|
65
|
-
{ value: 'ssh-rsa', label: 'ssh-rsa' },
|
|
66
|
-
{ value: 'ssh-dss', label: 'ssh-dss' },
|
|
67
|
-
{ value: 'ecdsa-sha2-nistp256', label: 'ecdsa-sha2-nistp256' },
|
|
68
|
-
{ value: 'ecdsa-sha2-nistp384', label: 'ecdsa-sha2-nistp384' },
|
|
69
|
-
{ value: 'ecdsa-sha2-nistp521', label: 'ecdsa-sha2-nistp521' },
|
|
70
|
-
{ value: 'ssh-ed25519', label: 'ssh-ed25519' },
|
|
71
|
-
{ value: 'rsa-sha2-256', label: 'rsa-sha2-256' },
|
|
72
|
-
{ value: 'rsa-sha2-512', label: 'rsa-sha2-512' }
|
|
73
|
-
],
|
|
74
|
-
},
|
|
75
|
-
})
|
|
76
|
-
},
|
|
77
|
-
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
78
|
-
let client = null;
|
|
79
|
-
const protocolBackwardCompatibility = yield (0, common_1.getProtocolBackwardCompatibility)(auth.protocol);
|
|
80
|
-
try {
|
|
81
|
-
if (!auth.privateKey && !auth.password && !auth.allow_anonymous_login) {
|
|
82
|
-
return {
|
|
83
|
-
valid: false,
|
|
84
|
-
error: 'Either password or private key must be provided for non-anonymous authentication.',
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
switch (protocolBackwardCompatibility) {
|
|
88
|
-
case 'sftp': {
|
|
89
|
-
if (auth.allow_anonymous_login) {
|
|
90
|
-
return {
|
|
91
|
-
valid: false,
|
|
92
|
-
error: 'Anonymous login is not supported for SFTP protocol.',
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
client = yield (0, common_1.getClient)(auth);
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
default: {
|
|
99
|
-
client = yield (0, common_1.getClient)(auth);
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return {
|
|
104
|
-
valid: true,
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
catch (err) {
|
|
108
|
-
return {
|
|
109
|
-
valid: false,
|
|
110
|
-
error: err === null || err === void 0 ? void 0 : err.message,
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
finally {
|
|
114
|
-
if (client) {
|
|
115
|
-
yield (0, common_1.endClient)(client, auth.protocol);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}),
|
|
119
|
-
required: true,
|
|
120
|
-
});
|
|
121
|
-
//# sourceMappingURL=auth.js.map
|
package/src/lib/auth.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAAqE;AAGrE,qCAAkF;AAErE,QAAA,QAAQ,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC3C,KAAK,EAAE;QACL,QAAQ,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAChC,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,qBAAqB;YAClC,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;oBAChC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;oBAC9B,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;iBACjC;aACF;SACF,CAAC;QACF,+BAA+B,EAAE,2BAAQ,CAAC,QAAQ,C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gBACR,CAAC;YACH,CAAC;YACD,OAAO;gBACL,KAAK,EAAE,IAAI;aACZ,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAG,GAAa,aAAb,GAAG,uBAAH,GAAG,CAAY,OAAO;aAC/B,CAAC;QACJ,CAAC;gBAAS,CAAC;YACT,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,IAAA,kBAAS,EAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YACzC,CAAC;QACH,CAAC;IACH,CAAC,CAAA;IACD,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC"}
|
package/src/lib/common.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import Client from 'ssh2-sftp-client';
|
|
2
|
-
import { ServerHostKeyAlgorithm } from 'ssh2';
|
|
3
|
-
import { Client as FTPClient } from 'basic-ftp';
|
|
4
|
-
export declare function getProtocolBackwardCompatibility(protocol: string | undefined): Promise<string>;
|
|
5
|
-
export declare function getClient<T extends Client | FTPClient>(auth: {
|
|
6
|
-
protocol: string | undefined;
|
|
7
|
-
host: string;
|
|
8
|
-
port: number;
|
|
9
|
-
allow_unauthorized_certificates: boolean | undefined;
|
|
10
|
-
allow_anonymous_login: boolean | undefined;
|
|
11
|
-
username: string;
|
|
12
|
-
password: string | undefined;
|
|
13
|
-
privateKey: string | undefined;
|
|
14
|
-
algorithm: ServerHostKeyAlgorithm[] | string[] | undefined;
|
|
15
|
-
}): Promise<T>;
|
|
16
|
-
export declare function endClient(client: Client | FTPClient, protocol: string | undefined): Promise<void>;
|
|
17
|
-
//# sourceMappingURL=common.d.ts.map
|
package/src/lib/common.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/lib/common.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAEhD,wBAAsB,gCAAgC,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,mBAKlF;AAED,wBAAsB,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,+BAA+B,EAAE,OAAO,GAAG,SAAS,CAAC;IAAC,qBAAqB,EAAE,OAAO,GAAG,SAAS,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,SAAS,EAAE,sBAAsB,EAAE,GAAG,MAAM,EAAE,GAAG,SAAS,CAAA;CAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAyF1X;AAED,wBAAsB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,iBAOvF"}
|