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
30 lines
649 B
TypeScript
30 lines
649 B
TypeScript
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'
|
|
}); |