@nifrajs/mock 1.13.0 → 2.1.0
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 +27 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# @nifrajs/mock
|
|
2
|
+
|
|
3
|
+
Generate deterministic mock responses from a Nifra application's reflected response contracts.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
bun add -d @nifrajs/mock
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { createMockServer } from "@nifrajs/mock"
|
|
11
|
+
import { app } from "./app"
|
|
12
|
+
|
|
13
|
+
const mock = createMockServer(app, { seed: 42 })
|
|
14
|
+
const response = await mock.fetch(new Request("http://local.test/users/1"))
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The mock server matches reflected routes and synthesizes values from supported JSON Schema keywords.
|
|
18
|
+
Unsupported or unsatisfiable schemas fail explicitly instead of returning known-invalid data. Use a
|
|
19
|
+
fixed seed when responses must be replayable across local development and CI.
|
|
20
|
+
|
|
21
|
+
## For AI agents
|
|
22
|
+
|
|
23
|
+
Start with [`LLM.md`](./LLM.md) — this package's contract card (the exports you call + its footguns),
|
|
24
|
+
one cheap read instead of the whole corpus. For the wider framework: the repo's
|
|
25
|
+
[`AGENTS.md`](../../AGENTS.md) is the copy-paste quick reference, and
|
|
26
|
+
[`llms-full.txt`](../../llms-full.txt) is the full machine-readable corpus. Run `nifra check` as the
|
|
27
|
+
done-gate, or `nifra mcp` to give the agent live project tools.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nifrajs/mock",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Contract-based mock server — reads route schemas and generates fake responses.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
"access": "public"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@nifrajs/core": "1.
|
|
29
|
+
"@nifrajs/core": "2.1.0"
|
|
30
30
|
}
|
|
31
31
|
}
|