Commit f0d6594
The streaming export route accepted `filter` and `orderby` but had no way to
carry the term a user had typed into the list's search box. Exporting after a
search downloaded the UNSEARCHED superset — more rows than the screen showed,
in a file that looks authoritative, with nothing indicating the difference.
The route's own comment claimed the opposite: that it "mirrors the active
view's filter + sort so the exported file matches what the user sees".
Same family as a dropped filter (#3948, #4181): a plausible answer that is
quietly broader than the one asked for.
Two new query params, both matching the list endpoint's semantics:
- `search=<term>` — folded into findData as `$search`, so it COMPOSES with
`filter` (`{ $and: [filter, search] }`) rather than replacing it. Empty or
whitespace-only terms are ignored, not applied as a blank predicate.
- `searchFields=a,b` — the ADR-0061 override for which fields the term scans.
Only meaningful alongside `search`, and intersected with the object's allowed
searchable set by the engine, exactly as on the list endpoint.
Unknown query params on this route were already ignored, so a client sending
`search` to an older server gets today's behaviour rather than an error.
Tested against the real engine + protocol in export-integration.test.ts. The
composition case is built so each half ALONE returns a different non-empty
result and only "both applied" returns none — a case where the two agree would
pass just as well with `search` dropped. Reverting rest-server.ts fails 4 of
the tests.
The file's in-memory driver also learned `$or` / `$contains`: `$search` folds
to `{ $or: [{ field: { $contains: term } }] }`, and a driver that skips
`$`-prefixed keys returns every row — so an "it filtered" assertion would have
passed for the wrong reason.
Note: `packages/rest/src/package-routes.ts` has two pre-existing TS2345 errors
on main (verified against a clean tree); untouched here.
Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
1 parent 42eeb7d commit f0d6594
3 files changed
Lines changed: 146 additions & 0 deletions
File tree
- .changeset
- packages/rest/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
48 | 52 | | |
49 | 53 | | |
50 | 54 | | |
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
54 | 62 | | |
55 | 63 | | |
56 | 64 | | |
| |||
571 | 579 | | |
572 | 580 | | |
573 | 581 | | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4666 | 4666 | | |
4667 | 4667 | | |
4668 | 4668 | | |
| 4669 | + | |
| 4670 | + | |
| 4671 | + | |
4669 | 4672 | | |
4670 | 4673 | | |
4671 | 4674 | | |
| |||
4740 | 4743 | | |
4741 | 4744 | | |
4742 | 4745 | | |
| 4746 | + | |
| 4747 | + | |
| 4748 | + | |
| 4749 | + | |
| 4750 | + | |
| 4751 | + | |
| 4752 | + | |
| 4753 | + | |
| 4754 | + | |
| 4755 | + | |
| 4756 | + | |
| 4757 | + | |
| 4758 | + | |
| 4759 | + | |
| 4760 | + | |
| 4761 | + | |
| 4762 | + | |
| 4763 | + | |
| 4764 | + | |
4743 | 4765 | | |
4744 | 4766 | | |
4745 | 4767 | | |
| |||
4880 | 4902 | | |
4881 | 4903 | | |
4882 | 4904 | | |
| 4905 | + | |
| 4906 | + | |
4883 | 4907 | | |
4884 | 4908 | | |
4885 | 4909 | | |
| |||
0 commit comments