@counterfact/repl 0.1.4 → 0.1.6
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/CHANGELOG.md +26 -0
- package/dist/repl.js +10 -24
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @counterfact/repl
|
|
2
2
|
|
|
3
|
+
## 0.1.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 96b565d: Add simulator.reset() to reconstruct stores, dependent contexts, source routes and startup state without restarting HTTP, and simulator.scenario(path, group?) to await named scenarios with the REPL arguments. Document request gating, reset failure recovery, reference lifetimes, and worker-scoped Playwright integration.
|
|
8
|
+
- Updated dependencies [96b565d]
|
|
9
|
+
- Updated dependencies [376ec98]
|
|
10
|
+
- @counterfact/runtime@0.2.0
|
|
11
|
+
- @counterfact/client@0.2.1
|
|
12
|
+
|
|
13
|
+
## 0.1.5
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 04d67bb: Validate and send required OpenAPI cookie, body, and form inputs through the immutable route builder, including REPL completions for the new methods.
|
|
18
|
+
- Updated dependencies [04d67bb]
|
|
19
|
+
- Updated dependencies [13155b0]
|
|
20
|
+
- Updated dependencies [1714e9a]
|
|
21
|
+
- Updated dependencies [02d013a]
|
|
22
|
+
- Updated dependencies [25215f4]
|
|
23
|
+
- Updated dependencies [befb686]
|
|
24
|
+
- Updated dependencies [15b30fb]
|
|
25
|
+
- Updated dependencies [ba93689]
|
|
26
|
+
- @counterfact/client@0.2.0
|
|
27
|
+
- @counterfact/runtime@0.1.5
|
|
28
|
+
|
|
3
29
|
## 0.1.4
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/dist/repl.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import repl from "node:repl";
|
|
2
|
+
import { resolveScenario } from "@counterfact/runtime";
|
|
2
3
|
import { RawHttpClient, createRouteFunction, } from "@counterfact/client";
|
|
3
4
|
function printToStdout(line) {
|
|
4
5
|
process.stdout.write(`${line}\n`);
|
|
5
6
|
}
|
|
6
7
|
const ROUTE_BUILDER_METHODS = [
|
|
7
8
|
"body(",
|
|
9
|
+
"cookies(",
|
|
10
|
+
"form(",
|
|
8
11
|
"headers(",
|
|
9
12
|
"help(",
|
|
10
13
|
"method(",
|
|
@@ -359,31 +362,14 @@ export function startRepl(contextRegistry, registry, config, print = printToStdo
|
|
|
359
362
|
this.displayPrompt();
|
|
360
363
|
return;
|
|
361
364
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
this.clearBufferedCommand();
|
|
366
|
-
this.displayPrompt();
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
if (parts.some((part) => part === ".." || part === ".")) {
|
|
370
|
-
print("Error: Path must not contain '.' or '..' segments");
|
|
371
|
-
this.clearBufferedCommand();
|
|
372
|
-
this.displayPrompt();
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
const functionName = parts[parts.length - 1] ?? "";
|
|
376
|
-
const fileKey = parts.length === 1 ? "index" : parts.slice(0, -1).join("/");
|
|
377
|
-
const module = selectedBinding.scenarioRegistry?.getModule(fileKey);
|
|
378
|
-
if (module === undefined) {
|
|
379
|
-
print(`Error: Could not find scenario file "${fileKey}"`);
|
|
380
|
-
this.clearBufferedCommand();
|
|
381
|
-
this.displayPrompt();
|
|
382
|
-
return;
|
|
365
|
+
let fn;
|
|
366
|
+
try {
|
|
367
|
+
fn = resolveScenario(selectedBinding.scenarioRegistry, scenarioPath);
|
|
383
368
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
369
|
+
catch (error) {
|
|
370
|
+
print(scenarioPath.split("/").filter(Boolean).length === 0
|
|
371
|
+
? usage
|
|
372
|
+
: `Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
387
373
|
this.clearBufferedCommand();
|
|
388
374
|
this.displayPrompt();
|
|
389
375
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@counterfact/repl",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Inspect and manipulate a running Counterfact simulator from a Node.js REPL.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"test:packed-consumer": "node test/package/repl-consumer-smoke.mjs"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@counterfact/client": "0.
|
|
56
|
-
"@counterfact/runtime": "0.
|
|
55
|
+
"@counterfact/client": "0.2.1",
|
|
56
|
+
"@counterfact/runtime": "0.2.0"
|
|
57
57
|
}
|
|
58
58
|
}
|