lam-cli 0.1.7__py3-none-any.whl → 1.0.0__py3-none-any.whl

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.
lam/utils.py ADDED
@@ -0,0 +1,22 @@
1
+ import json
2
+ import logging
3
+ import os
4
+ from typing import Optional, Tuple
5
+
6
+ logger = logging.getLogger(__name__)
7
+
8
+
9
+ def process_input(input: str) -> Tuple[str, Optional[str]]:
10
+ """Process and validate input data"""
11
+ if os.path.isfile(input):
12
+ logger.debug("Loading input from file: %s", input)
13
+ with open(input, 'r') as file:
14
+ return file.read(), None
15
+
16
+ try:
17
+ json.loads(input)
18
+ logger.debug("Validated inline JSON input")
19
+ return input, None
20
+ except json.JSONDecodeError as e:
21
+ logger.error("Invalid JSON input: %s", str(e))
22
+ return str(e), None
@@ -0,0 +1,229 @@
1
+ Metadata-Version: 2.4
2
+ Name: lam-cli
3
+ Version: 1.0.0
4
+ Summary: Secure data transformation tool supporting JQ and JavaScript (Bun)
5
+ Home-page: https://github.com/laminar-run/lam
6
+ Author: Laminar Run, Inc.
7
+ Author-email: connect@laminar.run
8
+ License: GPLv3
9
+ Project-URL: Documentation, https://docs.laminar.run
10
+ Project-URL: Source, https://github.com/laminar-run/lam
11
+ Project-URL: Issue Tracker, https://github.com/laminar-run/lam/issues
12
+ Keywords: laminar,api,integration,transformation,json,jq,javascript,bun
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
24
+ Classifier: Topic :: Software Development :: Build Tools
25
+ Requires-Python: >=3.9
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: backoff>=2.2.1
29
+ Requires-Dist: certifi>=2024.12.14
30
+ Requires-Dist: charset-normalizer>=3.3.2
31
+ Requires-Dist: click>=8.1.7
32
+ Requires-Dist: idna>=3.7
33
+ Requires-Dist: logtail-python>=0.2.2
34
+ Requires-Dist: monotonic>=1.6
35
+ Requires-Dist: msgpack>=1.0.8
36
+ Requires-Dist: posthog>=3.4.0
37
+ Requires-Dist: psutil>=5.9.0
38
+ Requires-Dist: python-dateutil>=2.8.2
39
+ Requires-Dist: requests>=2.32.3
40
+ Requires-Dist: six>=1.16.0
41
+ Requires-Dist: urllib3>=2.2.2
42
+ Dynamic: author
43
+ Dynamic: author-email
44
+ Dynamic: classifier
45
+ Dynamic: description
46
+ Dynamic: description-content-type
47
+ Dynamic: home-page
48
+ Dynamic: keywords
49
+ Dynamic: license
50
+ Dynamic: license-file
51
+ Dynamic: project-url
52
+ Dynamic: requires-dist
53
+ Dynamic: requires-python
54
+ Dynamic: summary
55
+
56
+ # LAM
57
+ LAM is a data transformation tool designed for Laminar's API integration platform.
58
+
59
+ ## Overview
60
+ LAM enables you to write efficient transformations for your API data using either JavaScript (Bun) or Python. It's designed to be secure, fast, and easy to integrate into your Laminar workflows.
61
+
62
+ ## Features
63
+ - **Dual Engine Support**: Choose between JavaScript (Bun runtime) for fast execution or Python for complex data processing
64
+ - **Built-in Libraries**: Access lodash and date-fns in JavaScript, comprehensive Python standard library modules
65
+ - **Security**: Runs in sandboxed environments with strict resource limits and security restrictions
66
+ - **Performance**: Uses Bun runtime for JavaScript and sandboxed Python interpreter
67
+ - **Monitoring**: Built-in execution statistics and error tracking
68
+
69
+ ## Execution Environments
70
+
71
+ ### Bun JavaScript Runtime (js)
72
+ **Configuration**:
73
+ - **Engine**: Bun
74
+ - **Timeout**: 5 seconds
75
+ - **Execution**: Isolated with `--no-fetch --smol --silent` flags
76
+ - **Storage**: No localStorage/sessionStorage support
77
+ - **Modules**: Shared node_modules directory
78
+
79
+ **Available Libraries**:
80
+ - **lodash** (^4.17.21): Utility library for array/object manipulation, data transformations (Global: `_`)
81
+ - **date-fns** (^2.30.0): Modern date utility library with `format`, `parseISO` functions
82
+
83
+ **Transform Function Signature**:
84
+ ```js
85
+ (input) => { /* transform logic */ return result; }
86
+ ```
87
+
88
+ ### Python Interpreter with Sandboxing (py)
89
+ **Configuration**:
90
+ - **Engine**: Python interpreter
91
+ - **Timeout**: 5 seconds
92
+ - **Memory Limit**: 100MB
93
+ - **CPU Limit**: 5 seconds (RLIMIT_CPU)
94
+ - **Virtual Memory**: 100MB (RLIMIT_AS)
95
+ - **Execution**: Isolated with `-I` flag (ignores environment/site packages)
96
+
97
+ **Security Restrictions**:
98
+ - **Blocked Modules**: subprocess, sys, os, shutil, pathlib, importlib, builtins, _thread, ctypes, socket, pickle, multiprocessing
99
+ - **Blocked Functions**: __import__, eval, exec, globals, locals, getattr, setattr, delattr, compile, open
100
+ - **Blocked Patterns**: __subclasses__, dunder attributes access
101
+
102
+ **Available Standard Library Modules**:
103
+ - **json**: JSON encoder and decoder
104
+ - **datetime**: Date and time handling
105
+ - **time**: Time-related functions
106
+ - **math**: Mathematical functions and constants
107
+ - **statistics**: Statistical functions (mean, median, mode, standard deviation)
108
+ - **collections**: Counter, defaultdict, OrderedDict, deque
109
+ - **itertools**: Efficient looping, combinations, permutations
110
+ - **functools**: reduce, partial, lru_cache
111
+ - **re**: Regular expression operations
112
+ - **copy**: Shallow and deep copy operations
113
+ - **decimal**: Precise decimal calculations
114
+ - **csv**: CSV file reading and writing
115
+ - **io**: StringIO, BytesIO for in-memory files
116
+ - **dataclasses**: Data classes for storing data
117
+ - **typing**: Type hints support
118
+ - **enum**: Support for enumerations
119
+ - **random**: Random number generation
120
+ - **uuid**: UUID generation
121
+ - **hashlib**: Secure hash and message digest algorithms
122
+ - **base64**: Base64 encoding and decoding
123
+ - **urllib**: URL handling modules
124
+ - **urllib.parse**: URL parsing utilities
125
+ - **html**: HTML processing utilities
126
+ - **xml**: XML processing
127
+ - **xml.etree**: XML ElementTree API
128
+ - **xml.etree.ElementTree**: XML parsing and creation
129
+ - **string**: String constants and classes
130
+ - **textwrap**: Text wrapping and filling
131
+ - **operator**: Standard operators as functions
132
+ - **bisect**: Array bisection algorithm
133
+ - **heapq**: Heap queue algorithm
134
+ - **array**: Efficient arrays of numeric values
135
+ - **unicodedata**: Unicode character database
136
+ - **locale**: Internationalization services
137
+ - **calendar**: Calendar-related functions
138
+ - **zoneinfo**: Time zone support (Python 3.9+)
139
+ - **struct**: Pack and unpack binary data
140
+ - **binascii**: Binary/ASCII conversions
141
+ - **codecs**: Encode and decode data
142
+ - **difflib**: Sequence comparison utilities
143
+ - **pprint**: Pretty-printer for data structures
144
+ - **reprlib**: Alternate repr() implementation
145
+ - **abc**: Abstract base classes
146
+ - **contextlib**: Context management utilities
147
+ - **secrets**: Cryptographically secure random numbers
148
+ - **fractions**: Rational numbers
149
+ - **numbers**: Numeric abstract base classes
150
+
151
+ **Safe Built-in Functions**:
152
+ `abs`, `all`, `any`, `bool`, `chr`, `dict`, `divmod`, `enumerate`, `filter`, `float`, `format`, `frozenset`, `hash`, `hex`, `int`, `isinstance`, `issubclass`, `iter`, `len`, `list`, `map`, `max`, `min`, `next`, `oct`, `ord`, `pow`, `print`, `range`, `repr`, `reversed`, `round`, `set`, `slice`, `sorted`, `str`, `sum`, `tuple`, `type`, `zip`
153
+
154
+ **Transform Function Signature**:
155
+ ```py
156
+ def transform(input_data):
157
+ # transform logic
158
+ return result
159
+ ```
160
+
161
+ ## Examples
162
+
163
+ ### JavaScript (Bun) Transformations
164
+ Perfect for fast data manipulation with familiar syntax:
165
+
166
+ ```javascript
167
+ (input) => {
168
+ // Use lodash for data manipulation
169
+ const processed = _.map(input.data, item => ({
170
+ id: item.id,
171
+ formattedDate: format(parseISO(item.date), 'MMM dd, yyyy'),
172
+ value: item.value * 2
173
+ }));
174
+
175
+ return {
176
+ processed,
177
+ summary: {
178
+ total: _.sumBy(processed, 'value'),
179
+ count: processed.length
180
+ }
181
+ };
182
+ }
183
+ ```
184
+
185
+ ### Python Transformations
186
+ Ideal for complex data processing and statistical analysis:
187
+
188
+ ```python
189
+ def transform(input_data):
190
+ import statistics
191
+ from collections import Counter
192
+
193
+ # Process numerical data
194
+ values = [item["value"] for item in input_data["data"] if "value" in item]
195
+
196
+ return {
197
+ "statistics": {
198
+ "mean": statistics.mean(values) if values else 0,
199
+ "median": statistics.median(values) if values else 0,
200
+ "count": len(values)
201
+ },
202
+ "frequency": dict(Counter(item["category"] for item in input_data["data"])),
203
+ "processedAt": datetime.now().isoformat()
204
+ }
205
+ ```
206
+
207
+ ## Integration with Laminar
208
+ LAM is designed to work seamlessly with Laminar's integration platform:
209
+
210
+ 1. **Flows**: Add data transformations to your API flows
211
+ 2. **Automation**: Schedule and automate data processing
212
+ 3. **Monitoring**: Track execution statistics and errors
213
+
214
+ ## Getting Started
215
+
216
+ ### Using LAM in Laminar
217
+ 1. Create a new flow in [Laminar](https://app.laminar.run)
218
+ 2. Add a transformation step
219
+ 3. Choose your engine (JavaScript or Python)
220
+ 4. Write your transformation function
221
+ 5. Deploy and monitor
222
+
223
+ ## Resources
224
+ - [Laminar Documentation](https://docs.laminar.run)
225
+ - [Sign up for Laminar](https://app.laminar.run)
226
+
227
+ ## Support
228
+ Get help with LAM:
229
+ - [Contact Support](mailto:connect@laminar.run)
@@ -0,0 +1,15 @@
1
+ lam/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
2
+ lam/core.py,sha256=ckcHNRyfhly9D9kpbeJQUPhpPYwCEM7tq9ATU4XZAR0,2645
3
+ lam/lam.py,sha256=Ge7nqJwqysTEIuVLYW0ECl34PT3mNvA_yWnZ1keg9lo,5065
4
+ lam/utils.py,sha256=l98xstNeiz7JdAhbwkaEwJTi2KSPnMxluS5ObUM4Bm4,626
5
+ lam/engines/__init__.py,sha256=o7DFSvAE0GQ2BOewiqFLAEjU_3LmWQLhaPrnfs1mLmw,809
6
+ lam/engines/base.py,sha256=I4UIfzqkRwdGIyW98GPXgxLsqNqjes0Mqx01DdCO2ho,1980
7
+ lam/engines/javascript.py,sha256=DIyjzrgMo0pEENsOHflhnstEpu_74rBwyIEffYXPuYo,10828
8
+ lam/engines/jq.py,sha256=jnm8w9s9CRtiSW_JzfgQWyapNnQGrYw8EDZGUGJoDjY,2565
9
+ lam/engines/python.py,sha256=iJpk2NVVGoLmQbnNEsiKuy8GxaYgOLFUnqF9Pyzo8ng,32134
10
+ lam_cli-1.0.0.dist-info/licenses/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
11
+ lam_cli-1.0.0.dist-info/METADATA,sha256=MfEKmeB19-fsTeAIZinh0y9nHA0DiXPsxMlSjkSkd4I,8437
12
+ lam_cli-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
+ lam_cli-1.0.0.dist-info/entry_points.txt,sha256=iJSsJitcGMikKJ3Q9KNWxEy911oTrSxGSO1HiwcBrKE,40
14
+ lam_cli-1.0.0.dist-info/top_level.txt,sha256=WyM7-Ig60qQH9meqS293pEd83jrMtbvGJM8ALZOQCtA,4
15
+ lam_cli-1.0.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.3.1)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,53 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: lam-cli
3
- Version: 0.1.7
4
- Summary: Secure data transformation tool supporting JQ and JavaScript (Bun)
5
- Home-page: https://github.com/laminar-run/lam
6
- Author: Laminar Run, Inc.
7
- Author-email: connect@laminar.run
8
- License: GPLv3
9
- Project-URL: Documentation, https://docs.laminar.run
10
- Project-URL: Source, https://github.com/laminar-run/lam
11
- Project-URL: Issue Tracker, https://github.com/laminar-run/lam/issues
12
- Keywords: laminar,api,integration,transformation,json,jq,javascript,bun
13
- Classifier: Development Status :: 4 - Beta
14
- Classifier: Environment :: Console
15
- Classifier: Intended Audience :: Developers
16
- Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
17
- Classifier: Operating System :: OS Independent
18
- Classifier: Programming Language :: Python :: 3
19
- Classifier: Programming Language :: Python :: 3.9
20
- Classifier: Programming Language :: Python :: 3.10
21
- Classifier: Programming Language :: Python :: 3.11
22
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
- Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
24
- Classifier: Topic :: Software Development :: Build Tools
25
- Requires-Python: >=3.9
26
- Description-Content-Type: text/markdown
27
- License-File: LICENSE
28
- Requires-Dist: backoff>=2.2.1
29
- Requires-Dist: certifi>=2024.12.14
30
- Requires-Dist: charset-normalizer>=3.3.2
31
- Requires-Dist: click>=8.1.7
32
- Requires-Dist: idna>=3.7
33
- Requires-Dist: logtail-python>=0.2.2
34
- Requires-Dist: monotonic>=1.6
35
- Requires-Dist: msgpack>=1.0.8
36
- Requires-Dist: posthog>=3.4.0
37
- Requires-Dist: psutil>=5.9.0
38
- Requires-Dist: python-dateutil>=2.8.2
39
- Requires-Dist: requests>=2.32.3
40
- Requires-Dist: six>=1.16.0
41
- Requires-Dist: urllib3>=2.2.2
42
- Dynamic: author
43
- Dynamic: author-email
44
- Dynamic: classifier
45
- Dynamic: description-content-type
46
- Dynamic: home-page
47
- Dynamic: keywords
48
- Dynamic: license
49
- Dynamic: license-file
50
- Dynamic: project-url
51
- Dynamic: requires-dist
52
- Dynamic: requires-python
53
- Dynamic: summary
@@ -1,8 +0,0 @@
1
- lam/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- lam/lam.py,sha256=jlK7-O--3nQSdGKy7YnIeWA8ToiJ2Q46TpnEuEqpFSk,38306
3
- lam_cli-0.1.7.dist-info/licenses/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
4
- lam_cli-0.1.7.dist-info/METADATA,sha256=jVVE7ktM1tzCIjNlG3UYb_fKDaziInoqF71FgdJpmJk,1917
5
- lam_cli-0.1.7.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
6
- lam_cli-0.1.7.dist-info/entry_points.txt,sha256=iJSsJitcGMikKJ3Q9KNWxEy911oTrSxGSO1HiwcBrKE,40
7
- lam_cli-0.1.7.dist-info/top_level.txt,sha256=WyM7-Ig60qQH9meqS293pEd83jrMtbvGJM8ALZOQCtA,4
8
- lam_cli-0.1.7.dist-info/RECORD,,