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:
11
src/query.ts
11
src/query.ts
@@ -162,6 +162,7 @@ export class Query {
|
||||
*/
|
||||
async post<R = any, P = any>(body: Data & P, options?: DataOpts): Promise<Result<R>> {
|
||||
const url = options?.url || this.url;
|
||||
console.log('query post', url, body, options);
|
||||
const { headers, adapter, beforeRequest, afterResponse, timeout, ...rest } = options || {};
|
||||
const _headers = { ...this.headers, ...headers };
|
||||
const _adapter = adapter || this.adapter;
|
||||
@@ -301,13 +302,3 @@ export class BaseQuery<T extends Query = Query, R extends { queryChain?: any; qu
|
||||
return this.query.get(data, options);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* 前端调用后端QueryRouter, 默认路径 /client/router
|
||||
*/
|
||||
export class ClientQuery extends Query {
|
||||
constructor(opts?: QueryOpts) {
|
||||
super({ ...opts, url: opts?.url || '/client/router' });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user