name: east-node-io
description: I/O platform functions for the East language on Node.js. Use when writing East programs that need SQL databases (SQLite, PostgreSQL, MySQL), NoSQL databases (Redis, MongoDB), S3 storage, file transfers (FTP, SFTP), file format parsing (XLSX, XML), or compression (Gzip, Zip, Tar). Triggers for: (1) Writing East programs with @elaraai/east-node-io, (2) Database operations with SQL.SQLite, SQL.Postgres, SQL.MySQL, NoSQL.Redis, NoSQL.MongoDB, (3) Cloud storage with Storage.S3, (4) File transfers with Transfer.FTP, Transfer.SFTP, (5) Format parsing with Format.XLSX, Format.XML, (6) Compression with Compression.Gzip, Compression.Zip, Compression.Tar.
East Node IO
I/O platform functions for the East language on Node.js. Enables East programs to interact with databases, cloud storage, file transfers, and data formats.
Quick Start
import { East, StringType, NullType } from "@elaraai/east";
import { SQL, Storage } from "@elaraai/east-node-io";
const queryDatabase = East.function([StringType], NullType, ($, userId) => {
const config = $.let({
host: "localhost",
port: 5432n,
database: "myapp",
user: "postgres",
password: "secret",
ssl: East.variant('none', null),
maxConnections: East.variant('none', null),
});
const conn = $.let(SQL.Postgres.connect(config));
$(SQL.Postgres.query(conn, "SELECT * FROM users WHERE id = $1", [East.variant("Integer", 42n)]));
$(SQL.Postgres.close(conn));
});
// Compile with specific module Implementation
const compiled = East.compileAsync(queryDatabase.toIR(), SQL.Postgres.Implementation);
await compiled("user123");
Decision Tree: Which Module to Use
Task → What do you need?
│
├─ SQL Database
│ ├─ SQL.SQLite (embedded, placeholder: ?)
│ │ └─ .connect(), .query(), .close()
│ ├─ SQL.Postgres (placeholder: $1, $2, ...)
│ │ └─ .connect(), .query(), .close()
│ └─ SQL.MySQL (placeholder: ?)
│ └─ .connect(), .query(), .close()
│
├─ NoSQL Database
│ ├─ NoSQL.Redis (key-value cache)
│ │ └─ .connect(), .get(), .set(), .setex(), .del(), .close()
│ └─ NoSQL.MongoDB (document store)
│ └─ .connect(), .insertOne(), .findOne(), .find(), .updateOne(), .deleteOne(), .close()
│
├─ Storage.S3 (S3-compatible object storage)
│ └─ .putObject(), .getObject(), .deleteObject(), .headObject(), .listObjects(), .presignUrl()
│
├─ Transfer (file transfers)
│ ├─ Transfer.FTP
│ │ └─ .connect(), .put(), .get(), .list(), .delete(), .close()
│ └─ Transfer.SFTP
│ └─ .connect(), .put(), .get(), .list(), .delete(), .close()
│
├─ Format (file parsing)
│ ├─ Format.XLSX (Excel spreadsheets)
│ │ └─ .read(), .write(), .info()
│ └─ Format.XML
│ └─ .parse(), .serialize()
│
└─ Compression
├─ Compression.Gzip (single file)
│ └─ .compress(), .decompress()
├─ Compression.Zip (archive)
│ └─ .compress(), .decompress()
└─ Compression.Tar (archive)
└─ .create(), .extract()
Compiling East Programs
Use specific module implementations:
// Single module
const compiled = East.compileAsync(myFunction.toIR(), SQL.Postgres.Implementation);
// Multiple modules
const compiled = East.compileAsync(
myFunction.toIR(),
[...SQL.Postgres.Implementation, ...Storage.S3.Implementation]
);
Reference Documentation
- API Reference - Complete function signatures, types, and arguments for all modules
- Examples - Working code examples by use case
Available Modules
| Module |
Import |
Purpose |
| SQL.SQLite |
import { SQL } from "@elaraai/east-node-io" |
SQLite database (placeholder: ?) |
| SQL.Postgres |
import { SQL } from "@elaraai/east-node-io" |
PostgreSQL database (placeholder: $1, $2) |
| SQL.MySQL |
import { SQL } from "@elaraai/east-node-io" |
MySQL database (placeholder: ?) |
| Storage.S3 |
import { Storage } from "@elaraai/east-node-io" |
S3 and S3-compatible storage |
| Transfer.FTP |
import { Transfer } from "@elaraai/east-node-io" |
FTP file transfers |
| Transfer.SFTP |
import { Transfer } from "@elaraai/east-node-io" |
SFTP file transfers |
| NoSQL.Redis |
import { NoSQL } from "@elaraai/east-node-io" |
Redis key-value store |
| NoSQL.MongoDB |
import { NoSQL } from "@elaraai/east-node-io" |
MongoDB document database |
| Format.XLSX |
import { Format } from "@elaraai/east-node-io" |
Excel spreadsheet parsing |
| Format.XML |
import { Format } from "@elaraai/east-node-io" |
XML parsing and serialization |
| Compression.Gzip |
import { Compression } from "@elaraai/east-node-io" |
Gzip compression |
| Compression.Zip |
import { Compression } from "@elaraai/east-node-io" |
ZIP archive creation/extraction |
| Compression.Tar |
import { Compression } from "@elaraai/east-node-io" |
TAR archive creation/extraction |
Accessing Types
import { SQL, Storage, NoSQL, Format } from "@elaraai/east-node-io";
// Access types via Module.SubModule.Types.TypeName
const postgresConfig = SQL.Postgres.Types.Config;
const sqlResult = SQL.Postgres.Types.Result;
const s3Config = Storage.S3.Types.Config;
const redisConfig = NoSQL.Redis.Types.Config;
const xlsxSheet = Format.XLSX.Types.Sheet;
Connection Pattern
All connection-based modules follow the same pattern:
// 1. Create config
const config = $.let({ /* connection options */ });
// 2. Connect
const conn = $.let(Module.connect(config));
// 3. Perform operations
$(Module.operation(conn, ...args));
// 4. Close connection
$(Module.close(conn));
1---2name: east-node-io3description: I/O platform functions for the East language on Node.js. Use when writing East programs that need SQL databases (SQLite, PostgreSQL, MySQL), NoSQL databases (Redis, MongoDB), S3 storage, file transfer4---5
6---
7name: east-node-io
8description: I/O platform functions for the East language on Node.js. Use when writing East programs that need SQL databases (SQLite, PostgreSQL, MySQL), NoSQL databases (Redis, MongoDB), S3 storage, file transfers (FTP, SFTP), file format parsing (XLSX, XML), or compression (Gzip, Zip, Tar). Triggers for: (1) Writing East programs with @elaraai/east-node-io, (2) Database operations with SQL.SQLite, SQL.Postgres, SQL.MySQL, NoSQL.Redis, NoSQL.MongoDB, (3) Cloud storage with Storage.S3, (4) File transfers with Transfer.FTP, Transfer.SFTP, (5) Format parsing with Format.XLSX, Format.XML, (6) Compression with Compression.Gzip, Compression.Zip, Compression.Tar.
9---
10
11# East Node IO
12
13I/O platform functions for the East language on Node.js. Enables East programs to interact with databases, cloud storage, file transfers, and data formats.
14
15## Quick Start
16
17```typescript
18import { East, StringType, NullType } from "@elaraai/east";
19import { SQL, Storage } from "@elaraai/east-node-io";
20
21const queryDatabase = East.function([StringType], NullType, ($, userId) => {
22 const config = $.let({
23 host: "localhost",
24 port: 5432n,
25 database: "myapp",
26 user: "postgres",
27 password: "secret",
28 ssl: East.variant('none', null),
29 maxConnections: East.variant('none', null),
30 });
31
32 const conn = $.let(SQL.Postgres.connect(config));
33 $(SQL.Postgres.query(conn, "SELECT * FROM users WHERE id = $1", [East.variant("Integer", 42n)]));
34 $(SQL.Postgres.close(conn));
35});
36
37// Compile with specific module Implementation
38const compiled = East.compileAsync(queryDatabase.toIR(), SQL.Postgres.Implementation);
39await compiled("user123");
40```
41
42## Decision Tree: Which Module to Use
43
44```
45Task → What do you need?
46 │
47 ├─ SQL Database
48 │ ├─ SQL.SQLite (embedded, placeholder: ?)
49 │ │ └─ .connect(), .query(), .close()
50 │ ├─ SQL.Postgres (placeholder: $1, $2, ...)
51 │ │ └─ .connect(), .query(), .close()
52 │ └─ SQL.MySQL (placeholder: ?)
53 │ └─ .connect(), .query(), .close()
54 │
55 ├─ NoSQL Database
56 │ ├─ NoSQL.Redis (key-value cache)
57 │ │ └─ .connect(), .get(), .set(), .setex(), .del(), .close()
58 │ └─ NoSQL.MongoDB (document store)
59 │ └─ .connect(), .insertOne(), .findOne(), .find(), .updateOne(), .deleteOne(), .close()
60 │
61 ├─ Storage.S3 (S3-compatible object storage)
62 │ └─ .putObject(), .getObject(), .deleteObject(), .headObject(), .listObjects(), .presignUrl()
63 │
64 ├─ Transfer (file transfers)
65 │ ├─ Transfer.FTP
66 │ │ └─ .connect(), .put(), .get(), .list(), .delete(), .close()
67 │ └─ Transfer.SFTP
68 │ └─ .connect(), .put(), .get(), .list(), .delete(), .close()
69 │
70 ├─ Format (file parsing)
71 │ ├─ Format.XLSX (Excel spreadsheets)
72 │ │ └─ .read(), .write(), .info()
73 │ └─ Format.XML
74 │ └─ .parse(), .serialize()
75 │
76 └─ Compression
77 ├─ Compression.Gzip (single file)
78 │ └─ .compress(), .decompress()
79 ├─ Compression.Zip (archive)
80 │ └─ .compress(), .decompress()
81 └─ Compression.Tar (archive)
82 └─ .create(), .extract()
83```
84
85## Compiling East Programs
86
87**Use specific module implementations:**
88```typescript
89// Single module
90const compiled = East.compileAsync(myFunction.toIR(), SQL.Postgres.Implementation);
91
92// Multiple modules
93const compiled = East.compileAsync(
94 myFunction.toIR(),
95 [...SQL.Postgres.Implementation, ...Storage.S3.Implementation]
96);
97```
98
99## Reference Documentation
100
101- **[API Reference](./reference/api.md)** - Complete function signatures, types, and arguments for all modules
102- **[Examples](./reference/examples.md)** - Working code examples by use case
103
104## Available Modules
105
106| Module | Import | Purpose |
107|--------|--------|---------|
108| SQL.SQLite | `import { SQL } from "@elaraai/east-node-io"` | SQLite database (placeholder: `?`) |
109| SQL.Postgres | `import { SQL } from "@elaraai/east-node-io"` | PostgreSQL database (placeholder: `$1`, `$2`) |
110| SQL.MySQL | `import { SQL } from "@elaraai/east-node-io"` | MySQL database (placeholder: `?`) |
111| Storage.S3 | `import { Storage } from "@elaraai/east-node-io"` | S3 and S3-compatible storage |
112| Transfer.FTP | `import { Transfer } from "@elaraai/east-node-io"` | FTP file transfers |
113| Transfer.SFTP | `import { Transfer } from "@elaraai/east-node-io"` | SFTP file transfers |
114| NoSQL.Redis | `import { NoSQL } from "@elaraai/east-node-io"` | Redis key-value store |
115| NoSQL.MongoDB | `import { NoSQL } from "@elaraai/east-node-io"` | MongoDB document database |
116| Format.XLSX | `import { Format } from "@elaraai/east-node-io"` | Excel spreadsheet parsing |
117| Format.XML | `import { Format } from "@elaraai/east-node-io"` | XML parsing and serialization |
118| Compression.Gzip | `import { Compression } from "@elaraai/east-node-io"` | Gzip compression |
119| Compression.Zip | `import { Compression } from "@elaraai/east-node-io"` | ZIP archive creation/extraction |
120| Compression.Tar | `import { Compression } from "@elaraai/east-node-io"` | TAR archive creation/extraction |
121
122## Accessing Types
123
124```typescript
125import { SQL, Storage, NoSQL, Format } from "@elaraai/east-node-io";
126
127// Access types via Module.SubModule.Types.TypeName
128const postgresConfig = SQL.Postgres.Types.Config;
129const sqlResult = SQL.Postgres.Types.Result;
130const s3Config = Storage.S3.Types.Config;
131const redisConfig = NoSQL.Redis.Types.Config;
132const xlsxSheet = Format.XLSX.Types.Sheet;
133```
134
135## Connection Pattern
136
137All connection-based modules follow the same pattern:
138
139```typescript
140// 1. Create config
141const config = $.let({ /* connection options */ });
142
143// 2. Connect
144const conn = $.let(Module.connect(config));
145
146// 3. Perform operations
147$(Module.operation(conn, ...args));
148
149// 4. Close connection
150$(Module.close(conn));
151```