Comments (2)
Usually I would search the latest item by /route/sort=-date
and I would expect to have similar ability using client generated code:
client.route.get({
filter: {},
sort: '-date',
})
from chiselstrike.
My current workaround is to run following bash script:
echo "Generating TypeScript interfaces from chiselstrike models ..."
npx chisel generate "$CLIENT_DIRECTORY"
echo "Adding sort and limit fields ..."
sed -i '/const url = new URL(origUrl);/a\ if (params.sort !== undefined) {\n url.searchParams.set("sort", params.sort);\n }\n if (params.limit !== undefined) {\n url.searchParams.set("limit", params.limit);\n }' "$CLIENT_DIRECTORY/client_lib.ts"
sed -i '/export type GetParams<Entity> = {/a\ limit?: number;\n sort?: string;' "$CLIENT_DIRECTORY/client_lib.ts"
It modifies client_lib.ts accordingly:
export type GetParams<Entity> = {
limit?: number;
sort?: string;
pageSize?: number;
offset?: number;
filter?: FilterExpr<Entity>;
headers?: Headers | Record<string, string>;
};
// ...
const url = new URL(origUrl);
if (params.sort !== undefined) {
url.searchParams.set("sort", params.sort);
}
if (params.limit !== undefined) {
url.searchParams.set("limit", params.limit);
}
from chiselstrike.
Related Issues (20)
- ChiselStrike is breaking on WSL2 HOT 1
- Possible to support EdgeDB? HOT 4
- Doesn't run from example HOT 4
- Wider support for JWT authentication HOT 1
- Support WebSocket endpoints HOT 1
- Proposal: nanoid instead of uuid
- Relationships: create a blogpost referencing existing author? HOT 2
- Build into desktop app
- Support working with pnpm
- events persistence: not-consumed are lost after restart HOT 1
- spawn long-running scripts with access to models
- Docs page not found HOT 1
- InvalidTopicException HOT 4
- Bug: grpc does not recognize files on any other port than 50051
- Support RabbitMQ as alternative to Kafka
- Kafka permanent connections
- `create-chiselstrike-app` example giving npm error "Cannot convert undefined or null to object"
- turso installer fails for fish
- Don't pollute home directory
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chiselstrike.