refactor: migrate from Rollup to Bun for build configuration
feat: update adapter to use globalThis for origin resolution fix: remove unused ClientQuery export from query.ts chore: update tsconfig to include test files and set rootDir feat: add create-query functionality for dynamic API generation feat: implement QueryApi with enhanced type inference from JSON Schema test: add comprehensive API tests for QueryApi functionality test: create demo routes and schemas for testing purposes docs: add type inference demo for QueryApi usage
This commit is contained in:
30
test/api.ts
Normal file
30
test/api.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { QueryApi } from '../src/query-api.ts';
|
||||
|
||||
export const queryApi = new QueryApi();
|
||||
|
||||
export const api = {
|
||||
"test": {
|
||||
"test": {
|
||||
"path": "test",
|
||||
"key": "test",
|
||||
"id": "rWfTW4jLlwPWN_LdYXPBO",
|
||||
"description": "test route",
|
||||
"type": "route",
|
||||
"middleware": [],
|
||||
"metadata": {
|
||||
"args": {
|
||||
"a": {
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"type": "string",
|
||||
"description": "arg a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// Additional routes can be added here
|
||||
} as const;
|
||||
|
||||
const res = await queryApi.post(api.test.test, {
|
||||
a: 'test'
|
||||
});
|
||||
Reference in New Issue
Block a user