@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,94 @@
|
|
|
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
|
+
* Shared storage type definitions for East Node IO.
|
|
7
|
+
*
|
|
8
|
+
* Provides East type definitions for S3 and S3-compatible object storage
|
|
9
|
+
* operations including configurations, metadata, and result types.
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
import { StructType, OptionType, ArrayType, StringType, IntegerType, BooleanType, DateTimeType, } from "@elaraai/east";
|
|
14
|
+
/**
|
|
15
|
+
* S3 storage configuration.
|
|
16
|
+
*
|
|
17
|
+
* Configures connection to S3 or S3-compatible object storage services
|
|
18
|
+
* (MinIO, DigitalOcean Spaces, etc.).
|
|
19
|
+
*/
|
|
20
|
+
export const S3ConfigType = StructType({
|
|
21
|
+
/**
|
|
22
|
+
* AWS region (e.g., "us-east-1", "eu-west-1").
|
|
23
|
+
*/
|
|
24
|
+
region: StringType,
|
|
25
|
+
/**
|
|
26
|
+
* S3 bucket name.
|
|
27
|
+
*/
|
|
28
|
+
bucket: StringType,
|
|
29
|
+
/**
|
|
30
|
+
* AWS access key ID for authentication.
|
|
31
|
+
* Optional, defaults to AWS credential chain.
|
|
32
|
+
*/
|
|
33
|
+
accessKeyId: OptionType(StringType),
|
|
34
|
+
/**
|
|
35
|
+
* AWS secret access key for authentication.
|
|
36
|
+
* Optional, defaults to AWS credential chain.
|
|
37
|
+
*/
|
|
38
|
+
secretAccessKey: OptionType(StringType),
|
|
39
|
+
/**
|
|
40
|
+
* Custom endpoint for S3-compatible services (e.g., "http://localhost:9000" for MinIO).
|
|
41
|
+
* Optional, defaults to AWS S3 endpoint.
|
|
42
|
+
*/
|
|
43
|
+
endpoint: OptionType(StringType),
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* S3 object metadata.
|
|
47
|
+
*
|
|
48
|
+
* Represents metadata about an object stored in S3.
|
|
49
|
+
*/
|
|
50
|
+
export const S3ObjectMetadataType = StructType({
|
|
51
|
+
/**
|
|
52
|
+
* Object key (path) in the bucket.
|
|
53
|
+
*/
|
|
54
|
+
key: StringType,
|
|
55
|
+
/**
|
|
56
|
+
* Object size in bytes.
|
|
57
|
+
*/
|
|
58
|
+
size: IntegerType,
|
|
59
|
+
/**
|
|
60
|
+
* Last modified timestamp as a Date object.
|
|
61
|
+
*/
|
|
62
|
+
lastModified: DateTimeType,
|
|
63
|
+
/**
|
|
64
|
+
* Content type of the object (MIME type).
|
|
65
|
+
* Optional, may be None if not set.
|
|
66
|
+
*/
|
|
67
|
+
contentType: OptionType(StringType),
|
|
68
|
+
/**
|
|
69
|
+
* ETag of the object (entity tag for versioning/caching).
|
|
70
|
+
* Optional, may be None if not available.
|
|
71
|
+
*/
|
|
72
|
+
etag: OptionType(StringType),
|
|
73
|
+
});
|
|
74
|
+
/**
|
|
75
|
+
* S3 list objects result.
|
|
76
|
+
*
|
|
77
|
+
* Contains the result of listing objects in an S3 bucket with pagination support.
|
|
78
|
+
*/
|
|
79
|
+
export const S3ListResultType = StructType({
|
|
80
|
+
/**
|
|
81
|
+
* Array of object metadata for objects matching the prefix.
|
|
82
|
+
*/
|
|
83
|
+
objects: ArrayType(S3ObjectMetadataType),
|
|
84
|
+
/**
|
|
85
|
+
* Whether the result list is truncated (more results available).
|
|
86
|
+
*/
|
|
87
|
+
isTruncated: BooleanType,
|
|
88
|
+
/**
|
|
89
|
+
* Continuation token for fetching next page of results.
|
|
90
|
+
* Optional, None if no more results available.
|
|
91
|
+
*/
|
|
92
|
+
continuationToken: OptionType(StringType),
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/storage/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EACH,UAAU,EACV,UAAU,EACV,SAAS,EACT,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,GACf,MAAM,eAAe,CAAC;AAEvB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;IACnC;;OAEG;IACH,MAAM,EAAE,UAAU;IAElB;;OAEG;IACH,MAAM,EAAE,UAAU;IAElB;;;OAGG;IACH,WAAW,EAAE,UAAU,CAAC,UAAU,CAAC;IAEnC;;;OAGG;IACH,eAAe,EAAE,UAAU,CAAC,UAAU,CAAC;IAEvC;;;OAGG;IACH,QAAQ,EAAE,UAAU,CAAC,UAAU,CAAC;CACnC,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;IAC3C;;OAEG;IACH,GAAG,EAAE,UAAU;IAEf;;OAEG;IACH,IAAI,EAAE,WAAW;IAEjB;;OAEG;IACH,YAAY,EAAE,YAAY;IAE1B;;;OAGG;IACH,WAAW,EAAE,UAAU,CAAC,UAAU,CAAC;IAEnC;;;OAGG;IACH,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC;CAC/B,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC;IACvC;;OAEG;IACH,OAAO,EAAE,SAAS,CAAC,oBAAoB,CAAC;IAExC;;OAEG;IACH,WAAW,EAAE,WAAW;IAExB;;;OAGG;IACH,iBAAiB,EAAE,UAAU,CAAC,UAAU,CAAC;CAC5C,CAAC,CAAC"}
|
|
@@ -0,0 +1,333 @@
|
|
|
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
|
+
* FTP platform functions for East Node IO.
|
|
7
|
+
*
|
|
8
|
+
* Provides FTP and FTPS file transfer operations for East programs,
|
|
9
|
+
* including upload, download, list, and delete operations.
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
import { BlobType, ArrayType, NullType } from "@elaraai/east";
|
|
14
|
+
import type { PlatformFunction } from "@elaraai/east/internal";
|
|
15
|
+
import { StringType } from "./types.js";
|
|
16
|
+
/**
|
|
17
|
+
* Connects to an FTP server.
|
|
18
|
+
*
|
|
19
|
+
* Creates a connection to an FTP or FTPS server and returns an opaque handle
|
|
20
|
+
* for use in file transfer operations.
|
|
21
|
+
*
|
|
22
|
+
* This is a platform function for the East language, enabling FTP file transfer
|
|
23
|
+
* operations in East programs running on Node.js.
|
|
24
|
+
*
|
|
25
|
+
* @param config - FTP connection configuration
|
|
26
|
+
* @returns Connection handle (opaque string)
|
|
27
|
+
*
|
|
28
|
+
* @throws {EastError} When connection fails due to:
|
|
29
|
+
* - Invalid hostname or port (location: "ftp_connect")
|
|
30
|
+
* - Authentication failure (location: "ftp_connect")
|
|
31
|
+
* - Network errors (location: "ftp_connect")
|
|
32
|
+
* - SSL/TLS errors for FTPS (location: "ftp_connect")
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* import { East, StringType, BlobType } from "@elaraai/east";
|
|
37
|
+
* import { Transfer } from "@elaraai/east-node-io";
|
|
38
|
+
*
|
|
39
|
+
* const uploadToFtp = East.function([StringType, BlobType], NullType, ($, filename, data) => {
|
|
40
|
+
* const config = $.let({
|
|
41
|
+
* host: "ftp.example.com",
|
|
42
|
+
* port: 21n,
|
|
43
|
+
* user: "username",
|
|
44
|
+
* password: "password",
|
|
45
|
+
* secure: false,
|
|
46
|
+
* });
|
|
47
|
+
*
|
|
48
|
+
* const conn = $.let(Transfer.FTP.connect(config));
|
|
49
|
+
* $(Transfer.FTP.put(conn, filename, data));
|
|
50
|
+
* $(Transfer.FTP.close(conn));
|
|
51
|
+
* });
|
|
52
|
+
*
|
|
53
|
+
* const compiled = East.compileAsync(uploadToFtp.toIR(), Transfer.FTP.Implementation);
|
|
54
|
+
* await compiled("file.txt", fileData);
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @remarks
|
|
58
|
+
* - Supports both FTP and FTPS (FTP over SSL/TLS)
|
|
59
|
+
* - Connection is maintained until explicitly closed
|
|
60
|
+
* - All operations are asynchronous (use East.compileAsync)
|
|
61
|
+
*/
|
|
62
|
+
export declare const ftp_connect: import("@elaraai/east").AsyncPlatformDefinition<[import("@elaraai/east").StructType<{
|
|
63
|
+
host: StringType;
|
|
64
|
+
port: import("@elaraai/east").IntegerType;
|
|
65
|
+
user: StringType;
|
|
66
|
+
password: StringType;
|
|
67
|
+
secure: import("@elaraai/east").BooleanType;
|
|
68
|
+
}>], StringType>;
|
|
69
|
+
/**
|
|
70
|
+
* Uploads a file to an FTP server.
|
|
71
|
+
*
|
|
72
|
+
* Uploads binary data to the FTP server at the specified remote path.
|
|
73
|
+
* Overwrites existing files with the same path.
|
|
74
|
+
*
|
|
75
|
+
* This is a platform function for the East language, enabling FTP file transfer
|
|
76
|
+
* operations in East programs running on Node.js.
|
|
77
|
+
*
|
|
78
|
+
* @param handle - Connection handle from ftp_connect()
|
|
79
|
+
* @param remotePath - Remote file path on the FTP server
|
|
80
|
+
* @param data - Binary data to upload
|
|
81
|
+
* @returns Null on success
|
|
82
|
+
*
|
|
83
|
+
* @throws {EastError} When upload fails due to:
|
|
84
|
+
* - Invalid connection handle (location: "ftp_put")
|
|
85
|
+
* - Permission denied (location: "ftp_put")
|
|
86
|
+
* - Invalid remote path (location: "ftp_put")
|
|
87
|
+
* - Network errors (location: "ftp_put")
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* import { East, StringType, BlobType, NullType } from "@elaraai/east";
|
|
92
|
+
* import { Transfer } from "@elaraai/east-node-io";
|
|
93
|
+
*
|
|
94
|
+
* const uploadFile = East.function([StringType, BlobType], NullType, ($, filename, data) => {
|
|
95
|
+
* const config = $.let({
|
|
96
|
+
* host: "ftp.example.com",
|
|
97
|
+
* port: 21n,
|
|
98
|
+
* user: "username",
|
|
99
|
+
* password: "password",
|
|
100
|
+
* secure: false,
|
|
101
|
+
* });
|
|
102
|
+
* const conn = $.let(Transfer.FTP.connect(config));
|
|
103
|
+
* $(Transfer.FTP.put(conn, `/uploads/${filename}`, data));
|
|
104
|
+
* $(Transfer.FTP.close(conn));
|
|
105
|
+
* return $.return(null);
|
|
106
|
+
* });
|
|
107
|
+
*
|
|
108
|
+
* const compiled = East.compileAsync(uploadFile.toIR(), Transfer.FTP.Implementation);
|
|
109
|
+
* await compiled("file.txt", fileData);
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* @remarks
|
|
113
|
+
* - Creates parent directories if they don't exist
|
|
114
|
+
* - Overwrites existing files
|
|
115
|
+
* - Binary mode transfer
|
|
116
|
+
*/
|
|
117
|
+
export declare const ftp_put: import("@elaraai/east").AsyncPlatformDefinition<[StringType, StringType, BlobType], NullType>;
|
|
118
|
+
/**
|
|
119
|
+
* Downloads a file from an FTP server.
|
|
120
|
+
*
|
|
121
|
+
* Retrieves binary data from the FTP server at the specified remote path.
|
|
122
|
+
* Returns the file data as a Blob (Uint8Array).
|
|
123
|
+
*
|
|
124
|
+
* This is a platform function for the East language, enabling FTP file transfer
|
|
125
|
+
* operations in East programs running on Node.js.
|
|
126
|
+
*
|
|
127
|
+
* @param handle - Connection handle from ftp_connect()
|
|
128
|
+
* @param remotePath - Remote file path on the FTP server
|
|
129
|
+
* @returns Binary data as Blob
|
|
130
|
+
*
|
|
131
|
+
* @throws {EastError} When download fails due to:
|
|
132
|
+
* - Invalid connection handle (location: "ftp_get")
|
|
133
|
+
* - File not found (location: "ftp_get")
|
|
134
|
+
* - Permission denied (location: "ftp_get")
|
|
135
|
+
* - Network errors (location: "ftp_get")
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```ts
|
|
139
|
+
* import { East, StringType, BlobType } from "@elaraai/east";
|
|
140
|
+
* import { Transfer } from "@elaraai/east-node-io";
|
|
141
|
+
*
|
|
142
|
+
* const downloadFile = East.function([StringType], BlobType, ($, filename) => {
|
|
143
|
+
* const config = $.let({
|
|
144
|
+
* host: "ftp.example.com",
|
|
145
|
+
* port: 21n,
|
|
146
|
+
* user: "username",
|
|
147
|
+
* password: "password",
|
|
148
|
+
* secure: false,
|
|
149
|
+
* });
|
|
150
|
+
* const conn = $.let(Transfer.FTP.connect(config));
|
|
151
|
+
* const data = $.let(Transfer.FTP.get(conn, `/downloads/${filename}`));
|
|
152
|
+
* $(Transfer.FTP.close(conn));
|
|
153
|
+
* return $.return(data);
|
|
154
|
+
* });
|
|
155
|
+
*
|
|
156
|
+
* const compiled = East.compileAsync(downloadFile.toIR(), Transfer.FTP.Implementation);
|
|
157
|
+
* const fileData = await compiled("file.txt"); // Returns Uint8Array
|
|
158
|
+
* ```
|
|
159
|
+
*
|
|
160
|
+
* @remarks
|
|
161
|
+
* - Binary mode transfer
|
|
162
|
+
* - Entire file is loaded into memory
|
|
163
|
+
*/
|
|
164
|
+
export declare const ftp_get: import("@elaraai/east").AsyncPlatformDefinition<[StringType, StringType], BlobType>;
|
|
165
|
+
/**
|
|
166
|
+
* Lists files in an FTP directory.
|
|
167
|
+
*
|
|
168
|
+
* Retrieves a list of files and directories at the specified remote path.
|
|
169
|
+
* Returns metadata for each file including name, size, and modification time.
|
|
170
|
+
*
|
|
171
|
+
* This is a platform function for the East language, enabling FTP file transfer
|
|
172
|
+
* operations in East programs running on Node.js.
|
|
173
|
+
*
|
|
174
|
+
* @param handle - Connection handle from ftp_connect()
|
|
175
|
+
* @param remotePath - Remote directory path on the FTP server
|
|
176
|
+
* @returns Array of file information metadata
|
|
177
|
+
*
|
|
178
|
+
* @throws {EastError} When listing fails due to:
|
|
179
|
+
* - Invalid connection handle (location: "ftp_list")
|
|
180
|
+
* - Directory not found (location: "ftp_list")
|
|
181
|
+
* - Permission denied (location: "ftp_list")
|
|
182
|
+
* - Network errors (location: "ftp_list")
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* import { East, StringType, ArrayType } from "@elaraai/east";
|
|
187
|
+
* import { Transfer } from "@elaraai/east-node-io";
|
|
188
|
+
*
|
|
189
|
+
* const listFiles = East.function([StringType], ArrayType(Transfer.FTP.Types.FileInfo), ($, remotePath) => {
|
|
190
|
+
* const config = $.let({
|
|
191
|
+
* host: "ftp.example.com",
|
|
192
|
+
* port: 21n,
|
|
193
|
+
* user: "username",
|
|
194
|
+
* password: "password",
|
|
195
|
+
* secure: false,
|
|
196
|
+
* });
|
|
197
|
+
* const conn = $.let(Transfer.FTP.connect(config));
|
|
198
|
+
* const files = $.let(Transfer.FTP.list(conn, remotePath));
|
|
199
|
+
* $(Transfer.FTP.close(conn));
|
|
200
|
+
* return $.return(files);
|
|
201
|
+
* });
|
|
202
|
+
*
|
|
203
|
+
* const compiled = East.compileAsync(listFiles.toIR(), Transfer.FTP.Implementation);
|
|
204
|
+
* const uploads = await compiled("/uploads"); // [{name: "file.txt", size: 1024n, ...}, ...]
|
|
205
|
+
* ```
|
|
206
|
+
*
|
|
207
|
+
* @remarks
|
|
208
|
+
* - Returns both files and directories
|
|
209
|
+
* - Use isDirectory field to distinguish between files and directories
|
|
210
|
+
*/
|
|
211
|
+
export declare const ftp_list: import("@elaraai/east").AsyncPlatformDefinition<[StringType, StringType], ArrayType<import("@elaraai/east").StructType<{
|
|
212
|
+
name: StringType;
|
|
213
|
+
path: StringType;
|
|
214
|
+
size: import("@elaraai/east").IntegerType;
|
|
215
|
+
isDirectory: import("@elaraai/east").BooleanType;
|
|
216
|
+
modifiedTime: StringType;
|
|
217
|
+
}>>>;
|
|
218
|
+
/**
|
|
219
|
+
* Deletes a file from an FTP server.
|
|
220
|
+
*
|
|
221
|
+
* Removes a file from the FTP server at the specified remote path.
|
|
222
|
+
* Does not delete directories.
|
|
223
|
+
*
|
|
224
|
+
* This is a platform function for the East language, enabling FTP file transfer
|
|
225
|
+
* operations in East programs running on Node.js.
|
|
226
|
+
*
|
|
227
|
+
* @param handle - Connection handle from ftp_connect()
|
|
228
|
+
* @param remotePath - Remote file path to delete
|
|
229
|
+
* @returns Null on success
|
|
230
|
+
*
|
|
231
|
+
* @throws {EastError} When deletion fails due to:
|
|
232
|
+
* - Invalid connection handle (location: "ftp_delete")
|
|
233
|
+
* - File not found (location: "ftp_delete")
|
|
234
|
+
* - Permission denied (location: "ftp_delete")
|
|
235
|
+
* - Network errors (location: "ftp_delete")
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```ts
|
|
239
|
+
* import { East, StringType, NullType } from "@elaraai/east";
|
|
240
|
+
* import { Transfer } from "@elaraai/east-node-io";
|
|
241
|
+
*
|
|
242
|
+
* const deleteFile = East.function([StringType], NullType, ($, filename) => {
|
|
243
|
+
* const config = $.let({
|
|
244
|
+
* host: "ftp.example.com",
|
|
245
|
+
* port: 21n,
|
|
246
|
+
* user: "username",
|
|
247
|
+
* password: "password",
|
|
248
|
+
* secure: false,
|
|
249
|
+
* });
|
|
250
|
+
* const conn = $.let(Transfer.FTP.connect(config));
|
|
251
|
+
* $(Transfer.FTP.delete(conn, `/uploads/${filename}`));
|
|
252
|
+
* $(Transfer.FTP.close(conn));
|
|
253
|
+
* return $.return(null);
|
|
254
|
+
* });
|
|
255
|
+
*
|
|
256
|
+
* const compiled = East.compileAsync(deleteFile.toIR(), Transfer.FTP.Implementation);
|
|
257
|
+
* await compiled("old-file.txt");
|
|
258
|
+
* ```
|
|
259
|
+
*
|
|
260
|
+
* @remarks
|
|
261
|
+
* - Only deletes files, not directories
|
|
262
|
+
* - Throws error if file doesn't exist
|
|
263
|
+
*/
|
|
264
|
+
export declare const ftp_delete: import("@elaraai/east").AsyncPlatformDefinition<[StringType, StringType], NullType>;
|
|
265
|
+
/**
|
|
266
|
+
* Closes an FTP connection.
|
|
267
|
+
*
|
|
268
|
+
* Closes the FTP connection and releases all resources.
|
|
269
|
+
* The handle becomes invalid after this operation.
|
|
270
|
+
*
|
|
271
|
+
* @param handle - Connection handle from ftp_connect()
|
|
272
|
+
* @returns Null on success
|
|
273
|
+
*
|
|
274
|
+
* @throws {EastError} When handle is invalid (location: "ftp_close")
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* ```ts
|
|
278
|
+
* import { East, NullType } from "@elaraai/east";
|
|
279
|
+
* import { Transfer } from "@elaraai/east-node-io";
|
|
280
|
+
*
|
|
281
|
+
* const cleanup = East.function([], NullType, $ => {
|
|
282
|
+
* const config = $.let({
|
|
283
|
+
* host: "ftp.example.com",
|
|
284
|
+
* port: 21n,
|
|
285
|
+
* user: "username",
|
|
286
|
+
* password: "password",
|
|
287
|
+
* secure: false,
|
|
288
|
+
* });
|
|
289
|
+
* const conn = $.let(Transfer.FTP.connect(config));
|
|
290
|
+
* // ... do work ...
|
|
291
|
+
* $(Transfer.FTP.close(conn));
|
|
292
|
+
* return $.return(null);
|
|
293
|
+
* });
|
|
294
|
+
*
|
|
295
|
+
* const compiled = East.compileAsync(cleanup.toIR(), Transfer.FTP.Implementation);
|
|
296
|
+
* await compiled();
|
|
297
|
+
* ```
|
|
298
|
+
*/
|
|
299
|
+
export declare const ftp_close: import("@elaraai/east").PlatformDefinition<[StringType], NullType>;
|
|
300
|
+
/**
|
|
301
|
+
* Closes all FTP connections.
|
|
302
|
+
*
|
|
303
|
+
* Closes all active FTP connections and releases all resources.
|
|
304
|
+
* Useful for test cleanup to ensure all connections are closed.
|
|
305
|
+
*
|
|
306
|
+
* @returns Null on success
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* ```ts
|
|
310
|
+
* import { East, NullType } from "@elaraai/east";
|
|
311
|
+
* import { Transfer } from "@elaraai/east-node-io";
|
|
312
|
+
*
|
|
313
|
+
* const cleanupAll = East.function([], NullType, $ => {
|
|
314
|
+
* // ... test code that may have left connections open ...
|
|
315
|
+
* $(Transfer.FTP.closeAll());
|
|
316
|
+
* return $.return(null);
|
|
317
|
+
* });
|
|
318
|
+
*
|
|
319
|
+
* const compiled = East.compileAsync(cleanupAll.toIR(), Transfer.FTP.Implementation);
|
|
320
|
+
* await compiled();
|
|
321
|
+
* ```
|
|
322
|
+
*
|
|
323
|
+
* @internal
|
|
324
|
+
*/
|
|
325
|
+
export declare const ftp_close_all: import("@elaraai/east").AsyncPlatformDefinition<[], NullType>;
|
|
326
|
+
/**
|
|
327
|
+
* Node.js implementation of FTP platform functions.
|
|
328
|
+
*
|
|
329
|
+
* Provides the runtime implementations for FTP operations using basic-ftp.
|
|
330
|
+
* Pass this to East.compileAsync() to enable FTP functionality.
|
|
331
|
+
*/
|
|
332
|
+
export declare const FtpImpl: PlatformFunction[];
|
|
333
|
+
//# sourceMappingURL=ftp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ftp.d.ts","sourceRoot":"","sources":["../../src/transfer/ftp.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAAQ,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAK/D,OAAO,EAAuC,UAAU,EAAgB,MAAM,YAAY,CAAC;AAE3F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,WAAW;;;;;;gBAA2E,CAAC;AAEpG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,eAAO,MAAM,OAAO,+FAAwF,CAAC;AAE7G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,OAAO,qFAA8E,CAAC;AAEnG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,QAAQ;;;;;;IAA8F,CAAC;AAEpH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,UAAU,qFAAiF,CAAC;AAEzG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,SAAS,oEAA+D,CAAC;AAEtF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,aAAa,+DAAoD,CAAC;AAE/E;;;;;GAKG;AACH,eAAO,MAAM,OAAO,EAAE,gBAAgB,EAuIrC,CAAC"}
|