60 lines
1.3 KiB
TypeScript
60 lines
1.3 KiB
TypeScript
import { appDefine, userAppDefine } from './defines/index.ts';
|
||
|
||
import { BaseQuery, DataOpts, Query } from '@kevisual/query/query';
|
||
|
||
export { appDefine, userAppDefine };
|
||
|
||
export class QueryApp extends BaseQuery {
|
||
appDefine = appDefine;
|
||
userAppDefine = userAppDefine;
|
||
constructor(opts?: { query: Query }) {
|
||
super(opts!);
|
||
this.appDefine.query = this.query;
|
||
this.userAppDefine.query = this.query;
|
||
}
|
||
getList(data: any, opts?: DataOpts) {
|
||
return this.appDefine.queryChain('listApps').post(data, opts);
|
||
}
|
||
getPublicApp(data: any, opts?: DataOpts) {
|
||
return this.query.post({
|
||
path: 'app',
|
||
key: 'getApp',
|
||
data: data,
|
||
}, opts);
|
||
}
|
||
getApp(data: {
|
||
key?: string;
|
||
version?: string;
|
||
/**
|
||
* 当app不存在,会创建一个新的,
|
||
* 之后上传文件就好了,会执行检测任务
|
||
*/
|
||
create?: boolean;
|
||
}, opts?: DataOpts) {
|
||
return this.query.post({
|
||
path: 'app',
|
||
key: 'get',
|
||
data: data,
|
||
}, opts);
|
||
}
|
||
/**
|
||
* 发布应用
|
||
* @param data
|
||
* @param opts
|
||
* @returns
|
||
*/
|
||
publichApp(data: {
|
||
id?: string;
|
||
username?: string,
|
||
detect?: boolean,
|
||
appKey?: string;
|
||
version?: string;
|
||
}, opts?: DataOpts) {
|
||
return this.query.post({
|
||
path: 'app',
|
||
key: 'publish',
|
||
data: { detect: true, ...data },
|
||
}, opts);
|
||
}
|
||
}
|