@zenera/faker 1.1.14 → 1.1.16

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.
Files changed (2) hide show
  1. package/README.md +13 -12
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -4,6 +4,7 @@
4
4
  <img src="https://raw.githubusercontent.com/andreyryabov/ZeneraNeo/main/docs/imgs/banner-faker-light.svg" alt="ZENERA FAKER" width="837">
5
5
  </picture>
6
6
 
7
+ [![npm](https://img.shields.io/npm/v/@zenera/faker.svg)](https://www.npmjs.com/package/@zenera/faker)
7
8
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/andreyryabov/ZeneraNeo/blob/main/LICENSE)
8
9
  [![Node](https://img.shields.io/badge/node-%E2%89%A524-brightgreen.svg)](https://nodejs.org)
9
10
 
@@ -12,7 +13,7 @@
12
13
  # @zenera/faker
13
14
 
14
15
  **A mock HTTP server for swagger/OpenAPI documents. Point it at a spec and it
15
- serves it — the response bodies are written, once, by a model.**
16
+ serves it - the response bodies are written, once, by a model.**
16
17
 
17
18
  > Part of [ZeneraNeo](https://github.com/andreyryabov/ZeneraNeo). It ships no
18
19
  > binary of its own: installing it adds a `faker` **subcommand** to
@@ -59,7 +60,7 @@ zen faker cache clear # throw it away
59
60
  ## How a body is produced
60
61
 
61
62
  The first time an operation is called, the faker asks a model to write a
62
- **Python generator** for it — one file, taking a JSON input path and a JSON
63
+ **Python generator** for it - one file, taking a JSON input path and a JSON
63
64
  output path. That file is then run against sample requests it makes up, and
64
65
  judged twice: against the operation's response schema, and against the echo
65
66
  rule, which says that where a path or query parameter shares a name with a
@@ -70,7 +71,7 @@ and is still wrong.
70
71
  If it fails, the diagnostics go back to the model and it tries again, up to
71
72
  `--attempts`. If it passes, the generator is kept in this machine's shared cache
72
73
  under `~/.zenera/neo/cache/faker-generator/`, keyed by the operation's shape, and
73
- every later request is just `podman exec python3 gen.py in.json out.json` — no
74
+ every later request is just `podman exec python3 gen.py in.json out.json` - no
74
75
  model, no tokens. The store is the machine's, so the same document served from
75
76
  another directory costs nothing the second time.
76
77
 
@@ -81,7 +82,7 @@ Generators run in a container with **no network**, on an image baked once with
81
82
 
82
83
  A list endpoint is the one place a mock can hang a real client. Given
83
84
  `?cursor=abc`, the honest-looking answer is a body that validates, echoes
84
- nothing it shouldn't, and hands back `abc` again — so the client asks for the
85
+ nothing it shouldn't, and hands back `abc` again - so the client asks for the
85
86
  same page forever.
86
87
 
87
88
  The faker reads the document for this. Where an operation has a paging
@@ -90,13 +91,13 @@ that carries the next one (`next`, `next_cursor`, `has_more`, …), three things
90
91
  happen, all in the operation's own names:
91
92
 
92
93
  - the model is told to fabricate **three pages** in total, to build the token
93
- out of the paging parameter rather than the seed, and to end the list — null,
94
+ out of the paging parameter rather than the seed, and to end the list - null,
94
95
  absent, or `has_more: false` where the schema leaves no other room;
95
96
  - the generator is then **walked**: the faker calls it with no cursor, follows
96
97
  the token it gets back, and rejects the file if the token repeats, cycles, or
97
98
  never runs out. The diagnostics say which, and the model gets another go;
98
- - at request time a token identical to the one just sent is **cut** — nulled or
99
- dropped, whichever the schema allows — and the request line says so. Nothing
99
+ - at request time a token identical to the one just sent is **cut** - nulled or
100
+ dropped, whichever the schema allows - and the request line says so. Nothing
100
101
  is invented in its place; a generator written before this rule existed is
101
102
  still cached, and a cache is not rebuilt because a rule changed.
102
103
 
@@ -105,8 +106,8 @@ are written again on first use; everything else keeps the key it had.
105
106
  `GET /__faker/routes` reports the shape that was recognised, per operation.
106
107
 
107
108
  Plenty of documents describe the envelope and never write down the parameter
108
- that reads it back. The first two steps cannot help there — nothing static can
109
- see a parameter that is not declared — but the cut still applies: it takes the
109
+ that reads it back. The first two steps cannot help there - nothing static can
110
+ see a parameter that is not declared - but the cut still applies: it takes the
110
111
  paging parameter from the request itself, since a client only sends `?cursor=X`
111
112
  because a body handed it X.
112
113
 
@@ -141,9 +142,9 @@ Environment variables still win over the keyring, exactly as they do for `zen`.
141
142
 
142
143
  | Package | What it is |
143
144
  | ------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
144
- | [`@zenera/cli`](https://github.com/andreyryabov/ZeneraNeo/blob/main/packages/cli/README.md) | `zen` — agent projects on the command line |
145
- | [`@zenera/neo`](https://github.com/andreyryabov/ZeneraNeo/blob/main/packages/neo/README.md) | the runtime — agents, models, tools, skills, memory |
146
- | [`@zenera/rag`](https://github.com/andreyryabov/ZeneraNeo/blob/main/packages/rag/README.md) | `zen rag` — an API description as a searchable graph |
145
+ | [`@zenera/cli`](https://github.com/andreyryabov/ZeneraNeo/blob/main/packages/cli/README.md) | `zen` - agent projects on the command line |
146
+ | [`@zenera/neo`](https://github.com/andreyryabov/ZeneraNeo/blob/main/packages/neo/README.md) | the runtime - agents, models, tools, skills, memory |
147
+ | [`@zenera/rag`](https://github.com/andreyryabov/ZeneraNeo/blob/main/packages/rag/README.md) | `zen rag` - an API description as a searchable graph |
147
148
 
148
149
  ## License
149
150
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenera/faker",
3
- "version": "1.1.14",
3
+ "version": "1.1.16",
4
4
  "description": "Mock HTTP server for swagger/OpenAPI documents, with response bodies generated by a model.",
5
5
  "keywords": [
6
6
  "openapi",
@@ -45,7 +45,7 @@
45
45
  "@apidevtools/swagger-parser": "^12.0.0",
46
46
  "ajv": "^8.17.1",
47
47
  "ajv-formats": "^3.0.1",
48
- "@zenera/cli": "^1.1.14",
49
- "@zenera/neo": "^1.1.14"
48
+ "@zenera/cli": "^1.1.16",
49
+ "@zenera/neo": "^1.1.16"
50
50
  }
51
51
  }