"重构模块依赖并添加查询应用功能"
This commit is contained in:
		
							
								
								
									
										4
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							@@ -4,8 +4,8 @@
 | 
				
			|||||||
[submodule "submodules/query-login"]
 | 
					[submodule "submodules/query-login"]
 | 
				
			||||||
	path = submodules/query-login
 | 
						path = submodules/query-login
 | 
				
			||||||
	url = git@git.xiongxiao.me:kevisual/kevisual-query-login.git
 | 
						url = git@git.xiongxiao.me:kevisual/kevisual-query-login.git
 | 
				
			||||||
[submodule "submodules/query-load"]
 | 
					[submodule "submodules/query-upload"]
 | 
				
			||||||
	path = submodules/query-load
 | 
						path = submodules/query-upload
 | 
				
			||||||
	url = git@git.xiongxiao.me:kevisual/kevisual-query-upload.git
 | 
						url = git@git.xiongxiao.me:kevisual/kevisual-query-upload.git
 | 
				
			||||||
[submodule "submodules/query-mark"]
 | 
					[submodule "submodules/query-mark"]
 | 
				
			||||||
	path = submodules/query-mark
 | 
						path = submodules/query-mark
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										13
									
								
								bun.copy.config.mjs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								bun.copy.config.mjs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					// @ts-check
 | 
				
			||||||
 | 
					import { execSync } from 'node:child_process';
 | 
				
			||||||
 | 
					import glob from 'fast-glob';
 | 
				
			||||||
 | 
					import fs from 'node:fs';
 | 
				
			||||||
 | 
					const files = await glob(['packages/*/dist', 'submodules/*/dist'], { onlyDirectories: true });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					console.log('files', files);
 | 
				
			||||||
 | 
					const clean = 'rimraf dist && mkdir dist';
 | 
				
			||||||
 | 
					execSync(clean);
 | 
				
			||||||
 | 
					for (let dir of files) {
 | 
				
			||||||
 | 
					  const rsync = `rsync ${dir}/* ./dist`;
 | 
				
			||||||
 | 
					  execSync(rsync);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										21
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								package.json
									
									
									
									
									
								
							@@ -4,7 +4,11 @@
 | 
				
			|||||||
  "description": "",
 | 
					  "description": "",
 | 
				
			||||||
  "main": "index.js",
 | 
					  "main": "index.js",
 | 
				
			||||||
  "scripts": {
 | 
					  "scripts": {
 | 
				
			||||||
    "test": "echo \"Error: no test specified\" && exit 1"
 | 
					    "build": "turbo run build",
 | 
				
			||||||
 | 
					    "postbuild": "bun bun.copy.config.mjs"
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "publishConfig": {
 | 
				
			||||||
 | 
					    "access": "public"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "files": [
 | 
					  "files": [
 | 
				
			||||||
    "dist"
 | 
					    "dist"
 | 
				
			||||||
@@ -12,10 +16,21 @@
 | 
				
			|||||||
  "keywords": [],
 | 
					  "keywords": [],
 | 
				
			||||||
  "author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
 | 
					  "author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
 | 
				
			||||||
  "license": "MIT",
 | 
					  "license": "MIT",
 | 
				
			||||||
  "packageManager": "pnpm@10.6.2",
 | 
					  "packageManager": "pnpm@10.11.0",
 | 
				
			||||||
  "type": "module",
 | 
					  "type": "module",
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "@kevisual/query": "^0.0.18",
 | 
					    "@kevisual/query": "^0.0.18",
 | 
				
			||||||
    "@kevisual/router": "^0.0.20"
 | 
					    "@kevisual/router": "^0.0.20",
 | 
				
			||||||
 | 
					    "@kevisual/types": "^0.0.10",
 | 
				
			||||||
 | 
					    "@kevisual/use-config": "^1.0.17",
 | 
				
			||||||
 | 
					    "fast-glob": "^3.3.3"
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "exports": {
 | 
				
			||||||
 | 
					    ".": {
 | 
				
			||||||
 | 
					      "import": "./dist/query-login-browser.js"
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "./*": {
 | 
				
			||||||
 | 
					      "import": "./dist/*"
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
							
								
								
									
										30
									
								
								packages/query-app/bun.config.mjs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								packages/query-app/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/*.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/query-app/package.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								packages/query-app/package.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					  "name": "@kevisual/query-app",
 | 
				
			||||||
 | 
					  "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"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										57
									
								
								packages/query-app/src/defines/app.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								packages/query-app/src/defines/app.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,57 @@
 | 
				
			|||||||
 | 
					import { QueryUtil } from './common.ts';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const appDefine = QueryUtil.create({
 | 
				
			||||||
 | 
					  getApp: {
 | 
				
			||||||
 | 
					    path: 'app',
 | 
				
			||||||
 | 
					    key: 'get',
 | 
				
			||||||
 | 
					    description: '获取应用信息',
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  updateApp: {
 | 
				
			||||||
 | 
					    path: 'app',
 | 
				
			||||||
 | 
					    key: 'update',
 | 
				
			||||||
 | 
					    description: '更新应用信息',
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  deleteApp: {
 | 
				
			||||||
 | 
					    path: 'app',
 | 
				
			||||||
 | 
					    key: 'delete',
 | 
				
			||||||
 | 
					    description: '删除应用信息',
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  listApps: {
 | 
				
			||||||
 | 
					    path: 'app',
 | 
				
			||||||
 | 
					    key: 'list',
 | 
				
			||||||
 | 
					    description: '列出所有应用信息',
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  canUploadFiles: {
 | 
				
			||||||
 | 
					    path: 'app',
 | 
				
			||||||
 | 
					    key: 'canUploadFiles',
 | 
				
			||||||
 | 
					    description: '检查是否可以上传文件',
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  uploadFiles: {
 | 
				
			||||||
 | 
					    path: 'app',
 | 
				
			||||||
 | 
					    key: 'uploadFiles',
 | 
				
			||||||
 | 
					    description: '上传文件',
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  publishApp: {
 | 
				
			||||||
 | 
					    path: 'app',
 | 
				
			||||||
 | 
					    key: 'publish',
 | 
				
			||||||
 | 
					    description: '发布应用',
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  getMinioList: {
 | 
				
			||||||
 | 
					    path: 'app',
 | 
				
			||||||
 | 
					    key: 'get-minio-list',
 | 
				
			||||||
 | 
					    description: '获取 MinIO 文件列表',
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  detectVersionList: {
 | 
				
			||||||
 | 
					    path: 'app',
 | 
				
			||||||
 | 
					    key: 'detectVersionList',
 | 
				
			||||||
 | 
					    description: '检测版本列表并同步 MinIO 数据',
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
							
								
								
									
										1
									
								
								packages/query-app/src/defines/common.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								packages/query-app/src/defines/common.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					export { QueryUtil } from '@kevisual/router/define';
 | 
				
			||||||
							
								
								
									
										3
									
								
								packages/query-app/src/defines/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								packages/query-app/src/defines/index.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					import { appDefine } from './app';
 | 
				
			||||||
 | 
					import { userAppDefine } from './user-app';
 | 
				
			||||||
 | 
					export { appDefine, userAppDefine };
 | 
				
			||||||
							
								
								
									
										33
									
								
								packages/query-app/src/defines/user-app.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								packages/query-app/src/defines/user-app.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
				
			|||||||
 | 
					import { QueryUtil } from './common.ts';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const userAppDefine = QueryUtil.create({
 | 
				
			||||||
 | 
					  listUserApps: {
 | 
				
			||||||
 | 
					    path: 'user-app',
 | 
				
			||||||
 | 
					    key: 'list',
 | 
				
			||||||
 | 
					    description: '列出当前用户的所有应用(不包含 data 字段)',
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  getUserApp: {
 | 
				
			||||||
 | 
					    path: 'user-app',
 | 
				
			||||||
 | 
					    key: 'get',
 | 
				
			||||||
 | 
					    description: '获取用户应用信息,可以指定 id 或 key',
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  updateUserApp: {
 | 
				
			||||||
 | 
					    path: 'user-app',
 | 
				
			||||||
 | 
					    key: 'update',
 | 
				
			||||||
 | 
					    description: '更新或创建用户应用',
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  deleteUserApp: {
 | 
				
			||||||
 | 
					    path: 'user-app',
 | 
				
			||||||
 | 
					    key: 'delete',
 | 
				
			||||||
 | 
					    description: '删除用户应用及关联数据',
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  testUserApp: {
 | 
				
			||||||
 | 
					    path: 'user-app',
 | 
				
			||||||
 | 
					    key: 'test',
 | 
				
			||||||
 | 
					    description: '对 user-app 的数据进行测试,获取版本信息',
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
							
								
								
									
										1
									
								
								packages/query-app/src/query-app-define.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								packages/query-app/src/query-app-define.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					export * from './defines/index.ts';
 | 
				
			||||||
							
								
								
									
										18
									
								
								packages/query-app/src/query-app.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								packages/query-app/src/query-app.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					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);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										6
									
								
								packages/query-app/src/test/query-app.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								packages/query-app/src/test/query-app.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					import { QueryApp } from '../query-app.ts';
 | 
				
			||||||
 | 
					import { Query } from '@kevisual/query/query';
 | 
				
			||||||
 | 
					const query = new Query();
 | 
				
			||||||
 | 
					const qa = new QueryApp({ query: query });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					qa.appDefine.queryChain('getApp').post({});
 | 
				
			||||||
							
								
								
									
										18
									
								
								packages/query-app/tsconfig.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								packages/query-app/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/**/*",
 | 
				
			||||||
 | 
					  ],
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										1571
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1571
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							 Submodule submodules/query-login updated: 557cd99b20...0a0ffbdb23
									
								
							
							
								
								
									
										22
									
								
								turbo.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								turbo.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					  "$schema": "https://turbo.build/schema.json",
 | 
				
			||||||
 | 
					  "tasks": {
 | 
				
			||||||
 | 
					    "build": {
 | 
				
			||||||
 | 
					      "dependsOn": [
 | 
				
			||||||
 | 
					        "^build"
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					      "outputs": [
 | 
				
			||||||
 | 
					        "dist/**"
 | 
				
			||||||
 | 
					      ]
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "dev:lib": {
 | 
				
			||||||
 | 
					      "persistent": true,
 | 
				
			||||||
 | 
					      "cache": true
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "build:lib": {
 | 
				
			||||||
 | 
					      "dependsOn": [
 | 
				
			||||||
 | 
					        "^build:lib"
 | 
				
			||||||
 | 
					      ]
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user