Skip to main content

Secure data transformation tool supporting JQ and JavaScript (Bun)

Project description

lam

Lam is a data transformation tool for Laminar that supports both jq and JavaScript transformations using Bun.

Quickstart

Install the dependencies:

# For JQ support
brew install jq  # or sudo apt-get install jq

# For JavaScript support
curl -fsSL https://bun.sh/install | bash

make setup

Run the CLI tool:

make cli ARGS="run <program> <input> [--language jq|js]"

Features

  • JQ transformations (default)
  • JavaScript transformations with Bun runtime
  • Built-in utilities (lodash, date-fns)
  • Resource monitoring and limits
  • Detailed execution statistics
  • Secure execution environment

Examples

JQ Transform

make cli ARGS="run examples/transform.jq data.json"

JavaScript Transform

make cli ARGS="run examples/transform.js data.json --language js"

Example JavaScript transform:

(input) => {
    // Lodash available as _
    return _.map(input.data, item => ({
        value: item.value * 2
    }));
}

Installation

Docker Installation

# Install lam-cli
RUN pip3 install git+https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/user/project.git@{version}

# Install dependencies
RUN apt-get update && apt-get install -y jq
RUN curl -fsSL https://bun.sh/install | bash

Manual Setup

Create a virtual environment and install dependencies:

python3 -m venv ./venv
source ./venv/bin/activate
pip install -r requirements.txt

Usage

# Basic usage
python3 ./lam/lam.py run <program> <input>

# With JavaScript
python3 ./lam/lam.py run script.js data.json --language js

# Full options
python3 ./lam/lam.py run <program> <input> \
    --language [jq|js] \
    --workspace_id <id> \
    --flow_id <id> \
    --execution_id <id> \
    [--as-json]

Resource Limits

  • Maximum input size: 10MB
  • Execution timeout: 5 seconds
  • Memory limits enabled
  • Disk space monitoring

Security

  • Sandboxed JavaScript execution
  • Network access disabled
  • Limited global scope
  • Resource monitoring
  • Secure dependency management

Logging and Monitoring

  • Execution statistics (duration, memory usage)
  • Detailed error tracking
  • PostHog analytics integration
  • Log file generation

Development

# Run all tests
make test

# Run specific test suite
make test-jq
make test-js
make test-js-edge-cases

# Run single test
make test-single TEST=test/js/example.js DATA=test/data/input.json

Releases

Update version in setup.py:

setup(
    name="lam-cli",
    version="0.0.<x>",
    ...
)

Create and push tag:

git tag v<version>-<increment>
git push origin v<version>-<increment>

Dependencies

Update dependencies:

pip3 install <package>
pip3 freeze > requirements.txt

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lam_cli-0.1.0.tar.gz (21.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lam_cli-0.1.0-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file lam_cli-0.1.0.tar.gz.

File metadata

  • Download URL: lam_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 21.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for lam_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c23c132e396a1cb0b8a2bae6a17880942df4ec7ddf1b9f6f69169fe846a313a2
MD5 c7d69411f0aa24aca2fdf7d8bd9952d3
BLAKE2b-256 b4882d56b96944728c49d5df3ed9f45f873f3b1a764dd7d6e878850105c2b25c

See more details on using hashes here.

Provenance

The following attestation bundles were made for lam_cli-0.1.0.tar.gz:

Publisher: publish.yml on laminar-run/lam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lam_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: lam_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for lam_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fa55407bccbc017a55bf67899f0b6f51d13446bddabf191640f99de77d2cc716
MD5 dac7779f91518f1100f1a3a1207f43c0
BLAKE2b-256 3cc067111829edd5a1c9d7a809f2b801904106d662b9a1fdd45943b437ca3ab0

See more details on using hashes here.

Provenance

The following attestation bundles were made for lam_cli-0.1.0-py3-none-any.whl:

Publisher: publish.yml on laminar-run/lam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page