@x12i/api-simulator-docs 0.1.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 +33 -0
- package/bin/api-simulator-docs.js +2 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +56 -0
- package/dist/cli.js.map +1 -0
- package/dist/generated/bundle.d.ts +8 -0
- package/dist/generated/bundle.d.ts.map +1 -0
- package/dist/generated/bundle.js +577 -0
- package/dist/generated/bundle.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @x12i/api-simulator-docs
|
|
2
|
+
|
|
3
|
+
api-simulator ebook **knowledge SDK**. Install as a **devDependency only** — do not add to production service dependencies.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm i -D @x12i/api-simulator-docs
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { apiSimulatorDocs } from "@x12i/api-simulator-docs";
|
|
11
|
+
|
|
12
|
+
apiSimulatorDocs.getUseCaseMarkdown("orient-simulator");
|
|
13
|
+
apiSimulatorDocs.getBookMarkdown("01-behaviors", "developers");
|
|
14
|
+
apiSimulatorDocs.manifest();
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
CLI:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx api-simulator-docs list-use-cases
|
|
21
|
+
npx api-simulator-docs use-case orient-simulator > pack.md
|
|
22
|
+
npx api-simulator-docs book 00-overview developers > book.md
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Human UI: from the api-simulator monorepo, run `npm run docs` (`docify-web` + content bundle).
|
|
26
|
+
|
|
27
|
+
Publishable static site:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm run docs:web # → dist/docs-web/
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Deploy the contents of `dist/docs-web/` to your docs host root (see root `site.json` `siteUrl`).
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { apiSimulatorDocs } from "./index.js";
|
|
3
|
+
const [cmd, id, audience] = process.argv.slice(2);
|
|
4
|
+
function usage() {
|
|
5
|
+
console.error(`Usage:
|
|
6
|
+
api-simulator-docs use-case <id> Print assembled use-case markdown
|
|
7
|
+
api-simulator-docs book <id> <audience> Print book markdown
|
|
8
|
+
api-simulator-docs list-use-cases List use case ids
|
|
9
|
+
api-simulator-docs list-books List book ids
|
|
10
|
+
`);
|
|
11
|
+
}
|
|
12
|
+
if (!cmd || cmd === "help" || cmd === "--help") {
|
|
13
|
+
usage();
|
|
14
|
+
process.exit(cmd ? 0 : 1);
|
|
15
|
+
}
|
|
16
|
+
if (cmd === "list-use-cases") {
|
|
17
|
+
for (const uc of apiSimulatorDocs.listUseCases()) {
|
|
18
|
+
console.log(`${uc.id}\t${uc.title}`);
|
|
19
|
+
}
|
|
20
|
+
process.exit(0);
|
|
21
|
+
}
|
|
22
|
+
if (cmd === "list-books") {
|
|
23
|
+
for (const b of apiSimulatorDocs.listBooks()) {
|
|
24
|
+
console.log(`${b.id}\t${b.title}\t${b.audiences.join(",")}`);
|
|
25
|
+
}
|
|
26
|
+
process.exit(0);
|
|
27
|
+
}
|
|
28
|
+
if (cmd === "use-case") {
|
|
29
|
+
if (!id) {
|
|
30
|
+
usage();
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
const md = apiSimulatorDocs.getUseCaseMarkdown(id);
|
|
34
|
+
if (!md) {
|
|
35
|
+
console.error(`Unknown use case: ${id}`);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
process.stdout.write(md);
|
|
39
|
+
process.exit(0);
|
|
40
|
+
}
|
|
41
|
+
if (cmd === "book") {
|
|
42
|
+
if (!id || !audience) {
|
|
43
|
+
usage();
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
const md = apiSimulatorDocs.getBookMarkdown(id, audience);
|
|
47
|
+
if (!md) {
|
|
48
|
+
console.error(`Unknown book/audience: ${id} ${audience}`);
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
process.stdout.write(md);
|
|
52
|
+
process.exit(0);
|
|
53
|
+
}
|
|
54
|
+
usage();
|
|
55
|
+
process.exit(1);
|
|
56
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,CAAC,GAAG,EAAE,EAAE,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAElD,SAAS,KAAK;IACZ,OAAO,CAAC,KAAK,CAAC;;;;;CAKf,CAAC,CAAC;AACH,CAAC;AAED,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,QAAQ,EAAE,CAAC;IAC/C,KAAK,EAAE,CAAC;IACR,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5B,CAAC;AAED,IAAI,GAAG,KAAK,gBAAgB,EAAE,CAAC;IAC7B,KAAK,MAAM,EAAE,IAAI,gBAAgB,CAAC,YAAY,EAAE,EAAE,CAAC;QACjD,OAAO,CAAC,GAAG,CAAC,GAAG,EA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AAI,CAAC,EAAE,EAAE,CAAC;QACR,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,IAAI,QAAQ,EAAE,CAAC,CAAC;QAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACzB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,KAAK,EAAE,CAAC;AACR,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Auto-generated by scripts/build-docs-knowledge.mjs — do not edit. */
|
|
2
|
+
import type { AgentManifest, Catalog, SiteConfig, UseCasesFile } from "@x12i/docify-core";
|
|
3
|
+
export declare const catalog: Catalog;
|
|
4
|
+
export declare const useCases: UseCasesFile;
|
|
5
|
+
export declare const site: SiteConfig;
|
|
6
|
+
export declare const manifest: AgentManifest;
|
|
7
|
+
export declare const files: Record<string, string>;
|
|
8
|
+
//# sourceMappingURL=bundle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/generated/bundle.ts"],"names":[],"mappings":"AACA,wEAAwE;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE1F,eAAO,MAAM,OAAO,EAmHf,OAAO,CAAC;AAEb,eAAO,MAAM,QAAQ,EA2LhB,YAAY,CAAC;AAElB,eAAO,MAAM,IAAI,EA8CZ,UAAU,CAAC;AAEhB,eAAO,MAAM,QAAQ,EA0MhB,aAAa,CAAC;AAEnB,eAAO,MAAM,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAqBxC,CAAC"}
|
|
@@ -0,0 +1,577 @@
|
|
|
1
|
+
export const catalog = {
|
|
2
|
+
"roles": [
|
|
3
|
+
{
|
|
4
|
+
"id": "developers",
|
|
5
|
+
"label": "Developers",
|
|
6
|
+
"tagline": "Build and ship simulators",
|
|
7
|
+
"description": "Engineers who define SimulatorDefinition endpoints, wire Node/HTTP adapters, and publish package simulators."
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"families": [
|
|
11
|
+
{
|
|
12
|
+
"id": "api-simulator",
|
|
13
|
+
"name": "api-simulator",
|
|
14
|
+
"tagline": "Transport-agnostic API simulation — fixed, relative, and function behaviors.",
|
|
15
|
+
"description": "Core library, adapters, package-simulator patterns, and Playground/Studio apps.",
|
|
16
|
+
"color": "#16324f"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"books": [
|
|
20
|
+
{
|
|
21
|
+
"id": "00-overview",
|
|
22
|
+
"familyId": "api-simulator",
|
|
23
|
+
"audiences": [
|
|
24
|
+
"developers"
|
|
25
|
+
],
|
|
26
|
+
"status": "available",
|
|
27
|
+
"kicker": "CASE FILE · SIM-00",
|
|
28
|
+
"title": "Overview",
|
|
29
|
+
"subtitle": "What api-simulator is",
|
|
30
|
+
"blurb": "Install, a minimal three-behavior example, and where to go next.",
|
|
31
|
+
"tags": [
|
|
32
|
+
"start-here",
|
|
33
|
+
"overview",
|
|
34
|
+
"install"
|
|
35
|
+
],
|
|
36
|
+
"color": "#16324f",
|
|
37
|
+
"dir": "00-overview"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"id": "01-behaviors",
|
|
41
|
+
"familyId": "api-simulator",
|
|
42
|
+
"audiences": [
|
|
43
|
+
"developers"
|
|
44
|
+
],
|
|
45
|
+
"status": "available",
|
|
46
|
+
"kicker": "CASE FILE · SIM-01",
|
|
47
|
+
"title": "Behaviors and Dispatch",
|
|
48
|
+
"subtitle": "Fixed, relative, simulation",
|
|
49
|
+
"blurb": "The three endpoint behaviors, dispatch APIs, contracts, latency, raw bodies, and path patterns.",
|
|
50
|
+
"tags": [
|
|
51
|
+
"behaviors",
|
|
52
|
+
"dispatch",
|
|
53
|
+
"templates"
|
|
54
|
+
],
|
|
55
|
+
"color": "#1f6e5c",
|
|
56
|
+
"dir": "01-behaviors"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"id": "02-adapters",
|
|
60
|
+
"familyId": "api-simulator",
|
|
61
|
+
"audiences": [
|
|
62
|
+
"developers"
|
|
63
|
+
],
|
|
64
|
+
"status": "available",
|
|
65
|
+
"kicker": "CASE FILE · SIM-02",
|
|
66
|
+
"title": "Adapters and Helpers",
|
|
67
|
+
"subtitle": "Node, store, OpenAPI, fetch",
|
|
68
|
+
"blurb": "Expose simulators over HTTP, compose helpers, and plug into Express, Fastify, or fetch runtimes.",
|
|
69
|
+
"tags": [
|
|
70
|
+
"node",
|
|
71
|
+
"adapters",
|
|
72
|
+
"helpers"
|
|
73
|
+
],
|
|
74
|
+
"color": "#a5710f",
|
|
75
|
+
"dir": "02-adapters"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"id": "03-package-simulators",
|
|
79
|
+
"familyId": "api-simulator",
|
|
80
|
+
"audiences": [
|
|
81
|
+
"developers"
|
|
82
|
+
],
|
|
83
|
+
"status": "available",
|
|
84
|
+
"kicker": "CASE FILE · SIM-03",
|
|
85
|
+
"title": "Package Simulators",
|
|
86
|
+
"subtitle": "Product-owned packages",
|
|
87
|
+
"blurb": "Ship logic, data, and optional Memorix fixtures in a product package — with or without static-memorix.",
|
|
88
|
+
"tags": [
|
|
89
|
+
"packages",
|
|
90
|
+
"memorix",
|
|
91
|
+
"examples"
|
|
92
|
+
],
|
|
93
|
+
"color": "#8b3a3a",
|
|
94
|
+
"dir": "03-package-simulators"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"id": "04-playground-studio",
|
|
98
|
+
"familyId": "api-simulator",
|
|
99
|
+
"audiences": [
|
|
100
|
+
"developers"
|
|
101
|
+
],
|
|
102
|
+
"status": "available",
|
|
103
|
+
"kicker": "CASE FILE · SIM-04",
|
|
104
|
+
"title": "Playground and Studio",
|
|
105
|
+
"subtitle": "Try and author locally",
|
|
106
|
+
"blurb": "Two UI apps over the same library: ephemeral Playground and local-first Studio.",
|
|
107
|
+
"tags": [
|
|
108
|
+
"ui",
|
|
109
|
+
"playground",
|
|
110
|
+
"studio"
|
|
111
|
+
],
|
|
112
|
+
"color": "#4a3f6b",
|
|
113
|
+
"dir": "04-playground-studio"
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
};
|
|
117
|
+
export const useCases = {
|
|
118
|
+
"useCases": [
|
|
119
|
+
{
|
|
120
|
+
"id": "orient-simulator",
|
|
121
|
+
"title": "Orient on api-simulator",
|
|
122
|
+
"goal": "Understand what the library does, install it, and run a minimal three-behavior example.",
|
|
123
|
+
"audiences": [
|
|
124
|
+
"developers"
|
|
125
|
+
],
|
|
126
|
+
"tags": [
|
|
127
|
+
"start-here",
|
|
128
|
+
"overview"
|
|
129
|
+
],
|
|
130
|
+
"path": [
|
|
131
|
+
{
|
|
132
|
+
"bookId": "00-overview",
|
|
133
|
+
"audience": "developers",
|
|
134
|
+
"chapters": [
|
|
135
|
+
"1-what-it-is",
|
|
136
|
+
"2-install",
|
|
137
|
+
"3-minimal-example",
|
|
138
|
+
"4-where-to-go-next"
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
],
|
|
142
|
+
"alsoSee": [
|
|
143
|
+
"00-overview",
|
|
144
|
+
"01-behaviors"
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"id": "define-three-behaviors",
|
|
149
|
+
"title": "Define the three endpoint behaviors",
|
|
150
|
+
"goal": "Author fixed, relative, and simulation endpoints and dispatch them from tests or adapters.",
|
|
151
|
+
"audiences": [
|
|
152
|
+
"developers"
|
|
153
|
+
],
|
|
154
|
+
"tags": [
|
|
155
|
+
"behaviors",
|
|
156
|
+
"dispatch"
|
|
157
|
+
],
|
|
158
|
+
"path": [
|
|
159
|
+
{
|
|
160
|
+
"bookId": "01-behaviors",
|
|
161
|
+
"audience": "developers",
|
|
162
|
+
"chapters": [
|
|
163
|
+
"1-fixed",
|
|
164
|
+
"2-relative",
|
|
165
|
+
"3-simulation-function",
|
|
166
|
+
"4-dispatch",
|
|
167
|
+
"5-endpoint-contract"
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
],
|
|
171
|
+
"alsoSee": [
|
|
172
|
+
"01-behaviors",
|
|
173
|
+
"02-adapters"
|
|
174
|
+
]
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"id": "expose-node-service",
|
|
178
|
+
"title": "Expose a Node.js HTTP service",
|
|
179
|
+
"goal": "Wrap a simulator with the Node HTTP adapter, and for processes that bind a port use @x12i/core-service (/health, /_live).",
|
|
180
|
+
"audiences": [
|
|
181
|
+
"developers"
|
|
182
|
+
],
|
|
183
|
+
"tags": [
|
|
184
|
+
"node",
|
|
185
|
+
"http",
|
|
186
|
+
"adapters",
|
|
187
|
+
"core-service"
|
|
188
|
+
],
|
|
189
|
+
"path": [
|
|
190
|
+
{
|
|
191
|
+
"bookId": "02-adapters",
|
|
192
|
+
"audience": "developers",
|
|
193
|
+
"chapters": [
|
|
194
|
+
"1-node-http-adapter",
|
|
195
|
+
"2-http-process-compliance-local-services",
|
|
196
|
+
"3-multiple-apis",
|
|
197
|
+
"7-express-and-fastify"
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
"alsoSee": [
|
|
202
|
+
"02-adapters"
|
|
203
|
+
]
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"id": "ship-package-simulator",
|
|
207
|
+
"title": "Ship a package simulator",
|
|
208
|
+
"goal": "Structure a product-owned package with logic, data, optional static-memorix composition, and core-service on the HTTP entry.",
|
|
209
|
+
"audiences": [
|
|
210
|
+
"developers"
|
|
211
|
+
],
|
|
212
|
+
"tags": [
|
|
213
|
+
"packages",
|
|
214
|
+
"memorix",
|
|
215
|
+
"core-service"
|
|
216
|
+
],
|
|
217
|
+
"path": [
|
|
218
|
+
{
|
|
219
|
+
"bookId": "03-package-simulators",
|
|
220
|
+
"audience": "developers",
|
|
221
|
+
"chapters": [
|
|
222
|
+
"1-what-a-package-simulator-is",
|
|
223
|
+
"2-recommended-structure",
|
|
224
|
+
"4-with-static-memorix"
|
|
225
|
+
]
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"bookId": "02-adapters",
|
|
229
|
+
"audience": "developers",
|
|
230
|
+
"chapters": [
|
|
231
|
+
"2-http-process-compliance-local-services"
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
],
|
|
235
|
+
"alsoSee": [
|
|
236
|
+
"03-package-simulators",
|
|
237
|
+
"02-adapters"
|
|
238
|
+
]
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"id": "run-playground-studio",
|
|
242
|
+
"title": "Run Playground and Studio",
|
|
243
|
+
"goal": "Start the local UI apps, know the port map, and understand the product rule.",
|
|
244
|
+
"audiences": [
|
|
245
|
+
"developers"
|
|
246
|
+
],
|
|
247
|
+
"tags": [
|
|
248
|
+
"ui",
|
|
249
|
+
"playground",
|
|
250
|
+
"studio"
|
|
251
|
+
],
|
|
252
|
+
"path": [
|
|
253
|
+
{
|
|
254
|
+
"bookId": "04-playground-studio",
|
|
255
|
+
"audience": "developers",
|
|
256
|
+
"chapters": [
|
|
257
|
+
"1-two-surfaces",
|
|
258
|
+
"2-run-locally",
|
|
259
|
+
"3-ports",
|
|
260
|
+
"4-product-rule"
|
|
261
|
+
]
|
|
262
|
+
}
|
|
263
|
+
],
|
|
264
|
+
"alsoSee": [
|
|
265
|
+
"04-playground-studio"
|
|
266
|
+
]
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"id": "library-demo-rest",
|
|
270
|
+
"title": "Build a plain REST package simulator",
|
|
271
|
+
"goal": "Follow the library-demo path: data modules, relative/simulation endpoints, no Memorix.",
|
|
272
|
+
"audiences": [
|
|
273
|
+
"developers"
|
|
274
|
+
],
|
|
275
|
+
"tags": [
|
|
276
|
+
"examples",
|
|
277
|
+
"rest",
|
|
278
|
+
"tutorial"
|
|
279
|
+
],
|
|
280
|
+
"path": [
|
|
281
|
+
{
|
|
282
|
+
"bookId": "03-package-simulators",
|
|
283
|
+
"audience": "developers",
|
|
284
|
+
"chapters": [
|
|
285
|
+
"1-what-a-package-simulator-is",
|
|
286
|
+
"3-plain-rest-library-demo"
|
|
287
|
+
]
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"bookId": "01-behaviors",
|
|
291
|
+
"audience": "developers",
|
|
292
|
+
"chapters": [
|
|
293
|
+
"2-relative",
|
|
294
|
+
"3-simulation-function"
|
|
295
|
+
]
|
|
296
|
+
}
|
|
297
|
+
],
|
|
298
|
+
"alsoSee": [
|
|
299
|
+
"03-package-simulators",
|
|
300
|
+
"01-behaviors"
|
|
301
|
+
]
|
|
302
|
+
}
|
|
303
|
+
]
|
|
304
|
+
};
|
|
305
|
+
export const site = {
|
|
306
|
+
"product": "api-simulator",
|
|
307
|
+
"brand": "x12i · api-simulator",
|
|
308
|
+
"brandAccent": "api-simulator",
|
|
309
|
+
"siteUrl": "https://docs.api-simulator.x12i.com",
|
|
310
|
+
"knowledgePackage": "@x12i/api-simulator-docs",
|
|
311
|
+
"footer": "api-simulator",
|
|
312
|
+
"accent": "oklch(45% 0.12 230)",
|
|
313
|
+
"accentAlt": "oklch(55% 0.12 50)",
|
|
314
|
+
"productUrl": "https://github.com/x12i/api-simulator",
|
|
315
|
+
"nav": [
|
|
316
|
+
{
|
|
317
|
+
"label": "Getting started",
|
|
318
|
+
"href": "/getting-started"
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"label": "Use cases",
|
|
322
|
+
"href": "/use-cases"
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
"label": "Catalog",
|
|
326
|
+
"href": "/catalog"
|
|
327
|
+
}
|
|
328
|
+
],
|
|
329
|
+
"footerLinks": [
|
|
330
|
+
{
|
|
331
|
+
"label": "Docs home",
|
|
332
|
+
"href": "/docs"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"label": "Getting started",
|
|
336
|
+
"href": "/getting-started"
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
"label": "Use cases",
|
|
340
|
+
"href": "/use-cases"
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"label": "Catalog",
|
|
344
|
+
"href": "/catalog"
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
"label": "Agents/SDK",
|
|
348
|
+
"href": "/agents"
|
|
349
|
+
}
|
|
350
|
+
]
|
|
351
|
+
};
|
|
352
|
+
export const manifest = {
|
|
353
|
+
"version": 1,
|
|
354
|
+
"product": "api-simulator",
|
|
355
|
+
"site": "https://docs.api-simulator.x12i.com",
|
|
356
|
+
"knowledgePackage": "@x12i/api-simulator-docs",
|
|
357
|
+
"roles": [
|
|
358
|
+
"developers"
|
|
359
|
+
],
|
|
360
|
+
"books": [
|
|
361
|
+
{
|
|
362
|
+
"id": "00-overview",
|
|
363
|
+
"audiences": [
|
|
364
|
+
"developers"
|
|
365
|
+
],
|
|
366
|
+
"md": {
|
|
367
|
+
"developers": "downloads/books/00-overview/developers.md"
|
|
368
|
+
},
|
|
369
|
+
"pdf": {
|
|
370
|
+
"developers": null
|
|
371
|
+
},
|
|
372
|
+
"chapters": {
|
|
373
|
+
"developers": "downloads/books/00-overview/developers.chapters.json"
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
"id": "01-behaviors",
|
|
378
|
+
"audiences": [
|
|
379
|
+
"developers"
|
|
380
|
+
],
|
|
381
|
+
"md": {
|
|
382
|
+
"developers": "downloads/books/01-behaviors/developers.md"
|
|
383
|
+
},
|
|
384
|
+
"pdf": {
|
|
385
|
+
"developers": null
|
|
386
|
+
},
|
|
387
|
+
"chapters": {
|
|
388
|
+
"developers": "downloads/books/01-behaviors/developers.chapters.json"
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"id": "02-adapters",
|
|
393
|
+
"audiences": [
|
|
394
|
+
"developers"
|
|
395
|
+
],
|
|
396
|
+
"md": {
|
|
397
|
+
"developers": "downloads/books/02-adapters/developers.md"
|
|
398
|
+
},
|
|
399
|
+
"pdf": {
|
|
400
|
+
"developers": null
|
|
401
|
+
},
|
|
402
|
+
"chapters": {
|
|
403
|
+
"developers": "downloads/books/02-adapters/developers.chapters.json"
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
"id": "03-package-simulators",
|
|
408
|
+
"audiences": [
|
|
409
|
+
"developers"
|
|
410
|
+
],
|
|
411
|
+
"md": {
|
|
412
|
+
"developers": "downloads/books/03-package-simulators/developers.md"
|
|
413
|
+
},
|
|
414
|
+
"pdf": {
|
|
415
|
+
"developers": null
|
|
416
|
+
},
|
|
417
|
+
"chapters": {
|
|
418
|
+
"developers": "downloads/books/03-package-simulators/developers.chapters.json"
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
"id": "04-playground-studio",
|
|
423
|
+
"audiences": [
|
|
424
|
+
"developers"
|
|
425
|
+
],
|
|
426
|
+
"md": {
|
|
427
|
+
"developers": "downloads/books/04-playground-studio/developers.md"
|
|
428
|
+
},
|
|
429
|
+
"pdf": {
|
|
430
|
+
"developers": null
|
|
431
|
+
},
|
|
432
|
+
"chapters": {
|
|
433
|
+
"developers": "downloads/books/04-playground-studio/developers.chapters.json"
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
],
|
|
437
|
+
"useCases": [
|
|
438
|
+
{
|
|
439
|
+
"id": "orient-simulator",
|
|
440
|
+
"title": "Orient on api-simulator",
|
|
441
|
+
"md": "downloads/use-cases/orient-simulator.md",
|
|
442
|
+
"path": [
|
|
443
|
+
{
|
|
444
|
+
"bookId": "00-overview",
|
|
445
|
+
"audience": "developers",
|
|
446
|
+
"chapters": [
|
|
447
|
+
"1-what-it-is",
|
|
448
|
+
"2-install",
|
|
449
|
+
"3-minimal-example",
|
|
450
|
+
"4-where-to-go-next"
|
|
451
|
+
]
|
|
452
|
+
}
|
|
453
|
+
]
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
"id": "define-three-behaviors",
|
|
457
|
+
"title": "Define the three endpoint behaviors",
|
|
458
|
+
"md": "downloads/use-cases/define-three-behaviors.md",
|
|
459
|
+
"path": [
|
|
460
|
+
{
|
|
461
|
+
"bookId": "01-behaviors",
|
|
462
|
+
"audience": "developers",
|
|
463
|
+
"chapters": [
|
|
464
|
+
"1-fixed",
|
|
465
|
+
"2-relative",
|
|
466
|
+
"3-simulation-function",
|
|
467
|
+
"4-dispatch",
|
|
468
|
+
"5-endpoint-contract"
|
|
469
|
+
]
|
|
470
|
+
}
|
|
471
|
+
]
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
"id": "expose-node-service",
|
|
475
|
+
"title": "Expose a Node.js HTTP service",
|
|
476
|
+
"md": "downloads/use-cases/expose-node-service.md",
|
|
477
|
+
"path": [
|
|
478
|
+
{
|
|
479
|
+
"bookId": "02-adapters",
|
|
480
|
+
"audience": "developers",
|
|
481
|
+
"chapters": [
|
|
482
|
+
"1-node-http-adapter",
|
|
483
|
+
"2-http-process-compliance-local-services",
|
|
484
|
+
"3-multiple-apis",
|
|
485
|
+
"7-express-and-fastify"
|
|
486
|
+
]
|
|
487
|
+
}
|
|
488
|
+
]
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
"id": "ship-package-simulator",
|
|
492
|
+
"title": "Ship a package simulator",
|
|
493
|
+
"md": "downloads/use-cases/ship-package-simulator.md",
|
|
494
|
+
"path": [
|
|
495
|
+
{
|
|
496
|
+
"bookId": "03-package-simulators",
|
|
497
|
+
"audience": "developers",
|
|
498
|
+
"chapters": [
|
|
499
|
+
"1-what-a-package-simulator-is",
|
|
500
|
+
"2-recommended-structure",
|
|
501
|
+
"4-with-static-memorix"
|
|
502
|
+
]
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
"bookId": "02-adapters",
|
|
506
|
+
"audience": "developers",
|
|
507
|
+
"chapters": [
|
|
508
|
+
"2-http-process-compliance-local-services"
|
|
509
|
+
]
|
|
510
|
+
}
|
|
511
|
+
]
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
"id": "run-playground-studio",
|
|
515
|
+
"title": "Run Playground and Studio",
|
|
516
|
+
"md": "downloads/use-cases/run-playground-studio.md",
|
|
517
|
+
"path": [
|
|
518
|
+
{
|
|
519
|
+
"bookId": "04-playground-studio",
|
|
520
|
+
"audience": "developers",
|
|
521
|
+
"chapters": [
|
|
522
|
+
"1-two-surfaces",
|
|
523
|
+
"2-run-locally",
|
|
524
|
+
"3-ports",
|
|
525
|
+
"4-product-rule"
|
|
526
|
+
]
|
|
527
|
+
}
|
|
528
|
+
]
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
"id": "library-demo-rest",
|
|
532
|
+
"title": "Build a plain REST package simulator",
|
|
533
|
+
"md": "downloads/use-cases/library-demo-rest.md",
|
|
534
|
+
"path": [
|
|
535
|
+
{
|
|
536
|
+
"bookId": "03-package-simulators",
|
|
537
|
+
"audience": "developers",
|
|
538
|
+
"chapters": [
|
|
539
|
+
"1-what-a-package-simulator-is",
|
|
540
|
+
"3-plain-rest-library-demo"
|
|
541
|
+
]
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
"bookId": "01-behaviors",
|
|
545
|
+
"audience": "developers",
|
|
546
|
+
"chapters": [
|
|
547
|
+
"2-relative",
|
|
548
|
+
"3-simulation-function"
|
|
549
|
+
]
|
|
550
|
+
}
|
|
551
|
+
]
|
|
552
|
+
}
|
|
553
|
+
]
|
|
554
|
+
};
|
|
555
|
+
export const files = {
|
|
556
|
+
"catalog.json": "{\n \"roles\": [\n {\n \"id\": \"developers\",\n \"label\": \"Developers\",\n \"tagline\": \"Build and ship simulators\",\n \"description\": \"Engineers who define SimulatorDefinition endpoints, wire Node/HTTP adapters, and publish package simulators.\"\n }\n ],\n \"families\": [\n {\n \"id\": \"api-simulator\",\n \"name\": \"api-simulator\",\n \"tagline\": \"Transport-agnostic API simulation — fixed, relative, and function behaviors.\",\n \"description\": \"Core library, adapters, package-simulator patterns, and Playground/Studio apps.\",\n \"color\": \"#16324f\"\n }\n ],\n \"books\": [\n {\n \"id\": \"00-overview\",\n \"familyId\": \"api-simulator\",\n \"audiences\": [\n \"developers\"\n ],\n \"status\": \"available\",\n \"kicker\": \"CASE FILE · SIM-00\",\n \"title\": \"Overview\",\n \"subtitle\": \"What api-simulator is\",\n \"blurb\": \"Install, a minimal three-behavior example, and where to go next.\",\n \"tags\": [\n \"start-here\",\n \"overview\",\n \"install\"\n ],\n \"color\": \"#16324f\",\n \"dir\": \"00-overview\"\n },\n {\n \"id\": \"01-behaviors\",\n \"familyId\": \"api-simulator\",\n \"audiences\": [\n \"developers\"\n ],\n \"status\": \"available\",\n \"kicker\": \"CASE FILE · SIM-01\",\n \"title\": \"Behaviors and Dispatch\",\n \"subtitle\": \"Fixed, relative, simulation\",\n \"blurb\": \"The three endpoint behaviors, dispatch APIs, contracts, latency, raw bodies, and path patterns.\",\n \"tags\": [\n \"behaviors\",\n \"dispatch\",\n \"templates\"\n ],\n \"color\": \"#1f6e5c\",\n \"dir\": \"01-behaviors\"\n },\n {\n \"id\": \"02-adapters\",\n \"familyId\": \"api-simulator\",\n \"audiences\": [\n \"developers\"\n ],\n \"status\": \"available\",\n \"kicker\": \"CASE FILE · SIM-02\",\n \"title\": \"Adapters and Helpers\",\n \"subtitle\": \"Node, store, OpenAPI, fetch\",\n \"blurb\": \"Expose simulators over HTTP, compose helpers, and plug into Express, Fastify, or fetch runtimes.\",\n \"tags\": [\n \"node\",\n \"adapters\",\n \"helpers\"\n ],\n \"color\": \"#a5710f\",\n \"dir\": \"02-adapters\"\n },\n {\n \"id\": \"03-package-simulators\",\n \"familyId\": \"api-simulator\",\n \"audiences\": [\n \"developers\"\n ],\n \"status\": \"available\",\n \"kicker\": \"CASE FILE · SIM-03\",\n \"title\": \"Package Simulators\",\n \"subtitle\": \"Product-owned packages\",\n \"blurb\": \"Ship logic, data, and optional Memorix fixtures in a product package — with or without static-memorix.\",\n \"tags\": [\n \"packages\",\n \"memorix\",\n \"examples\"\n ],\n \"color\": \"#8b3a3a\",\n \"dir\": \"03-package-simulators\"\n },\n {\n \"id\": \"04-playground-studio\",\n \"familyId\": \"api-simulator\",\n \"audiences\": [\n \"developers\"\n ],\n \"status\": \"available\",\n \"kicker\": \"CASE FILE · SIM-04\",\n \"title\": \"Playground and Studio\",\n \"subtitle\": \"Try and author locally\",\n \"blurb\": \"Two UI apps over the same library: ephemeral Playground and local-first Studio.\",\n \"tags\": [\n \"ui\",\n \"playground\",\n \"studio\"\n ],\n \"color\": \"#4a3f6b\",\n \"dir\": \"04-playground-studio\"\n }\n ]\n}",
|
|
557
|
+
"use-cases.json": "{\n \"useCases\": [\n {\n \"id\": \"orient-simulator\",\n \"title\": \"Orient on api-simulator\",\n \"goal\": \"Understand what the library does, install it, and run a minimal three-behavior example.\",\n \"audiences\": [\n \"developers\"\n ],\n \"tags\": [\n \"start-here\",\n \"overview\"\n ],\n \"path\": [\n {\n \"bookId\": \"00-overview\",\n \"audience\": \"developers\",\n \"chapters\": [\n \"1-what-it-is\",\n \"2-install\",\n \"3-minimal-example\",\n \"4-where-to-go-next\"\n ]\n }\n ],\n \"alsoSee\": [\n \"00-overview\",\n \"01-behaviors\"\n ]\n },\n {\n \"id\": \"define-three-behaviors\",\n \"title\": \"Define the three endpoint behaviors\",\n \"goal\": \"Author fixed, relative, and simulation endpoints and dispatch them from tests or adapters.\",\n \"audiences\": [\n \"developers\"\n ],\n \"tags\": [\n \"behaviors\",\n \"dispatch\"\n ],\n \"path\": [\n {\n \"bookId\": \"01-behaviors\",\n \"audience\": \"developers\",\n \"chapters\": [\n \"1-fixed\",\n \"2-relative\",\n \"3-simulation-function\",\n \"4-dispatch\",\n \"5-endpoint-contract\"\n ]\n }\n ],\n \"alsoSee\": [\n \"01-behaviors\",\n \"02-adapters\"\n ]\n },\n {\n \"id\": \"expose-node-service\",\n \"title\": \"Expose a Node.js HTTP service\",\n \"goal\": \"Wrap a simulator with the Node HTTP adapter, and for processes that bind a port use @x12i/core-service (/health, /_live).\",\n \"audiences\": [\n \"developers\"\n ],\n \"tags\": [\n \"node\",\n \"http\",\n \"adapters\",\n \"core-service\"\n ],\n \"path\": [\n {\n \"bookId\": \"02-adapters\",\n \"audience\": \"developers\",\n \"chapters\": [\n \"1-node-http-adapter\",\n \"2-http-process-compliance-local-services\",\n \"3-multiple-apis\",\n \"7-express-and-fastify\"\n ]\n }\n ],\n \"alsoSee\": [\n \"02-adapters\"\n ]\n },\n {\n \"id\": \"ship-package-simulator\",\n \"title\": \"Ship a package simulator\",\n \"goal\": \"Structure a product-owned package with logic, data, optional static-memorix composition, and core-service on the HTTP entry.\",\n \"audiences\": [\n \"developers\"\n ],\n \"tags\": [\n \"packages\",\n \"memorix\",\n \"core-service\"\n ],\n \"path\": [\n {\n \"bookId\": \"03-package-simulators\",\n \"audience\": \"developers\",\n \"chapters\": [\n \"1-what-a-package-simulator-is\",\n \"2-recommended-structure\",\n \"4-with-static-memorix\"\n ]\n },\n {\n \"bookId\": \"02-adapters\",\n \"audience\": \"developers\",\n \"chapters\": [\n \"2-http-process-compliance-local-services\"\n ]\n }\n ],\n \"alsoSee\": [\n \"03-package-simulators\",\n \"02-adapters\"\n ]\n },\n {\n \"id\": \"run-playground-studio\",\n \"title\": \"Run Playground and Studio\",\n \"goal\": \"Start the local UI apps, know the port map, and understand the product rule.\",\n \"audiences\": [\n \"developers\"\n ],\n \"tags\": [\n \"ui\",\n \"playground\",\n \"studio\"\n ],\n \"path\": [\n {\n \"bookId\": \"04-playground-studio\",\n \"audience\": \"developers\",\n \"chapters\": [\n \"1-two-surfaces\",\n \"2-run-locally\",\n \"3-ports\",\n \"4-product-rule\"\n ]\n }\n ],\n \"alsoSee\": [\n \"04-playground-studio\"\n ]\n },\n {\n \"id\": \"library-demo-rest\",\n \"title\": \"Build a plain REST package simulator\",\n \"goal\": \"Follow the library-demo path: data modules, relative/simulation endpoints, no Memorix.\",\n \"audiences\": [\n \"developers\"\n ],\n \"tags\": [\n \"examples\",\n \"rest\",\n \"tutorial\"\n ],\n \"path\": [\n {\n \"bookId\": \"03-package-simulators\",\n \"audience\": \"developers\",\n \"chapters\": [\n \"1-what-a-package-simulator-is\",\n \"3-plain-rest-library-demo\"\n ]\n },\n {\n \"bookId\": \"01-behaviors\",\n \"audience\": \"developers\",\n \"chapters\": [\n \"2-relative\",\n \"3-simulation-function\"\n ]\n }\n ],\n \"alsoSee\": [\n \"03-package-simulators\",\n \"01-behaviors\"\n ]\n }\n ]\n}",
|
|
558
|
+
"site.json": "{\n \"product\": \"api-simulator\",\n \"brand\": \"x12i · api-simulator\",\n \"brandAccent\": \"api-simulator\",\n \"siteUrl\": \"https://docs.api-simulator.x12i.com\",\n \"knowledgePackage\": \"@x12i/api-simulator-docs\",\n \"footer\": \"api-simulator\",\n \"accent\": \"oklch(45% 0.12 230)\",\n \"accentAlt\": \"oklch(55% 0.12 50)\",\n \"productUrl\": \"https://github.com/x12i/api-simulator\",\n \"nav\": [\n {\n \"label\": \"Getting started\",\n \"href\": \"/getting-started\"\n },\n {\n \"label\": \"Use cases\",\n \"href\": \"/use-cases\"\n },\n {\n \"label\": \"Catalog\",\n \"href\": \"/catalog\"\n }\n ],\n \"footerLinks\": [\n {\n \"label\": \"Docs home\",\n \"href\": \"/docs\"\n },\n {\n \"label\": \"Getting started\",\n \"href\": \"/getting-started\"\n },\n {\n \"label\": \"Use cases\",\n \"href\": \"/use-cases\"\n },\n {\n \"label\": \"Catalog\",\n \"href\": \"/catalog\"\n },\n {\n \"label\": \"Agents/SDK\",\n \"href\": \"/agents\"\n }\n ]\n}",
|
|
559
|
+
"agent-manifest.json": "{\n \"version\": 1,\n \"product\": \"api-simulator\",\n \"site\": \"https://docs.api-simulator.x12i.com\",\n \"knowledgePackage\": \"@x12i/api-simulator-docs\",\n \"roles\": [\n \"developers\"\n ],\n \"books\": [\n {\n \"id\": \"00-overview\",\n \"audiences\": [\n \"developers\"\n ],\n \"md\": {\n \"developers\": \"downloads/books/00-overview/developers.md\"\n },\n \"pdf\": {\n \"developers\": null\n },\n \"chapters\": {\n \"developers\": \"downloads/books/00-overview/developers.chapters.json\"\n }\n },\n {\n \"id\": \"01-behaviors\",\n \"audiences\": [\n \"developers\"\n ],\n \"md\": {\n \"developers\": \"downloads/books/01-behaviors/developers.md\"\n },\n \"pdf\": {\n \"developers\": null\n },\n \"chapters\": {\n \"developers\": \"downloads/books/01-behaviors/developers.chapters.json\"\n }\n },\n {\n \"id\": \"02-adapters\",\n \"audiences\": [\n \"developers\"\n ],\n \"md\": {\n \"developers\": \"downloads/books/02-adapters/developers.md\"\n },\n \"pdf\": {\n \"developers\": null\n },\n \"chapters\": {\n \"developers\": \"downloads/books/02-adapters/developers.chapters.json\"\n }\n },\n {\n \"id\": \"03-package-simulators\",\n \"audiences\": [\n \"developers\"\n ],\n \"md\": {\n \"developers\": \"downloads/books/03-package-simulators/developers.md\"\n },\n \"pdf\": {\n \"developers\": null\n },\n \"chapters\": {\n \"developers\": \"downloads/books/03-package-simulators/developers.chapters.json\"\n }\n },\n {\n \"id\": \"04-playground-studio\",\n \"audiences\": [\n \"developers\"\n ],\n \"md\": {\n \"developers\": \"downloads/books/04-playground-studio/developers.md\"\n },\n \"pdf\": {\n \"developers\": null\n },\n \"chapters\": {\n \"developers\": \"downloads/books/04-playground-studio/developers.chapters.json\"\n }\n }\n ],\n \"useCases\": [\n {\n \"id\": \"orient-simulator\",\n \"title\": \"Orient on api-simulator\",\n \"md\": \"downloads/use-cases/orient-simulator.md\",\n \"path\": [\n {\n \"bookId\": \"00-overview\",\n \"audience\": \"developers\",\n \"chapters\": [\n \"1-what-it-is\",\n \"2-install\",\n \"3-minimal-example\",\n \"4-where-to-go-next\"\n ]\n }\n ]\n },\n {\n \"id\": \"define-three-behaviors\",\n \"title\": \"Define the three endpoint behaviors\",\n \"md\": \"downloads/use-cases/define-three-behaviors.md\",\n \"path\": [\n {\n \"bookId\": \"01-behaviors\",\n \"audience\": \"developers\",\n \"chapters\": [\n \"1-fixed\",\n \"2-relative\",\n \"3-simulation-function\",\n \"4-dispatch\",\n \"5-endpoint-contract\"\n ]\n }\n ]\n },\n {\n \"id\": \"expose-node-service\",\n \"title\": \"Expose a Node.js HTTP service\",\n \"md\": \"downloads/use-cases/expose-node-service.md\",\n \"path\": [\n {\n \"bookId\": \"02-adapters\",\n \"audience\": \"developers\",\n \"chapters\": [\n \"1-node-http-adapter\",\n \"2-http-process-compliance-local-services\",\n \"3-multiple-apis\",\n \"7-express-and-fastify\"\n ]\n }\n ]\n },\n {\n \"id\": \"ship-package-simulator\",\n \"title\": \"Ship a package simulator\",\n \"md\": \"downloads/use-cases/ship-package-simulator.md\",\n \"path\": [\n {\n \"bookId\": \"03-package-simulators\",\n \"audience\": \"developers\",\n \"chapters\": [\n \"1-what-a-package-simulator-is\",\n \"2-recommended-structure\",\n \"4-with-static-memorix\"\n ]\n },\n {\n \"bookId\": \"02-adapters\",\n \"audience\": \"developers\",\n \"chapters\": [\n \"2-http-process-compliance-local-services\"\n ]\n }\n ]\n },\n {\n \"id\": \"run-playground-studio\",\n \"title\": \"Run Playground and Studio\",\n \"md\": \"downloads/use-cases/run-playground-studio.md\",\n \"path\": [\n {\n \"bookId\": \"04-playground-studio\",\n \"audience\": \"developers\",\n \"chapters\": [\n \"1-two-surfaces\",\n \"2-run-locally\",\n \"3-ports\",\n \"4-product-rule\"\n ]\n }\n ]\n },\n {\n \"id\": \"library-demo-rest\",\n \"title\": \"Build a plain REST package simulator\",\n \"md\": \"downloads/use-cases/library-demo-rest.md\",\n \"path\": [\n {\n \"bookId\": \"03-package-simulators\",\n \"audience\": \"developers\",\n \"chapters\": [\n \"1-what-a-package-simulator-is\",\n \"3-plain-rest-library-demo\"\n ]\n },\n {\n \"bookId\": \"01-behaviors\",\n \"audience\": \"developers\",\n \"chapters\": [\n \"2-relative\",\n \"3-simulation-function\"\n ]\n }\n ]\n }\n ]\n}",
|
|
560
|
+
"downloads/books/00-overview/developers.chapters.json": "[\n {\n \"slug\": \"preamble\",\n \"title\": \"Introduction\",\n \"level\": 2,\n \"order\": 0\n },\n {\n \"slug\": \"1-what-it-is\",\n \"title\": \"1. What it is\",\n \"level\": 2,\n \"order\": 1\n },\n {\n \"slug\": \"2-install\",\n \"title\": \"2. Install\",\n \"level\": 2,\n \"order\": 2\n },\n {\n \"slug\": \"3-minimal-example\",\n \"title\": \"3. Minimal example\",\n \"level\": 2,\n \"order\": 3\n },\n {\n \"slug\": \"4-where-to-go-next\",\n \"title\": \"4. Where to go next\",\n \"level\": 2,\n \"order\": 4\n }\n]",
|
|
561
|
+
"downloads/books/00-overview/developers.md": "# Overview — Developers\n\n**Audience:** Engineers installing and evaluating `@x12i/api-simulator`. \n**Related:** [Behaviors](../01-behaviors/developers/BOOK.md) · [Package simulators](../03-package-simulators/developers/BOOK.md)\n\n---\n\n## 1. What it is\n\nCore TypeScript framework for building simulated API services.\n\nEach endpoint defines **exactly one** behavior:\n\n1. `fixed` — always return the configured response.\n2. `relative` — render a configured JSON response using values from the request and API-local data.\n3. `simulation` — run a function that receives the matched request and returns a response.\n\nThe core is transport-agnostic. It can be called directly from tests, wrapped by Fastify/Express, or exposed through the included Node.js HTTP adapter.\n\n**Data and metadata:** this package does **not** load fixtures from disk, MongoDB, Memorix, or HTTP. Consumers pass an in-memory `SimulatorDefinition` (`api.data` + endpoints). Optional helpers (`createStore`, OpenAPI) still take data you supply. Product-owned **package simulators** ship their own logic, data, and (when needed) Memorix fixtures.\n\n---\n\n## 2. Install\n\n```bash\nnpm install @x12i/api-simulator\n```\n\nRequires Node.js 20+.\n\n---\n\n## 3. Minimal example\n\n```ts\nimport { createApiSimulator } from '@x12i/api-simulator';\n\nconst simulator = createApiSimulator({\n apis: [\n {\n id: 'objects-api',\n basePath: '/api/v1',\n data: {\n children: [\n {\n id: 'child-1',\n parentId: '{{request.params.parentId}}'\n },\n {\n id: 'child-2',\n parentId: '{{request.params.parentId}}'\n }\n ]\n },\n endpoints: [\n {\n id: 'health',\n method: 'GET',\n path: '/health',\n behavior: {\n type: 'fixed',\n response: {\n status: 200,\n body: { status: 'ok' }\n }\n }\n },\n {\n id: 'list-children',\n method: 'GET',\n path: '/parents/:parentId/children',\n behavior: {\n type: 'relative',\n response: {\n body: {\n parentId: '{{request.params.parentId}}',\n items: '{{data.children}}'\n }\n }\n }\n },\n {\n id: 'calculate-score',\n method: 'POST',\n path: '/score',\n behavior: {\n type: 'simulation',\n handler: ({ request }) => {\n const values = (request.body as { values: number[] }).values;\n return {\n body: {\n score: values.reduce((sum, value) => sum + value, 0)\n }\n };\n }\n }\n }\n ]\n }\n ]\n});\n```\n\n---\n\n## 4. Where to go next\n\n- Try the **Playground** app (anonymous, ~30-second first dispatch).\n- Author projects in **Studio** (local-first).\n- Follow [`examples/library-demo/TUTORIAL.md`](../../../examples/library-demo/TUTORIAL.md) for a guided REST walkthrough.\n- Or [`examples/flowstate-simulator/TUTORIAL.md`](../../../examples/flowstate-simulator/TUTORIAL.md) to compose with `@x12i/static-memorix`.\n- Use cases: `orient-simulator`, `define-three-behaviors`, `ship-package-simulator`.\n",
|
|
562
|
+
"downloads/books/01-behaviors/developers.chapters.json": "[\n {\n \"slug\": \"preamble\",\n \"title\": \"Introduction\",\n \"level\": 2,\n \"order\": 0\n },\n {\n \"slug\": \"1-fixed\",\n \"title\": \"1. Fixed\",\n \"level\": 2,\n \"order\": 1\n },\n {\n \"slug\": \"2-relative\",\n \"title\": \"2. Relative\",\n \"level\": 2,\n \"order\": 2\n },\n {\n \"slug\": \"3-simulation-function\",\n \"title\": \"3. Simulation function\",\n \"level\": 2,\n \"order\": 3\n },\n {\n \"slug\": \"4-dispatch\",\n \"title\": \"4. Dispatch\",\n \"level\": 2,\n \"order\": 4\n },\n {\n \"slug\": \"5-endpoint-contract\",\n \"title\": \"5. Endpoint contract\",\n \"level\": 2,\n \"order\": 5\n },\n {\n \"slug\": \"6-artificial-latency\",\n \"title\": \"6. Artificial latency\",\n \"level\": 2,\n \"order\": 6\n },\n {\n \"slug\": \"7-raw-responses\",\n \"title\": \"7. Raw responses\",\n \"level\": 2,\n \"order\": 7\n },\n {\n \"slug\": \"8-path-patterns\",\n \"title\": \"8. Path patterns\",\n \"level\": 2,\n \"order\": 8\n }\n]",
|
|
563
|
+
"downloads/books/01-behaviors/developers.md": "# Behaviors and Dispatch — Developers\n\n**Audience:** Engineers defining endpoint behaviors and calling `dispatch`. \n**Related:** [Overview](../00-overview/developers/BOOK.md) · [Adapters](../02-adapters/developers/BOOK.md)\n\n---\n\n## 1. Fixed\n\nUse fixed behavior for health endpoints, stable metadata, constants, and simple fixtures.\n\n```ts\n{\n id: 'capabilities',\n method: 'GET',\n path: '/capabilities',\n behavior: {\n type: 'fixed',\n response: {\n status: 200,\n headers: { 'x-simulator': 'true' },\n body: { features: ['read', 'search'] }\n }\n }\n}\n```\n\n---\n\n## 2. Relative\n\nRelative behavior starts with configured JSON, then resolves tokens against the matched request and the API's internal `data` object.\n\nSupported token roots:\n\n- `{{request.params.parentId}}`\n- `{{request.query.page}}`\n- `{{request.headers.x-tenant-id}}`\n- `{{request.body.customer.id}}`\n- `{{data.children}}`\n- Array indexes, such as `{{data.users[0].id}}`\n\n```ts\n{\n id: 'children',\n method: 'GET',\n path: '/parents/:parentId/children',\n behavior: {\n type: 'relative',\n response: {\n body: {\n parentId: '{{request.params.parentId}}',\n items: '{{data.children}}'\n }\n }\n }\n}\n```\n\nA token occupying the entire string preserves its original type. Therefore, `{{request.body.limit}}` can produce a number and `{{data.children}}` can produce an array. A token embedded inside text is converted to a string:\n\n```ts\n{ message: 'Children for parent {{request.params.parentId}}' }\n```\n\nTokens inside API-local data are rendered too. This lets a reusable internal fixture inherit an identifier from the incoming request:\n\n```ts\ndata: {\n children: [\n { id: 'child-1', parentId: '{{request.params.parentId}}' }\n ]\n}\n```\n\nRelative behavior is strict by default. A missing token throws `TemplateResolutionError`. Set `strict: false` to leave unresolved tokens unchanged.\n\n---\n\n## 3. Simulation function\n\nUse a simulation function when output needs conditions, calculations, validation, generated values, branching, or error responses.\n\n```ts\n{\n id: 'quote',\n method: 'POST',\n path: '/quote',\n behavior: {\n type: 'simulation',\n handler: async ({ request, data, apiId, endpointId }) => {\n const quantity = Number((request.body as { quantity: number }).quantity);\n const unitPrice = Number(data.unitPrice);\n\n return {\n status: 201,\n body: {\n apiId,\n endpointId,\n quantity,\n unitPrice,\n total: quantity * unitPrice\n }\n };\n }\n }\n}\n```\n\n---\n\n## 4. Dispatch\n\n```ts\nconst result = await simulator.dispatch({\n method: 'GET',\n path: '/api/v1/parents/parent-42/children'\n});\n\nconsole.log(result.response.body);\n```\n\n`dispatch()` throws `EndpointNotFoundError` when nothing matches. `tryDispatch()` returns `undefined` instead.\n\n---\n\n## 5. Endpoint contract\n\n```ts\ntype EndpointDefinition = {\n id: string;\n method: HttpMethod;\n path: string;\n enabled?: boolean;\n delayMs?: number;\n behavior:\n | { type: 'fixed'; response: SimulatorResponse }\n | { type: 'relative'; response: SimulatorResponse; strict?: boolean }\n | { type: 'simulation'; handler: SimulationFunction };\n};\n```\n\nThe discriminated `behavior` union is the core guarantee: an endpoint cannot validly have two behaviors, and it cannot omit its behavior.\n\n---\n\n## 6. Artificial latency\n\n```ts\n{\n id: 'slow-search',\n method: 'GET',\n path: '/search',\n delayMs: 750,\n behavior: {\n type: 'fixed',\n response: { body: { items: [] } }\n }\n}\n```\n\n---\n\n## 7. Raw responses\n\n```ts\nimport { RawResponseBody, createApiSimulator } from '@x12i/api-simulator';\n\n// In a simulation handler:\nreturn {\n body: new RawResponseBody('<h1>hello</h1>', 'text/html; charset=utf-8')\n};\n```\n\nTransport adapters write `RawResponseBody` verbatim instead of `JSON.stringify`.\n\n---\n\n## 8. Path patterns\n\nSupports `:id`, `:id(\\\\d+)`, and optional `:slug?` segments. Static routes are matched before parameter routes, so `/users/me` wins over `/users/:id`.\n",
|
|
564
|
+
"downloads/books/02-adapters/developers.chapters.json": "[\n {\n \"slug\": \"preamble\",\n \"title\": \"Introduction\",\n \"level\": 2,\n \"order\": 0\n },\n {\n \"slug\": \"1-node-http-adapter\",\n \"title\": \"1. Node HTTP adapter\",\n \"level\": 2,\n \"order\": 1\n },\n {\n \"slug\": \"2-http-process-compliance-local-services\",\n \"title\": \"2. HTTP process compliance (local services)\",\n \"level\": 2,\n \"order\": 2\n },\n {\n \"slug\": \"3-multiple-apis\",\n \"title\": \"3. Multiple APIs\",\n \"level\": 2,\n \"order\": 3\n },\n {\n \"slug\": \"4-in-memory-store\",\n \"title\": \"4. In-memory store\",\n \"level\": 2,\n \"order\": 4\n },\n {\n \"slug\": \"5-openapi-skeletons\",\n \"title\": \"5. OpenAPI skeletons\",\n \"level\": 2,\n \"order\": 5\n },\n {\n \"slug\": \"6-fetch-adapter\",\n \"title\": \"6. Fetch adapter\",\n \"level\": 2,\n \"order\": 6\n },\n {\n \"slug\": \"7-express-and-fastify\",\n \"title\": \"7. Express and Fastify\",\n \"level\": 2,\n \"order\": 7\n },\n {\n \"slug\": \"8-auth-and-rate-limits\",\n \"title\": \"8. Auth and rate limits\",\n \"level\": 2,\n \"order\": 8\n },\n {\n \"slug\": \"9-cors-host-and-validators\",\n \"title\": \"9. CORS host and validators\",\n \"level\": 2,\n \"order\": 9\n },\n {\n \"slug\": \"10-record-and-replay\",\n \"title\": \"10. Record and replay\",\n \"level\": 2,\n \"order\": 10\n },\n {\n \"slug\": \"11-node-body-parsers\",\n \"title\": \"11. Node body parsers\",\n \"level\": 2,\n \"order\": 11\n },\n {\n \"slug\": \"12-simulator-options\",\n \"title\": \"12. Simulator options\",\n \"level\": 2,\n \"order\": 12\n }\n]",
|
|
565
|
+
"downloads/books/02-adapters/developers.md": "# Adapters and Helpers — Developers\n\n**Audience:** Engineers exposing simulators over HTTP and composing helpers. \n**Related:** [Behaviors](../01-behaviors/developers/BOOK.md) · [Package simulators](../03-package-simulators/developers/BOOK.md)\n\n---\n\n## 1. Node HTTP adapter\n\n```ts\nimport { createServer } from 'node:http';\nimport { createNodeHttpHandler } from '@x12i/api-simulator/node';\n\ncreateServer(createNodeHttpHandler(simulator)).listen(5520);\n```\n\nThe adapter:\n\n- parses URL path and query values;\n- normalizes request headers to lowercase keys (values may be `string | string[]`);\n- parses JSON, urlencoded, and text bodies by default; returns `Buffer` for binary;\n- returns `404` when no simulated endpoint matches;\n- returns `500` when rendering or simulation fails;\n- limits request bodies to 1 MiB by default;\n- writes `RawResponseBody` verbatim (HTML/XML/CSV/binary).\n\nThe `./node` adapter is **transport-only**. It does not bind ports, serve `/_live`, or print a compliance banner. Processes that **listen on HTTP** should wrap it with `@x12i/core-service` (next section).\n\n---\n\n## 2. HTTP process compliance (local services)\n\nAny example or package simulator that **binds an HTTP port** should use [`@x12i/core-service`](https://www.npmjs.com/package/@x12i/core-service) (pulls `@x12i/api-live-view`; uses `@x12i/ports-manager`).\n\nProduct contract (current **`@x12i/memorix-docs`**, not old memorix-ebooks):\n\n- Use case **`http-process-compliance`**\n- Building Services (developers) → **HTTP process compliance (local services)**\n- Deep reference: package READMEs for `core-service`, `ports-manager`, `api-live-view`\n\nThis repo applies that contract in zone **`api-simulator` (5520–5539)** — not Memorix’s 5100–5119.\n\n| Surface | Role |\n|--------|------|\n| Port from zone map | `scripts/api-simulator-ports.mjs` / `createSimulatorHttp` |\n| `GET /health` | Process liveness |\n| `/_live` | In-process request rings (api-live-view) |\n| `x-correlation-id` | Request/response correlation |\n| Startup banner | origin · health · live · docs |\n\nShared helper:\n\n```js\nimport { createSimulatorHttp } from '../../scripts/create-simulator-http.mjs';\n\nconst { core, announce } = createSimulatorHttp({\n id: 'my-simulator',\n title: 'My package simulator',\n portKey: 'api', // or flowstate / libraryDemo\n portEnv: 'API_SIMULATOR_API_PORT'\n});\n\nconst server = createServer(async (req, res) => {\n if (await core.tryHandleCore(req, res)) return;\n await createNodeHttpHandler(simulator)(req, res);\n});\n\nawait announce(server);\n```\n\nPublished `@x12i/api-simulator` stays **zero runtime dependencies**. Remote *clients* do not install these kits; *servers that bind* do.\n\n---\n\n## 3. Multiple APIs\n\nA single simulator can expose many APIs. Each API has its own `id`, optional `basePath`, internal `data`, and endpoints.\n\n```ts\nconst simulator = createApiSimulator({\n apis: [crmApi, billingApi, identityApi]\n});\n```\n\nDuplicate `METHOD + full path` routes are rejected during startup. Structurally ambiguous routes such as `/users/:id` and `/users/:name` are also rejected. Static routes are matched before parameter routes.\n\n---\n\n## 4. In-memory store\n\n```ts\nimport { createStore } from '@x12i/api-simulator/store';\n\nconst users = createStore([{ id: '1', name: 'Ada' }]);\nusers.create({ name: 'Grace' });\nusers.list({ name: 'Ada' });\nusers.reset(); // restore seed — useful between tests\n```\n\n---\n\n## 5. OpenAPI skeletons\n\n```ts\nimport { openapiToApiDefinition } from '@x12i/api-simulator/openapi';\n\nconst api = openapiToApiDefinition(parsedOpenApiObject, { id: 'pets-api', basePath: '/v1' });\n```\n\nPass an already-parsed JS object (parse YAML yourself if needed).\n\n---\n\n## 6. Fetch adapter\n\n```ts\nimport { createFetchHandler } from '@x12i/api-simulator/fetch';\n\nexport default {\n fetch: createFetchHandler(simulator)\n};\n```\n\n---\n\n## 7. Express and Fastify\n\n```ts\n// Express\napp.use(async (req, res) => {\n const match = await simulator.tryDispatch({\n method: req.method,\n path: req.path,\n headers: req.headers,\n query: req.query,\n body: req.body\n });\n if (!match) return res.status(404).json({ error: 'NOT_FOUND' });\n res.status(match.response.status ?? 200).set(match.response.headers ?? {}).send(match.response.body);\n});\n```\n\n---\n\n## 8. Auth and rate limits\n\n```ts\nimport { requireBearerToken, rateLimit } from '@x12i/api-simulator/helpers';\n\nhandler: rateLimit({ windowMs: 60_000, max: 30 })(\n requireBearerToken((token) => token === 'secret')(\n ({ request }) => ({ body: { ok: true, path: request.path } })\n )\n)\n```\n\n---\n\n## 9. CORS host and validators\n\n```ts\n{\n id: 'api',\n host: 'tenant.example.com',\n cors: { origins: '*', methods: ['GET', 'POST', 'OPTIONS'] },\n endpoints: [{\n id: 'create',\n method: 'POST',\n path: '/items',\n validate: ({ request }) => {\n if (!request.body) return { status: 400, body: { error: 'EMPTY' } };\n },\n behavior: { type: 'fixed', response: { status: 201, body: { ok: true } } }\n }]\n}\n```\n\n---\n\n## 10. Record and replay\n\n```bash\nnode scripts/record-replay.mjs --base https://httpbin.org --paths /get,/uuid --out captured.json\n```\n\n---\n\n## 11. Node body parsers\n\nBuilt-in parsers: JSON, `application/x-www-form-urlencoded`, `text/plain`. Binary bodies are returned as `Buffer`. Plug in multipart yourself:\n\n```ts\ncreateNodeHttpHandler(simulator, {\n bodyParsers: {\n 'multipart/form-data': async (raw, contentType) => {\n // use busboy / your parser of choice\n return { rawLength: raw.length, contentType };\n }\n }\n});\n```\n\n---\n\n## 12. Simulator options\n\n```ts\nconst simulator = createApiSimulator(definition, {\n recordHistory: { limit: 100 },\n validateTemplates: true // checks {{data.*}} at construction\n});\n\nsimulator.getHistory();\nsimulator.clearHistory();\n```\n",
|
|
566
|
+
"downloads/books/03-package-simulators/developers.chapters.json": "[\n {\n \"slug\": \"preamble\",\n \"title\": \"Introduction\",\n \"level\": 2,\n \"order\": 0\n },\n {\n \"slug\": \"1-what-a-package-simulator-is\",\n \"title\": \"1. What a package simulator is\",\n \"level\": 2,\n \"order\": 1\n },\n {\n \"slug\": \"2-recommended-structure\",\n \"title\": \"2. Recommended structure\",\n \"level\": 2,\n \"order\": 2\n },\n {\n \"slug\": \"3-plain-rest-library-demo\",\n \"title\": \"3. Plain REST library-demo\",\n \"level\": 2,\n \"order\": 3\n },\n {\n \"slug\": \"4-with-static-memorix\",\n \"title\": \"4. With static-memorix\",\n \"level\": 2,\n \"order\": 4\n },\n {\n \"slug\": \"5-flowstate-walkthrough\",\n \"title\": \"5. FlowState walkthrough\",\n \"level\": 2,\n \"order\": 5\n }\n]",
|
|
567
|
+
"downloads/books/03-package-simulators/developers.md": "# Package Simulators — Developers\n\n**Audience:** Engineers shipping product-owned simulator packages. \n**Related:** [Overview](../00-overview/developers/BOOK.md) · [Behaviors](../01-behaviors/developers/BOOK.md)\n\n---\n\n## 1. What a package simulator is\n\nA **package simulator** is a small product-owned package that uses `@x12i/api-simulator` as the engine and ships its own:\n\n- **logic** — `simulation` handlers (and optional `createStore` state)\n- **data** — seeds under `api.data` and/or fixture JSON\n- **metadata** — when the product speaks Memorix, declarative packs and explorer fixtures\n\nThe core library stays **zero runtime dependencies** and does not load data or metadata from disk, MongoDB, or HTTP. Your package (or an example like `examples/flowstate-simulator`) owns that.\n\n---\n\n## 2. Recommended structure\n\n```text\nmy-provider-simulator/\n├─ mocks/ # optional — shared with static-memorix when used\n│ ├─ data/\n│ ├─ metadata/\n│ └─ metadata-packs/\n├─ src/\n│ ├─ data/ # seeds for api.data / createStore\n│ ├─ simulations/ # package-specific handlers\n│ ├─ api.ts # createApiSimulator({ apis: [...] })\n│ ├─ memorix.ts # optional — buildServer({ MOCKS_DIR })\n│ └─ server.ts # Node/HTTP entry: core-service + tryDispatch ± forward\n└─ package.json\n```\n\nKeep provider-specific data and simulation logic outside `@x12i/api-simulator`. The core remains the reusable engine.\n\nHTTP entrypoints that bind a port use [`@x12i/core-service`](https://www.npmjs.com/package/@x12i/core-service) (see [Adapters — HTTP process compliance](../02-adapters/developers/BOOK.md#2-http-process-compliance-local-services)). Shared helper in this repo: [`scripts/create-simulator-http.mjs`](../../../scripts/create-simulator-http.mjs).\n\n---\n\n## 3. Plain REST library-demo\n\nIf the API is ordinary REST (no Memorix), follow [`examples/library-demo/TUTORIAL.md`](../../../examples/library-demo/TUTORIAL.md):\n\n1. Data modules seed `api.data` / `createStore`.\n2. Relative endpoints for list/read shapes; simulation handlers for writes and branching.\n3. `createApiSimulator` + optional Node HTTP entry — **no** `@x12i/static-memorix`.\n\nRunnable reference: [`examples/library-demo/`](../../../examples/library-demo).\n\n---\n\n## 4. With static-memorix\n\nFor Memorix Explorer (`/api/explorer/*`) and Metadata (`/api/metadata/*`) parity without MongoDB/Redis, compose [`@x12i/static-memorix`](https://www.npmjs.com/package/@x12i/static-memorix):\n\n1. Keep a shared `mocks/` tree (`data/`, `metadata/`, `metadata-packs/`).\n2. Load seeds into package REST via small helpers (see the FlowState example’s `src/bridge.mjs`).\n3. Run `buildServer()` / `startServer()` with `MOCKS_DIR` pointing at that tree.\n4. Serve one port with `@x12i/core-service`: `tryHandleCore` → `tryDispatch` package routes → forward misses to static-memorix (`inject`).\n\n| Surface | Owner |\n|--------|--------|\n| `/health`, `/_live` | `@x12i/core-service` (zone `api-simulator`) |\n| `/api/v1/<your-product>/*` | `@x12i/api-simulator` endpoints in your package |\n| `/api/explorer/*`, `/api/metadata/*` | `@x12i/static-memorix` (`MOCKS_DIR` → shared `mocks/`) |\n\n**Org scope:** `x-memorix-org-id` may be sent for client realism; it is a **no-op for isolation** in this simulator (not `memorix-service`).\n\nstatic-memorix is not a substitute for full `memorix-service` (pipelines, relationship materialize, abstract reverse-write, etc.).\n\n---\n\n## 5. FlowState walkthrough\n\nFull compose walkthrough: [`examples/flowstate-simulator/TUTORIAL.md`](../../../examples/flowstate-simulator/TUTORIAL.md).\n\n```bash\nnode examples/flowstate-simulator/demo.mjs\nnode examples/flowstate-simulator/src/server.mjs # :5522\n```\n",
|
|
568
|
+
"downloads/books/04-playground-studio/developers.chapters.json": "[\n {\n \"slug\": \"preamble\",\n \"title\": \"Introduction\",\n \"level\": 2,\n \"order\": 0\n },\n {\n \"slug\": \"1-two-surfaces\",\n \"title\": \"1. Two surfaces\",\n \"level\": 2,\n \"order\": 1\n },\n {\n \"slug\": \"2-run-locally\",\n \"title\": \"2. Run locally\",\n \"level\": 2,\n \"order\": 2\n },\n {\n \"slug\": \"3-ports\",\n \"title\": \"3. Ports\",\n \"level\": 2,\n \"order\": 3\n },\n {\n \"slug\": \"4-product-rule\",\n \"title\": \"4. Product rule\",\n \"level\": 2,\n \"order\": 4\n },\n {\n \"slug\": \"5-out-of-v1-studio\",\n \"title\": \"5. Out of v1 Studio\",\n \"level\": 2,\n \"order\": 5\n }\n]",
|
|
569
|
+
"downloads/books/04-playground-studio/developers.md": "# Playground and Studio — Developers\n\n**Audience:** Engineers running the local UI apps. \n**Related:** [Overview](../00-overview/developers/BOOK.md)\n\n---\n\n## 1. Two surfaces\n\nTwo separate UI apps over `@x12i/api-simulator`. They are **not** one merged workspace.\n\n| Surface | Job | Mindset |\n|---|---|---|\n| Playground (`apps/playground`) | Try a request in ~30 seconds | Ephemeral, session-only |\n| Studio (`apps/studio`) | Author and own a simulator | Persistent (IndexedDB), exportable |\n\nPlayground **Open in Studio** hands off the current definition via `sessionStorage`.\n\n---\n\n## 2. Run locally\n\nFrom the repo root (after `npm install` and `npm run build`):\n\n```bash\nnpm run build\nnpm run dev -w @x12i/playground # http://127.0.0.1:5523\nnpm run dev -w @x12i/studio # http://127.0.0.1:5521\n```\n\nOr use the root aliases: `npm run dev:playground` / `npm run dev:studio`.\n\n---\n\n## 3. Ports\n\nPorts come from [`@x12i/ports-manager`](https://www.npmjs.com/package/@x12i/ports-manager) zone **`api-simulator`** (5520–5539, even = API, odd = UI). Wrapper: [`scripts/api-simulator-ports.mjs`](../../../scripts/api-simulator-ports.mjs).\n\n| Name | Port | Role |\n|------|------|------|\n| `api` / library-demo / codegen | 5520 | API |\n| `studio` (Vite) | 5521 | UI |\n| `flowstate` compose server | 5522 | API |\n| `playground` (Vite) | 5523 | UI |\n\n```bash\nnpx x12i-ports zone api-simulator\n```\n\n**UI apps vs API processes:** Playground and Studio are Vite **UI** processes (odd ports). They do not need `@x12i/core-service` `/_live`. Example **API** processes that bind even ports (library-demo, FlowState compose, `node-server`) use `@x12i/core-service` for `/health` and `/_live` — see [Adapters — HTTP process compliance](../02-adapters/developers/BOOK.md#2-http-process-compliance-local-services).\n\n---\n\n## 4. Product rule\n\nBoth apps edit a UI model that maps to `SimulatorDefinition` / endpoint behaviors. The library remains the API of record; the UIs generate and preview — they do not invent a parallel DSL.\n\n---\n\n## 5. Out of v1 Studio\n\nCloud auth/sync, org SSO, CI, marketplace, multi-env matrices, and share links are deferred (Studio v1.1+).\n",
|
|
570
|
+
"downloads/use-cases/define-three-behaviors.md": "# Define the three endpoint behaviors\n\n> **Use case id:** `define-three-behaviors`\n> **Goal:** Author fixed, relative, and simulation endpoints and dispatch them from tests or adapters.\n> **Audiences:** developers\n> **Tags:** behaviors, dispatch\n\n## Reading path\n\n1. **Behaviors and Dispatch** (developers) → chapters: `1-fixed`, `2-relative`, `3-simulation-function`, `4-dispatch`, `5-endpoint-contract`\n\n## From: Behaviors and Dispatch — 1. Fixed\n\nUse fixed behavior for health endpoints, stable metadata, constants, and simple fixtures.\n\n```ts\n{\n id: 'capabilities',\n method: 'GET',\n path: '/capabilities',\n behavior: {\n type: 'fixed',\n response: {\n status: 200,\n headers: { 'x-simulator': 'true' },\n body: { features: ['read', 'search'] }\n }\n }\n}\n```\n\n---\n\n## From: Behaviors and Dispatch — 2. Relative\n\nRelative behavior starts with configured JSON, then resolves tokens against the matched request and the API's internal `data` object.\n\nSupported token roots:\n\n- `{{request.params.parentId}}`\n- `{{request.query.page}}`\n- `{{request.headers.x-tenant-id}}`\n- `{{request.body.customer.id}}`\n- `{{data.children}}`\n- Array indexes, such as `{{data.users[0].id}}`\n\n```ts\n{\n id: 'children',\n method: 'GET',\n path: '/parents/:parentId/children',\n behavior: {\n type: 'relative',\n response: {\n body: {\n parentId: '{{request.params.parentId}}',\n items: '{{data.children}}'\n }\n }\n }\n}\n```\n\nA token occupying the entire string preserves its original type. Therefore, `{{request.body.limit}}` can produce a number and `{{data.children}}` can produce an array. A token embedded inside text is converted to a string:\n\n```ts\n{ message: 'Children for parent {{request.params.parentId}}' }\n```\n\nTokens inside API-local data are rendered too. This lets a reusable internal fixture inherit an identifier from the incoming request:\n\n```ts\ndata: {\n children: [\n { id: 'child-1', parentId: '{{request.params.parentId}}' }\n ]\n}\n```\n\nRelative behavior is strict by default. A missing token throws `TemplateResolutionError`. Set `strict: false` to leave unresolved tokens unchanged.\n\n---\n\n## From: Behaviors and Dispatch — 3. Simulation function\n\nUse a simulation function when output needs conditions, calculations, validation, generated values, branching, or error responses.\n\n```ts\n{\n id: 'quote',\n method: 'POST',\n path: '/quote',\n behavior: {\n type: 'simulation',\n handler: async ({ request, data, apiId, endpointId }) => {\n const quantity = Number((request.body as { quantity: number }).quantity);\n const unitPrice = Number(data.unitPrice);\n\n return {\n status: 201,\n body: {\n apiId,\n endpointId,\n quantity,\n unitPrice,\n total: quantity * unitPrice\n }\n };\n }\n }\n}\n```\n\n---\n\n## From: Behaviors and Dispatch — 4. Dispatch\n\n```ts\nconst result = await simulator.dispatch({\n method: 'GET',\n path: '/api/v1/parents/parent-42/children'\n});\n\nconsole.log(result.response.body);\n```\n\n`dispatch()` throws `EndpointNotFoundError` when nothing matches. `tryDispatch()` returns `undefined` instead.\n\n---\n\n## From: Behaviors and Dispatch — 5. Endpoint contract\n\n```ts\ntype EndpointDefinition = {\n id: string;\n method: HttpMethod;\n path: string;\n enabled?: boolean;\n delayMs?: number;\n behavior:\n | { type: 'fixed'; response: SimulatorResponse }\n | { type: 'relative'; response: SimulatorResponse; strict?: boolean }\n | { type: 'simulation'; handler: SimulationFunction };\n};\n```\n\nThe discriminated `behavior` union is the core guarantee: an endpoint cannot validly have two behaviors, and it cannot omit its behavior.\n\n---\n\n## Also see\n\n- **Behaviors and Dispatch** (`01-behaviors`) — The three endpoint behaviors, dispatch APIs, contracts, latency, raw bodies, and path patterns.\n- **Adapters and Helpers** (`02-adapters`) — Expose simulators over HTTP, compose helpers, and plug into Express, Fastify, or fetch runtimes.\n\n---\n\n_Generated use-case pack for agents and humans. See `agent-manifest.json` for discovery._\n",
|
|
571
|
+
"downloads/use-cases/expose-node-service.md": "# Expose a Node.js HTTP service\n\n> **Use case id:** `expose-node-service`\n> **Goal:** Wrap a simulator with the Node HTTP adapter, and for processes that bind a port use @x12i/core-service (/health, /_live).\n> **Audiences:** developers\n> **Tags:** node, http, adapters, core-service\n\n## Reading path\n\n1. **Adapters and Helpers** (developers) → chapters: `1-node-http-adapter`, `2-http-process-compliance-local-services`, `3-multiple-apis`, `7-express-and-fastify`\n\n## From: Adapters and Helpers — 1. Node HTTP adapter\n\n```ts\nimport { createServer } from 'node:http';\nimport { createNodeHttpHandler } from '@x12i/api-simulator/node';\n\ncreateServer(createNodeHttpHandler(simulator)).listen(5520);\n```\n\nThe adapter:\n\n- parses URL path and query values;\n- normalizes request headers to lowercase keys (values may be `string | string[]`);\n- parses JSON, urlencoded, and text bodies by default; returns `Buffer` for binary;\n- returns `404` when no simulated endpoint matches;\n- returns `500` when rendering or simulation fails;\n- limits request bodies to 1 MiB by default;\n- writes `RawResponseBody` verbatim (HTML/XML/CSV/binary).\n\nThe `./node` adapter is **transport-only**. It does not bind ports, serve `/_live`, or print a compliance banner. Processes that **listen on HTTP** should wrap it with `@x12i/core-service` (next section).\n\n---\n\n## From: Adapters and Helpers — 2. HTTP process compliance (local services)\n\nAny example or package simulator that **binds an HTTP port** should use [`@x12i/core-service`](https://www.npmjs.com/package/@x12i/core-service) (pulls `@x12i/api-live-view`; uses `@x12i/ports-manager`).\n\nProduct contract (current **`@x12i/memorix-docs`**, not old memorix-ebooks):\n\n- Use case **`http-process-compliance`**\n- Building Services (developers) → **HTTP process compliance (local services)**\n- Deep reference: package READMEs for `core-service`, `ports-manager`, `api-live-view`\n\nThis repo applies that contract in zone **`api-simulator` (5520–5539)** — not Memorix’s 5100–5119.\n\n| Surface | Role |\n|--------|------|\n| Port from zone map | `scripts/api-simulator-ports.mjs` / `createSimulatorHttp` |\n| `GET /health` | Process liveness |\n| `/_live` | In-process request rings (api-live-view) |\n| `x-correlation-id` | Request/response correlation |\n| Startup banner | origin · health · live · docs |\n\nShared helper:\n\n```js\nimport { createSimulatorHttp } from '../../scripts/create-simulator-http.mjs';\n\nconst { core, announce } = createSimulatorHttp({\n id: 'my-simulator',\n title: 'My package simulator',\n portKey: 'api', // or flowstate / libraryDemo\n portEnv: 'API_SIMULATOR_API_PORT'\n});\n\nconst server = createServer(async (req, res) => {\n if (await core.tryHandleCore(req, res)) return;\n await createNodeHttpHandler(simulator)(req, res);\n});\n\nawait announce(server);\n```\n\nPublished `@x12i/api-simulator` stays **zero runtime dependencies**. Remote *clients* do not install these kits; *servers that bind* do.\n\n---\n\n## From: Adapters and Helpers — 3. Multiple APIs\n\nA single simulator can expose many APIs. Each API has its own `id`, optional `basePath`, internal `data`, and endpoints.\n\n```ts\nconst simulator = createApiSimulator({\n apis: [crmApi, billingApi, identityApi]\n});\n```\n\nDuplicate `METHOD + full path` routes are rejected during startup. Structurally ambiguous routes such as `/users/:id` and `/users/:name` are also rejected. Static routes are matched before parameter routes.\n\n---\n\n## From: Adapters and Helpers — 7. Express and Fastify\n\n```ts\n// Express\napp.use(async (req, res) => {\n const match = await simulator.tryDispatch({\n method: req.method,\n path: req.path,\n headers: req.headers,\n query: req.query,\n body: req.body\n });\n if (!match) return res.status(404).json({ error: 'NOT_FOUND' });\n res.status(match.response.status ?? 200).set(match.response.headers ?? {}).send(match.response.body);\n});\n```\n\n---\n\n## Also see\n\n- **Adapters and Helpers** (`02-adapters`) — Expose simulators over HTTP, compose helpers, and plug into Express, Fastify, or fetch runtimes.\n\n---\n\n_Generated use-case pack for agents and humans. See `agent-manifest.json` for discovery._\n",
|
|
572
|
+
"downloads/use-cases/library-demo-rest.md": "# Build a plain REST package simulator\n\n> **Use case id:** `library-demo-rest`\n> **Goal:** Follow the library-demo path: data modules, relative/simulation endpoints, no Memorix.\n> **Audiences:** developers\n> **Tags:** examples, rest, tutorial\n\n## Reading path\n\n1. **Package Simulators** (developers) → chapters: `1-what-a-package-simulator-is`, `3-plain-rest-library-demo`\n1. **Behaviors and Dispatch** (developers) → chapters: `2-relative`, `3-simulation-function`\n\n## From: Package Simulators — 1. What a package simulator is\n\nA **package simulator** is a small product-owned package that uses `@x12i/api-simulator` as the engine and ships its own:\n\n- **logic** — `simulation` handlers (and optional `createStore` state)\n- **data** — seeds under `api.data` and/or fixture JSON\n- **metadata** — when the product speaks Memorix, declarative packs and explorer fixtures\n\nThe core library stays **zero runtime dependencies** and does not load data or metadata from disk, MongoDB, or HTTP. Your package (or an example like `examples/flowstate-simulator`) owns that.\n\n---\n\n## From: Package Simulators — 3. Plain REST library-demo\n\nIf the API is ordinary REST (no Memorix), follow [`examples/library-demo/TUTORIAL.md`](../../../examples/library-demo/TUTORIAL.md):\n\n1. Data modules seed `api.data` / `createStore`.\n2. Relative endpoints for list/read shapes; simulation handlers for writes and branching.\n3. `createApiSimulator` + optional Node HTTP entry — **no** `@x12i/static-memorix`.\n\nRunnable reference: [`examples/library-demo/`](../../../examples/library-demo).\n\n---\n\n## From: Behaviors and Dispatch — 2. Relative\n\nRelative behavior starts with configured JSON, then resolves tokens against the matched request and the API's internal `data` object.\n\nSupported token roots:\n\n- `{{request.params.parentId}}`\n- `{{request.query.page}}`\n- `{{request.headers.x-tenant-id}}`\n- `{{request.body.customer.id}}`\n- `{{data.children}}`\n- Array indexes, such as `{{data.users[0].id}}`\n\n```ts\n{\n id: 'children',\n method: 'GET',\n path: '/parents/:parentId/children',\n behavior: {\n type: 'relative',\n response: {\n body: {\n parentId: '{{request.params.parentId}}',\n items: '{{data.children}}'\n }\n }\n }\n}\n```\n\nA token occupying the entire string preserves its original type. Therefore, `{{request.body.limit}}` can produce a number and `{{data.children}}` can produce an array. A token embedded inside text is converted to a string:\n\n```ts\n{ message: 'Children for parent {{request.params.parentId}}' }\n```\n\nTokens inside API-local data are rendered too. This lets a reusable internal fixture inherit an identifier from the incoming request:\n\n```ts\ndata: {\n children: [\n { id: 'child-1', parentId: '{{request.params.parentId}}' }\n ]\n}\n```\n\nRelative behavior is strict by default. A missing token throws `TemplateResolutionError`. Set `strict: false` to leave unresolved tokens unchanged.\n\n---\n\n## From: Behaviors and Dispatch — 3. Simulation function\n\nUse a simulation function when output needs conditions, calculations, validation, generated values, branching, or error responses.\n\n```ts\n{\n id: 'quote',\n method: 'POST',\n path: '/quote',\n behavior: {\n type: 'simulation',\n handler: async ({ request, data, apiId, endpointId }) => {\n const quantity = Number((request.body as { quantity: number }).quantity);\n const unitPrice = Number(data.unitPrice);\n\n return {\n status: 201,\n body: {\n apiId,\n endpointId,\n quantity,\n unitPrice,\n total: quantity * unitPrice\n }\n };\n }\n }\n}\n```\n\n---\n\n## Also see\n\n- **Package Simulators** (`03-package-simulators`) — Ship logic, data, and optional Memorix fixtures in a product package — with or without static-memorix.\n- **Behaviors and Dispatch** (`01-behaviors`) — The three endpoint behaviors, dispatch APIs, contracts, latency, raw bodies, and path patterns.\n\n---\n\n_Generated use-case pack for agents and humans. See `agent-manifest.json` for discovery._\n",
|
|
573
|
+
"downloads/use-cases/orient-simulator.md": "# Orient on api-simulator\n\n> **Use case id:** `orient-simulator`\n> **Goal:** Understand what the library does, install it, and run a minimal three-behavior example.\n> **Audiences:** developers\n> **Tags:** start-here, overview\n\n## Reading path\n\n1. **Overview** (developers) → chapters: `1-what-it-is`, `2-install`, `3-minimal-example`, `4-where-to-go-next`\n\n## From: Overview — 1. What it is\n\nCore TypeScript framework for building simulated API services.\n\nEach endpoint defines **exactly one** behavior:\n\n1. `fixed` — always return the configured response.\n2. `relative` — render a configured JSON response using values from the request and API-local data.\n3. `simulation` — run a function that receives the matched request and returns a response.\n\nThe core is transport-agnostic. It can be called directly from tests, wrapped by Fastify/Express, or exposed through the included Node.js HTTP adapter.\n\n**Data and metadata:** this package does **not** load fixtures from disk, MongoDB, Memorix, or HTTP. Consumers pass an in-memory `SimulatorDefinition` (`api.data` + endpoints). Optional helpers (`createStore`, OpenAPI) still take data you supply. Product-owned **package simulators** ship their own logic, data, and (when needed) Memorix fixtures.\n\n---\n\n## From: Overview — 2. Install\n\n```bash\nnpm install @x12i/api-simulator\n```\n\nRequires Node.js 20+.\n\n---\n\n## From: Overview — 3. Minimal example\n\n```ts\nimport { createApiSimulator } from '@x12i/api-simulator';\n\nconst simulator = createApiSimulator({\n apis: [\n {\n id: 'objects-api',\n basePath: '/api/v1',\n data: {\n children: [\n {\n id: 'child-1',\n parentId: '{{request.params.parentId}}'\n },\n {\n id: 'child-2',\n parentId: '{{request.params.parentId}}'\n }\n ]\n },\n endpoints: [\n {\n id: 'health',\n method: 'GET',\n path: '/health',\n behavior: {\n type: 'fixed',\n response: {\n status: 200,\n body: { status: 'ok' }\n }\n }\n },\n {\n id: 'list-children',\n method: 'GET',\n path: '/parents/:parentId/children',\n behavior: {\n type: 'relative',\n response: {\n body: {\n parentId: '{{request.params.parentId}}',\n items: '{{data.children}}'\n }\n }\n }\n },\n {\n id: 'calculate-score',\n method: 'POST',\n path: '/score',\n behavior: {\n type: 'simulation',\n handler: ({ request }) => {\n const values = (request.body as { values: number[] }).values;\n return {\n body: {\n score: values.reduce((sum, value) => sum + value, 0)\n }\n };\n }\n }\n }\n ]\n }\n ]\n});\n```\n\n---\n\n## From: Overview — 4. Where to go next\n\n- Try the **Playground** app (anonymous, ~30-second first dispatch).\n- Author projects in **Studio** (local-first).\n- Follow [`examples/library-demo/TUTORIAL.md`](../../../examples/library-demo/TUTORIAL.md) for a guided REST walkthrough.\n- Or [`examples/flowstate-simulator/TUTORIAL.md`](../../../examples/flowstate-simulator/TUTORIAL.md) to compose with `@x12i/static-memorix`.\n- Use cases: `orient-simulator`, `define-three-behaviors`, `ship-package-simulator`.\n\n## Also see\n\n- **Overview** (`00-overview`) — Install, a minimal three-behavior example, and where to go next.\n- **Behaviors and Dispatch** (`01-behaviors`) — The three endpoint behaviors, dispatch APIs, contracts, latency, raw bodies, and path patterns.\n\n---\n\n_Generated use-case pack for agents and humans. See `agent-manifest.json` for discovery._\n",
|
|
574
|
+
"downloads/use-cases/run-playground-studio.md": "# Run Playground and Studio\n\n> **Use case id:** `run-playground-studio`\n> **Goal:** Start the local UI apps, know the port map, and understand the product rule.\n> **Audiences:** developers\n> **Tags:** ui, playground, studio\n\n## Reading path\n\n1. **Playground and Studio** (developers) → chapters: `1-two-surfaces`, `2-run-locally`, `3-ports`, `4-product-rule`\n\n## From: Playground and Studio — 1. Two surfaces\n\nTwo separate UI apps over `@x12i/api-simulator`. They are **not** one merged workspace.\n\n| Surface | Job | Mindset |\n|---|---|---|\n| Playground (`apps/playground`) | Try a request in ~30 seconds | Ephemeral, session-only |\n| Studio (`apps/studio`) | Author and own a simulator | Persistent (IndexedDB), exportable |\n\nPlayground **Open in Studio** hands off the current definition via `sessionStorage`.\n\n---\n\n## From: Playground and Studio — 2. Run locally\n\nFrom the repo root (after `npm install` and `npm run build`):\n\n```bash\nnpm run build\nnpm run dev -w @x12i/playground # http://127.0.0.1:5523\nnpm run dev -w @x12i/studio # http://127.0.0.1:5521\n```\n\nOr use the root aliases: `npm run dev:playground` / `npm run dev:studio`.\n\n---\n\n## From: Playground and Studio — 3. Ports\n\nPorts come from [`@x12i/ports-manager`](https://www.npmjs.com/package/@x12i/ports-manager) zone **`api-simulator`** (5520–5539, even = API, odd = UI). Wrapper: [`scripts/api-simulator-ports.mjs`](../../../scripts/api-simulator-ports.mjs).\n\n| Name | Port | Role |\n|------|------|------|\n| `api` / library-demo / codegen | 5520 | API |\n| `studio` (Vite) | 5521 | UI |\n| `flowstate` compose server | 5522 | API |\n| `playground` (Vite) | 5523 | UI |\n\n```bash\nnpx x12i-ports zone api-simulator\n```\n\n**UI apps vs API processes:** Playground and Studio are Vite **UI** processes (odd ports). They do not need `@x12i/core-service` `/_live`. Example **API** processes that bind even ports (library-demo, FlowState compose, `node-server`) use `@x12i/core-service` for `/health` and `/_live` — see [Adapters — HTTP process compliance](../02-adapters/developers/BOOK.md#2-http-process-compliance-local-services).\n\n---\n\n## From: Playground and Studio — 4. Product rule\n\nBoth apps edit a UI model that maps to `SimulatorDefinition` / endpoint behaviors. The library remains the API of record; the UIs generate and preview — they do not invent a parallel DSL.\n\n---\n\n## Also see\n\n- **Playground and Studio** (`04-playground-studio`) — Two UI apps over the same library: ephemeral Playground and local-first Studio.\n\n---\n\n_Generated use-case pack for agents and humans. See `agent-manifest.json` for discovery._\n",
|
|
575
|
+
"downloads/use-cases/ship-package-simulator.md": "# Ship a package simulator\n\n> **Use case id:** `ship-package-simulator`\n> **Goal:** Structure a product-owned package with logic, data, optional static-memorix composition, and core-service on the HTTP entry.\n> **Audiences:** developers\n> **Tags:** packages, memorix, core-service\n\n## Reading path\n\n1. **Package Simulators** (developers) → chapters: `1-what-a-package-simulator-is`, `2-recommended-structure`, `4-with-static-memorix`\n1. **Adapters and Helpers** (developers) → chapters: `2-http-process-compliance-local-services`\n\n## From: Package Simulators — 1. What a package simulator is\n\nA **package simulator** is a small product-owned package that uses `@x12i/api-simulator` as the engine and ships its own:\n\n- **logic** — `simulation` handlers (and optional `createStore` state)\n- **data** — seeds under `api.data` and/or fixture JSON\n- **metadata** — when the product speaks Memorix, declarative packs and explorer fixtures\n\nThe core library stays **zero runtime dependencies** and does not load data or metadata from disk, MongoDB, or HTTP. Your package (or an example like `examples/flowstate-simulator`) owns that.\n\n---\n\n## From: Package Simulators — 2. Recommended structure\n\n```text\nmy-provider-simulator/\n├─ mocks/ # optional — shared with static-memorix when used\n│ ├─ data/\n│ ├─ metadata/\n│ └─ metadata-packs/\n├─ src/\n│ ├─ data/ # seeds for api.data / createStore\n│ ├─ simulations/ # package-specific handlers\n│ ├─ api.ts # createApiSimulator({ apis: [...] })\n│ ├─ memorix.ts # optional — buildServer({ MOCKS_DIR })\n│ └─ server.ts # Node/HTTP entry: core-service + tryDispatch ± forward\n└─ package.json\n```\n\nKeep provider-specific data and simulation logic outside `@x12i/api-simulator`. The core remains the reusable engine.\n\nHTTP entrypoints that bind a port use [`@x12i/core-service`](https://www.npmjs.com/package/@x12i/core-service) (see [Adapters — HTTP process compliance](../02-adapters/developers/BOOK.md#2-http-process-compliance-local-services)). Shared helper in this repo: [`scripts/create-simulator-http.mjs`](../../../scripts/create-simulator-http.mjs).\n\n---\n\n## From: Package Simulators — 4. With static-memorix\n\nFor Memorix Explorer (`/api/explorer/*`) and Metadata (`/api/metadata/*`) parity without MongoDB/Redis, compose [`@x12i/static-memorix`](https://www.npmjs.com/package/@x12i/static-memorix):\n\n1. Keep a shared `mocks/` tree (`data/`, `metadata/`, `metadata-packs/`).\n2. Load seeds into package REST via small helpers (see the FlowState example’s `src/bridge.mjs`).\n3. Run `buildServer()` / `startServer()` with `MOCKS_DIR` pointing at that tree.\n4. Serve one port with `@x12i/core-service`: `tryHandleCore` → `tryDispatch` package routes → forward misses to static-memorix (`inject`).\n\n| Surface | Owner |\n|--------|--------|\n| `/health`, `/_live` | `@x12i/core-service` (zone `api-simulator`) |\n| `/api/v1/<your-product>/*` | `@x12i/api-simulator` endpoints in your package |\n| `/api/explorer/*`, `/api/metadata/*` | `@x12i/static-memorix` (`MOCKS_DIR` → shared `mocks/`) |\n\n**Org scope:** `x-memorix-org-id` may be sent for client realism; it is a **no-op for isolation** in this simulator (not `memorix-service`).\n\nstatic-memorix is not a substitute for full `memorix-service` (pipelines, relationship materialize, abstract reverse-write, etc.).\n\n---\n\n## From: Adapters and Helpers — 2. HTTP process compliance (local services)\n\nAny example or package simulator that **binds an HTTP port** should use [`@x12i/core-service`](https://www.npmjs.com/package/@x12i/core-service) (pulls `@x12i/api-live-view`; uses `@x12i/ports-manager`).\n\nProduct contract (current **`@x12i/memorix-docs`**, not old memorix-ebooks):\n\n- Use case **`http-process-compliance`**\n- Building Services (developers) → **HTTP process compliance (local services)**\n- Deep reference: package READMEs for `core-service`, `ports-manager`, `api-live-view`\n\nThis repo applies that contract in zone **`api-simulator` (5520–5539)** — not Memorix’s 5100–5119.\n\n| Surface | Role |\n|--------|------|\n| Port from zone map | `scripts/api-simulator-ports.mjs` / `createSimulatorHttp` |\n| `GET /health` | Process liveness |\n| `/_live` | In-process request rings (api-live-view) |\n| `x-correlation-id` | Request/response correlation |\n| Startup banner | origin · health · live · docs |\n\nShared helper:\n\n```js\nimport { createSimulatorHttp } from '../../scripts/create-simulator-http.mjs';\n\nconst { core, announce } = createSimulatorHttp({\n id: 'my-simulator',\n title: 'My package simulator',\n portKey: 'api', // or flowstate / libraryDemo\n portEnv: 'API_SIMULATOR_API_PORT'\n});\n\nconst server = createServer(async (req, res) => {\n if (await core.tryHandleCore(req, res)) return;\n await createNodeHttpHandler(simulator)(req, res);\n});\n\nawait announce(server);\n```\n\nPublished `@x12i/api-simulator` stays **zero runtime dependencies**. Remote *clients* do not install these kits; *servers that bind* do.\n\n---\n\n## Also see\n\n- **Package Simulators** (`03-package-simulators`) — Ship logic, data, and optional Memorix fixtures in a product package — with or without static-memorix.\n- **Adapters and Helpers** (`02-adapters`) — Expose simulators over HTTP, compose helpers, and plug into Express, Fastify, or fetch runtimes.\n\n---\n\n_Generated use-case pack for agents and humans. See `agent-manifest.json` for discovery._\n"
|
|
576
|
+
};
|
|
577
|
+
//# sourceMappingURL=bundle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../../src/generated/bundle.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,OAAO,EAAE;QACP;YACE,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,YAAY;YACrB,SAAS,EAAE,2BAA2B;YACtC,aAAa,EAAE,8GAA8G;SAC9H;KACF;IACD,UAAU,EAAE;QACV;YACE,IAAI,EAAE,eAAe;YACrB,MAAM,EAAE,eAAe;YACvB,SAAS,EAAE,8EAA8E;YACzF,aAAa,EAAE,iFAAiF;YAChG,OAAO,EAAE,SAAS;SACnB;KACF;IACD,OAAO,EAAE;QACP;YACE,IAAI,EAAE,aAAa;YACnB,UAAU,EAAE,eAAe;YAC3B,WAAW,EAAE;gBACX,YAAY;aACb;YACD,QAAQ,EAAE,WAAW;YACrB,QAAQ,EAAE,oBAAoB;YAC9B,OAAO,EAAE,UAAU;YACnB,UAAU,EAAE,uBAAuB;YACnC,OAAO,EAAE,kEAAkE;YAC3E,MAAM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vpF,+CAA+C,EAAE,+5KAA+5K;CACj9K,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { catalog, useCases, site, manifest, files } from "./generated/bundle.js";
|
|
2
|
+
/** Pre-wired api-simulator knowledge SDK. Install as a **devDependency** only. */
|
|
3
|
+
export declare const apiSimulatorDocs: import("@x12i/docify-sdk").EbooksSdk;
|
|
4
|
+
export { catalog, useCases, site, manifest, files };
|
|
5
|
+
export default apiSimulatorDocs;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEjF,kFAAkF;AAClF,eAAO,MAAM,gBAAgB,sCAM3B,CAAC;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACpD,eAAe,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createEbooksSdk } from "@x12i/docify-sdk";
|
|
2
|
+
import { catalog, useCases, site, manifest, files } from "./generated/bundle.js";
|
|
3
|
+
/** Pre-wired api-simulator knowledge SDK. Install as a **devDependency** only. */
|
|
4
|
+
export const apiSimulatorDocs = createEbooksSdk({
|
|
5
|
+
catalog,
|
|
6
|
+
useCases,
|
|
7
|
+
site,
|
|
8
|
+
manifest,
|
|
9
|
+
files,
|
|
10
|
+
});
|
|
11
|
+
export { catalog, useCases, site, manifest, files };
|
|
12
|
+
export default apiSimulatorDocs;
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEjF,kFAAkF;AAClF,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC;IAC9C,OAAO;IACP,QAAQ;IACR,IAAI;IACJ,QAAQ;IACR,KAAK;CACN,CAAC,CAAC;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACpD,eAAe,gBAAgB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@x12i/api-simulator-docs",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "api-simulator docs knowledge SDK — install as a devDependency only. Catalog, use cases, and markdown packs for humans and agents.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"api-simulator-docs": "bin/api-simulator-docs.js"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"bin",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"prebuild": "node -e \"import('node:fs').then(fs=>fs.rmSync('dist',{recursive:true,force:true}))\"",
|
|
24
|
+
"build": "tsc -p tsconfig.json",
|
|
25
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=20"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@x12i/docify-core": "^1.0.1",
|
|
32
|
+
"@x12i/docify-sdk": "^1.0.1"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/node": "^22.15.0",
|
|
36
|
+
"typescript": "^5.8.3"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"keywords": [
|
|
42
|
+
"x12i",
|
|
43
|
+
"api-simulator",
|
|
44
|
+
"docs",
|
|
45
|
+
"knowledge",
|
|
46
|
+
"devDependency"
|
|
47
|
+
],
|
|
48
|
+
"license": "MIT"
|
|
49
|
+
}
|