npm.io
1.0.26 • Published 4d ago

@elaraai/east-node-std

Licence
AGPL-3.0-or-later
Version
1.0.26
Deps
0
Size
330 kB
Vulns
0
Weekly
1.5K

East Node

Node platform functions for the East language

License Node Version

East Node provides Node.js platform integration for the East language. It enables East programs to interact with the Node.js runtime through platform functions for file system operations, console I/O, HTTP requests, cryptography, and more.

Features

  • File System - Read/write files, manage directories
  • Console I/O - stdout/stderr output, stdin input
  • HTTP Client - Modern Fetch API for HTTP requests
  • Cryptography - Random bytes, SHA-256, UUID generation
  • Random - Random number generation with 14 statistical distributions
  • Time Operations - Timestamps and sleep
  • Path Utilities - Cross-platform path manipulation
  • Test Framework - Built-in testing utilities
  • Type-Safe - Full TypeScript support with EastError handling

Installation

npm install @elaraai/east-node-std @elaraai/east

Quick Start

import { East, NullType, StringType } from "@elaraai/east";
import { NodePlatform, Console, FileSystem } from "@elaraai/east-node-std";

// Define an East function using platform functions
const processFile = East.function(
    [StringType],  // Input: file path
    NullType,      // Output: null
    ($, inputPath) => {
        const content = $.let(FileSystem.readFile(inputPath));
        $(Console.log(content));
        $(FileSystem.writeFile("output.txt", content));
    }
);

// Compile with Node.js platform and execute
const compiled = East.compile(processFile.toIR(), NodePlatform);
compiled("/path/to/input.txt");

Platform Functions

East Node provides seven platform modules:

Module Functions Description
Console log, error, write Console I/O operations
FileSystem readFile, writeFile, exists, createDirectory, etc. File system operations (11 functions)
Fetch get, post, request HTTP client using Fetch API
Crypto randomBytes, hashSha256, uuid Cryptographic operations
Time now, sleep Time and delay operations
Path join, resolve, dirname, basename, extname Path manipulation
Random uniform, normal, range, exponential, bernoulli, etc. Random number generation with 14 distributions

Complete platform:

import { NodePlatform } from "@elaraai/east-node-std";
const compiled = East.compile(myFunction.toIR(), NodePlatform);

Individual modules:

import { Console, FileSystem } from "@elaraai/east-node-std";
const compiled = East.compile(myFunction.toIR(), [...Console.Implementation, ...FileSystem.Implementation]);

Documentation

Testing

East Node includes a test framework for East code:

import { describeEast, Test } from "@elaraai/east-node-std";
import { East } from "@elaraai/east";

await describeEast("Math operations", (test) => {
    test("addition works", $ => {
        const result = $.let(East.value(1n).add(2n));
        $(Test.equal(result, 3n));
    });
});

Run tests:

npm test          # Run all tests
make test         # Alternative via Makefile

Development

npm run build     # Compile TypeScript
npm run test      # Run test suite (requires build)
npm run lint      # Check code quality

Security

Platform functions are intentionally limited for sandbox security:

  • No process access (exit, environment variables, command-line arguments)
  • No arbitrary command execution
  • Controlled I/O operations only
  • All operations are type-checked

Claude Code plugin

The East ecosystem also ships a Claude Code plugin — East language skills, example search, and preemptive diagnostics for East code — installed separately from the elaraai marketplace:

# Inside Claude Code
/plugin marketplace add elaraai/east-workspace
/plugin install east@elaraai
# From a terminal
claude plugin marketplace add elaraai/east-workspace
claude plugin install east@elaraai

License

Dual-licensed:

Ecosystem
  • East: Statically typed, expression-based language with serializable IR. Run portable logic across TypeScript, Python, C, and other runtimes.

    • @elaraai/east: Core language SDK with type system, expressions, and reference JS compiler
  • East Node: Node.js platform functions for I/O, databases, and system operations.

  • East C: C11 native runtime for executing East IR. Distributed via npm (launcher + per-platform optional dependencies) and as tarballs on each GitHub Release.

    • @elaraai/east-c-cli: npm launcher — installs the matching native binary as an optional dependency
    • east-c: Core runtime — type system, IR interpreter, builtins, serialization (Beast2, JSON, CSV, East text)
    • east-c-std: Console, FileSystem, Fetch, Crypto, Time, Path, Random
    • east-c-cli: CLI for running East IR programs natively
  • East Python: Python runtime, standard platform, I/O, and data-science platform functions. Published to PyPI.

    • east-py: Core Python runtime — type system, IR compiler, 212+ builtins, Cython-accelerated hot paths
    • east-py-std: Console, FileSystem, Fetch, Crypto, Time, Path, Random
    • east-py-io: SQLite, PostgreSQL, MySQL, MongoDB, Redis, S3, FTP, SFTP, XLSX, XML, compression
    • east-py-cli: CLI for running East IR programs in Python
    • east-py-datascience (PyPI) + @elaraai/east-py-datascience (npm): Optimization (MADS, Optuna, ALNS, GoogleOR), ML (XGBoost, LightGBM, NGBoost, PyTorch, Lightning, GP), Bayesian inference (PyMC), explainability (SHAP), conformal prediction (MAPIE)
  • East UI: Typed UI component definitions and React renderer, plus VS Code preview.

  • e3 — East Execution Engine: Durable execution engine for running East pipelines at scale. Git-like content-addressable storage, automatic memoization, reactive dataflow, real-time monitoring.

About Elara

East is developed by Elara AI Pty Ltd, an AI-powered platform that creates economic digital twins of businesses that optimize performance. Elara combines business objectives, decisions and data to help organizations make data-driven decisions across operations, purchasing, sales and customer engagement, and project and investment planning. East powers the computational layer of Elara solutions, enabling the expression of complex business logic and data in a simple, type-safe and portable language.


Developed by Elara AI Pty Ltd.


Developed by Elara AI Pty Ltd

Keywords