fix: fix error
This commit is contained in:
parent
edde6181f7
commit
a97bb5f732
28
package.json
28
package.json
@ -35,19 +35,19 @@
|
|||||||
"@kevisual/ai-graph": "workspace:^",
|
"@kevisual/ai-graph": "workspace:^",
|
||||||
"@kevisual/ai-lang": "workspace:^",
|
"@kevisual/ai-lang": "workspace:^",
|
||||||
"@kevisual/auth": "1.0.5",
|
"@kevisual/auth": "1.0.5",
|
||||||
"@kevisual/local-app-manager": "0.1.6-alpha.3",
|
"@kevisual/local-app-manager": "0.1.6-alpha.5",
|
||||||
"@kevisual/router": "^0.0.6-alpha-3",
|
"@kevisual/router": "^0.0.6-alpha-5",
|
||||||
"@types/semver": "^7.5.8",
|
"@types/semver": "^7.5.8",
|
||||||
"archiver": "^7.0.1",
|
"archiver": "^7.0.1",
|
||||||
"bullmq": "^5.34.0",
|
"bullmq": "^5.34.6",
|
||||||
"dayjs": "^1.11.13",
|
"dayjs": "^1.11.13",
|
||||||
"dts-bundle-generator": "^9.5.1",
|
"dts-bundle-generator": "^9.5.1",
|
||||||
"formidable": "^3.5.2",
|
"formidable": "^3.5.2",
|
||||||
"ioredis": "^5.4.1",
|
"ioredis": "^5.4.2",
|
||||||
"json5": "^2.2.3",
|
"json5": "^2.2.3",
|
||||||
"jsonwebtoken": "^9.0.2",
|
"jsonwebtoken": "^9.0.2",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"minio": "^8.0.2",
|
"minio": "^8.0.3",
|
||||||
"nanoid": "^5.0.9",
|
"nanoid": "^5.0.9",
|
||||||
"neo4j-driver": "^5.27.0",
|
"neo4j-driver": "^5.27.0",
|
||||||
"neode": "^0.4.9",
|
"neode": "^0.4.9",
|
||||||
@ -68,26 +68,26 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@kevisual/use-config": "^1.0.7",
|
"@kevisual/use-config": "^1.0.7",
|
||||||
"@rollup/plugin-alias": "^5.1.1",
|
"@rollup/plugin-alias": "^5.1.1",
|
||||||
"@rollup/plugin-commonjs": "^28.0.1",
|
"@rollup/plugin-commonjs": "^28.0.2",
|
||||||
"@rollup/plugin-json": "^6.1.0",
|
"@rollup/plugin-json": "^6.1.0",
|
||||||
"@rollup/plugin-node-resolve": "^15.3.0",
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
||||||
"@rollup/plugin-replace": "^6.0.1",
|
"@rollup/plugin-replace": "^6.0.2",
|
||||||
"@rollup/plugin-typescript": "^12.1.1",
|
"@rollup/plugin-typescript": "^12.1.2",
|
||||||
"@types/archiver": "^6.0.3",
|
"@types/archiver": "^6.0.3",
|
||||||
"@types/crypto-js": "^4.2.2",
|
"@types/crypto-js": "^4.2.2",
|
||||||
"@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.10.2",
|
"@types/node": "^22.10.5",
|
||||||
"@types/react": "^19.0.1",
|
"@types/react": "^19.0.2",
|
||||||
"@types/uuid": "^10.0.0",
|
"@types/uuid": "^10.0.0",
|
||||||
"concurrently": "^9.1.0",
|
"concurrently": "^9.1.2",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"nodemon": "^3.1.7",
|
"nodemon": "^3.1.9",
|
||||||
"pm2": "^5.4.3",
|
"pm2": "^5.4.3",
|
||||||
"pm2-dev": "^5.4.1",
|
"pm2-dev": "^5.4.1",
|
||||||
"rimraf": "^6.0.1",
|
"rimraf": "^6.0.1",
|
||||||
"rollup": "^4.28.1",
|
"rollup": "^4.29.1",
|
||||||
"rollup-plugin-copy": "^3.5.0",
|
"rollup-plugin-copy": "^3.5.0",
|
||||||
"rollup-plugin-dts": "^6.1.1",
|
"rollup-plugin-dts": "^6.1.1",
|
||||||
"tape": "^5.9.0",
|
"tape": "^5.9.0",
|
||||||
|
460
pnpm-lock.yaml
generated
460
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -26,6 +26,8 @@ app
|
|||||||
path: item.path,
|
path: item.path,
|
||||||
key: item.key,
|
key: item.key,
|
||||||
description: item.description,
|
description: item.description,
|
||||||
|
validator: item.validator,
|
||||||
|
// schema: item.schema,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@ -9,7 +9,7 @@ import { app, minioClient } from '@/app.ts';
|
|||||||
import { bucketName } from '@/modules/minio.ts';
|
import { bucketName } from '@/modules/minio.ts';
|
||||||
import { getContentType } from '@/utils/get-content-type.ts';
|
import { getContentType } from '@/utils/get-content-type.ts';
|
||||||
import { hash } from 'crypto';
|
import { hash } from 'crypto';
|
||||||
import { MicroAppModel } from '@/routes/micro-app/models.ts';
|
import { MicroAppUploadModel } from '@/routes/micro-app/models.ts';
|
||||||
const cacheFilePath = useFileStore('cache-file', { needExists: true });
|
const cacheFilePath = useFileStore('cache-file', { needExists: true });
|
||||||
|
|
||||||
router.post('/api/micro-app/upload', async (req, res) => {
|
router.post('/api/micro-app/upload', async (req, res) => {
|
||||||
@ -137,7 +137,7 @@ router.get('/api/micro-app/download/:id', async (req, res) => {
|
|||||||
tokenUser = auth.tokenUser;
|
tokenUser = auth.tokenUser;
|
||||||
if (!tokenUser) return;
|
if (!tokenUser) return;
|
||||||
}
|
}
|
||||||
const file = await MicroAppModel.findByPk(id);
|
const file = await MicroAppUploadModel.findByPk(id);
|
||||||
if (!DEV_SERVER) {
|
if (!DEV_SERVER) {
|
||||||
file.uid !== tokenUser.id && res.end(error('No permission', 403));
|
file.uid !== tokenUser.id && res.end(error('No permission', 403));
|
||||||
return;
|
return;
|
||||||
|
@ -1 +1,2 @@
|
|||||||
import './list.ts';
|
import './list.ts';
|
||||||
|
import './upload-list.ts'
|
@ -1,5 +1,5 @@
|
|||||||
import { app } from '@/app.ts';
|
import { app } from '@/app.ts';
|
||||||
import { MicroAppModel } from './models.ts';
|
import { MicroAppUploadModel } from './models.ts';
|
||||||
import { appPathCheck, installApp } from './module/install-app.ts';
|
import { appPathCheck, installApp } from './module/install-app.ts';
|
||||||
import { manager } from './manager-app.ts';
|
import { manager } from './manager-app.ts';
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ app
|
|||||||
if (collection?.tags) {
|
if (collection?.tags) {
|
||||||
tags.push(...collection.tags);
|
tags.push(...collection.tags);
|
||||||
}
|
}
|
||||||
const microApp = await MicroAppModel.create({
|
const microApp = await MicroAppUploadModel.create({
|
||||||
title: name,
|
title: name,
|
||||||
description: collection?.readme || '',
|
description: collection?.readme || '',
|
||||||
type: 'micro-app',
|
type: 'micro-app',
|
||||||
@ -63,7 +63,7 @@ app
|
|||||||
if (!id) {
|
if (!id) {
|
||||||
ctx.throw(400, 'Invalid id');
|
ctx.throw(400, 'Invalid id');
|
||||||
}
|
}
|
||||||
const microApp = await MicroAppModel.findByPk(id);
|
const microApp = await MicroAppUploadModel.findByPk(id);
|
||||||
const { file } = microApp.data || {};
|
const { file } = microApp.data || {};
|
||||||
const path = file?.path;
|
const path = file?.path;
|
||||||
if (!path) {
|
if (!path) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { sequelize } from '@/modules/sequelize.ts';
|
import { sequelize } from '@/modules/sequelize.ts';
|
||||||
import { DataTypes, Model } from 'sequelize';
|
import { DataTypes, Model } from 'sequelize';
|
||||||
|
|
||||||
export type MicroApp = Partial<InstanceType<typeof MicroAppModel>>;
|
export type MicroApp = Partial<InstanceType<typeof MicroAppUploadModel>>;
|
||||||
|
|
||||||
type MicroAppData = {
|
type MicroAppData = {
|
||||||
file?: {
|
file?: {
|
||||||
@ -14,7 +14,7 @@ type MicroAppData = {
|
|||||||
data?: any;
|
data?: any;
|
||||||
collection?: any; // 上传的信息汇总
|
collection?: any; // 上传的信息汇总
|
||||||
};
|
};
|
||||||
export class MicroAppModel extends Model {
|
export class MicroAppUploadModel extends Model {
|
||||||
declare id: string;
|
declare id: string;
|
||||||
declare title: string;
|
declare title: string;
|
||||||
declare description: string;
|
declare description: string;
|
||||||
@ -29,7 +29,7 @@ export class MicroAppModel extends Model {
|
|||||||
declare uname: string;
|
declare uname: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
MicroAppModel.init(
|
MicroAppUploadModel.init(
|
||||||
{
|
{
|
||||||
id: {
|
id: {
|
||||||
type: DataTypes.UUID,
|
type: DataTypes.UUID,
|
||||||
@ -76,11 +76,11 @@ MicroAppModel.init(
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
sequelize,
|
sequelize,
|
||||||
tableName: 'micro_apps',
|
tableName: 'micro_apps_upload',
|
||||||
// paranoid: true,
|
// paranoid: true,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
MicroAppModel.sync({ alter: true, logging: false }).catch((e) => {
|
MicroAppUploadModel.sync({ alter: true, logging: false }).catch((e) => {
|
||||||
console.error('MicroAppModel sync', e);
|
console.error('MicroAppUploadModel sync', e);
|
||||||
});
|
});
|
||||||
|
57
src/routes/micro-app/upload-list.ts
Normal file
57
src/routes/micro-app/upload-list.ts
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
import { app } from '@/app.ts';
|
||||||
|
import { MicroAppUploadModel } from './models.ts';
|
||||||
|
|
||||||
|
// 获取MicroAppUpload的uploadList的接口
|
||||||
|
app
|
||||||
|
.route({
|
||||||
|
path: 'micro-app-upload',
|
||||||
|
key: 'list',
|
||||||
|
middleware: ['auth'],
|
||||||
|
description: 'Get micro app upload list',
|
||||||
|
})
|
||||||
|
.define(async (ctx) => {
|
||||||
|
const { uid } = ctx.state.tokenUser;
|
||||||
|
const uploadList = await MicroAppUploadModel.findAll({
|
||||||
|
where: { uid },
|
||||||
|
});
|
||||||
|
ctx.body = uploadList;
|
||||||
|
})
|
||||||
|
.addTo(app);
|
||||||
|
|
||||||
|
// 获取单个MicroAppUpload的接口
|
||||||
|
app
|
||||||
|
.route({
|
||||||
|
path: 'micro-app-upload',
|
||||||
|
key: 'get',
|
||||||
|
middleware: ['auth'],
|
||||||
|
description: 'Get a single micro app upload',
|
||||||
|
})
|
||||||
|
.define(async (ctx) => {
|
||||||
|
const { id } = ctx.query;
|
||||||
|
const upload = await MicroAppUploadModel.findOne({
|
||||||
|
where: { id },
|
||||||
|
});
|
||||||
|
if (upload) {
|
||||||
|
ctx.body = upload;
|
||||||
|
} else {
|
||||||
|
ctx.throw(404, 'Not found');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.addTo(app);
|
||||||
|
|
||||||
|
// 删除MicroAppUpload的接口
|
||||||
|
app
|
||||||
|
.route({
|
||||||
|
path: 'micro-app-upload',
|
||||||
|
key: 'delete',
|
||||||
|
middleware: ['auth'],
|
||||||
|
description: 'Delete a micro app upload',
|
||||||
|
})
|
||||||
|
.define(async (ctx) => {
|
||||||
|
const { id } = ctx.query;
|
||||||
|
const deleted = await MicroAppUploadModel.destroy({
|
||||||
|
where: { id },
|
||||||
|
});
|
||||||
|
ctx.body = { deleted };
|
||||||
|
})
|
||||||
|
.addTo(app);
|
Loading…
x
Reference in New Issue
Block a user