@kevisual/query 0.0.30 → 0.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/query-browser.d.ts +23 -1
- package/dist/query-browser.js +31 -1
- package/dist/query.d.ts +23 -1
- package/dist/query.js +31 -1
- package/package.json +1 -1
package/dist/query-browser.d.ts
CHANGED
|
@@ -221,6 +221,28 @@ declare class Query {
|
|
|
221
221
|
fetchText(urlOrOptions?: string | QueryOpts$1, options?: QueryOpts$1): Promise<Result<any>>;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
+
declare class BaseQuery<T extends Query = Query, R extends {
|
|
225
|
+
queryChain?: any;
|
|
226
|
+
query?: any;
|
|
227
|
+
} = {
|
|
228
|
+
queryChain: any;
|
|
229
|
+
query?: T;
|
|
230
|
+
}> {
|
|
231
|
+
query: T;
|
|
232
|
+
queryDefine: R;
|
|
233
|
+
constructor(opts?: {
|
|
234
|
+
query?: T;
|
|
235
|
+
queryDefine?: R;
|
|
236
|
+
clientQuery?: T;
|
|
237
|
+
});
|
|
238
|
+
get chain(): R['queryChain'];
|
|
239
|
+
post<R = any, P = any>(data: P, options?: DataOpts): Promise<Result<R>>;
|
|
240
|
+
get<R = any, P = any>(data: P, options?: DataOpts): Promise<Result<R>>;
|
|
241
|
+
}
|
|
242
|
+
declare class ClientQuery extends Query {
|
|
243
|
+
constructor(opts?: QueryOpts$1);
|
|
244
|
+
}
|
|
245
|
+
|
|
224
246
|
type QueryOpts = {
|
|
225
247
|
url?: string;
|
|
226
248
|
adapter?: typeof adapter;
|
|
@@ -245,5 +267,5 @@ declare class QueryClient extends Query {
|
|
|
245
267
|
removeToken(): void;
|
|
246
268
|
}
|
|
247
269
|
|
|
248
|
-
export { Query, QueryClient, QueryWs, adapter, wrapperError };
|
|
270
|
+
export { BaseQuery, ClientQuery, Query, QueryClient, QueryWs, adapter, wrapperError };
|
|
249
271
|
export type { Data, DataOpts, QueryOpts, QueryWsOpts, Result };
|
package/dist/query-browser.js
CHANGED
|
@@ -516,6 +516,36 @@ class Query {
|
|
|
516
516
|
return setBaseResponse(res);
|
|
517
517
|
}
|
|
518
518
|
}
|
|
519
|
+
class BaseQuery {
|
|
520
|
+
query;
|
|
521
|
+
queryDefine;
|
|
522
|
+
constructor(opts) {
|
|
523
|
+
if (opts?.clientQuery) {
|
|
524
|
+
this.query = opts.clientQuery;
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
this.query = opts?.query;
|
|
528
|
+
}
|
|
529
|
+
if (opts.queryDefine) {
|
|
530
|
+
this.queryDefine = opts.queryDefine;
|
|
531
|
+
this.queryDefine.query = this.query;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
get chain() {
|
|
535
|
+
return this.queryDefine.queryChain;
|
|
536
|
+
}
|
|
537
|
+
post(data, options) {
|
|
538
|
+
return this.query.post(data, options);
|
|
539
|
+
}
|
|
540
|
+
get(data, options) {
|
|
541
|
+
return this.query.get(data, options);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
class ClientQuery extends Query {
|
|
545
|
+
constructor(opts) {
|
|
546
|
+
super({ ...opts, url: opts?.url || '/client/router' });
|
|
547
|
+
}
|
|
548
|
+
}
|
|
519
549
|
|
|
520
550
|
/**
|
|
521
551
|
* 前端调用后端QueryRouter, 封装 beforeRequest 和 wss
|
|
@@ -558,4 +588,4 @@ class QueryClient extends Query {
|
|
|
558
588
|
// 移除默认生成的实例
|
|
559
589
|
// export const client = new QueryClient();
|
|
560
590
|
|
|
561
|
-
export { Query, QueryClient, QueryWs, adapter, wrapperError };
|
|
591
|
+
export { BaseQuery, ClientQuery, Query, QueryClient, QueryWs, adapter, wrapperError };
|
package/dist/query.d.ts
CHANGED
|
@@ -228,5 +228,27 @@ declare class Query {
|
|
|
228
228
|
fetchText(urlOrOptions?: string | QueryOpts, options?: QueryOpts): Promise<Result<any>>;
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
|
|
231
|
+
declare class BaseQuery<T extends Query = Query, R extends {
|
|
232
|
+
queryChain?: any;
|
|
233
|
+
query?: any;
|
|
234
|
+
} = {
|
|
235
|
+
queryChain: any;
|
|
236
|
+
query?: T;
|
|
237
|
+
}> {
|
|
238
|
+
query: T;
|
|
239
|
+
queryDefine: R;
|
|
240
|
+
constructor(opts?: {
|
|
241
|
+
query?: T;
|
|
242
|
+
queryDefine?: R;
|
|
243
|
+
clientQuery?: T;
|
|
244
|
+
});
|
|
245
|
+
get chain(): R['queryChain'];
|
|
246
|
+
post<R = any, P = any>(data: P, options?: DataOpts): Promise<Result<R>>;
|
|
247
|
+
get<R = any, P = any>(data: P, options?: DataOpts): Promise<Result<R>>;
|
|
248
|
+
}
|
|
249
|
+
declare class ClientQuery extends Query {
|
|
250
|
+
constructor(opts?: QueryOpts);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export { BaseQuery, ClientQuery, Query, adapter, setBaseResponse, wrapperError };
|
|
232
254
|
export type { Data, DataOpts, Fn, QueryOpts, Result };
|
package/dist/query.js
CHANGED
|
@@ -300,5 +300,35 @@ class Query {
|
|
|
300
300
|
return setBaseResponse(res);
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
|
+
class BaseQuery {
|
|
304
|
+
query;
|
|
305
|
+
queryDefine;
|
|
306
|
+
constructor(opts) {
|
|
307
|
+
if (opts?.clientQuery) {
|
|
308
|
+
this.query = opts.clientQuery;
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
this.query = opts?.query;
|
|
312
|
+
}
|
|
313
|
+
if (opts.queryDefine) {
|
|
314
|
+
this.queryDefine = opts.queryDefine;
|
|
315
|
+
this.queryDefine.query = this.query;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
get chain() {
|
|
319
|
+
return this.queryDefine.queryChain;
|
|
320
|
+
}
|
|
321
|
+
post(data, options) {
|
|
322
|
+
return this.query.post(data, options);
|
|
323
|
+
}
|
|
324
|
+
get(data, options) {
|
|
325
|
+
return this.query.get(data, options);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
class ClientQuery extends Query {
|
|
329
|
+
constructor(opts) {
|
|
330
|
+
super({ ...opts, url: opts?.url || '/client/router' });
|
|
331
|
+
}
|
|
332
|
+
}
|
|
303
333
|
|
|
304
|
-
export { Query, adapter, setBaseResponse, wrapperError };
|
|
334
|
+
export { BaseQuery, ClientQuery, Query, adapter, setBaseResponse, wrapperError };
|