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-io-23description: 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.4---56# East Node IO78I/O platform functions for the East language on Node.js. Enables East programs to interact with databases, cloud storage, file transfers, and data formats.910## Quick Start1112```typescript13import { East, StringType, NullType } from "@elaraai/east";14import { SQL, Storage } from "@elaraai/east-node-io";1516const queryDatabase = East.function([StringType], NullType, ($, userId) => {17 const config = $.let({18 host: "localhost",19 port: 5432n,20 database: "myapp",21 user: "postgres",22 password: "secret",23 ssl: East.variant('none', null),24 maxConnections: East.variant('none', null),25 });2627 const conn = $.let(SQL.Postgres.connect(config));28 $(SQL.Postgres.query(conn, "SELECT * FROM users WHERE id = $1", [East.variant("Integer", 42n)]));29 $(SQL.Postgres.close(conn));30});3132// Compile with specific module Implementation33const compiled = East.compileAsync(queryDatabase.toIR(), SQL.Postgres.Implementation);34await compiled("user123");35```3637## Decision Tree: Which Module to Use3839```40Task → What do you need?41 │42 ├─ SQL Database43 │ ├─ SQL.SQLite (embedded, placeholder: ?)44 │ │ └─ .connect(), .query(), .close()45 │ ├─ SQL.Postgres (placeholder: $1, $2, ...)46 │ │ └─ .connect(), .query(), .close()47 │ └─ SQL.MySQL (placeholder: ?)48 │ └─ .connect(), .query(), .close()49 │50 ├─ NoSQL Database51 │ ├─ NoSQL.Redis (key-value cache)52 │ │ └─ .connect(), .get(), .set(), .setex(), .del(), .close()53 │ └─ NoSQL.MongoDB (document store)54 │ └─ .connect(), .insertOne(), .findOne(), .find(), .updateOne(), .deleteOne(), .close()55 │56 ├─ Storage.S3 (S3-compatible object storage)57 │ └─ .putObject(), .getObject(), .deleteObject(), .headObject(), .listObjects(), .presignUrl()58 │59 ├─ Transfer (file transfers)60 │ ├─ Transfer.FTP61 │ │ └─ .connect(), .put(), .get(), .list(), .delete(), .close()62 │ └─ Transfer.SFTP63 │ └─ .connect(), .put(), .get(), .list(), .delete(), .close()64 │65 ├─ Format (file parsing)66 │ ├─ Format.XLSX (Excel spreadsheets)67 │ │ └─ .read(), .write(), .info()68 │ └─ Format.XML69 │ └─ .parse(), .serialize()70 │71 └─ Compression72 ├─ Compression.Gzip (single file)73 │ └─ .compress(), .decompress()74 ├─ Compression.Zip (archive)75 │ └─ .compress(), .decompress()76 └─ Compression.Tar (archive)77 └─ .create(), .extract()78```7980## Compiling East Programs8182**Use specific module implementations:**83```typescript84// Single module85const compiled = East.compileAsync(myFunction.toIR(), SQL.Postgres.Implementation);8687// Multiple modules88const compiled = East.compileAsync(89 myFunction.toIR(),90 [...SQL.Postgres.Implementation, ...Storage.S3.Implementation]91);92```9394## Reference Documentation9596- **[API Reference](./reference/api.md)** - Complete function signatures, types, and arguments for all modules97- **[Examples](./reference/examples.md)** - Working code examples by use case9899## Available Modules100101| Module | Import | Purpose |102|--------|--------|---------|103| SQL.SQLite | `import { SQL } from "@elaraai/east-node-io"` | SQLite database (placeholder: `?`) |104| SQL.Postgres | `import { SQL } from "@elaraai/east-node-io"` | PostgreSQL database (placeholder: `$1`, `$2`) |105| SQL.MySQL | `import { SQL } from "@elaraai/east-node-io"` | MySQL database (placeholder: `?`) |106| Storage.S3 | `import { Storage } from "@elaraai/east-node-io"` | S3 and S3-compatible storage |107| Transfer.FTP | `import { Transfer } from "@elaraai/east-node-io"` | FTP file transfers |108| Transfer.SFTP | `import { Transfer } from "@elaraai/east-node-io"` | SFTP file transfers |109| NoSQL.Redis | `import { NoSQL } from "@elaraai/east-node-io"` | Redis key-value store |110| NoSQL.MongoDB | `import { NoSQL } from "@elaraai/east-node-io"` | MongoDB document database |111| Format.XLSX | `import { Format } from "@elaraai/east-node-io"` | Excel spreadsheet parsing |112| Format.XML | `import { Format } from "@elaraai/east-node-io"` | XML parsing and serialization |113| Compression.Gzip | `import { Compression } from "@elaraai/east-node-io"` | Gzip compression |114| Compression.Zip | `import { Compression } from "@elaraai/east-node-io"` | ZIP archive creation/extraction |115| Compression.Tar | `import { Compression } from "@elaraai/east-node-io"` | TAR archive creation/extraction |116117## Accessing Types118119```typescript120import { SQL, Storage, NoSQL, Format } from "@elaraai/east-node-io";121122// Access types via Module.SubModule.Types.TypeName123const postgresConfig = SQL.Postgres.Types.Config;124const sqlResult = SQL.Postgres.Types.Result;125const s3Config = Storage.S3.Types.Config;126const redisConfig = NoSQL.Redis.Types.Config;127const xlsxSheet = Format.XLSX.Types.Sheet;128```129130## Connection Pattern131132All connection-based modules follow the same pattern:133134```typescript135// 1. Create config136const config = $.let({ /* connection options */ });137138// 2. Connect139const conn = $.let(Module.connect(config));140141// 3. Perform operations142$(Module.operation(conn, ...args));143144// 4. Close connection145$(Module.close(conn));146```