add quser app
This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "@kevisual/query-awesome",
 | 
			
		||||
  "version": "0.0.1",
 | 
			
		||||
  "version": "0.0.2",
 | 
			
		||||
  "description": "",
 | 
			
		||||
  "main": "index.js",
 | 
			
		||||
  "scripts": {
 | 
			
		||||
@@ -23,7 +23,8 @@
 | 
			
		||||
    "@kevisual/router": "^0.0.20",
 | 
			
		||||
    "@kevisual/types": "^0.0.10",
 | 
			
		||||
    "@kevisual/use-config": "^1.0.17",
 | 
			
		||||
    "fast-glob": "^3.3.3"
 | 
			
		||||
    "fast-glob": "^3.3.3",
 | 
			
		||||
    "tsup": "^8.4.0"
 | 
			
		||||
  },
 | 
			
		||||
  "exports": {
 | 
			
		||||
    ".": {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										30
									
								
								packages/list/bun.config.mjs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								packages/list/bun.config.mjs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
// @ts-check
 | 
			
		||||
import { resolvePath, getDevInputs } from '@kevisual/use-config/env';
 | 
			
		||||
import { execSync } from 'node:child_process';
 | 
			
		||||
import glob from 'fast-glob';
 | 
			
		||||
 | 
			
		||||
const files = await glob(['src/defines/*.ts', 'src/query/*.ts', 'src/router/*.ts']);
 | 
			
		||||
const inputs = getDevInputs(files);
 | 
			
		||||
const external = ['@kevisual/router'];
 | 
			
		||||
for (let input of inputs) {
 | 
			
		||||
  const entry = input.path;
 | 
			
		||||
  const naming = input.naming;
 | 
			
		||||
  /**
 | 
			
		||||
   * @type {import('bun').BuildConfig}
 | 
			
		||||
   */
 | 
			
		||||
  await Bun.build({
 | 
			
		||||
    target: 'node',
 | 
			
		||||
    format: 'esm',
 | 
			
		||||
    entrypoints: [resolvePath(entry, { meta: import.meta })],
 | 
			
		||||
    outdir: resolvePath('./dist', { meta: import.meta }),
 | 
			
		||||
 | 
			
		||||
    naming: {
 | 
			
		||||
      entry: naming + '.js',
 | 
			
		||||
    },
 | 
			
		||||
    external: external,
 | 
			
		||||
    env: 'KEVISUAL_*',
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  const cmd = `dts -i ${entry} -o ${naming}.d.ts`;
 | 
			
		||||
  execSync(cmd, { stdio: 'inherit' });
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										18
									
								
								packages/list/package.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								packages/list/package.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "@kevisual/query-list",
 | 
			
		||||
  "version": "0.0.1",
 | 
			
		||||
  "description": "",
 | 
			
		||||
  "main": "index.js",
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "build": "bun bun.config.mjs"
 | 
			
		||||
  },
 | 
			
		||||
  "keywords": [],
 | 
			
		||||
  "files": [
 | 
			
		||||
    "src",
 | 
			
		||||
    "dist"
 | 
			
		||||
  ],
 | 
			
		||||
  "author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
 | 
			
		||||
  "license": "MIT",
 | 
			
		||||
  "packageManager": "pnpm@10.6.2",
 | 
			
		||||
  "type": "module"
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										27
									
								
								packages/list/src/defines/query-shop-define.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								packages/list/src/defines/query-shop-define.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
import { QueryUtil } from '@kevisual/router/define';
 | 
			
		||||
 | 
			
		||||
export const shopDefine = QueryUtil.create({
 | 
			
		||||
  getRegistry: {
 | 
			
		||||
    path: 'shop',
 | 
			
		||||
    key: 'get-registry',
 | 
			
		||||
    description: '获取应用商店注册表信息',
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  listInstalled: {
 | 
			
		||||
    path: 'shop',
 | 
			
		||||
    key: 'list-installed',
 | 
			
		||||
    description: '列出当前已安装的所有应用',
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  install: {
 | 
			
		||||
    path: 'shop',
 | 
			
		||||
    key: 'install',
 | 
			
		||||
    description: '安装指定的应用,可以指定 id、type、force 和 yes 参数',
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  uninstall: {
 | 
			
		||||
    path: 'shop',
 | 
			
		||||
    key: 'uninstall',
 | 
			
		||||
    description: '卸载指定的应用,可以指定 id 和 type 参数',
 | 
			
		||||
  },
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										19
									
								
								packages/list/src/query/query-shop.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								packages/list/src/query/query-shop.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
import { shopDefine } from '../defines/query-shop-define.ts';
 | 
			
		||||
 | 
			
		||||
import { BaseQuery, DataOpts, Query } from '@kevisual/query/query';
 | 
			
		||||
 | 
			
		||||
export { shopDefine };
 | 
			
		||||
 | 
			
		||||
export class QueryApp extends BaseQuery {
 | 
			
		||||
  appDefine = shopDefine;
 | 
			
		||||
  constructor(opts?: { query: Query }) {
 | 
			
		||||
    super(opts!);
 | 
			
		||||
    this.appDefine.query = this.query;
 | 
			
		||||
  }
 | 
			
		||||
  get chain() {
 | 
			
		||||
    return this.appDefine.queryChain;
 | 
			
		||||
  }
 | 
			
		||||
  getInstall(data: any, opts?: DataOpts) {
 | 
			
		||||
    return this.appDefine.queryChain('install').post(data, opts);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										18
									
								
								packages/list/tsconfig.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								packages/list/tsconfig.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
{
 | 
			
		||||
  "extends": "@kevisual/types/json/frontend.json",
 | 
			
		||||
  "compilerOptions": {
 | 
			
		||||
    "baseUrl": ".",
 | 
			
		||||
    "typeRoots": [
 | 
			
		||||
      "./node_modules/@types",
 | 
			
		||||
      "./node_modules/@kevisual"
 | 
			
		||||
    ],
 | 
			
		||||
    "paths": {
 | 
			
		||||
      "@/*": [
 | 
			
		||||
        "src/*"
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  "include": [
 | 
			
		||||
    "src/**/*",
 | 
			
		||||
  ],
 | 
			
		||||
}
 | 
			
		||||
@@ -54,4 +54,9 @@ export const appDefine = QueryUtil.create({
 | 
			
		||||
    key: 'detectVersionList',
 | 
			
		||||
    description: '检测版本列表并同步 MinIO 数据',
 | 
			
		||||
  },
 | 
			
		||||
  publicList: {
 | 
			
		||||
    path: 'app',
 | 
			
		||||
    key: 'public-list',
 | 
			
		||||
    description: '获取公开应用列表',
 | 
			
		||||
  },
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										17
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										17
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							@@ -23,6 +23,11 @@ importers:
 | 
			
		||||
      fast-glob:
 | 
			
		||||
        specifier: ^3.3.3
 | 
			
		||||
        version: 3.3.3
 | 
			
		||||
      tsup:
 | 
			
		||||
        specifier: ^8.4.0
 | 
			
		||||
        version: 8.4.0(typescript@5.8.3)
 | 
			
		||||
 | 
			
		||||
  packages/list: {}
 | 
			
		||||
 | 
			
		||||
  packages/query-app: {}
 | 
			
		||||
 | 
			
		||||
@@ -86,6 +91,18 @@ importers:
 | 
			
		||||
        specifier: ^8.4.0
 | 
			
		||||
        version: 8.4.0(typescript@5.8.3)
 | 
			
		||||
 | 
			
		||||
  submodules/query-upload:
 | 
			
		||||
    devDependencies:
 | 
			
		||||
      '@types/node':
 | 
			
		||||
        specifier: ^22.13.14
 | 
			
		||||
        version: 22.15.18
 | 
			
		||||
      eventsource:
 | 
			
		||||
        specifier: ^3.0.6
 | 
			
		||||
        version: 3.0.7
 | 
			
		||||
      tsup:
 | 
			
		||||
        specifier: ^8.4.0
 | 
			
		||||
        version: 8.4.0(typescript@5.8.3)
 | 
			
		||||
 | 
			
		||||
packages:
 | 
			
		||||
 | 
			
		||||
  '@babel/code-frame@7.27.1':
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user