@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.
Files changed (114) hide show
  1. package/dist/compression/gzip.d.ts +108 -0
  2. package/dist/compression/gzip.d.ts.map +1 -0
  3. package/dist/compression/gzip.js +153 -0
  4. package/dist/compression/gzip.js.map +1 -0
  5. package/dist/compression/index.d.ts +308 -0
  6. package/dist/compression/index.d.ts.map +1 -0
  7. package/dist/compression/index.js +289 -0
  8. package/dist/compression/index.js.map +1 -0
  9. package/dist/compression/tar.d.ts +115 -0
  10. package/dist/compression/tar.d.ts.map +1 -0
  11. package/dist/compression/tar.js +254 -0
  12. package/dist/compression/tar.js.map +1 -0
  13. package/dist/compression/types.d.ts +124 -0
  14. package/dist/compression/types.d.ts.map +1 -0
  15. package/dist/compression/types.js +106 -0
  16. package/dist/compression/types.js.map +1 -0
  17. package/dist/compression/zip.d.ts +121 -0
  18. package/dist/compression/zip.d.ts.map +1 -0
  19. package/dist/compression/zip.js +200 -0
  20. package/dist/compression/zip.js.map +1 -0
  21. package/dist/connection/index.d.ts +78 -0
  22. package/dist/connection/index.d.ts.map +1 -0
  23. package/dist/connection/index.js +134 -0
  24. package/dist/connection/index.js.map +1 -0
  25. package/dist/format/csv.d.ts +210 -0
  26. package/dist/format/csv.d.ts.map +1 -0
  27. package/dist/format/csv.js +729 -0
  28. package/dist/format/csv.js.map +1 -0
  29. package/dist/format/index.d.ts +641 -0
  30. package/dist/format/index.d.ts.map +1 -0
  31. package/dist/format/index.js +463 -0
  32. package/dist/format/index.js.map +1 -0
  33. package/dist/format/types.d.ts +176 -0
  34. package/dist/format/types.d.ts.map +1 -0
  35. package/dist/format/types.js +122 -0
  36. package/dist/format/types.js.map +1 -0
  37. package/dist/format/xlsx.d.ts +178 -0
  38. package/dist/format/xlsx.d.ts.map +1 -0
  39. package/dist/format/xlsx.js +313 -0
  40. package/dist/format/xlsx.js.map +1 -0
  41. package/dist/format/xml.d.ts +302 -0
  42. package/dist/format/xml.d.ts.map +1 -0
  43. package/dist/format/xml.js +602 -0
  44. package/dist/format/xml.js.map +1 -0
  45. package/dist/index.d.ts +25 -0
  46. package/dist/index.d.ts.map +1 -0
  47. package/dist/index.js +32 -0
  48. package/dist/index.js.map +1 -0
  49. package/dist/nosql/index.d.ts +503 -0
  50. package/dist/nosql/index.d.ts.map +1 -0
  51. package/dist/nosql/index.js +483 -0
  52. package/dist/nosql/index.js.map +1 -0
  53. package/dist/nosql/mongodb.d.ts +306 -0
  54. package/dist/nosql/mongodb.d.ts.map +1 -0
  55. package/dist/nosql/mongodb.js +552 -0
  56. package/dist/nosql/mongodb.js.map +1 -0
  57. package/dist/nosql/redis.d.ts +268 -0
  58. package/dist/nosql/redis.d.ts.map +1 -0
  59. package/dist/nosql/redis.js +371 -0
  60. package/dist/nosql/redis.js.map +1 -0
  61. package/dist/nosql/types.d.ts +70 -0
  62. package/dist/nosql/types.d.ts.map +1 -0
  63. package/dist/nosql/types.js +79 -0
  64. package/dist/nosql/types.js.map +1 -0
  65. package/dist/sql/index.d.ts +777 -0
  66. package/dist/sql/index.d.ts.map +1 -0
  67. package/dist/sql/index.js +515 -0
  68. package/dist/sql/index.js.map +1 -0
  69. package/dist/sql/mysql.d.ts +238 -0
  70. package/dist/sql/mysql.d.ts.map +1 -0
  71. package/dist/sql/mysql.js +396 -0
  72. package/dist/sql/mysql.js.map +1 -0
  73. package/dist/sql/postgres.d.ts +237 -0
  74. package/dist/sql/postgres.d.ts.map +1 -0
  75. package/dist/sql/postgres.js +381 -0
  76. package/dist/sql/postgres.js.map +1 -0
  77. package/dist/sql/sqlite.d.ts +217 -0
  78. package/dist/sql/sqlite.d.ts.map +1 -0
  79. package/dist/sql/sqlite.js +366 -0
  80. package/dist/sql/sqlite.js.map +1 -0
  81. package/dist/sql/types.d.ts +205 -0
  82. package/dist/sql/types.d.ts.map +1 -0
  83. package/dist/sql/types.js +175 -0
  84. package/dist/sql/types.js.map +1 -0
  85. package/dist/storage/index.d.ts +304 -0
  86. package/dist/storage/index.d.ts.map +1 -0
  87. package/dist/storage/index.js +234 -0
  88. package/dist/storage/index.js.map +1 -0
  89. package/dist/storage/s3.d.ts +373 -0
  90. package/dist/storage/s3.d.ts.map +1 -0
  91. package/dist/storage/s3.js +502 -0
  92. package/dist/storage/s3.js.map +1 -0
  93. package/dist/storage/types.d.ts +117 -0
  94. package/dist/storage/types.d.ts.map +1 -0
  95. package/dist/storage/types.js +94 -0
  96. package/dist/storage/types.js.map +1 -0
  97. package/dist/transfer/ftp.d.ts +333 -0
  98. package/dist/transfer/ftp.d.ts.map +1 -0
  99. package/dist/transfer/ftp.js +437 -0
  100. package/dist/transfer/ftp.js.map +1 -0
  101. package/dist/transfer/index.d.ts +456 -0
  102. package/dist/transfer/index.d.ts.map +1 -0
  103. package/dist/transfer/index.js +414 -0
  104. package/dist/transfer/index.js.map +1 -0
  105. package/dist/transfer/sftp.d.ts +333 -0
  106. package/dist/transfer/sftp.d.ts.map +1 -0
  107. package/dist/transfer/sftp.js +436 -0
  108. package/dist/transfer/sftp.js.map +1 -0
  109. package/dist/transfer/types.d.ts +108 -0
  110. package/dist/transfer/types.d.ts.map +1 -0
  111. package/dist/transfer/types.js +110 -0
  112. package/dist/transfer/types.js.map +1 -0
  113. package/dist/tsconfig.tsbuildinfo +1 -0
  114. package/package.json +8 -8
@@ -0,0 +1,304 @@
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
+ * Cloud storage platform functions.
7
+ *
8
+ * Provides S3 and S3-compatible object storage operations for East programs,
9
+ * supporting upload, download, delete, list, and presigned URL generation.
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ export * from "./s3.js";
14
+ export * from "./types.js";
15
+ /**
16
+ * Cloud storage platform functions.
17
+ *
18
+ * Provides S3 and S3-compatible object storage operations for East programs,
19
+ * including upload, download, delete, list, and presigned URL generation.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * import { East, StringType, BlobType } from "@elaraai/east";
24
+ * import { Storage } from "@elaraai/east-node-io";
25
+ *
26
+ * const uploadFile = East.function([StringType, BlobType], StringType, ($, filename, data) => {
27
+ * const config = $.let({
28
+ * region: "us-east-1",
29
+ * bucket: "my-bucket",
30
+ * accessKeyId: variant('some',"AKIAIOSFODNN7EXAMPLE"),
31
+ * secretAccessKey: variant('some',"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"),
32
+ * endpoint: variant('none', null),
33
+ * });
34
+ *
35
+ * // Upload the file
36
+ * $(Storage.S3.putObject(config, filename, data));
37
+ *
38
+ * // Generate presigned URL for sharing (valid for 1 hour)
39
+ * $.return(Storage.S3.presignUrl(config, filename, 3600n));
40
+ * });
41
+ *
42
+ * const compiled = East.compileAsync(uploadFile.toIR(), Storage.S3.Implementation);
43
+ * const shareableUrl = await compiled("report.pdf", pdfBlob);
44
+ * ```
45
+ */
46
+ export declare const Storage: {
47
+ /**
48
+ * S3 and S3-compatible object storage operations.
49
+ *
50
+ * Provides platform functions for Amazon S3, MinIO, DigitalOcean Spaces,
51
+ * and other S3-compatible object storage services.
52
+ */
53
+ readonly S3: {
54
+ /**
55
+ * Uploads an object to S3.
56
+ *
57
+ * Uploads binary data to an S3 bucket with the specified key (path).
58
+ * Overwrites existing objects with the same key.
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * const uploadFile = East.function([StringType, BlobType], NullType, ($, filename, data) => {
63
+ * const config = $.let({
64
+ * region: "us-east-1",
65
+ * bucket: "my-bucket",
66
+ * accessKeyId: variant('none', null),
67
+ * secretAccessKey: variant('none', null),
68
+ * endpoint: variant('none', null),
69
+ * });
70
+ *
71
+ * $(Storage.S3.putObject(config, filename, data));
72
+ * });
73
+ *
74
+ * const compiled = East.compileAsync(uploadFile.toIR(), Storage.S3.Implementation);
75
+ * await compiled("report.pdf", pdfData);
76
+ * ```
77
+ */
78
+ readonly putObject: import("@elaraai/east").AsyncPlatformDefinition<[import("@elaraai/east").StructType<{
79
+ region: import("@elaraai/east").StringType;
80
+ bucket: import("@elaraai/east").StringType;
81
+ accessKeyId: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
82
+ secretAccessKey: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
83
+ endpoint: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
84
+ }>, import("@elaraai/east").StringType, import("@elaraai/east").BlobType], import("@elaraai/east").NullType>;
85
+ /**
86
+ * Downloads an object from S3.
87
+ *
88
+ * Retrieves binary data from an S3 bucket by key (path).
89
+ * Returns the object data as a Blob (Uint8Array).
90
+ *
91
+ * @example
92
+ * ```ts
93
+ * const downloadFile = East.function([StringType], BlobType, ($, filename) => {
94
+ * const config = $.let({
95
+ * region: "us-east-1",
96
+ * bucket: "my-bucket",
97
+ * accessKeyId: variant('none', null),
98
+ * secretAccessKey: variant('none', null),
99
+ * endpoint: variant('none', null),
100
+ * });
101
+ *
102
+ * $.return(Storage.S3.getObject(config, filename));
103
+ * });
104
+ *
105
+ * const compiled = East.compileAsync(downloadFile.toIR(), Storage.S3.Implementation);
106
+ * await compiled("report.pdf"); // Uint8Array containing PDF data
107
+ * ```
108
+ */
109
+ readonly getObject: import("@elaraai/east").AsyncPlatformDefinition<[import("@elaraai/east").StructType<{
110
+ region: import("@elaraai/east").StringType;
111
+ bucket: import("@elaraai/east").StringType;
112
+ accessKeyId: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
113
+ secretAccessKey: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
114
+ endpoint: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
115
+ }>, import("@elaraai/east").StringType], import("@elaraai/east").BlobType>;
116
+ /**
117
+ * Retrieves object metadata without downloading.
118
+ *
119
+ * Gets metadata for an S3 object including size, ETag (hash), last modified time,
120
+ * and content type. Useful for checking if a file has changed by comparing ETags.
121
+ *
122
+ * @example
123
+ * ```ts
124
+ * const getMetadata = East.function([StringType], S3ObjectMetadataType, ($, filename) => {
125
+ * const config = $.let({
126
+ * region: "us-east-1",
127
+ * bucket: "my-bucket",
128
+ * accessKeyId: variant('none', null),
129
+ * secretAccessKey: variant('none', null),
130
+ * endpoint: variant('none', null),
131
+ * });
132
+ *
133
+ * const metadata = $.let(Storage.S3.headObject(config, filename));
134
+ * $.return(metadata);
135
+ * });
136
+ *
137
+ * const compiled = East.compileAsync(getMetadata.toIR(), Storage.S3.Implementation);
138
+ * await compiled("report.pdf"); // {size: 12345n, contentType: variant('some', "application/pdf"), ...}
139
+ * ```
140
+ */
141
+ readonly headObject: import("@elaraai/east").AsyncPlatformDefinition<[import("@elaraai/east").StructType<{
142
+ region: import("@elaraai/east").StringType;
143
+ bucket: import("@elaraai/east").StringType;
144
+ accessKeyId: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
145
+ secretAccessKey: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
146
+ endpoint: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
147
+ }>, import("@elaraai/east").StringType], import("@elaraai/east").StructType<{
148
+ key: import("@elaraai/east").StringType;
149
+ size: import("@elaraai/east").IntegerType;
150
+ lastModified: import("@elaraai/east").DateTimeType;
151
+ contentType: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
152
+ etag: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
153
+ }>>;
154
+ /**
155
+ * Deletes an object from S3.
156
+ *
157
+ * Removes an object from an S3 bucket by key (path).
158
+ * Succeeds even if the object doesn't exist (idempotent).
159
+ *
160
+ * @example
161
+ * ```ts
162
+ * const deleteFile = East.function([StringType], NullType, ($, filename) => {
163
+ * const config = $.let({
164
+ * region: "us-east-1",
165
+ * bucket: "my-bucket",
166
+ * accessKeyId: variant('none', null),
167
+ * secretAccessKey: variant('none', null),
168
+ * endpoint: variant('none', null),
169
+ * });
170
+ *
171
+ * $(Storage.S3.deleteObject(config, filename));
172
+ * });
173
+ *
174
+ * const compiled = East.compileAsync(deleteFile.toIR(), Storage.S3.Implementation);
175
+ * await compiled("old-report.pdf");
176
+ * ```
177
+ */
178
+ readonly deleteObject: import("@elaraai/east").AsyncPlatformDefinition<[import("@elaraai/east").StructType<{
179
+ region: import("@elaraai/east").StringType;
180
+ bucket: import("@elaraai/east").StringType;
181
+ accessKeyId: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
182
+ secretAccessKey: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
183
+ endpoint: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
184
+ }>, import("@elaraai/east").StringType], import("@elaraai/east").NullType>;
185
+ /**
186
+ * Lists objects in an S3 bucket with a prefix.
187
+ *
188
+ * Retrieves metadata for objects matching a prefix, with pagination support.
189
+ * Returns up to `maxKeys` objects per request.
190
+ *
191
+ * @example
192
+ * ```ts
193
+ * const listFiles = East.function([StringType], S3ListResultType, ($, prefix) => {
194
+ * const config = $.let({
195
+ * region: "us-east-1",
196
+ * bucket: "my-bucket",
197
+ * accessKeyId: variant('none', null),
198
+ * secretAccessKey: variant('none', null),
199
+ * endpoint: variant('none', null),
200
+ * });
201
+ *
202
+ * $.return(Storage.S3.listObjects(config, prefix, 100n));
203
+ * });
204
+ *
205
+ * const compiled = East.compileAsync(listFiles.toIR(), Storage.S3.Implementation);
206
+ * const result = await compiled("files/"); // {objects: [...], isTruncated: false, ...}
207
+ * ```
208
+ */
209
+ readonly listObjects: import("@elaraai/east").AsyncPlatformDefinition<[import("@elaraai/east").StructType<{
210
+ region: import("@elaraai/east").StringType;
211
+ bucket: import("@elaraai/east").StringType;
212
+ accessKeyId: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
213
+ secretAccessKey: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
214
+ endpoint: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
215
+ }>, import("@elaraai/east").StringType, import("@elaraai/east").IntegerType], import("@elaraai/east").StructType<{
216
+ objects: import("@elaraai/east").ArrayType<import("@elaraai/east").StructType<{
217
+ key: import("@elaraai/east").StringType;
218
+ size: import("@elaraai/east").IntegerType;
219
+ lastModified: import("@elaraai/east").DateTimeType;
220
+ contentType: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
221
+ etag: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
222
+ }>>;
223
+ isTruncated: import("@elaraai/east").BooleanType;
224
+ continuationToken: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
225
+ }>>;
226
+ /**
227
+ * Generates a presigned URL for temporary access to an S3 object.
228
+ *
229
+ * Creates a signed URL that grants temporary access to an object without
230
+ * requiring AWS credentials. Useful for sharing files or client-side uploads.
231
+ *
232
+ * @example
233
+ * ```ts
234
+ * const shareFile = East.function([StringType], StringType, ($, filename) => {
235
+ * const config = $.let({
236
+ * region: "us-east-1",
237
+ * bucket: "my-bucket",
238
+ * accessKeyId: variant('some',"AKIAIOSFODNN7EXAMPLE"),
239
+ * secretAccessKey: variant('some',"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"),
240
+ * endpoint: variant('none', null),
241
+ * });
242
+ *
243
+ * $.return(Storage.S3.presignUrl(config, filename, 3600n)); // 1 hour expiration
244
+ * });
245
+ *
246
+ * const compiled = East.compileAsync(shareFile.toIR(), Storage.S3.Implementation);
247
+ * const url = await compiled("report.pdf"); // "https://my-bucket.s3.amazonaws.com/..."
248
+ * ```
249
+ */
250
+ readonly presignUrl: import("@elaraai/east").AsyncPlatformDefinition<[import("@elaraai/east").StructType<{
251
+ region: import("@elaraai/east").StringType;
252
+ bucket: import("@elaraai/east").StringType;
253
+ accessKeyId: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
254
+ secretAccessKey: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
255
+ endpoint: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
256
+ }>, import("@elaraai/east").StringType, import("@elaraai/east").IntegerType], import("@elaraai/east").StringType>;
257
+ /**
258
+ * Node.js implementation of S3 platform functions.
259
+ *
260
+ * Pass this to East.compileAsync() to enable S3 operations.
261
+ */
262
+ readonly Implementation: import("@elaraai/east/internal").PlatformFunction[];
263
+ /**
264
+ * Type definitions for S3 operations.
265
+ */
266
+ readonly Types: {
267
+ /**
268
+ * S3 connection configuration type.
269
+ */
270
+ readonly Config: import("@elaraai/east").StructType<{
271
+ region: import("@elaraai/east").StringType;
272
+ bucket: import("@elaraai/east").StringType;
273
+ accessKeyId: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
274
+ secretAccessKey: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
275
+ endpoint: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
276
+ }>;
277
+ /**
278
+ * S3 object metadata type.
279
+ */
280
+ readonly ObjectMetadata: import("@elaraai/east").StructType<{
281
+ key: import("@elaraai/east").StringType;
282
+ size: import("@elaraai/east").IntegerType;
283
+ lastModified: import("@elaraai/east").DateTimeType;
284
+ contentType: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
285
+ etag: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
286
+ }>;
287
+ /**
288
+ * S3 list objects result type.
289
+ */
290
+ readonly ListResult: import("@elaraai/east").StructType<{
291
+ objects: import("@elaraai/east").ArrayType<import("@elaraai/east").StructType<{
292
+ key: import("@elaraai/east").StringType;
293
+ size: import("@elaraai/east").IntegerType;
294
+ lastModified: import("@elaraai/east").DateTimeType;
295
+ contentType: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
296
+ etag: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
297
+ }>>;
298
+ isTruncated: import("@elaraai/east").BooleanType;
299
+ continuationToken: import("@elaraai/east").OptionType<import("@elaraai/east").StringType>;
300
+ }>;
301
+ };
302
+ };
303
+ };
304
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAGH,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAkB3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,OAAO;IAChB;;;;;OAKG;;QAEC;;;;;;;;;;;;;;;;;;;;;;;WAuBG;;;;;;;;QAGH;;;;;;;;;;;;;;;;;;;;;;;WAuBG;;;;;;;;QAGH;;;;;;;;;;;;;;;;;;;;;;;;WAwBG;;;;;;;;;;;;;;QAGH;;;;;;;;;;;;;;;;;;;;;;;WAuBG;;;;;;;;QAGH;;;;;;;;;;;;;;;;;;;;;;;WAuBG;;;;;;;;;;;;;;;;;;QAGH;;;;;;;;;;;;;;;;;;;;;;;WAuBG;;;;;;;;QAGH;;;;WAIG;;QAGH;;WAEG;;YAEC;;eAEG;;;;;;;;YAGH;;eAEG;;;;;;;;YAGH;;eAEG;;;;;;;;;;;;;;CAIL,CAAC"}
@@ -0,0 +1,234 @@
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
+ * Cloud storage platform functions.
7
+ *
8
+ * Provides S3 and S3-compatible object storage operations for East programs,
9
+ * supporting upload, download, delete, list, and presigned URL generation.
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ // Export individual modules
14
+ export * from "./s3.js";
15
+ export * from "./types.js";
16
+ // Import for grouped exports
17
+ import { s3_put_object, s3_get_object, s3_head_object, s3_delete_object, s3_list_objects, s3_presign_url, S3Impl } from "./s3.js";
18
+ import { S3ConfigType, S3ObjectMetadataType, S3ListResultType } from "./types.js";
19
+ /**
20
+ * Cloud storage platform functions.
21
+ *
22
+ * Provides S3 and S3-compatible object storage operations for East programs,
23
+ * including upload, download, delete, list, and presigned URL generation.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * import { East, StringType, BlobType } from "@elaraai/east";
28
+ * import { Storage } from "@elaraai/east-node-io";
29
+ *
30
+ * const uploadFile = East.function([StringType, BlobType], StringType, ($, filename, data) => {
31
+ * const config = $.let({
32
+ * region: "us-east-1",
33
+ * bucket: "my-bucket",
34
+ * accessKeyId: variant('some',"AKIAIOSFODNN7EXAMPLE"),
35
+ * secretAccessKey: variant('some',"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"),
36
+ * endpoint: variant('none', null),
37
+ * });
38
+ *
39
+ * // Upload the file
40
+ * $(Storage.S3.putObject(config, filename, data));
41
+ *
42
+ * // Generate presigned URL for sharing (valid for 1 hour)
43
+ * $.return(Storage.S3.presignUrl(config, filename, 3600n));
44
+ * });
45
+ *
46
+ * const compiled = East.compileAsync(uploadFile.toIR(), Storage.S3.Implementation);
47
+ * const shareableUrl = await compiled("report.pdf", pdfBlob);
48
+ * ```
49
+ */
50
+ export const Storage = {
51
+ /**
52
+ * S3 and S3-compatible object storage operations.
53
+ *
54
+ * Provides platform functions for Amazon S3, MinIO, DigitalOcean Spaces,
55
+ * and other S3-compatible object storage services.
56
+ */
57
+ S3: {
58
+ /**
59
+ * Uploads an object to S3.
60
+ *
61
+ * Uploads binary data to an S3 bucket with the specified key (path).
62
+ * Overwrites existing objects with the same key.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * const uploadFile = East.function([StringType, BlobType], NullType, ($, filename, data) => {
67
+ * const config = $.let({
68
+ * region: "us-east-1",
69
+ * bucket: "my-bucket",
70
+ * accessKeyId: variant('none', null),
71
+ * secretAccessKey: variant('none', null),
72
+ * endpoint: variant('none', null),
73
+ * });
74
+ *
75
+ * $(Storage.S3.putObject(config, filename, data));
76
+ * });
77
+ *
78
+ * const compiled = East.compileAsync(uploadFile.toIR(), Storage.S3.Implementation);
79
+ * await compiled("report.pdf", pdfData);
80
+ * ```
81
+ */
82
+ putObject: s3_put_object,
83
+ /**
84
+ * Downloads an object from S3.
85
+ *
86
+ * Retrieves binary data from an S3 bucket by key (path).
87
+ * Returns the object data as a Blob (Uint8Array).
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * const downloadFile = East.function([StringType], BlobType, ($, filename) => {
92
+ * const config = $.let({
93
+ * region: "us-east-1",
94
+ * bucket: "my-bucket",
95
+ * accessKeyId: variant('none', null),
96
+ * secretAccessKey: variant('none', null),
97
+ * endpoint: variant('none', null),
98
+ * });
99
+ *
100
+ * $.return(Storage.S3.getObject(config, filename));
101
+ * });
102
+ *
103
+ * const compiled = East.compileAsync(downloadFile.toIR(), Storage.S3.Implementation);
104
+ * await compiled("report.pdf"); // Uint8Array containing PDF data
105
+ * ```
106
+ */
107
+ getObject: s3_get_object,
108
+ /**
109
+ * Retrieves object metadata without downloading.
110
+ *
111
+ * Gets metadata for an S3 object including size, ETag (hash), last modified time,
112
+ * and content type. Useful for checking if a file has changed by comparing ETags.
113
+ *
114
+ * @example
115
+ * ```ts
116
+ * const getMetadata = East.function([StringType], S3ObjectMetadataType, ($, filename) => {
117
+ * const config = $.let({
118
+ * region: "us-east-1",
119
+ * bucket: "my-bucket",
120
+ * accessKeyId: variant('none', null),
121
+ * secretAccessKey: variant('none', null),
122
+ * endpoint: variant('none', null),
123
+ * });
124
+ *
125
+ * const metadata = $.let(Storage.S3.headObject(config, filename));
126
+ * $.return(metadata);
127
+ * });
128
+ *
129
+ * const compiled = East.compileAsync(getMetadata.toIR(), Storage.S3.Implementation);
130
+ * await compiled("report.pdf"); // {size: 12345n, contentType: variant('some', "application/pdf"), ...}
131
+ * ```
132
+ */
133
+ headObject: s3_head_object,
134
+ /**
135
+ * Deletes an object from S3.
136
+ *
137
+ * Removes an object from an S3 bucket by key (path).
138
+ * Succeeds even if the object doesn't exist (idempotent).
139
+ *
140
+ * @example
141
+ * ```ts
142
+ * const deleteFile = East.function([StringType], NullType, ($, filename) => {
143
+ * const config = $.let({
144
+ * region: "us-east-1",
145
+ * bucket: "my-bucket",
146
+ * accessKeyId: variant('none', null),
147
+ * secretAccessKey: variant('none', null),
148
+ * endpoint: variant('none', null),
149
+ * });
150
+ *
151
+ * $(Storage.S3.deleteObject(config, filename));
152
+ * });
153
+ *
154
+ * const compiled = East.compileAsync(deleteFile.toIR(), Storage.S3.Implementation);
155
+ * await compiled("old-report.pdf");
156
+ * ```
157
+ */
158
+ deleteObject: s3_delete_object,
159
+ /**
160
+ * Lists objects in an S3 bucket with a prefix.
161
+ *
162
+ * Retrieves metadata for objects matching a prefix, with pagination support.
163
+ * Returns up to `maxKeys` objects per request.
164
+ *
165
+ * @example
166
+ * ```ts
167
+ * const listFiles = East.function([StringType], S3ListResultType, ($, prefix) => {
168
+ * const config = $.let({
169
+ * region: "us-east-1",
170
+ * bucket: "my-bucket",
171
+ * accessKeyId: variant('none', null),
172
+ * secretAccessKey: variant('none', null),
173
+ * endpoint: variant('none', null),
174
+ * });
175
+ *
176
+ * $.return(Storage.S3.listObjects(config, prefix, 100n));
177
+ * });
178
+ *
179
+ * const compiled = East.compileAsync(listFiles.toIR(), Storage.S3.Implementation);
180
+ * const result = await compiled("files/"); // {objects: [...], isTruncated: false, ...}
181
+ * ```
182
+ */
183
+ listObjects: s3_list_objects,
184
+ /**
185
+ * Generates a presigned URL for temporary access to an S3 object.
186
+ *
187
+ * Creates a signed URL that grants temporary access to an object without
188
+ * requiring AWS credentials. Useful for sharing files or client-side uploads.
189
+ *
190
+ * @example
191
+ * ```ts
192
+ * const shareFile = East.function([StringType], StringType, ($, filename) => {
193
+ * const config = $.let({
194
+ * region: "us-east-1",
195
+ * bucket: "my-bucket",
196
+ * accessKeyId: variant('some',"AKIAIOSFODNN7EXAMPLE"),
197
+ * secretAccessKey: variant('some',"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"),
198
+ * endpoint: variant('none', null),
199
+ * });
200
+ *
201
+ * $.return(Storage.S3.presignUrl(config, filename, 3600n)); // 1 hour expiration
202
+ * });
203
+ *
204
+ * const compiled = East.compileAsync(shareFile.toIR(), Storage.S3.Implementation);
205
+ * const url = await compiled("report.pdf"); // "https://my-bucket.s3.amazonaws.com/..."
206
+ * ```
207
+ */
208
+ presignUrl: s3_presign_url,
209
+ /**
210
+ * Node.js implementation of S3 platform functions.
211
+ *
212
+ * Pass this to East.compileAsync() to enable S3 operations.
213
+ */
214
+ Implementation: S3Impl,
215
+ /**
216
+ * Type definitions for S3 operations.
217
+ */
218
+ Types: {
219
+ /**
220
+ * S3 connection configuration type.
221
+ */
222
+ Config: S3ConfigType,
223
+ /**
224
+ * S3 object metadata type.
225
+ */
226
+ ObjectMetadata: S3ObjectMetadataType,
227
+ /**
228
+ * S3 list objects result type.
229
+ */
230
+ ListResult: S3ListResultType,
231
+ },
232
+ },
233
+ };
234
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,4BAA4B;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAE3B,6BAA6B;AAC7B,OAAO,EACH,aAAa,EACb,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,MAAM,EACT,MAAM,SAAS,CAAC;AACjB,OAAO,EACH,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EACnB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACnB;;;;;OAKG;IACH,EAAE,EAAE;QACA;;;;;;;;;;;;;;;;;;;;;;;WAuBG;QACH,SAAS,EAAE,aAAa;QAExB;;;;;;;;;;;;;;;;;;;;;;;WAuBG;QACH,SAAS,EAAE,aAAa;QAExB;;;;;;;;;;;;;;;;;;;;;;;;WAwBG;QACH,UAAU,EAAE,cAAc;QAE1B;;;;;;;;;;;;;;;;;;;;;;;WAuBG;QACH,YAAY,EAAE,gBAAgB;QAE9B;;;;;;;;;;;;;;;;;;;;;;;WAuBG;QACH,WAAW,EAAE,eAAe;QAE5B;;;;;;;;;;;;;;;;;;;;;;;WAuBG;QACH,UAAU,EAAE,cAAc;QAE1B;;;;WAIG;QACH,cAAc,EAAE,MAAM;QAEtB;;WAEG;QACH,KAAK,EAAE;YACH;;eAEG;YACH,MAAM,EAAE,YAAY;YAEpB;;eAEG;YACH,cAAc,EAAE,oBAAoB;YAEpC;;eAEG;YACH,UAAU,EAAE,gBAAgB;SAC/B;KACJ;CACK,CAAC"}