Skip to content

Commit c905d4e

Browse files
authored
Merge pull request #229 from itsmeakhil/features/improve-api-client
Features/improve api client
2 parents 510250f + 641b77f commit c905d4e

219 files changed

Lines changed: 23091 additions & 395 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/api-runner/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# @mydevtools/api-runner
2+
3+
Headless runner for [mydevtools](https://mydevtools.tech) API client collections — Postman / Newman compatible.
4+
5+
Same scripts, same `pm.*` API, same JUnit output as the web runner.
6+
7+
## Install
8+
9+
```bash
10+
npm i -g @mydevtools/api-runner
11+
```
12+
13+
## Run
14+
15+
```bash
16+
mydevtools-api run my-collection.json
17+
mydevtools-api run my-collection.json --env prod.env.json --data users.csv
18+
mydevtools-api run my-collection.json --reporter junit --reporter-out report.xml --bail
19+
```
20+
21+
## Flags
22+
23+
| Flag | Description |
24+
|---|---|
25+
| `--data <file>` | CSV or JSON-array data file. One iteration per row; row keys override `{{vars}}`. |
26+
| `--env <file>` | Postman Environment v2 export. Enabled values become the base `{{var}}` map. |
27+
| `--iterations <N>` | Iterations when no data file is given. Default 1. |
28+
| `--reporter <name>` | `cli` (default) or `junit`. |
29+
| `--reporter-out <path>` | Required for `--reporter junit`. |
30+
| `--bail` | Stop on the first failing assertion / network error. |
31+
32+
## Exit codes
33+
34+
| Code | Meaning |
35+
|---|---|
36+
| 0 | All tests passed |
37+
| 1 | Some tests / requests failed |
38+
| 2 | Usage error |
39+
40+
## Differences vs the web runner (v0.1)
41+
42+
- No cookie jar (Node `fetch` has no jar) — provide auth via env vars.
43+
- No OAuth refresh flow — pre-mint a bearer token and put it in env.
44+
- No SSE / streaming (the web has `/api/proxy-stream`; the CLI does plain `await response.text()`).
45+
- No GraphQL introspection.
46+
47+
Everything else — scripts, env mutations, `{{response.body.x}}` chaining,
48+
folder inheritance, data-driven iterations, JUnit XML — matches the web runner
49+
bit-for-bit.

apps/api-runner/dist/csv.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/** Same CSV/JSON data-file parser as the web app — verbatim port for portability. */
2+
export declare function parseCsv(text: string): Record<string, string>[];
3+
export declare function parseDataFile(text: string): Record<string, string>[];

apps/api-runner/dist/csv.js

Lines changed: 77 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/api-runner/dist/csv.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/api-runner/dist/index.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env node
2+
/**
3+
* mydevtools-api CLI.
4+
* Headless equivalent of the web-side collection runner. Same scripts, same
5+
* substitution layering, same JUnit output — runs over a Postman v2.1 export.
6+
*/
7+
export {};

apps/api-runner/dist/index.js

Lines changed: 133 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/api-runner/dist/index.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/api-runner/dist/junit.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/** JUnit XML emitter — port of `apps/web/src/lib/runner/junit.ts`. */
2+
import type { RequestRunResult } from "./types.js";
3+
export declare function buildJUnitXml(results: RequestRunResult[], suiteName: string): string;

0 commit comments

Comments
 (0)