Commit c8f9b30
feat(entities): new entity APIs — cursor pages, count, distinct, aggregate, upsert
Wraps the scan-free entity routes added in base44-dev/apper#24939. Fifty apps with
the deepest `skip` reads were reviewed; none paged because a user asked for page N.
Every loop existed to get a number, to check whether a key already exists, to walk a
table with a resume point that is not an offset, or to list a field's distinct values.
- list(options) / filter(query, options): pass an options object {sort, limit,
cursor, fields} instead of positional args to read one cursor page; returns
{items, next_cursor, has_more}. Positional calls are unchanged. skip is
documented as deprecated for loops.
- count(query?): number of readable records matching a filter.
- distinct(field, query?): {values, truncated}, capped at 5000 values.
- aggregate(spec): group_by / date_bucket / count / sum / avg / min / max /
count_distinct / having / sort / limit; returns {rows, truncated}.
- upsert(records, {key}): create or update by a natural key, up to 500 records.
New public types are exported and listed in types-to-expose.json.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>1 parent 99bab39 commit c8f9b30
6 files changed
Lines changed: 628 additions & 19 deletions
File tree
- scripts/mintlify-post-processing
- src
- modules
- tests
- types
- unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
22 | 26 | | |
| 27 | + | |
| 28 | + | |
23 | 29 | | |
24 | 30 | | |
| 31 | + | |
| 32 | + | |
25 | 33 | | |
26 | 34 | | |
27 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
42 | 46 | | |
43 | 47 | | |
44 | 48 | | |
45 | 49 | | |
| 50 | + | |
| 51 | + | |
46 | 52 | | |
47 | 53 | | |
| 54 | + | |
| 55 | + | |
48 | 56 | | |
49 | 57 | | |
50 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
8 | 15 | | |
9 | 16 | | |
10 | 17 | | |
| |||
75 | 82 | | |
76 | 83 | | |
77 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
78 | 99 | | |
79 | 100 | | |
80 | 101 | | |
| |||
94 | 115 | | |
95 | 116 | | |
96 | 117 | | |
97 | | - | |
| 118 | + | |
98 | 119 | | |
99 | | - | |
| 120 | + | |
100 | 121 | | |
101 | 122 | | |
102 | 123 | | |
103 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
104 | 128 | | |
105 | | - | |
| 129 | + | |
106 | 130 | | |
107 | 131 | | |
108 | 132 | | |
| |||
111 | 135 | | |
112 | 136 | | |
113 | 137 | | |
114 | | - | |
| 138 | + | |
115 | 139 | | |
116 | 140 | | |
117 | | - | |
| 141 | + | |
118 | 142 | | |
119 | 143 | | |
120 | 144 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
125 | 151 | | |
126 | | - | |
| 152 | + | |
127 | 153 | | |
128 | 154 | | |
129 | 155 | | |
| |||
167 | 193 | | |
168 | 194 | | |
169 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
170 | 227 | | |
171 | 228 | | |
172 | 229 | | |
| |||
0 commit comments