-
Notifications
You must be signed in to change notification settings - Fork 104
feat(zero-zod): added zero zod at @rocicorp/zero/zod #5371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
| Branch | 0xcadams/zero-to-zod |
| Testbed | self-hosted |
🚨 1 Alert
| Benchmark | Measure Units | View | Benchmark Result (Result Δ%) | Lower Boundary (Limit %) |
|---|---|---|---|---|
| 3 exists (AND) | Throughput operations / second (ops/s) x 1e3 | 📈 plot 🚷 threshold 🚨 alert (🔔) | 1.93 ops/s x 1e3(-10.01%)Baseline: 2.15 ops/s x 1e3 | 1.96 ops/s x 1e3 (101.40%) |
Click to view all benchmark results
| Benchmark | Throughput | Benchmark Result operations / second (ops/s) (Result Δ%) | Lower Boundary operations / second (ops/s) (Limit %) |
|---|---|---|---|
| 1 exists: track.exists(album) | 📈 view plot 🚷 view threshold | 14,211.05 ops/s(-3.53%)Baseline: 14,731.12 ops/s | 13,463.47 ops/s (94.74%) |
| 10 exists (AND) | 📈 view plot 🚷 view threshold | 219,487.03 ops/s(+0.53%)Baseline: 218,336.15 ops/s | 211,226.49 ops/s (96.24%) |
| 10 exists (OR) | 📈 view plot 🚷 view threshold | 4,256.93 ops/s(+0.79%)Baseline: 4,223.37 ops/s | 3,903.44 ops/s (91.70%) |
| 12 exists (AND) | 📈 view plot 🚷 view threshold | 196,008.85 ops/s(+1.76%)Baseline: 192,616.94 ops/s | 183,554.60 ops/s (93.65%) |
| 12 exists (OR) | 📈 view plot 🚷 view threshold | 3,580.68 ops/s(-0.29%)Baseline: 3,590.93 ops/s | 3,341.80 ops/s (93.33%) |
| 12 level nesting | 📈 view plot 🚷 view threshold | 3,148.53 ops/s(+0.61%)Baseline: 3,129.41 ops/s | 2,907.80 ops/s (92.35%) |
| 2 exists (AND): track.exists(album).exists(genre) | 📈 view plot 🚷 view threshold | 5,292.69 ops/s(-5.12%)Baseline: 5,578.12 ops/s | 5,129.84 ops/s (96.92%) |
| 3 exists (AND) | 📈 view plot 🚷 view threshold 🚨 view alert (🔔) | 1,930.56 ops/s(-10.01%)Baseline: 2,145.29 ops/s | 1,957.64 ops/s (101.40%) |
| 3 exists (OR) | 📈 view plot 🚷 view threshold | 1,031.74 ops/s(-4.41%)Baseline: 1,079.32 ops/s | 987.19 ops/s (95.68%) |
| 5 exists (AND) | 📈 view plot 🚷 view threshold | 333.68 ops/s(-1.60%)Baseline: 339.10 ops/s | 313.59 ops/s (93.98%) |
| 5 exists (OR) | 📈 view plot 🚷 view threshold | 174.49 ops/s(-2.63%)Baseline: 179.21 ops/s | 165.44 ops/s (94.82%) |
| Nested 2 levels: track > album > artist | 📈 view plot 🚷 view threshold | 4,876.49 ops/s(+1.20%)Baseline: 4,818.85 ops/s | 4,461.94 ops/s (91.50%) |
| Nested 4 levels: playlist > tracks > album > artist | 📈 view plot 🚷 view threshold | 793.70 ops/s(+0.26%)Baseline: 791.67 ops/s | 729.67 ops/s (91.93%) |
| Nested with filters: track > album > artist (filtered) | 📈 view plot 🚷 view threshold | 4,036.04 ops/s(+0.65%)Baseline: 4,009.98 ops/s | 3,666.80 ops/s (90.85%) |
| planned: playlist.exists(tracks) | 📈 view plot 🚷 view threshold | 667.73 ops/s(+2.12%)Baseline: 653.89 ops/s | 623.87 ops/s (93.43%) |
| planned: track.exists(album) OR exists(genre) | 📈 view plot 🚷 view threshold | 167.05 ops/s(-2.85%)Baseline: 171.94 ops/s | 161.99 ops/s (96.97%) |
| planned: track.exists(album) where title="Big Ones" | 📈 view plot 🚷 view threshold | 7,920.26 ops/s(-0.50%)Baseline: 7,960.15 ops/s | 7,568.39 ops/s (95.56%) |
| planned: track.exists(album).exists(genre) | 📈 view plot 🚷 view threshold | 41.70 ops/s(+0.15%)Baseline: 41.64 ops/s | 39.97 ops/s (95.85%) |
| planned: track.exists(album).exists(genre) with filters | 📈 view plot 🚷 view threshold | 5,690.61 ops/s(+1.07%)Baseline: 5,630.22 ops/s | 5,337.97 ops/s (93.80%) |
| planned: track.exists(playlists) | 📈 view plot 🚷 view threshold | 4.31 ops/s(+2.02%)Baseline: 4.23 ops/s | 4.06 ops/s (94.08%) |
| unplanned: playlist.exists(tracks) | 📈 view plot 🚷 view threshold | 649.06 ops/s(+2.26%)Baseline: 634.70 ops/s | 606.66 ops/s (93.47%) |
| unplanned: track.exists(album) OR exists(genre) | 📈 view plot 🚷 view threshold | 48.49 ops/s(+1.90%)Baseline: 47.58 ops/s | 45.09 ops/s (92.99%) |
| unplanned: track.exists(album) where title="Big Ones" | 📈 view plot 🚷 view threshold | 60.18 ops/s(+1.20%)Baseline: 59.47 ops/s | 56.88 ops/s (94.51%) |
| unplanned: track.exists(album).exists(genre) | 📈 view plot 🚷 view threshold | 41.45 ops/s(+0.11%)Baseline: 41.41 ops/s | 39.69 ops/s (95.74%) |
| unplanned: track.exists(album).exists(genre) with filters | 📈 view plot 🚷 view threshold | 59.08 ops/s(+2.03%)Baseline: 57.91 ops/s | 55.57 ops/s (94.05%) |
| unplanned: track.exists(playlists) | 📈 view plot 🚷 view threshold | 4.30 ops/s(+1.61%)Baseline: 4.23 ops/s | 4.06 ops/s (94.57%) |
| zpg: all playlists | 📈 view plot 🚷 view threshold | 5.88 ops/s(+0.96%)Baseline: 5.82 ops/s | 5.68 ops/s (96.72%) |
| zql: all playlists | 📈 view plot 🚷 view threshold | 8.37 ops/s(+3.72%)Baseline: 8.07 ops/s | 7.51 ops/s (89.65%) |
| zql: edit for limited query, inside the bound | 📈 view plot 🚷 view threshold | 226,930.32 ops/s(+3.33%)Baseline: 219,612.75 ops/s | 201,782.56 ops/s (88.92%) |
| zql: edit for limited query, outside the bound | 📈 view plot 🚷 view threshold | 229,657.06 ops/s(+0.10%)Baseline: 229,417.35 ops/s | 199,847.87 ops/s (87.02%) |
| zql: push into limited query, inside the bound | 📈 view plot 🚷 view threshold | 114,651.85 ops/s(+1.26%)Baseline: 113,225.89 ops/s | 106,555.87 ops/s (92.94%) |
| zql: push into limited query, outside the bound | 📈 view plot 🚷 view threshold | 441,214.10 ops/s(+6.20%)Baseline: 415,459.25 ops/s | 361,467.12 ops/s (81.93%) |
| zql: push into unlimited query | 📈 view plot 🚷 view threshold | 342,725.66 ops/s(-0.23%)Baseline: 343,516.86 ops/s | 312,979.09 ops/s (91.32%) |
| zqlite: all playlists | 📈 view plot 🚷 view threshold | 1.92 ops/s(+2.17%)Baseline: 1.88 ops/s | 1.80 ops/s (93.33%) |
| zqlite: edit for limited query, inside the bound | 📈 view plot 🚷 view threshold | 80,349.13 ops/s(+0.77%)Baseline: 79,734.14 ops/s | 72,165.37 ops/s (89.81%) |
| zqlite: edit for limited query, outside the bound | 📈 view plot 🚷 view threshold | 83,763.25 ops/s(+4.16%)Baseline: 80,418.72 ops/s | 69,226.93 ops/s (82.65%) |
| zqlite: push into limited query, inside the bound | 📈 view plot 🚷 view threshold | 4,136.15 ops/s(+0.01%)Baseline: 4,135.67 ops/s | 3,992.78 ops/s (96.53%) |
| zqlite: push into limited query, outside the bound | 📈 view plot 🚷 view threshold | 89,806.74 ops/s(-1.28%)Baseline: 90,975.43 ops/s | 83,600.83 ops/s (93.09%) |
| zqlite: push into unlimited query | 📈 view plot 🚷 view threshold | 120,683.55 ops/s(-6.71%)Baseline: 129,366.20 ops/s | 118,996.70 ops/s (98.60%) |
|
| Branch | 0xcadams/zero-to-zod |
| Testbed | Linux |
Click to view all benchmark results
| Benchmark | File Size | Benchmark Result kilobytes (KB) (Result Δ%) | Upper Boundary kilobytes (KB) (Limit %) |
|---|---|---|---|
| zero-package.tgz | 📈 view plot 🚷 view threshold | 1,773.97 KB(+0.09%)Baseline: 1,772.46 KB | 1,807.91 KB (98.12%) |
| zero.js | 📈 view plot 🚷 view threshold | 240.20 KB(0.00%)Baseline: 240.20 KB | 245.00 KB (98.04%) |
| zero.js.br | 📈 view plot 🚷 view threshold | 65.95 KB(0.00%)Baseline: 65.95 KB | 67.27 KB (98.04%) |
|
| Branch | 0xcadams/zero-to-zod |
| Testbed | self-hosted |
Click to view all benchmark results
| Benchmark | Throughput | Benchmark Result operations / second (ops/s) (Result Δ%) | Lower Boundary operations / second (ops/s) (Limit %) |
|---|---|---|---|
| src/client/custom.bench.ts > big schema | 📈 view plot 🚷 view threshold | 144,762.00 ops/s(-75.60%)Baseline: 593,244.53 ops/s | -257,821.49 ops/s (-178.10%) |
| src/client/zero.bench.ts > basics > All 1000 rows x 10 columns (numbers) | 📈 view plot 🚷 view threshold | 2,682.49 ops/s(+4.67%)Baseline: 2,562.81 ops/s | 2,277.21 ops/s (84.89%) |
| src/client/zero.bench.ts > pk compare > pk = N | 📈 view plot 🚷 view threshold | 68,682.26 ops/s(+5.23%)Baseline: 65,269.76 ops/s | 59,482.80 ops/s (86.61%) |
| src/client/zero.bench.ts > with filter > Lower rows 500 x 10 columns (numbers) | 📈 view plot 🚷 view threshold | 4,165.17 ops/s(+6.31%)Baseline: 3,917.84 ops/s | 3,583.49 ops/s (86.03%) |
packages/zero-zod/src/zod.ts
Outdated
|
|
||
| export type ColumnZodType<V> = V extends SchemaValue | ||
| ? V extends {customType: infer T} | ||
| ? ZodType<T, T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love this. It means that the zod validator is not doing what it should be doing, which is validating the type exists in the enum.
So this is essentially casting a string to an enum here. Or whatever the type is, e.g. string<somestring${string}>().
At least there's type validation on the mutator/query on the client. But since this is running on the server, we can't guarantee that a malicious string was sent that doesn't fit the enum. Because the types for the enum only exist in TS and not at runtime...
No description provided.