@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,456 @@
|
|
|
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 * from "./ftp.js";
|
|
14
|
+
export * from "./sftp.js";
|
|
15
|
+
export { FtpConfigType, SftpConfigType, FileInfoType } from "./types.js";
|
|
16
|
+
/**
|
|
17
|
+
* File transfer platform functions.
|
|
18
|
+
*
|
|
19
|
+
* Provides FTP and SFTP file transfer operations for East programs,
|
|
20
|
+
* including upload, download, list, and delete operations.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* import { East, StringType, BlobType, NullType } from "@elaraai/east";
|
|
25
|
+
* import { Transfer } from "@elaraai/east-node-io";
|
|
26
|
+
*
|
|
27
|
+
* const uploadFile = East.function([StringType, BlobType], NullType, ($, filename, data) => {
|
|
28
|
+
* const config = $.let({
|
|
29
|
+
* host: "ftp.example.com",
|
|
30
|
+
* port: 21n,
|
|
31
|
+
* user: "username",
|
|
32
|
+
* password: "password",
|
|
33
|
+
* secure: false,
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* const conn = $.let(Transfer.FTP.connect(config));
|
|
37
|
+
* $(Transfer.FTP.put(conn, `/uploads/${filename}`, data));
|
|
38
|
+
* $(Transfer.FTP.close(conn));
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* const compiled = East.compileAsync(uploadFile.toIR(), Transfer.FTP.Implementation);
|
|
42
|
+
* await compiled("document.pdf", pdfData);
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare const Transfer: {
|
|
46
|
+
/**
|
|
47
|
+
* FTP and FTPS file transfer operations.
|
|
48
|
+
*
|
|
49
|
+
* Provides platform functions for FTP (File Transfer Protocol) and
|
|
50
|
+
* FTPS (FTP over SSL/TLS) servers.
|
|
51
|
+
*/
|
|
52
|
+
readonly FTP: {
|
|
53
|
+
/**
|
|
54
|
+
* Connects to an FTP server.
|
|
55
|
+
*
|
|
56
|
+
* Creates a connection to an FTP or FTPS server and returns an
|
|
57
|
+
* opaque handle for use in file transfer operations.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const uploadFile = East.function([StringType, BlobType], NullType, ($, path, data) => {
|
|
62
|
+
* const config = $.let({
|
|
63
|
+
* host: "ftp.example.com",
|
|
64
|
+
* port: 21n,
|
|
65
|
+
* user: "username",
|
|
66
|
+
* password: "password",
|
|
67
|
+
* secure: false,
|
|
68
|
+
* });
|
|
69
|
+
*
|
|
70
|
+
* const conn = $.let(Transfer.FTP.connect(config));
|
|
71
|
+
* $(Transfer.FTP.put(conn, path, data));
|
|
72
|
+
* $(Transfer.FTP.close(conn));
|
|
73
|
+
* });
|
|
74
|
+
*
|
|
75
|
+
* const compiled = East.compileAsync(uploadFile.toIR(), Transfer.FTP.Implementation);
|
|
76
|
+
* await compiled("/uploads/report.pdf", pdfData);
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
readonly connect: import("@elaraai/east").AsyncPlatformDefinition<[import("@elaraai/east").StructType<{
|
|
80
|
+
host: import("./types.js").StringType;
|
|
81
|
+
port: import("@elaraai/east").IntegerType;
|
|
82
|
+
user: import("./types.js").StringType;
|
|
83
|
+
password: import("./types.js").StringType;
|
|
84
|
+
secure: import("@elaraai/east").BooleanType;
|
|
85
|
+
}>], import("./types.js").StringType>;
|
|
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
|
+
readonly put: import("@elaraai/east").AsyncPlatformDefinition<[import("./types.js").StringType, import("./types.js").StringType, import("@elaraai/east").BlobType], import("@elaraai/east").NullType>;
|
|
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
|
+
readonly get: import("@elaraai/east").AsyncPlatformDefinition<[import("./types.js").StringType, import("./types.js").StringType], import("@elaraai/east").BlobType>;
|
|
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
|
+
readonly list: import("@elaraai/east").AsyncPlatformDefinition<[import("./types.js").StringType, import("./types.js").StringType], import("@elaraai/east").ArrayType<import("@elaraai/east").StructType<{
|
|
163
|
+
name: import("./types.js").StringType;
|
|
164
|
+
path: import("./types.js").StringType;
|
|
165
|
+
size: import("@elaraai/east").IntegerType;
|
|
166
|
+
isDirectory: import("@elaraai/east").BooleanType;
|
|
167
|
+
modifiedTime: import("./types.js").StringType;
|
|
168
|
+
}>>>;
|
|
169
|
+
/**
|
|
170
|
+
* Deletes a file from an FTP server.
|
|
171
|
+
*
|
|
172
|
+
* Removes a file from the FTP server at the specified remote path.
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```ts
|
|
176
|
+
* const deleteFile = East.function([StringType], NullType, ($, path) => {
|
|
177
|
+
* const config = $.let({
|
|
178
|
+
* host: "ftp.example.com",
|
|
179
|
+
* port: 21n,
|
|
180
|
+
* user: "username",
|
|
181
|
+
* password: "password",
|
|
182
|
+
* secure: false,
|
|
183
|
+
* });
|
|
184
|
+
* const conn = $.let(Transfer.FTP.connect(config));
|
|
185
|
+
* $(Transfer.FTP.delete(conn, path));
|
|
186
|
+
* $(Transfer.FTP.close(conn));
|
|
187
|
+
* });
|
|
188
|
+
*
|
|
189
|
+
* const compiled = East.compileAsync(deleteFile.toIR(), Transfer.FTP.Implementation);
|
|
190
|
+
* await compiled("/uploads/old-file.txt");
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
readonly delete: import("@elaraai/east").AsyncPlatformDefinition<[import("./types.js").StringType, import("./types.js").StringType], import("@elaraai/east").NullType>;
|
|
194
|
+
/**
|
|
195
|
+
* Closes the FTP connection.
|
|
196
|
+
*
|
|
197
|
+
* Closes the connection and releases all resources.
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* ```ts
|
|
201
|
+
* const cleanup = East.function([], NullType, $ => {
|
|
202
|
+
* const config = $.let({
|
|
203
|
+
* host: "ftp.example.com",
|
|
204
|
+
* port: 21n,
|
|
205
|
+
* user: "username",
|
|
206
|
+
* password: "password",
|
|
207
|
+
* secure: false,
|
|
208
|
+
* });
|
|
209
|
+
* const conn = $.let(Transfer.FTP.connect(config));
|
|
210
|
+
* // ... do work ...
|
|
211
|
+
* $(Transfer.FTP.close(conn));
|
|
212
|
+
* });
|
|
213
|
+
*
|
|
214
|
+
* const compiled = East.compileAsync(cleanup.toIR(), Transfer.FTP.Implementation);
|
|
215
|
+
* await compiled();
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
readonly close: import("@elaraai/east").PlatformDefinition<[import("./types.js").StringType], import("@elaraai/east").NullType>;
|
|
219
|
+
/**
|
|
220
|
+
* Node.js implementation of FTP platform functions.
|
|
221
|
+
*
|
|
222
|
+
* Pass this to East.compileAsync() to enable FTP operations.
|
|
223
|
+
*/
|
|
224
|
+
readonly Implementation: import("@elaraai/east/internal").PlatformFunction[];
|
|
225
|
+
/**
|
|
226
|
+
* Type definitions for FTP operations.
|
|
227
|
+
*/
|
|
228
|
+
readonly Types: {
|
|
229
|
+
/**
|
|
230
|
+
* FTP connection configuration type.
|
|
231
|
+
*/
|
|
232
|
+
readonly Config: import("@elaraai/east").StructType<{
|
|
233
|
+
host: import("./types.js").StringType;
|
|
234
|
+
port: import("@elaraai/east").IntegerType;
|
|
235
|
+
user: import("./types.js").StringType;
|
|
236
|
+
password: import("./types.js").StringType;
|
|
237
|
+
secure: import("@elaraai/east").BooleanType;
|
|
238
|
+
}>;
|
|
239
|
+
/**
|
|
240
|
+
* File information metadata type.
|
|
241
|
+
*/
|
|
242
|
+
readonly FileInfo: import("@elaraai/east").StructType<{
|
|
243
|
+
name: import("./types.js").StringType;
|
|
244
|
+
path: import("./types.js").StringType;
|
|
245
|
+
size: import("@elaraai/east").IntegerType;
|
|
246
|
+
isDirectory: import("@elaraai/east").BooleanType;
|
|
247
|
+
modifiedTime: import("./types.js").StringType;
|
|
248
|
+
}>;
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* SFTP file transfer operations.
|
|
253
|
+
*
|
|
254
|
+
* Provides platform functions for SFTP (SSH File Transfer Protocol) servers.
|
|
255
|
+
*/
|
|
256
|
+
readonly SFTP: {
|
|
257
|
+
/**
|
|
258
|
+
* Connects to an SFTP server.
|
|
259
|
+
*
|
|
260
|
+
* Creates a connection to an SFTP server and returns an
|
|
261
|
+
* opaque handle for use in file transfer operations.
|
|
262
|
+
*
|
|
263
|
+
* @example
|
|
264
|
+
* ```ts
|
|
265
|
+
* const uploadFile = East.function([StringType, BlobType], NullType, ($, path, data) => {
|
|
266
|
+
* const config = $.let({
|
|
267
|
+
* host: "sftp.example.com",
|
|
268
|
+
* port: 22n,
|
|
269
|
+
* username: "user",
|
|
270
|
+
* password: East.some("password"),
|
|
271
|
+
* privateKey: variant('none', null),
|
|
272
|
+
* });
|
|
273
|
+
*
|
|
274
|
+
* const conn = $.let(Transfer.SFTP.connect(config));
|
|
275
|
+
* $(Transfer.SFTP.put(conn, path, data));
|
|
276
|
+
* $(Transfer.SFTP.close(conn));
|
|
277
|
+
* });
|
|
278
|
+
*
|
|
279
|
+
* const compiled = East.compileAsync(uploadFile.toIR(), Transfer.SFTP.Implementation);
|
|
280
|
+
* await compiled("/uploads/report.pdf", pdfData);
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
readonly connect: import("@elaraai/east").AsyncPlatformDefinition<[import("@elaraai/east").StructType<{
|
|
284
|
+
host: import("./types.js").StringType;
|
|
285
|
+
port: import("@elaraai/east").IntegerType;
|
|
286
|
+
username: import("./types.js").StringType;
|
|
287
|
+
password: import("@elaraai/east").OptionType<import("./types.js").StringType>;
|
|
288
|
+
privateKey: import("@elaraai/east").OptionType<import("./types.js").StringType>;
|
|
289
|
+
}>], import("./types.js").StringType>;
|
|
290
|
+
/**
|
|
291
|
+
* Uploads a file to an SFTP server.
|
|
292
|
+
*
|
|
293
|
+
* Uploads binary data to the SFTP server at the specified remote path.
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* ```ts
|
|
297
|
+
* const uploadFile = East.function([StringType, BlobType], NullType, ($, path, data) => {
|
|
298
|
+
* const config = $.let({
|
|
299
|
+
* host: "sftp.example.com",
|
|
300
|
+
* port: 22n,
|
|
301
|
+
* username: "user",
|
|
302
|
+
* password: variant('some', "password"),
|
|
303
|
+
* privateKey: variant('none', null),
|
|
304
|
+
* });
|
|
305
|
+
* const conn = $.let(Transfer.SFTP.connect(config));
|
|
306
|
+
* $(Transfer.SFTP.put(conn, path, data));
|
|
307
|
+
* $(Transfer.SFTP.close(conn));
|
|
308
|
+
* });
|
|
309
|
+
*
|
|
310
|
+
* const compiled = East.compileAsync(uploadFile.toIR(), Transfer.SFTP.Implementation);
|
|
311
|
+
* await compiled("/uploads/file.txt", fileData);
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
readonly put: import("@elaraai/east").AsyncPlatformDefinition<[import("./types.js").StringType, import("./types.js").StringType, import("@elaraai/east").BlobType], import("@elaraai/east").NullType>;
|
|
315
|
+
/**
|
|
316
|
+
* Downloads a file from an SFTP server.
|
|
317
|
+
*
|
|
318
|
+
* Retrieves binary data from the SFTP server at the specified remote path.
|
|
319
|
+
*
|
|
320
|
+
* @example
|
|
321
|
+
* ```ts
|
|
322
|
+
* const downloadFile = East.function([StringType], BlobType, ($, path) => {
|
|
323
|
+
* const config = $.let({
|
|
324
|
+
* host: "sftp.example.com",
|
|
325
|
+
* port: 22n,
|
|
326
|
+
* username: "user",
|
|
327
|
+
* password: variant('some', "password"),
|
|
328
|
+
* privateKey: variant('none', null),
|
|
329
|
+
* });
|
|
330
|
+
* const conn = $.let(Transfer.SFTP.connect(config));
|
|
331
|
+
* const data = $.let(Transfer.SFTP.get(conn, path));
|
|
332
|
+
* $(Transfer.SFTP.close(conn));
|
|
333
|
+
* $.return(data);
|
|
334
|
+
* });
|
|
335
|
+
*
|
|
336
|
+
* const compiled = East.compileAsync(downloadFile.toIR(), Transfer.SFTP.Implementation);
|
|
337
|
+
* await compiled("/downloads/file.txt"); // Uint8Array
|
|
338
|
+
* ```
|
|
339
|
+
*/
|
|
340
|
+
readonly get: import("@elaraai/east").AsyncPlatformDefinition<[import("./types.js").StringType, import("./types.js").StringType], import("@elaraai/east").BlobType>;
|
|
341
|
+
/**
|
|
342
|
+
* Lists files in an SFTP directory.
|
|
343
|
+
*
|
|
344
|
+
* Retrieves metadata for all files and directories in the specified path.
|
|
345
|
+
*
|
|
346
|
+
* @example
|
|
347
|
+
* ```ts
|
|
348
|
+
* const listFiles = East.function([StringType], ArrayType(FileInfoType), ($, path) => {
|
|
349
|
+
* const config = $.let({
|
|
350
|
+
* host: "sftp.example.com",
|
|
351
|
+
* port: 22n,
|
|
352
|
+
* username: "user",
|
|
353
|
+
* password: variant('some', "password"),
|
|
354
|
+
* privateKey: variant('none', null),
|
|
355
|
+
* });
|
|
356
|
+
* const conn = $.let(Transfer.SFTP.connect(config));
|
|
357
|
+
* const files = $.let(Transfer.SFTP.list(conn, path));
|
|
358
|
+
* $(Transfer.SFTP.close(conn));
|
|
359
|
+
* $.return(files);
|
|
360
|
+
* });
|
|
361
|
+
*
|
|
362
|
+
* const compiled = East.compileAsync(listFiles.toIR(), Transfer.SFTP.Implementation);
|
|
363
|
+
* await compiled("/uploads"); // [{name: "file.txt", size: 1024n, ...}, ...]
|
|
364
|
+
* ```
|
|
365
|
+
*/
|
|
366
|
+
readonly list: import("@elaraai/east").AsyncPlatformDefinition<[import("./types.js").StringType, import("./types.js").StringType], import("@elaraai/east").ArrayType<import("@elaraai/east").StructType<{
|
|
367
|
+
name: import("./types.js").StringType;
|
|
368
|
+
path: import("./types.js").StringType;
|
|
369
|
+
size: import("@elaraai/east").IntegerType;
|
|
370
|
+
isDirectory: import("@elaraai/east").BooleanType;
|
|
371
|
+
modifiedTime: import("./types.js").StringType;
|
|
372
|
+
}>>>;
|
|
373
|
+
/**
|
|
374
|
+
* Deletes a file from an SFTP server.
|
|
375
|
+
*
|
|
376
|
+
* Removes a file from the SFTP server at the specified remote path.
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* ```ts
|
|
380
|
+
* const deleteFile = East.function([StringType], NullType, ($, path) => {
|
|
381
|
+
* const config = $.let({
|
|
382
|
+
* host: "sftp.example.com",
|
|
383
|
+
* port: 22n,
|
|
384
|
+
* username: "user",
|
|
385
|
+
* password: variant('some', "password"),
|
|
386
|
+
* privateKey: variant('none', null),
|
|
387
|
+
* });
|
|
388
|
+
* const conn = $.let(Transfer.SFTP.connect(config));
|
|
389
|
+
* $(Transfer.SFTP.delete(conn, path));
|
|
390
|
+
* $(Transfer.SFTP.close(conn));
|
|
391
|
+
* });
|
|
392
|
+
*
|
|
393
|
+
* const compiled = East.compileAsync(deleteFile.toIR(), Transfer.SFTP.Implementation);
|
|
394
|
+
* await compiled("/uploads/old-file.txt");
|
|
395
|
+
* ```
|
|
396
|
+
*/
|
|
397
|
+
readonly delete: import("@elaraai/east").AsyncPlatformDefinition<[import("./types.js").StringType, import("./types.js").StringType], import("@elaraai/east").NullType>;
|
|
398
|
+
/**
|
|
399
|
+
* Closes the SFTP connection.
|
|
400
|
+
*
|
|
401
|
+
* Closes the connection and releases all resources.
|
|
402
|
+
*
|
|
403
|
+
* @example
|
|
404
|
+
* ```ts
|
|
405
|
+
* const cleanup = East.function([], NullType, $ => {
|
|
406
|
+
* const config = $.let({
|
|
407
|
+
* host: "sftp.example.com",
|
|
408
|
+
* port: 22n,
|
|
409
|
+
* username: "user",
|
|
410
|
+
* password: variant('some', "password"),
|
|
411
|
+
* privateKey: variant('none', null),
|
|
412
|
+
* });
|
|
413
|
+
* const conn = $.let(Transfer.SFTP.connect(config));
|
|
414
|
+
* // ... do work ...
|
|
415
|
+
* $(Transfer.SFTP.close(conn));
|
|
416
|
+
* });
|
|
417
|
+
*
|
|
418
|
+
* const compiled = East.compileAsync(cleanup.toIR(), Transfer.SFTP.Implementation);
|
|
419
|
+
* await compiled();
|
|
420
|
+
* ```
|
|
421
|
+
*/
|
|
422
|
+
readonly close: import("@elaraai/east").AsyncPlatformDefinition<[import("./types.js").StringType], import("@elaraai/east").NullType>;
|
|
423
|
+
/**
|
|
424
|
+
* Node.js implementation of SFTP platform functions.
|
|
425
|
+
*
|
|
426
|
+
* Pass this to East.compileAsync() to enable SFTP operations.
|
|
427
|
+
*/
|
|
428
|
+
readonly Implementation: import("@elaraai/east/internal").PlatformFunction[];
|
|
429
|
+
/**
|
|
430
|
+
* Type definitions for SFTP operations.
|
|
431
|
+
*/
|
|
432
|
+
readonly Types: {
|
|
433
|
+
/**
|
|
434
|
+
* SFTP connection configuration type.
|
|
435
|
+
*/
|
|
436
|
+
readonly Config: import("@elaraai/east").StructType<{
|
|
437
|
+
host: import("./types.js").StringType;
|
|
438
|
+
port: import("@elaraai/east").IntegerType;
|
|
439
|
+
username: import("./types.js").StringType;
|
|
440
|
+
password: import("@elaraai/east").OptionType<import("./types.js").StringType>;
|
|
441
|
+
privateKey: import("@elaraai/east").OptionType<import("./types.js").StringType>;
|
|
442
|
+
}>;
|
|
443
|
+
/**
|
|
444
|
+
* File information metadata type.
|
|
445
|
+
*/
|
|
446
|
+
readonly FileInfo: import("@elaraai/east").StructType<{
|
|
447
|
+
name: import("./types.js").StringType;
|
|
448
|
+
path: import("./types.js").StringType;
|
|
449
|
+
size: import("@elaraai/east").IntegerType;
|
|
450
|
+
isDirectory: import("@elaraai/east").BooleanType;
|
|
451
|
+
modifiedTime: import("./types.js").StringType;
|
|
452
|
+
}>;
|
|
453
|
+
};
|
|
454
|
+
};
|
|
455
|
+
};
|
|
456
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transfer/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAGH,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAG1B,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AA2BzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,QAAQ;IACjB;;;;;OAKG;;QAEC;;;;;;;;;;;;;;;;;;;;;;;;;WAyBG;;;;;;;;QAGH;;;;;;;;;;;;;;;;;;;;;;;WAuBG;;QAGH;;;;;;;;;;;;;;;;;;;;;;;;WAwBG;;QAGH;;;;;;;;;;;;;;;;;;;;;;;;WAwBG;;;;;;;;QAGH;;;;;;;;;;;;;;;;;;;;;;;WAuBG;;QAGH;;;;;;;;;;;;;;;;;;;;;;;WAuBG;;QAGH;;;;WAIG;;QAGH;;WAEG;;YAEC;;eAEG;;;;;;;;YAGH;;eAEG;;;;;;;;;;IAKX;;;;OAIG;;QAEC;;;;;;;;;;;;;;;;;;;;;;;;;WAyBG;;;;;;;;QAGH;;;;;;;;;;;;;;;;;;;;;;;WAuBG;;QAGH;;;;;;;;;;;;;;;;;;;;;;;;WAwBG;;QAGH;;;;;;;;;;;;;;;;;;;;;;;;WAwBG;;;;;;;;QAGH;;;;;;;;;;;;;;;;;;;;;;;WAuBG;;QAGH;;;;;;;;;;;;;;;;;;;;;;;WAuBG;;QAGH;;;;WAIG;;QAGH;;WAEG;;YAEC;;eAEG;;;;;;;;YAGH;;eAEG;;;;;;;;;;CAIL,CAAC"}
|