Commit d620b41
feat(stdlib): add jsonField extern for minimal JSON field extraction (#211)
Adds `pub extern fn jsonField(json, key) -> String` to
stdlib/Vscode.affine + runtime impl in packages/affine-vscode/mod.js.
The wasm guest has no JSON parser and only stringConcat/stringEndsWith/
stringIsEmpty, so it cannot decode the payloads returned by
thenableResultJson / httpPostJson. jsonField reads one top-level field
(scalar coerced to string; object/array re-serialised), mirroring
thenableResultJson's synchronous reg(string) shape with "" as the
absent/parse-fail sentinel. Deliberately minimal — enough for result
objects like { tier, tier_code, score } and the { __error } reject
shape; nested/array access is out of scope by design.
Surfaced as a real gap by the first #205 consumer (rsr-certifier
extension rewire, PR-5d-B); unblocks every future #205 consumer.
Full dune gate green (257/257), zero regression.
Refs #199 #205
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 0a4692a commit d620b41
2 files changed
Lines changed: 37 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
387 | 408 | | |
388 | 409 | | |
389 | 410 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
0 commit comments