diff --git a/constants.ts b/constants.ts index 43a817c..6f5bf2a 100644 --- a/constants.ts +++ b/constants.ts @@ -11,7 +11,4 @@ export const VALID_TAGS = [ "other", ] as const -export const VALID_DATABASES = ['mysql', 'postgresql'] as const - export type ValidTag = typeof VALID_TAGS[number] -export type ValidDatabase = typeof VALID_DATABASES[number] diff --git a/generate.ts b/generate.ts index 5e64470..1f9f8b9 100644 --- a/generate.ts +++ b/generate.ts @@ -2,7 +2,7 @@ import * as fs from 'node:fs' import * as path from 'node:path' import { fileURLToPath } from 'node:url' import { parse as parseToml } from 'toml' -import { VALID_TAGS, VALID_DATABASES, ValidTag, ValidDatabase } from './constants.js' +import { VALID_TAGS, ValidTag } from './constants.js' const __filename = fileURLToPath(import.meta.url) const __dirname = path.dirname(__filename) @@ -14,7 +14,6 @@ interface PluginTomlPlugin { description: string author: string tags?: ValidTag[] - database?: ValidDatabase[] } interface PluginToml { @@ -205,18 +204,6 @@ function generatePluginData(pluginsDir: string, gitmodulesPath: string, existing } } - // Validate and filter database - let database: ValidDatabase[] | undefined - if (rawPlugin.database && Array.isArray(rawPlugin.database)) { - const filtered = rawPlugin.database - .map(db => db.toLowerCase() as ValidDatabase) - .filter((db): db is ValidDatabase => VALID_DATABASES.includes(db)) - if (filtered.length > 0) { - // @ts-ignore - database = [...new Set(filtered)] - } - } - const icon = resolveIconUrl(rawPlugin.icon, gitModule.url, gitModule.branch) const plugin: PluginTomlPlugin = { ...(icon && { icon }), @@ -225,7 +212,6 @@ function generatePluginData(pluginsDir: string, gitmodulesPath: string, existing description: rawPlugin.description, author: rawPlugin.author, ...(tags && { tags }), - ...(database && { database }), } pluginDataListByPath.set(gitModule.path, { @@ -245,10 +231,8 @@ function generatePluginData(pluginsDir: string, gitmodulesPath: string, existing function generateTypeScriptCode(pluginDataList: PluginData[]): string { return `export const validTags = ${ JSON.stringify(VALID_TAGS, null, 2) } as const -export const validDatabases = ${ JSON.stringify(VALID_DATABASES, null, 2) } as const export type ValidTag = typeof validTags[number] -export type ValidDatabase = typeof validDatabases[number] export interface PluginTomlPlugin { icon?: string @@ -257,7 +241,6 @@ export interface PluginTomlPlugin { description: string author: string tags?: ValidTag[] - database?: ValidDatabase[] } export interface GitModule { @@ -293,7 +276,7 @@ function main() { fs.writeFileSync( path.join(baseDir, 'plugins-data.json'), - JSON.stringify({ validTags: VALID_TAGS, validDatabases: VALID_DATABASES, pluginDataList }, null, 2), + JSON.stringify({ validTags: VALID_TAGS, pluginDataList }, null, 2), 'utf-8' ) diff --git a/plugins-data.json b/plugins-data.json index d0f2b88..65413f9 100644 --- a/plugins-data.json +++ b/plugins-data.json @@ -10,25 +10,17 @@ "payment", "other" ], - "validDatabases": [ - "mysql", - "postgresql" - ], "pluginDataList": [ { "plugin": { "icon": "https://wu-clan.github.io/picx-images-hosting/logo/fba.svg", "summary": "AI", - "version": "1.0.0", + "version": "1.0.1", "description": "为系统提供基础 AI 文本对话能力,包含供应商、模型、默认模型、快捷短语和会话管理", "author": "wu-clan", "tags": [ "agent", "ai" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -41,17 +33,13 @@ "plugin": { "icon": "https://wu-clan.github.io/picx-images-hosting/logo/fba.svg", "summary": "AI Buddy", - "version": "0.1.0", + "version": "0.1.1", "description": "为系统提供 Buddy 全量 AI 能力,由后端提供接口,前端后台管理,客户端在同一对话内切工作或编码", "author": "wu-clan", "tags": [ "agent", "ai", "mcp" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -64,15 +52,11 @@ "plugin": { "icon": "https://wu-clan.github.io/picx-images-hosting/logo/fba.svg", "summary": "AI Buddy Group", - "version": "0.1.0", + "version": "0.1.1", "description": "用于管理 AI Buddy 资源分组及资源可见性", "author": "wu-clan", "tags": [ "ai" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -136,15 +120,11 @@ { "plugin": { "summary": "API Key", - "version": "0.0.5", + "version": "0.0.6", "description": "用户自定义 API Key 管理,支持生成、管理和使用 API Key 进行接口认证", "author": "wu-clan", "tags": [ "auth" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -177,10 +157,6 @@ "author": "as-fba", "tags": [ "storage" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -208,15 +184,11 @@ { "plugin": { "summary": "Casbin RBAC", - "version": "0.0.3", + "version": "0.0.4", "description": "基于 Casbin 实现的 RBAC 访问控制", "author": "wu-clan", "tags": [ "auth" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -228,15 +200,11 @@ { "plugin": { "summary": "Casdoor SSO", - "version": "0.0.5", + "version": "0.0.6", "description": "通过 Casdoor 实现 SSO 单点登录集成", "author": "wu-clan", "tags": [ "auth" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -248,14 +216,11 @@ { "plugin": { "summary": "验证码识别服务", - "version": "0.0.1", + "version": "0.0.2", "description": "基于 ddddocr 的本地验证码识别 API(文本/滑块/点选)", "author": "david", "tags": [ "other" - ], - "database": [ - "mysql" ] }, "git": { @@ -286,9 +251,6 @@ "tags": [ "mcp", "auth" - ], - "database": [ - "mysql" ] }, "git": { @@ -322,10 +284,6 @@ "author": "yzbf", "tags": [ "storage" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -337,15 +295,11 @@ { "plugin": { "summary": "OSS", - "version": "0.0.6", + "version": "0.0.7", "description": "阿里云 OSS 文件上传", "author": "wu-clan", "tags": [ "storage" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -358,15 +312,11 @@ "plugin": { "icon": "https://wu-clan.github.io/picx-images-hosting/logo/fba.svg", "summary": "S3", - "version": "0.0.3", + "version": "0.0.4", "description": "提供兼容 S3 协议的对象存储配置与文件读写能力", "author": "wu-clan", "tags": [ "storage" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -413,9 +363,6 @@ "author": "pd-qa-backend", "tags": [ "task" - ], - "database": [ - "mysql" ] }, "git": { @@ -444,15 +391,11 @@ { "plugin": { "summary": "Task", - "version": "0.0.3", + "version": "0.0.4", "description": "基于 taskiq 的异步任务队列插件", "author": "wu-clan", "tags": [ "task" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -464,15 +407,11 @@ { "plugin": { "summary": "多租户", - "version": "0.0.2", + "version": "0.0.3", "description": "为系统提供多租户能力,包括租户管理、套餐管理、行级数据隔离", "author": "wu-clan", "tags": [ "other" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -490,10 +429,6 @@ "tags": [ "ai", "other" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -527,9 +462,6 @@ "author": "Shj366", "tags": [ "other" - ], - "database": [ - "mysql" ] }, "git": { @@ -563,10 +495,6 @@ "tags": [ "task", "notification" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { diff --git a/plugins-data.ts b/plugins-data.ts index 3721039..d9b080e 100644 --- a/plugins-data.ts +++ b/plugins-data.ts @@ -9,13 +9,8 @@ export const validTags = [ "payment", "other" ] as const -export const validDatabases = [ - "mysql", - "postgresql" -] as const export type ValidTag = typeof validTags[number] -export type ValidDatabase = typeof validDatabases[number] export interface PluginTomlPlugin { icon?: string @@ -24,7 +19,6 @@ export interface PluginTomlPlugin { description: string author: string tags?: ValidTag[] - database?: ValidDatabase[] } export interface GitModule { @@ -43,16 +37,12 @@ export const pluginDataList: PluginData[] = [ "plugin": { "icon": "https://wu-clan.github.io/picx-images-hosting/logo/fba.svg", "summary": "AI", - "version": "1.0.0", + "version": "1.0.1", "description": "为系统提供基础 AI 文本对话能力,包含供应商、模型、默认模型、快捷短语和会话管理", "author": "wu-clan", "tags": [ "agent", "ai" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -65,17 +55,13 @@ export const pluginDataList: PluginData[] = [ "plugin": { "icon": "https://wu-clan.github.io/picx-images-hosting/logo/fba.svg", "summary": "AI Buddy", - "version": "0.1.0", + "version": "0.1.1", "description": "为系统提供 Buddy 全量 AI 能力,由后端提供接口,前端后台管理,客户端在同一对话内切工作或编码", "author": "wu-clan", "tags": [ "agent", "ai", "mcp" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -88,15 +74,11 @@ export const pluginDataList: PluginData[] = [ "plugin": { "icon": "https://wu-clan.github.io/picx-images-hosting/logo/fba.svg", "summary": "AI Buddy Group", - "version": "0.1.0", + "version": "0.1.1", "description": "用于管理 AI Buddy 资源分组及资源可见性", "author": "wu-clan", "tags": [ "ai" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -160,15 +142,11 @@ export const pluginDataList: PluginData[] = [ { "plugin": { "summary": "API Key", - "version": "0.0.5", + "version": "0.0.6", "description": "用户自定义 API Key 管理,支持生成、管理和使用 API Key 进行接口认证", "author": "wu-clan", "tags": [ "auth" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -201,10 +179,6 @@ export const pluginDataList: PluginData[] = [ "author": "as-fba", "tags": [ "storage" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -232,15 +206,11 @@ export const pluginDataList: PluginData[] = [ { "plugin": { "summary": "Casbin RBAC", - "version": "0.0.3", + "version": "0.0.4", "description": "基于 Casbin 实现的 RBAC 访问控制", "author": "wu-clan", "tags": [ "auth" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -252,15 +222,11 @@ export const pluginDataList: PluginData[] = [ { "plugin": { "summary": "Casdoor SSO", - "version": "0.0.5", + "version": "0.0.6", "description": "通过 Casdoor 实现 SSO 单点登录集成", "author": "wu-clan", "tags": [ "auth" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -272,14 +238,11 @@ export const pluginDataList: PluginData[] = [ { "plugin": { "summary": "验证码识别服务", - "version": "0.0.1", + "version": "0.0.2", "description": "基于 ddddocr 的本地验证码识别 API(文本/滑块/点选)", "author": "david", "tags": [ "other" - ], - "database": [ - "mysql" ] }, "git": { @@ -310,9 +273,6 @@ export const pluginDataList: PluginData[] = [ "tags": [ "mcp", "auth" - ], - "database": [ - "mysql" ] }, "git": { @@ -346,10 +306,6 @@ export const pluginDataList: PluginData[] = [ "author": "yzbf", "tags": [ "storage" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -361,15 +317,11 @@ export const pluginDataList: PluginData[] = [ { "plugin": { "summary": "OSS", - "version": "0.0.6", + "version": "0.0.7", "description": "阿里云 OSS 文件上传", "author": "wu-clan", "tags": [ "storage" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -382,15 +334,11 @@ export const pluginDataList: PluginData[] = [ "plugin": { "icon": "https://wu-clan.github.io/picx-images-hosting/logo/fba.svg", "summary": "S3", - "version": "0.0.3", + "version": "0.0.4", "description": "提供兼容 S3 协议的对象存储配置与文件读写能力", "author": "wu-clan", "tags": [ "storage" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -437,9 +385,6 @@ export const pluginDataList: PluginData[] = [ "author": "pd-qa-backend", "tags": [ "task" - ], - "database": [ - "mysql" ] }, "git": { @@ -468,15 +413,11 @@ export const pluginDataList: PluginData[] = [ { "plugin": { "summary": "Task", - "version": "0.0.3", + "version": "0.0.4", "description": "基于 taskiq 的异步任务队列插件", "author": "wu-clan", "tags": [ "task" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -488,15 +429,11 @@ export const pluginDataList: PluginData[] = [ { "plugin": { "summary": "多租户", - "version": "0.0.2", + "version": "0.0.3", "description": "为系统提供多租户能力,包括租户管理、套餐管理、行级数据隔离", "author": "wu-clan", "tags": [ "other" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -514,10 +451,6 @@ export const pluginDataList: PluginData[] = [ "tags": [ "ai", "other" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { @@ -551,9 +484,6 @@ export const pluginDataList: PluginData[] = [ "author": "Shj366", "tags": [ "other" - ], - "database": [ - "mysql" ] }, "git": { @@ -587,10 +517,6 @@ export const pluginDataList: PluginData[] = [ "tags": [ "task", "notification" - ], - "database": [ - "mysql", - "postgresql" ] }, "git": { diff --git a/plugins/ai b/plugins/ai index ee6d76a..9db0a2a 160000 --- a/plugins/ai +++ b/plugins/ai @@ -1 +1 @@ -Subproject commit ee6d76af7106c32f17d40b23367ffcac179fa074 +Subproject commit 9db0a2a82611d51b16b05c65fb0a55db67584dab diff --git a/plugins/ai_buddy b/plugins/ai_buddy index dd19e23..85f0d52 160000 --- a/plugins/ai_buddy +++ b/plugins/ai_buddy @@ -1 +1 @@ -Subproject commit dd19e23a0f992677f42c2a3f34386ff34bbe14b3 +Subproject commit 85f0d52a1d29885b5cd23bdd3653d72921b2a924 diff --git a/plugins/ai_buddy_group b/plugins/ai_buddy_group index ce20b1f..5d90922 160000 --- a/plugins/ai_buddy_group +++ b/plugins/ai_buddy_group @@ -1 +1 @@ -Subproject commit ce20b1f564981985bd3c8c3e74cf94980099c16c +Subproject commit 5d90922098fa111c2be76c0da88c4d8ae7bc1266 diff --git a/plugins/api_key b/plugins/api_key index d6042d2..5ca22d9 160000 --- a/plugins/api_key +++ b/plugins/api_key @@ -1 +1 @@ -Subproject commit d6042d28778541af0de48781cd0fe511ef95ad49 +Subproject commit 5ca22d9aca1bd5b6f30d203cc1e5e85875125e88 diff --git a/plugins/casbin_rbac b/plugins/casbin_rbac index 8ba6f58..f6658a3 160000 --- a/plugins/casbin_rbac +++ b/plugins/casbin_rbac @@ -1 +1 @@ -Subproject commit 8ba6f58cf4555e7d82841872c12fe23a2d8c4e20 +Subproject commit f6658a3ff3a0b0a0885dc8db9ef37421f5ef446b diff --git a/plugins/casdoor_sso b/plugins/casdoor_sso index dac5d3b..950fe1d 160000 --- a/plugins/casdoor_sso +++ b/plugins/casdoor_sso @@ -1 +1 @@ -Subproject commit dac5d3bbaab619bb681314af68245ac74a6bef14 +Subproject commit 950fe1d5bd0f345d02fb2d3f5caa44ef6e2a671e diff --git a/plugins/ddddocr_server b/plugins/ddddocr_server index 30f9582..628aa70 160000 --- a/plugins/ddddocr_server +++ b/plugins/ddddocr_server @@ -1 +1 @@ -Subproject commit 30f9582dc999cad2d30fa278d662e6788d0c4fe4 +Subproject commit 628aa70c9da8e58faa4531a98116be66a690b2a7 diff --git a/plugins/oss b/plugins/oss index 5ce4000..cb28bcd 160000 --- a/plugins/oss +++ b/plugins/oss @@ -1 +1 @@ -Subproject commit 5ce40008f2847c62a5541fe64bb31ff8a91badce +Subproject commit cb28bcd3a2322c98cfa9226760f42e9adc52e8dd diff --git a/plugins/s3 b/plugins/s3 index dc76a18..7cfab9a 160000 --- a/plugins/s3 +++ b/plugins/s3 @@ -1 +1 @@ -Subproject commit dc76a1824e732f2b2605c48a44c1cf158bcb0542 +Subproject commit 7cfab9a0548a8a82114c31a8cab5a02a6ed5ddf2 diff --git a/plugins/task b/plugins/task index ef33a06..7fd0dd6 160000 --- a/plugins/task +++ b/plugins/task @@ -1 +1 @@ -Subproject commit ef33a068dfe76c9813a3fed21e49ee9628367ea1 +Subproject commit 7fd0dd6bbd5c654017a87e953a0d620fe0accd42 diff --git a/plugins/tenant b/plugins/tenant index cb5a83e..878d9f8 160000 --- a/plugins/tenant +++ b/plugins/tenant @@ -1 +1 @@ -Subproject commit cb5a83e5468249343a86b61b16cfef18f312f175 +Subproject commit 878d9f8e564d40e8c7ffe7f73ebf9bdda46c8e0a diff --git a/scripts/validate-submission.ts b/scripts/validate-submission.ts index 1fa21be..c9b64f1 100644 --- a/scripts/validate-submission.ts +++ b/scripts/validate-submission.ts @@ -1,18 +1,10 @@ import * as fs from 'node:fs' import * as path from 'node:path' -import { parse as parseToml } from 'toml' - -import { VALID_DATABASES, type ValidDatabase } from '../constants.js' - -interface PluginManifest { - plugin?: { - database?: string[] - } -} const BACKEND_PLUGIN_NAME_PATTERN = /^[a-z0-9_]+$/ const FRONTEND_PLUGIN_NAME_PATTERN = /^[a-z0-9_-]+$/ const REQUIRED_SQL_FILES = ['init.sql', 'destroy.sql', 'init_snowflake.sql', 'destroy_snowflake.sql'] +const DATABASE_DIR = 'postgresql' function fail(message: string): never { throw new Error(message) @@ -53,22 +45,13 @@ function validateBackendStructure(pluginName: string, pluginPath: string): void assertFile(path.join(pluginPath, '__init__.py'), '__init__.py') const modelPath = path.join(pluginPath, 'model') - if (!fs.existsSync(modelPath) || !fs.statSync(modelPath).isDirectory()) return + const sqlPath = path.join(pluginPath, 'sql') + const hasModel = fs.existsSync(modelPath) && fs.statSync(modelPath).isDirectory() + const hasSql = fs.existsSync(sqlPath) && fs.statSync(sqlPath).isDirectory() + if (!hasModel && !hasSql) return - const manifest = parseToml(fs.readFileSync(path.join(pluginPath, 'plugin.toml'), 'utf-8')) as PluginManifest - const databases = manifest.plugin?.database - if (!databases || databases.length === 0) { - fail('plugins with a model directory must declare plugin.database') - } - - for (const database of databases) { - if (!VALID_DATABASES.includes(database as ValidDatabase)) { - fail(`unsupported database in plugin.database: ${ database }`) - } - - for (const sqlFile of REQUIRED_SQL_FILES) { - assertFile(path.join(pluginPath, 'sql', database, sqlFile), `${ database } SQL file`) - } + for (const sqlFile of REQUIRED_SQL_FILES) { + assertFile(path.join(pluginPath, 'sql', DATABASE_DIR, sqlFile), `${ DATABASE_DIR } SQL file`) } if (!pluginName) { diff --git a/validate.ts b/validate.ts index ce3ac74..e8fc8dd 100644 --- a/validate.ts +++ b/validate.ts @@ -2,7 +2,7 @@ import * as fs from 'node:fs' import * as path from 'node:path' import { fileURLToPath } from 'node:url' import { parse as parseToml } from 'toml' -import { VALID_TAGS, VALID_DATABASES, ValidTag, ValidDatabase } from './constants.js' +import { VALID_TAGS, ValidTag } from './constants.js' const __filename = fileURLToPath(import.meta.url) const __dirname = path.dirname(__filename) @@ -14,7 +14,6 @@ interface PluginTomlPlugin { description: string author: string tags?: string[] - database?: string[] } interface PluginToml { @@ -49,7 +48,7 @@ const REQUIRED_FIELDS: (keyof Pick !VALID_DATABASES.includes(db.toLowerCase() as ValidDatabase) - ) - if (invalidDatabases.length > 0) { - errors.push({ - field: 'database', - message: 'Invalid values', - invalidValues: invalidDatabases, - }) - } - } - return { plugin: pluginName, passed: errors.length === 0, @@ -223,7 +208,6 @@ function generateReport(results: ValidationResult[], skippedPlugins: string[] = report += `| Backend plugin name | lowercase letters, numbers, underscores |\n` report += `| Frontend plugin name | lowercase letters, numbers, underscores, hyphens |\n` report += `| Tags | ${ VALID_TAGS.map(t => `\`${ t }\``).join(', ') } |\n` - report += `| Database | ${ VALID_DATABASES.map(d => `\`${ d }\``).join(', ') } |\n` } if (skippedPlugins.length > 0) { @@ -282,7 +266,6 @@ function main() { console.log(`\nResult: ${ passed } passed, ${ failed } failed`) if (failed > 0) { console.error(`\nAllowed tags: ${ VALID_TAGS.join(', ') }`) - console.error(`Allowed database: ${ VALID_DATABASES.join(', ') }`) } }