@elaraai/east-node-io 0.0.1-beta.0 → 0.0.1-beta.2
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/compression/gzip.d.ts +108 -0
- package/dist/compression/gzip.d.ts.map +1 -0
- package/dist/compression/gzip.js +153 -0
- package/dist/compression/gzip.js.map +1 -0
- package/dist/compression/index.d.ts +308 -0
- package/dist/compression/index.d.ts.map +1 -0
- package/dist/compression/index.js +289 -0
- package/dist/compression/index.js.map +1 -0
- package/dist/compression/tar.d.ts +115 -0
- package/dist/compression/tar.d.ts.map +1 -0
- package/dist/compression/tar.js +254 -0
- package/dist/compression/tar.js.map +1 -0
- package/dist/compression/types.d.ts +124 -0
- package/dist/compression/types.d.ts.map +1 -0
- package/dist/compression/types.js +106 -0
- package/dist/compression/types.js.map +1 -0
- package/dist/compression/zip.d.ts +121 -0
- package/dist/compression/zip.d.ts.map +1 -0
- package/dist/compression/zip.js +200 -0
- package/dist/compression/zip.js.map +1 -0
- package/dist/connection/index.d.ts +78 -0
- package/dist/connection/index.d.ts.map +1 -0
- package/dist/connection/index.js +134 -0
- package/dist/connection/index.js.map +1 -0
- package/dist/format/csv.d.ts +210 -0
- package/dist/format/csv.d.ts.map +1 -0
- package/dist/format/csv.js +729 -0
- package/dist/format/csv.js.map +1 -0
- package/dist/format/index.d.ts +641 -0
- package/dist/format/index.d.ts.map +1 -0
- package/dist/format/index.js +463 -0
- package/dist/format/index.js.map +1 -0
- package/dist/format/types.d.ts +176 -0
- package/dist/format/types.d.ts.map +1 -0
- package/dist/format/types.js +122 -0
- package/dist/format/types.js.map +1 -0
- package/dist/format/xlsx.d.ts +178 -0
- package/dist/format/xlsx.d.ts.map +1 -0
- package/dist/format/xlsx.js +313 -0
- package/dist/format/xlsx.js.map +1 -0
- package/dist/format/xml.d.ts +302 -0
- package/dist/format/xml.d.ts.map +1 -0
- package/dist/format/xml.js +602 -0
- package/dist/format/xml.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/nosql/index.d.ts +503 -0
- package/dist/nosql/index.d.ts.map +1 -0
- package/dist/nosql/index.js +483 -0
- package/dist/nosql/index.js.map +1 -0
- package/dist/nosql/mongodb.d.ts +306 -0
- package/dist/nosql/mongodb.d.ts.map +1 -0
- package/dist/nosql/mongodb.js +552 -0
- package/dist/nosql/mongodb.js.map +1 -0
- package/dist/nosql/redis.d.ts +268 -0
- package/dist/nosql/redis.d.ts.map +1 -0
- package/dist/nosql/redis.js +371 -0
- package/dist/nosql/redis.js.map +1 -0
- package/dist/nosql/types.d.ts +70 -0
- package/dist/nosql/types.d.ts.map +1 -0
- package/dist/nosql/types.js +79 -0
- package/dist/nosql/types.js.map +1 -0
- package/dist/sql/index.d.ts +777 -0
- package/dist/sql/index.d.ts.map +1 -0
- package/dist/sql/index.js +515 -0
- package/dist/sql/index.js.map +1 -0
- package/dist/sql/mysql.d.ts +238 -0
- package/dist/sql/mysql.d.ts.map +1 -0
- package/dist/sql/mysql.js +396 -0
- package/dist/sql/mysql.js.map +1 -0
- package/dist/sql/postgres.d.ts +237 -0
- package/dist/sql/postgres.d.ts.map +1 -0
- package/dist/sql/postgres.js +381 -0
- package/dist/sql/postgres.js.map +1 -0
- package/dist/sql/sqlite.d.ts +217 -0
- package/dist/sql/sqlite.d.ts.map +1 -0
- package/dist/sql/sqlite.js +366 -0
- package/dist/sql/sqlite.js.map +1 -0
- package/dist/sql/types.d.ts +205 -0
- package/dist/sql/types.d.ts.map +1 -0
- package/dist/sql/types.js +175 -0
- package/dist/sql/types.js.map +1 -0
- package/dist/storage/index.d.ts +304 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +234 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/s3.d.ts +373 -0
- package/dist/storage/s3.d.ts.map +1 -0
- package/dist/storage/s3.js +502 -0
- package/dist/storage/s3.js.map +1 -0
- package/dist/storage/types.d.ts +117 -0
- package/dist/storage/types.d.ts.map +1 -0
- package/dist/storage/types.js +94 -0
- package/dist/storage/types.js.map +1 -0
- package/dist/transfer/ftp.d.ts +333 -0
- package/dist/transfer/ftp.d.ts.map +1 -0
- package/dist/transfer/ftp.js +437 -0
- package/dist/transfer/ftp.js.map +1 -0
- package/dist/transfer/index.d.ts +456 -0
- package/dist/transfer/index.d.ts.map +1 -0
- package/dist/transfer/index.js +414 -0
- package/dist/transfer/index.js.map +1 -0
- package/dist/transfer/sftp.d.ts +333 -0
- package/dist/transfer/sftp.d.ts.map +1 -0
- package/dist/transfer/sftp.js +436 -0
- package/dist/transfer/sftp.js.map +1 -0
- package/dist/transfer/types.d.ts +108 -0
- package/dist/transfer/types.d.ts.map +1 -0
- package/dist/transfer/types.js +110 -0
- package/dist/transfer/types.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +8 -8
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* File transfer platform functions.
|
|
7
|
+
*
|
|
8
|
+
* Provides FTP and SFTP file transfer operations for East programs,
|
|
9
|
+
* supporting upload, download, list, and delete operations.
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
// Export individual modules
|
|
14
|
+
export * from "./ftp.js";
|
|
15
|
+
export * from "./sftp.js";
|
|
16
|
+
// Export public types (not ConnectionHandleType to avoid conflict with SQL module)
|
|
17
|
+
export { FtpConfigType, SftpConfigType, FileInfoType } from "./types.js";
|
|
18
|
+
// Import for grouped exports
|
|
19
|
+
import { ftp_connect, ftp_put, ftp_get, ftp_list, ftp_delete, ftp_close, FtpImpl } from "./ftp.js";
|
|
20
|
+
import { sftp_connect, sftp_put, sftp_get, sftp_list, sftp_delete, sftp_close, SftpImpl } from "./sftp.js";
|
|
21
|
+
import { FtpConfigType, SftpConfigType, FileInfoType } from "./types.js";
|
|
22
|
+
/**
|
|
23
|
+
* File transfer platform functions.
|
|
24
|
+
*
|
|
25
|
+
* Provides FTP and SFTP file transfer operations for East programs,
|
|
26
|
+
* including upload, download, list, and delete operations.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* import { East, StringType, BlobType, NullType } from "@elaraai/east";
|
|
31
|
+
* import { Transfer } from "@elaraai/east-node-io";
|
|
32
|
+
*
|
|
33
|
+
* const uploadFile = East.function([StringType, BlobType], NullType, ($, filename, data) => {
|
|
34
|
+
* const config = $.let({
|
|
35
|
+
* host: "ftp.example.com",
|
|
36
|
+
* port: 21n,
|
|
37
|
+
* user: "username",
|
|
38
|
+
* password: "password",
|
|
39
|
+
* secure: false,
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* const conn = $.let(Transfer.FTP.connect(config));
|
|
43
|
+
* $(Transfer.FTP.put(conn, `/uploads/${filename}`, data));
|
|
44
|
+
* $(Transfer.FTP.close(conn));
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* const compiled = East.compileAsync(uploadFile.toIR(), Transfer.FTP.Implementation);
|
|
48
|
+
* await compiled("document.pdf", pdfData);
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export const Transfer = {
|
|
52
|
+
/**
|
|
53
|
+
* FTP and FTPS file transfer operations.
|
|
54
|
+
*
|
|
55
|
+
* Provides platform functions for FTP (File Transfer Protocol) and
|
|
56
|
+
* FTPS (FTP over SSL/TLS) servers.
|
|
57
|
+
*/
|
|
58
|
+
FTP: {
|
|
59
|
+
/**
|
|
60
|
+
* Connects to an FTP server.
|
|
61
|
+
*
|
|
62
|
+
* Creates a connection to an FTP or FTPS server and returns an
|
|
63
|
+
* opaque handle for use in file transfer operations.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* const uploadFile = East.function([StringType, BlobType], NullType, ($, path, data) => {
|
|
68
|
+
* const config = $.let({
|
|
69
|
+
* host: "ftp.example.com",
|
|
70
|
+
* port: 21n,
|
|
71
|
+
* user: "username",
|
|
72
|
+
* password: "password",
|
|
73
|
+
* secure: false,
|
|
74
|
+
* });
|
|
75
|
+
*
|
|
76
|
+
* const conn = $.let(Transfer.FTP.connect(config));
|
|
77
|
+
* $(Transfer.FTP.put(conn, path, data));
|
|
78
|
+
* $(Transfer.FTP.close(conn));
|
|
79
|
+
* });
|
|
80
|
+
*
|
|
81
|
+
* const compiled = East.compileAsync(uploadFile.toIR(), Transfer.FTP.Implementation);
|
|
82
|
+
* await compiled("/uploads/report.pdf", pdfData);
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
connect: ftp_connect,
|
|
86
|
+
/**
|
|
87
|
+
* Uploads a file to an FTP server.
|
|
88
|
+
*
|
|
89
|
+
* Uploads binary data to the FTP server at the specified remote path.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* const uploadFile = East.function([StringType, BlobType], NullType, ($, path, data) => {
|
|
94
|
+
* const config = $.let({
|
|
95
|
+
* host: "ftp.example.com",
|
|
96
|
+
* port: 21n,
|
|
97
|
+
* user: "username",
|
|
98
|
+
* password: "password",
|
|
99
|
+
* secure: false,
|
|
100
|
+
* });
|
|
101
|
+
* const conn = $.let(Transfer.FTP.connect(config));
|
|
102
|
+
* $(Transfer.FTP.put(conn, path, data));
|
|
103
|
+
* $(Transfer.FTP.close(conn));
|
|
104
|
+
* });
|
|
105
|
+
*
|
|
106
|
+
* const compiled = East.compileAsync(uploadFile.toIR(), Transfer.FTP.Implementation);
|
|
107
|
+
* await compiled("/uploads/file.txt", fileData);
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
put: ftp_put,
|
|
111
|
+
/**
|
|
112
|
+
* Downloads a file from an FTP server.
|
|
113
|
+
*
|
|
114
|
+
* Retrieves binary data from the FTP server at the specified remote path.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```ts
|
|
118
|
+
* const downloadFile = East.function([StringType], BlobType, ($, path) => {
|
|
119
|
+
* const config = $.let({
|
|
120
|
+
* host: "ftp.example.com",
|
|
121
|
+
* port: 21n,
|
|
122
|
+
* user: "username",
|
|
123
|
+
* password: "password",
|
|
124
|
+
* secure: false,
|
|
125
|
+
* });
|
|
126
|
+
* const conn = $.let(Transfer.FTP.connect(config));
|
|
127
|
+
* const data = $.let(Transfer.FTP.get(conn, path));
|
|
128
|
+
* $(Transfer.FTP.close(conn));
|
|
129
|
+
* $.return(data);
|
|
130
|
+
* });
|
|
131
|
+
*
|
|
132
|
+
* const compiled = East.compileAsync(downloadFile.toIR(), Transfer.FTP.Implementation);
|
|
133
|
+
* await compiled("/downloads/file.txt"); // Uint8Array
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
get: ftp_get,
|
|
137
|
+
/**
|
|
138
|
+
* Lists files in an FTP directory.
|
|
139
|
+
*
|
|
140
|
+
* Retrieves metadata for all files and directories in the specified path.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```ts
|
|
144
|
+
* const listFiles = East.function([StringType], ArrayType(FileInfoType), ($, path) => {
|
|
145
|
+
* const config = $.let({
|
|
146
|
+
* host: "ftp.example.com",
|
|
147
|
+
* port: 21n,
|
|
148
|
+
* user: "username",
|
|
149
|
+
* password: "password",
|
|
150
|
+
* secure: false,
|
|
151
|
+
* });
|
|
152
|
+
* const conn = $.let(Transfer.FTP.connect(config));
|
|
153
|
+
* const files = $.let(Transfer.FTP.list(conn, path));
|
|
154
|
+
* $(Transfer.FTP.close(conn));
|
|
155
|
+
* $.return(files);
|
|
156
|
+
* });
|
|
157
|
+
*
|
|
158
|
+
* const compiled = East.compileAsync(listFiles.toIR(), Transfer.FTP.Implementation);
|
|
159
|
+
* await compiled("/uploads"); // [{name: "file.txt", size: 1024n, ...}, ...]
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
list: ftp_list,
|
|
163
|
+
/**
|
|
164
|
+
* Deletes a file from an FTP server.
|
|
165
|
+
*
|
|
166
|
+
* Removes a file from the FTP server at the specified remote path.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* const deleteFile = East.function([StringType], NullType, ($, path) => {
|
|
171
|
+
* const config = $.let({
|
|
172
|
+
* host: "ftp.example.com",
|
|
173
|
+
* port: 21n,
|
|
174
|
+
* user: "username",
|
|
175
|
+
* password: "password",
|
|
176
|
+
* secure: false,
|
|
177
|
+
* });
|
|
178
|
+
* const conn = $.let(Transfer.FTP.connect(config));
|
|
179
|
+
* $(Transfer.FTP.delete(conn, path));
|
|
180
|
+
* $(Transfer.FTP.close(conn));
|
|
181
|
+
* });
|
|
182
|
+
*
|
|
183
|
+
* const compiled = East.compileAsync(deleteFile.toIR(), Transfer.FTP.Implementation);
|
|
184
|
+
* await compiled("/uploads/old-file.txt");
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
delete: ftp_delete,
|
|
188
|
+
/**
|
|
189
|
+
* Closes the FTP connection.
|
|
190
|
+
*
|
|
191
|
+
* Closes the connection and releases all resources.
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```ts
|
|
195
|
+
* const cleanup = East.function([], NullType, $ => {
|
|
196
|
+
* const config = $.let({
|
|
197
|
+
* host: "ftp.example.com",
|
|
198
|
+
* port: 21n,
|
|
199
|
+
* user: "username",
|
|
200
|
+
* password: "password",
|
|
201
|
+
* secure: false,
|
|
202
|
+
* });
|
|
203
|
+
* const conn = $.let(Transfer.FTP.connect(config));
|
|
204
|
+
* // ... do work ...
|
|
205
|
+
* $(Transfer.FTP.close(conn));
|
|
206
|
+
* });
|
|
207
|
+
*
|
|
208
|
+
* const compiled = East.compileAsync(cleanup.toIR(), Transfer.FTP.Implementation);
|
|
209
|
+
* await compiled();
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
close: ftp_close,
|
|
213
|
+
/**
|
|
214
|
+
* Node.js implementation of FTP platform functions.
|
|
215
|
+
*
|
|
216
|
+
* Pass this to East.compileAsync() to enable FTP operations.
|
|
217
|
+
*/
|
|
218
|
+
Implementation: FtpImpl,
|
|
219
|
+
/**
|
|
220
|
+
* Type definitions for FTP operations.
|
|
221
|
+
*/
|
|
222
|
+
Types: {
|
|
223
|
+
/**
|
|
224
|
+
* FTP connection configuration type.
|
|
225
|
+
*/
|
|
226
|
+
Config: FtpConfigType,
|
|
227
|
+
/**
|
|
228
|
+
* File information metadata type.
|
|
229
|
+
*/
|
|
230
|
+
FileInfo: FileInfoType,
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
/**
|
|
234
|
+
* SFTP file transfer operations.
|
|
235
|
+
*
|
|
236
|
+
* Provides platform functions for SFTP (SSH File Transfer Protocol) servers.
|
|
237
|
+
*/
|
|
238
|
+
SFTP: {
|
|
239
|
+
/**
|
|
240
|
+
* Connects to an SFTP server.
|
|
241
|
+
*
|
|
242
|
+
* Creates a connection to an SFTP server and returns an
|
|
243
|
+
* opaque handle for use in file transfer operations.
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* ```ts
|
|
247
|
+
* const uploadFile = East.function([StringType, BlobType], NullType, ($, path, data) => {
|
|
248
|
+
* const config = $.let({
|
|
249
|
+
* host: "sftp.example.com",
|
|
250
|
+
* port: 22n,
|
|
251
|
+
* username: "user",
|
|
252
|
+
* password: East.some("password"),
|
|
253
|
+
* privateKey: variant('none', null),
|
|
254
|
+
* });
|
|
255
|
+
*
|
|
256
|
+
* const conn = $.let(Transfer.SFTP.connect(config));
|
|
257
|
+
* $(Transfer.SFTP.put(conn, path, data));
|
|
258
|
+
* $(Transfer.SFTP.close(conn));
|
|
259
|
+
* });
|
|
260
|
+
*
|
|
261
|
+
* const compiled = East.compileAsync(uploadFile.toIR(), Transfer.SFTP.Implementation);
|
|
262
|
+
* await compiled("/uploads/report.pdf", pdfData);
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
connect: sftp_connect,
|
|
266
|
+
/**
|
|
267
|
+
* Uploads a file to an SFTP server.
|
|
268
|
+
*
|
|
269
|
+
* Uploads binary data to the SFTP server at the specified remote path.
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```ts
|
|
273
|
+
* const uploadFile = East.function([StringType, BlobType], NullType, ($, path, data) => {
|
|
274
|
+
* const config = $.let({
|
|
275
|
+
* host: "sftp.example.com",
|
|
276
|
+
* port: 22n,
|
|
277
|
+
* username: "user",
|
|
278
|
+
* password: variant('some', "password"),
|
|
279
|
+
* privateKey: variant('none', null),
|
|
280
|
+
* });
|
|
281
|
+
* const conn = $.let(Transfer.SFTP.connect(config));
|
|
282
|
+
* $(Transfer.SFTP.put(conn, path, data));
|
|
283
|
+
* $(Transfer.SFTP.close(conn));
|
|
284
|
+
* });
|
|
285
|
+
*
|
|
286
|
+
* const compiled = East.compileAsync(uploadFile.toIR(), Transfer.SFTP.Implementation);
|
|
287
|
+
* await compiled("/uploads/file.txt", fileData);
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
put: sftp_put,
|
|
291
|
+
/**
|
|
292
|
+
* Downloads a file from an SFTP server.
|
|
293
|
+
*
|
|
294
|
+
* Retrieves binary data from the SFTP server at the specified remote path.
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* ```ts
|
|
298
|
+
* const downloadFile = East.function([StringType], BlobType, ($, path) => {
|
|
299
|
+
* const config = $.let({
|
|
300
|
+
* host: "sftp.example.com",
|
|
301
|
+
* port: 22n,
|
|
302
|
+
* username: "user",
|
|
303
|
+
* password: variant('some', "password"),
|
|
304
|
+
* privateKey: variant('none', null),
|
|
305
|
+
* });
|
|
306
|
+
* const conn = $.let(Transfer.SFTP.connect(config));
|
|
307
|
+
* const data = $.let(Transfer.SFTP.get(conn, path));
|
|
308
|
+
* $(Transfer.SFTP.close(conn));
|
|
309
|
+
* $.return(data);
|
|
310
|
+
* });
|
|
311
|
+
*
|
|
312
|
+
* const compiled = East.compileAsync(downloadFile.toIR(), Transfer.SFTP.Implementation);
|
|
313
|
+
* await compiled("/downloads/file.txt"); // Uint8Array
|
|
314
|
+
* ```
|
|
315
|
+
*/
|
|
316
|
+
get: sftp_get,
|
|
317
|
+
/**
|
|
318
|
+
* Lists files in an SFTP directory.
|
|
319
|
+
*
|
|
320
|
+
* Retrieves metadata for all files and directories in the specified path.
|
|
321
|
+
*
|
|
322
|
+
* @example
|
|
323
|
+
* ```ts
|
|
324
|
+
* const listFiles = East.function([StringType], ArrayType(FileInfoType), ($, path) => {
|
|
325
|
+
* const config = $.let({
|
|
326
|
+
* host: "sftp.example.com",
|
|
327
|
+
* port: 22n,
|
|
328
|
+
* username: "user",
|
|
329
|
+
* password: variant('some', "password"),
|
|
330
|
+
* privateKey: variant('none', null),
|
|
331
|
+
* });
|
|
332
|
+
* const conn = $.let(Transfer.SFTP.connect(config));
|
|
333
|
+
* const files = $.let(Transfer.SFTP.list(conn, path));
|
|
334
|
+
* $(Transfer.SFTP.close(conn));
|
|
335
|
+
* $.return(files);
|
|
336
|
+
* });
|
|
337
|
+
*
|
|
338
|
+
* const compiled = East.compileAsync(listFiles.toIR(), Transfer.SFTP.Implementation);
|
|
339
|
+
* await compiled("/uploads"); // [{name: "file.txt", size: 1024n, ...}, ...]
|
|
340
|
+
* ```
|
|
341
|
+
*/
|
|
342
|
+
list: sftp_list,
|
|
343
|
+
/**
|
|
344
|
+
* Deletes a file from an SFTP server.
|
|
345
|
+
*
|
|
346
|
+
* Removes a file from the SFTP server at the specified remote path.
|
|
347
|
+
*
|
|
348
|
+
* @example
|
|
349
|
+
* ```ts
|
|
350
|
+
* const deleteFile = East.function([StringType], NullType, ($, path) => {
|
|
351
|
+
* const config = $.let({
|
|
352
|
+
* host: "sftp.example.com",
|
|
353
|
+
* port: 22n,
|
|
354
|
+
* username: "user",
|
|
355
|
+
* password: variant('some', "password"),
|
|
356
|
+
* privateKey: variant('none', null),
|
|
357
|
+
* });
|
|
358
|
+
* const conn = $.let(Transfer.SFTP.connect(config));
|
|
359
|
+
* $(Transfer.SFTP.delete(conn, path));
|
|
360
|
+
* $(Transfer.SFTP.close(conn));
|
|
361
|
+
* });
|
|
362
|
+
*
|
|
363
|
+
* const compiled = East.compileAsync(deleteFile.toIR(), Transfer.SFTP.Implementation);
|
|
364
|
+
* await compiled("/uploads/old-file.txt");
|
|
365
|
+
* ```
|
|
366
|
+
*/
|
|
367
|
+
delete: sftp_delete,
|
|
368
|
+
/**
|
|
369
|
+
* Closes the SFTP connection.
|
|
370
|
+
*
|
|
371
|
+
* Closes the connection and releases all resources.
|
|
372
|
+
*
|
|
373
|
+
* @example
|
|
374
|
+
* ```ts
|
|
375
|
+
* const cleanup = East.function([], NullType, $ => {
|
|
376
|
+
* const config = $.let({
|
|
377
|
+
* host: "sftp.example.com",
|
|
378
|
+
* port: 22n,
|
|
379
|
+
* username: "user",
|
|
380
|
+
* password: variant('some', "password"),
|
|
381
|
+
* privateKey: variant('none', null),
|
|
382
|
+
* });
|
|
383
|
+
* const conn = $.let(Transfer.SFTP.connect(config));
|
|
384
|
+
* // ... do work ...
|
|
385
|
+
* $(Transfer.SFTP.close(conn));
|
|
386
|
+
* });
|
|
387
|
+
*
|
|
388
|
+
* const compiled = East.compileAsync(cleanup.toIR(), Transfer.SFTP.Implementation);
|
|
389
|
+
* await compiled();
|
|
390
|
+
* ```
|
|
391
|
+
*/
|
|
392
|
+
close: sftp_close,
|
|
393
|
+
/**
|
|
394
|
+
* Node.js implementation of SFTP platform functions.
|
|
395
|
+
*
|
|
396
|
+
* Pass this to East.compileAsync() to enable SFTP operations.
|
|
397
|
+
*/
|
|
398
|
+
Implementation: SftpImpl,
|
|
399
|
+
/**
|
|
400
|
+
* Type definitions for SFTP operations.
|
|
401
|
+
*/
|
|
402
|
+
Types: {
|
|
403
|
+
/**
|
|
404
|
+
* SFTP connection configuration type.
|
|
405
|
+
*/
|
|
406
|
+
Config: SftpConfigType,
|
|
407
|
+
/**
|
|
408
|
+
* File information metadata type.
|
|
409
|
+
*/
|
|
410
|
+
FileInfo: FileInfoType,
|
|
411
|
+
},
|
|
412
|
+
},
|
|
413
|
+
};
|
|
414
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transfer/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,4BAA4B;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAE1B,mFAAmF;AACnF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEzE,6BAA6B;AAC7B,OAAO,EACH,WAAW,EACX,OAAO,EACP,OAAO,EACP,QAAQ,EACR,UAAU,EACV,SAAS,EACT,OAAO,EACV,MAAM,UAAU,CAAC;AAClB,OAAO,EACH,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,WAAW,EACX,UAAU,EACV,QAAQ,EACX,MAAM,WAAW,CAAC;AACnB,OAAO,EACH,aAAa,EACb,cAAc,EACd,YAAY,EACf,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACpB;;;;;OAKG;IACH,GAAG,EAAE;QACD;;;;;;;;;;;;;;;;;;;;;;;;;WAyBG;QACH,OAAO,EAAE,WAAW;QAEpB;;;;;;;;;;;;;;;;;;;;;;;WAuBG;QACH,GAAG,EAAE,OAAO;QAEZ;;;;;;;;;;;;;;;;;;;;;;;;WAwBG;QACH,GAAG,EAAE,OAAO;QAEZ;;;;;;;;;;;;;;;;;;;;;;;;WAwBG;QACH,IAAI,EAAE,QAAQ;QAEd;;;;;;;;;;;;;;;;;;;;;;;WAuBG;QACH,MAAM,EAAE,UAAU;QAElB;;;;;;;;;;;;;;;;;;;;;;;WAuBG;QACH,KAAK,EAAE,SAAS;QAEhB;;;;WAIG;QACH,cAAc,EAAE,OAAO;QAEvB;;WAEG;QACH,KAAK,EAAE;YACH;;eAEG;YACH,MAAM,EAAE,aAAa;YAErB;;eAEG;YACH,QAAQ,EAAE,YAAY;SACzB;KACJ;IAED;;;;OAIG;IACH,IAAI,EAAE;QACF;;;;;;;;;;;;;;;;;;;;;;;;;WAyBG;QACH,OAAO,EAAE,YAAY;QAErB;;;;;;;;;;;;;;;;;;;;;;;WAuBG;QACH,GAAG,EAAE,QAAQ;QAEb;;;;;;;;;;;;;;;;;;;;;;;;WAwBG;QACH,GAAG,EAAE,QAAQ;QAEb;;;;;;;;;;;;;;;;;;;;;;;;WAwBG;QACH,IAAI,EAAE,SAAS;QAEf;;;;;;;;;;;;;;;;;;;;;;;WAuBG;QACH,MAAM,EAAE,WAAW;QAEnB;;;;;;;;;;;;;;;;;;;;;;;WAuBG;QACH,KAAK,EAAE,UAAU;QAEjB;;;;WAIG;QACH,cAAc,EAAE,QAAQ;QAExB;;WAEG;QACH,KAAK,EAAE;YACH;;eAEG;YACH,MAAM,EAAE,cAAc;YAEtB;;eAEG;YACH,QAAQ,EAAE,YAAY;SACzB;KACJ;CACK,CAAC"}
|