add test and update router version
This commit is contained in:
		
							
								
								
									
										12
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								package.json
									
									
									
									
									
								
							| @@ -33,10 +33,10 @@ | |||||||
|   "license": "ISC", |   "license": "ISC", | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
|     "@abearxiong/auth": "1.0.2", |     "@abearxiong/auth": "1.0.2", | ||||||
|     "@abearxiong/router": "0.0.1-alpha.40", |     "@abearxiong/router": "0.0.1-alpha.43", | ||||||
|     "@abearxiong/use-config": "^0.0.2", |     "@abearxiong/use-config": "^0.0.2", | ||||||
|     "@babel/core": "^7.25.7", |     "@babel/core": "^7.25.8", | ||||||
|     "@babel/preset-env": "^7.25.7", |     "@babel/preset-env": "^7.25.8", | ||||||
|     "@babel/preset-typescript": "^7.25.7", |     "@babel/preset-typescript": "^7.25.7", | ||||||
|     "@kevisual/ai-graph": "workspace:^", |     "@kevisual/ai-graph": "workspace:^", | ||||||
|     "@kevisual/ai-lang": "workspace:^", |     "@kevisual/ai-lang": "workspace:^", | ||||||
| @@ -52,7 +52,7 @@ | |||||||
|     "lodash-es": "^4.17.21", |     "lodash-es": "^4.17.21", | ||||||
|     "minio": "^8.0.1", |     "minio": "^8.0.1", | ||||||
|     "nanoid": "^5.0.7", |     "nanoid": "^5.0.7", | ||||||
|     "neo4j-driver": "^5.25.0", |     "neo4j-driver": "^5.26.0", | ||||||
|     "neode": "^0.4.9", |     "neode": "^0.4.9", | ||||||
|     "node-fetch": "^3.3.2", |     "node-fetch": "^3.3.2", | ||||||
|     "ollama": "^0.5.9", |     "ollama": "^0.5.9", | ||||||
| @@ -71,7 +71,7 @@ | |||||||
|     "@types/formidable": "^3.4.5", |     "@types/formidable": "^3.4.5", | ||||||
|     "@types/jsonwebtoken": "^9.0.7", |     "@types/jsonwebtoken": "^9.0.7", | ||||||
|     "@types/lodash-es": "^4.17.12", |     "@types/lodash-es": "^4.17.12", | ||||||
|     "@types/node": "^22.7.4", |     "@types/node": "^22.7.5", | ||||||
|     "@types/uuid": "^10.0.0", |     "@types/uuid": "^10.0.0", | ||||||
|     "@types/webpack-env": "^1.18.5", |     "@types/webpack-env": "^1.18.5", | ||||||
|     "concurrently": "^9.0.1", |     "concurrently": "^9.0.1", | ||||||
| @@ -84,7 +84,7 @@ | |||||||
|     "tape": "^5.9.0", |     "tape": "^5.9.0", | ||||||
|     "ts-loader": "^9.5.1", |     "ts-loader": "^9.5.1", | ||||||
|     "tsx": "^4.19.1", |     "tsx": "^4.19.1", | ||||||
|     "typescript": "^5.6.2", |     "typescript": "^5.6.3", | ||||||
|     "webpack": "^5.95.0", |     "webpack": "^5.95.0", | ||||||
|     "webpack-cli": "^5.1.4", |     "webpack-cli": "^5.1.4", | ||||||
|     "webpack-node-externals": "^3.0.0" |     "webpack-node-externals": "^3.0.0" | ||||||
|   | |||||||
							
								
								
									
										994
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										994
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,6 +1,6 @@ | |||||||
| import { sequelize } from '../../../modules/sequelize.ts'; | import { sequelize } from '../../../modules/sequelize.ts'; | ||||||
| import { DataTypes, Model } from 'sequelize'; | import { DataTypes, Model } from 'sequelize'; | ||||||
| import { AppData, AppType } from './app.ts'; | import { AppData, AppType, AppStatus } from './app.ts'; | ||||||
|  |  | ||||||
| export type AppList = Partial<InstanceType<typeof AppListModel>>; | export type AppList = Partial<InstanceType<typeof AppListModel>>; | ||||||
|  |  | ||||||
| @@ -13,6 +13,7 @@ export class AppListModel extends Model { | |||||||
|   declare version: string; |   declare version: string; | ||||||
|   declare key: string; |   declare key: string; | ||||||
|   declare uid: string; |   declare uid: string; | ||||||
|  |   declare status: string; | ||||||
| } | } | ||||||
|  |  | ||||||
| AppListModel.init( | AppListModel.init( | ||||||
| @@ -38,6 +39,10 @@ AppListModel.init( | |||||||
|       type: DataTypes.UUID, |       type: DataTypes.UUID, | ||||||
|       allowNull: true, |       allowNull: true, | ||||||
|     }, |     }, | ||||||
|  |     status: { | ||||||
|  |       type: DataTypes.STRING, | ||||||
|  |       defaultValue: 'running', | ||||||
|  |     }, | ||||||
|   }, |   }, | ||||||
|   { |   { | ||||||
|     sequelize, |     sequelize, | ||||||
|   | |||||||
| @@ -5,7 +5,10 @@ export interface AppData { | |||||||
|   files: { name: string; path: string }[]; |   files: { name: string; path: string }[]; | ||||||
| } | } | ||||||
| export type AppType = 'web-single' | 'web-module'; | export type AppType = 'web-single' | 'web-module'; | ||||||
|  | export enum AppStatus { | ||||||
|  |   running = 'running', | ||||||
|  |   stop = 'stop', | ||||||
|  | } | ||||||
| export type App = Partial<InstanceType<typeof AppModel>>; | export type App = Partial<InstanceType<typeof AppModel>>; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|   | |||||||
| @@ -118,3 +118,21 @@ app | |||||||
|     return ctx; |     return ctx; | ||||||
|   }) |   }) | ||||||
|   .addTo(app); |   .addTo(app); | ||||||
|  |  | ||||||
|  | app | ||||||
|  |   .route({ | ||||||
|  |     path: 'user-app', | ||||||
|  |     key: 'test', | ||||||
|  |   }) | ||||||
|  |   .define(async (ctx) => { | ||||||
|  |     const id = ctx.query.id; | ||||||
|  |     if (!id) { | ||||||
|  |       throw new CustomError('id is required'); | ||||||
|  |     } | ||||||
|  |     const am = await AppListModel.findByPk(id); | ||||||
|  |     if (!am) { | ||||||
|  |       throw new CustomError('app not found'); | ||||||
|  |     } | ||||||
|  |     ctx.body = am; | ||||||
|  |   }) | ||||||
|  |   .addTo(app); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user