tiefrun 0.0.0-stage β 1.0.1
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.
- package/README.md +277 -2
- package/bin/tiefrun.js +36 -0
- package/package.json +17 -4
package/README.md
CHANGED
|
@@ -1,3 +1,278 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MicroRapids API Runtime
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
High-performance API runtime built with Rust for executing OpenAPI specifications.
|
|
4
|
+
|
|
5
|
+
## β¨ Features
|
|
6
|
+
|
|
7
|
+
- π **High-performance** request processing with Rust
|
|
8
|
+
- π **Built-in security** policies and prompt injection detection
|
|
9
|
+
- π **Rate limiting** and throttling
|
|
10
|
+
- π **Multi-protocol** support (REST, GraphQL coming soon)
|
|
11
|
+
- π **OAuth2** authentication (GitHub, Google, Microsoft, etc.)
|
|
12
|
+
- π€ **MCP Agent** for AI integration
|
|
13
|
+
- π¦ **Multi-platform** - Available everywhere
|
|
14
|
+
|
|
15
|
+
## π Quick Start
|
|
16
|
+
|
|
17
|
+
### NPM (Recommended for CLI)
|
|
18
|
+
```bash
|
|
19
|
+
npm install -g tiefrun
|
|
20
|
+
tiefrun --help
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Docker
|
|
24
|
+
```bash
|
|
25
|
+
docker pull ghcr.io/microrapids/api-runtime:latest
|
|
26
|
+
docker run -p 8080:8080 ghcr.io/microrapids/api-runtime:latest
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Python
|
|
30
|
+
```bash
|
|
31
|
+
pip install tiefrun
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
import tiefrun
|
|
36
|
+
|
|
37
|
+
client = tiefrun.Client("api.yaml")
|
|
38
|
+
response = client.execute("getPetById", {"id": 123})
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Rust
|
|
42
|
+
```toml
|
|
43
|
+
# Cargo.toml
|
|
44
|
+
[dependencies]
|
|
45
|
+
tiefrun = "0.1.6"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Or install CLI directly:
|
|
49
|
+
```bash
|
|
50
|
+
cargo install tiefrun
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Direct Binary Download
|
|
54
|
+
```bash
|
|
55
|
+
# Linux/macOS
|
|
56
|
+
curl -L https://github.com/microrapids/api-runtime/releases/latest/download/tiefrun-$(uname -s)-$(uname -m) -o tiefrun
|
|
57
|
+
chmod +x tiefrun
|
|
58
|
+
sudo mv tiefrun /usr/local/bin/
|
|
59
|
+
|
|
60
|
+
# Windows
|
|
61
|
+
# Download from https://github.com/microrapids/api-runtime/releases
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## π Basic Usage
|
|
65
|
+
|
|
66
|
+
### CLI Commands
|
|
67
|
+
```bash
|
|
68
|
+
# Initialize a new API project
|
|
69
|
+
tiefrun init my-api
|
|
70
|
+
|
|
71
|
+
# Run an API operation
|
|
72
|
+
tiefrun run api.yaml --operation getPetById --data '{"id": 1}'
|
|
73
|
+
|
|
74
|
+
# Validate OpenAPI specification
|
|
75
|
+
tiefrun validate spec.yaml
|
|
76
|
+
|
|
77
|
+
# Generate SDK
|
|
78
|
+
tiefrun gen sdk --language typescript --spec api.yaml
|
|
79
|
+
|
|
80
|
+
# Start MCP Agent server
|
|
81
|
+
tiefrun agent start
|
|
82
|
+
|
|
83
|
+
# Explore API interactively
|
|
84
|
+
tiefrun explore api.yaml
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Using with Node.js
|
|
88
|
+
|
|
89
|
+
#### As a Library (WebAssembly)
|
|
90
|
+
```bash
|
|
91
|
+
npm install tiefrun-wasm
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```javascript
|
|
95
|
+
import init, { Client } from 'tiefrun-wasm';
|
|
96
|
+
|
|
97
|
+
await init();
|
|
98
|
+
const client = new Client('api.yaml');
|
|
99
|
+
const response = await client.execute('getPetById', { id: 1 });
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### SDK Package (Coming Soon)
|
|
103
|
+
```javascript
|
|
104
|
+
// Coming soon: tiefrun-node package
|
|
105
|
+
const Tiefrun = require('tiefrun-node');
|
|
106
|
+
|
|
107
|
+
const client = new Tiefrun.Client('api.yaml');
|
|
108
|
+
const response = await client.execute('getPetById', { id: 1 });
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Using with Docker
|
|
112
|
+
```bash
|
|
113
|
+
# Run with local spec file
|
|
114
|
+
docker run -v $(pwd):/app -p 8080:8080 ghcr.io/microrapids/api-runtime:latest \
|
|
115
|
+
tiefrun run /app/api.yaml
|
|
116
|
+
|
|
117
|
+
# Start MCP agent
|
|
118
|
+
docker run -p 3000:3000 ghcr.io/microrapids/api-runtime:latest \
|
|
119
|
+
tiefrun-agent start
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## ποΈ Architecture
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
tiefrun/
|
|
126
|
+
βββ CLI Tool # Command-line interface
|
|
127
|
+
βββ Runtime Engine # Core Rust execution engine
|
|
128
|
+
βββ MCP Agent # Model Context Protocol server
|
|
129
|
+
βββ Security Layer # Rate limiting, auth, policies
|
|
130
|
+
βββ SDK Generator # Multi-language SDK generation
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## π§ Advanced Features
|
|
134
|
+
|
|
135
|
+
### OAuth2 Authentication
|
|
136
|
+
```bash
|
|
137
|
+
# Login with OAuth2 provider
|
|
138
|
+
tiefrun auth login github
|
|
139
|
+
tiefrun auth login google --client-id YOUR_CLIENT_ID
|
|
140
|
+
|
|
141
|
+
# Use authenticated requests
|
|
142
|
+
tiefrun run api.yaml --operation createRepo --auth-profile github
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Collections & Testing
|
|
146
|
+
```bash
|
|
147
|
+
# Run API collections
|
|
148
|
+
tiefrun collection run my-collection.yaml
|
|
149
|
+
|
|
150
|
+
# Run as tests
|
|
151
|
+
tiefrun collection test my-tests.yaml --output junit
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Security Policies
|
|
155
|
+
```yaml
|
|
156
|
+
# policy.yaml
|
|
157
|
+
rules:
|
|
158
|
+
- name: no-delete-operations
|
|
159
|
+
pattern: "DELETE /api/*"
|
|
160
|
+
action: deny
|
|
161
|
+
|
|
162
|
+
- name: rate-limit
|
|
163
|
+
pattern: "*"
|
|
164
|
+
rateLimit:
|
|
165
|
+
requests: 100
|
|
166
|
+
window: 60s
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
tiefrun run api.yaml --policy policy.yaml
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## π¦ Package Ecosystem
|
|
174
|
+
|
|
175
|
+
| Package | Description | Install |
|
|
176
|
+
|---------|-------------|---------|
|
|
177
|
+
| `tiefrun` | CLI tool & runtime | `npm install -g tiefrun` |
|
|
178
|
+
| `tiefrun` | Python bindings | `pip install tiefrun` |
|
|
179
|
+
| `tiefrun` | Rust crate | `cargo install tiefrun` |
|
|
180
|
+
| `tiefrun-wasm` | WebAssembly (coming soon) | `npm install tiefrun-wasm` |
|
|
181
|
+
| `tiefrun-node` | Node.js SDK (coming soon) | `npm install tiefrun-node` |
|
|
182
|
+
|
|
183
|
+
## π Security Features
|
|
184
|
+
|
|
185
|
+
- **Prompt Injection Detection**: AI-safety for LLM integrations
|
|
186
|
+
- **Rate Limiting**: Token bucket algorithm with burst control
|
|
187
|
+
- **Request Validation**: Schema validation against OpenAPI spec
|
|
188
|
+
- **Authentication**: OAuth2, API Key, Basic Auth support
|
|
189
|
+
- **Policy Engine**: Flexible security rules
|
|
190
|
+
- **Secret Redaction**: Automatic sensitive data masking
|
|
191
|
+
|
|
192
|
+
## π§ͺ Testing
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# Run tests
|
|
196
|
+
cargo test
|
|
197
|
+
|
|
198
|
+
# Run with coverage
|
|
199
|
+
cargo tarpaulin --out Html
|
|
200
|
+
|
|
201
|
+
# Run integration tests
|
|
202
|
+
./tests/run_all_tests.sh
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## π Documentation
|
|
206
|
+
|
|
207
|
+
- [CLI Reference](https://github.com/microrapids/api-runtime/blob/main/api-runtime/docs/CLI_REFERENCE.md)
|
|
208
|
+
- [API Documentation](https://github.com/microrapids/api-runtime/blob/main/api-runtime/docs/API.md)
|
|
209
|
+
- [Security Guide](https://github.com/microrapids/api-runtime/blob/main/api-runtime/docs/SECURITY.md)
|
|
210
|
+
- [MCP Agent Guide](https://github.com/microrapids/api-runtime/blob/main/api-runtime/agent/README.md)
|
|
211
|
+
|
|
212
|
+
## π€ Contributing
|
|
213
|
+
|
|
214
|
+
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
# Fork and clone
|
|
218
|
+
git clone https://github.com/YOUR_USERNAME/api-runtime.git
|
|
219
|
+
|
|
220
|
+
# Create feature branch
|
|
221
|
+
git checkout -b feature/amazing-feature
|
|
222
|
+
|
|
223
|
+
# Make changes and test
|
|
224
|
+
cargo test
|
|
225
|
+
cargo fmt
|
|
226
|
+
cargo clippy
|
|
227
|
+
|
|
228
|
+
# Commit with conventional commits
|
|
229
|
+
git commit -m "feat: add amazing feature"
|
|
230
|
+
|
|
231
|
+
# Push and create PR
|
|
232
|
+
git push origin feature/amazing-feature
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## π Benchmarks
|
|
236
|
+
|
|
237
|
+
| Operation | Tiefrun | Postman | Insomnia |
|
|
238
|
+
|-----------|---------|---------|----------|
|
|
239
|
+
| Startup | 50ms | 2s | 1.5s |
|
|
240
|
+
| First Request | 15ms | 200ms | 150ms |
|
|
241
|
+
| Throughput | 10K req/s | 1K req/s | 800 req/s |
|
|
242
|
+
| Memory | 25MB | 300MB | 250MB |
|
|
243
|
+
|
|
244
|
+
*Benchmarked on M1 MacBook Pro with local API server
|
|
245
|
+
|
|
246
|
+
## πΊοΈ Roadmap
|
|
247
|
+
|
|
248
|
+
- [x] CLI tool
|
|
249
|
+
- [x] OpenAPI 3.0 support
|
|
250
|
+
- [x] OAuth2 authentication
|
|
251
|
+
- [x] MCP Agent
|
|
252
|
+
- [x] NPM package
|
|
253
|
+
- [x] Python bindings
|
|
254
|
+
- [ ] WebAssembly support
|
|
255
|
+
- [ ] GraphQL support
|
|
256
|
+
- [ ] OpenAPI 3.1 support
|
|
257
|
+
- [ ] GUI application
|
|
258
|
+
- [ ] Cloud platform
|
|
259
|
+
|
|
260
|
+
## π License
|
|
261
|
+
|
|
262
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
263
|
+
|
|
264
|
+
## π Links
|
|
265
|
+
|
|
266
|
+
- **NPM**: https://www.npmjs.com/package/tiefrun
|
|
267
|
+
- **PyPI**: https://pypi.org/project/tiefrun
|
|
268
|
+
- **GitHub**: https://github.com/microrapids/api-runtime
|
|
269
|
+
- **Docker Hub**: https://hub.docker.com/r/microrapids/tiefrun
|
|
270
|
+
- **Documentation**: https://docs.microrapids.com (coming soon)
|
|
271
|
+
|
|
272
|
+
## π Sponsors
|
|
273
|
+
|
|
274
|
+
Special thanks to our sponsors and contributors who make this project possible.
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
**Built with β€οΈ using Rust** | **Star β us on [GitHub](https://github.com/microrapids/api-runtime)**
|
package/bin/tiefrun.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// TR-33: resolve the per-platform package npm installed for this host (each
|
|
3
|
+
// sub-package is os/cpu-gated, so only one is present) and exec its binary as
|
|
4
|
+
// `tiefrun` (argv0) so --help/usage shows the right program name.
|
|
5
|
+
const { spawn } = require('child_process');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
|
|
8
|
+
function binaryPath() {
|
|
9
|
+
const platform = process.platform; // darwin | linux | win32
|
|
10
|
+
const arch = process.arch; // x64 | arm64
|
|
11
|
+
const pkg = `@microrapid/tiefrun-${platform}-${arch}`;
|
|
12
|
+
const exe = platform === 'win32' ? 'tiefrun.exe' : 'tiefrun';
|
|
13
|
+
let pkgJson;
|
|
14
|
+
try {
|
|
15
|
+
pkgJson = require.resolve(`${pkg}/package.json`);
|
|
16
|
+
} catch (e) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
`Missing platform package '${pkg}'. Reinstall tiefrun with optional ` +
|
|
19
|
+
`dependencies enabled (npm install --include=optional), or download a ` +
|
|
20
|
+
`binary from https://github.com/microrapids/api-runtime/releases`
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
return path.join(path.dirname(pkgJson), 'bin', exe);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
const child = spawn(binaryPath(), process.argv.slice(2), { stdio: 'inherit', argv0: 'tiefrun' });
|
|
28
|
+
child.on('error', (err) => { console.error('tiefrun:', err.message); process.exit(1); });
|
|
29
|
+
child.on('exit', (code, signal) => {
|
|
30
|
+
if (signal) process.kill(process.pid, signal);
|
|
31
|
+
else process.exit(code === null ? 1 : code);
|
|
32
|
+
});
|
|
33
|
+
} catch (err) {
|
|
34
|
+
console.error('tiefrun:', err.message);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tiefrun",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "MicroRapids API Runtime - executable OpenAPI specifications",
|
|
5
|
+
"bin": { "tiefrun": "./bin/tiefrun.js" },
|
|
6
|
+
"files": ["bin/**/*"],
|
|
7
|
+
"optionalDependencies": {
|
|
8
|
+
"@microrapid/tiefrun-linux-x64": "1.0.1",
|
|
9
|
+
"@microrapid/tiefrun-linux-arm64": "1.0.1",
|
|
10
|
+
"@microrapid/tiefrun-darwin-x64": "1.0.1",
|
|
11
|
+
"@microrapid/tiefrun-darwin-arm64": "1.0.1",
|
|
12
|
+
"@microrapid/tiefrun-win32-x64": "1.0.1"
|
|
13
|
+
},
|
|
14
|
+
"repository": { "type": "git", "url": "https://github.com/microrapids/api-runtime.git" },
|
|
15
|
+
"keywords": ["cli", "api", "openapi", "testing", "rest", "graphql"],
|
|
16
|
+
"author": "MicroRapids Team",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"engines": { "node": ">=14.0.0" }
|
|
19
|
+
}
|