From 9a69ef8520cc0517c111252d26251576ef443dbb Mon Sep 17 00:00:00 2001 From: Shigma Date: Fri, 9 Feb 2024 04:23:33 +0800 Subject: [PATCH] chore: add database-* plugins --- database/memory/.npmignore | 2 ++ database/memory/package.json | 54 ++++++++++++++++++++++++++++ database/memory/src/index.ts | 3 ++ database/memory/tsconfig.json | 10 ++++++ database/mongo/.npmignore | 2 ++ database/mongo/package.json | 54 ++++++++++++++++++++++++++++ database/mongo/src/index.ts | 3 ++ database/mongo/tsconfig.json | 10 ++++++ database/mysql/.npmignore | 2 ++ database/mysql/README.md | 11 ++++++ database/mysql/package.json | 53 ++++++++++++++++++++++++++++ database/mysql/src/index.ts | 3 ++ database/mysql/tsconfig.json | 10 ++++++ database/postgres/.npmignore | 2 ++ database/postgres/package.json | 54 ++++++++++++++++++++++++++++ database/postgres/src/index.ts | 3 ++ database/postgres/tsconfig.json | 10 ++++++ database/sqlite/.npmignore | 2 ++ database/sqlite/README.md | 3 ++ database/sqlite/package.json | 62 +++++++++++++++++++++++++++++++++ database/sqlite/src/index.ts | 3 ++ database/sqlite/tsconfig.json | 10 ++++++ 22 files changed, 366 insertions(+) create mode 100644 database/memory/.npmignore create mode 100644 database/memory/package.json create mode 100644 database/memory/src/index.ts create mode 100644 database/memory/tsconfig.json create mode 100644 database/mongo/.npmignore create mode 100644 database/mongo/package.json create mode 100644 database/mongo/src/index.ts create mode 100644 database/mongo/tsconfig.json create mode 100644 database/mysql/.npmignore create mode 100644 database/mysql/README.md create mode 100644 database/mysql/package.json create mode 100644 database/mysql/src/index.ts create mode 100644 database/mysql/tsconfig.json create mode 100644 database/postgres/.npmignore create mode 100644 database/postgres/package.json create mode 100644 database/postgres/src/index.ts create mode 100644 database/postgres/tsconfig.json create mode 100644 database/sqlite/.npmignore create mode 100644 database/sqlite/README.md create mode 100644 database/sqlite/package.json create mode 100644 database/sqlite/src/index.ts create mode 100644 database/sqlite/tsconfig.json diff --git a/database/memory/.npmignore b/database/memory/.npmignore new file mode 100644 index 0000000..7e5fcbc --- /dev/null +++ b/database/memory/.npmignore @@ -0,0 +1,2 @@ +.DS_Store +tsconfig.tsbuildinfo diff --git a/database/memory/package.json b/database/memory/package.json new file mode 100644 index 0000000..ffbd64e --- /dev/null +++ b/database/memory/package.json @@ -0,0 +1,54 @@ +{ + "name": "@koishijs/plugin-database-memory", + "description": "A in-memory database implementation for Koishi", + "version": "3.0.0-alpha.0", + "main": "lib/index.cjs", + "module": "lib/index.mjs", + "typings": "lib/index.d.ts", + "files": [ + "lib", + "src" + ], + "author": "Shigma ", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/koishijs/koishi.git", + "directory": "plugins/database/memory" + }, + "bugs": { + "url": "https://github.com/koishijs/koishi/issues" + }, + "homepage": "https://koishi.chat/plugins/database/memory.html", + "keywords": [ + "bot", + "chatbot", + "koishi", + "plugin", + "database", + "server", + "memory" + ], + "koishi": { + "hidden": true, + "category": "storage", + "description": { + "en": "In-memory database support", + "zh": "基于内存的数据库支持 (主要用于本地测试)" + }, + "service": { + "implements": [ + "database" + ] + } + }, + "peerDependencies": { + "koishi": "^4.17.0-alpha.0" + }, + "devDependencies": { + "koishi": "^4.17.0-alpha.0" + }, + "dependencies": { + "@minatojs/driver-memory": "^3.0.0-alpha.0" + } +} diff --git a/database/memory/src/index.ts b/database/memory/src/index.ts new file mode 100644 index 0000000..26d648c --- /dev/null +++ b/database/memory/src/index.ts @@ -0,0 +1,3 @@ +import { MemoryDriver } from '@minatojs/driver-memory' + +export default MemoryDriver diff --git a/database/memory/tsconfig.json b/database/memory/tsconfig.json new file mode 100644 index 0000000..e193a11 --- /dev/null +++ b/database/memory/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.base", + "compilerOptions": { + "rootDir": "src", + "outDir": "lib", + }, + "include": [ + "src", + ], +} \ No newline at end of file diff --git a/database/mongo/.npmignore b/database/mongo/.npmignore new file mode 100644 index 0000000..7e5fcbc --- /dev/null +++ b/database/mongo/.npmignore @@ -0,0 +1,2 @@ +.DS_Store +tsconfig.tsbuildinfo diff --git a/database/mongo/package.json b/database/mongo/package.json new file mode 100644 index 0000000..9ce64c7 --- /dev/null +++ b/database/mongo/package.json @@ -0,0 +1,54 @@ +{ + "name": "@koishijs/plugin-database-mongo", + "description": "MongoDB support for Koishi", + "version": "5.0.0-alpha.0", + "main": "lib/index.js", + "typings": "lib/index.d.ts", + "files": [ + "lib", + "src" + ], + "author": "undefined ", + "contributors": [ + "Shigma ", + "undefined " + ], + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/koishijs/koishi.git", + "directory": "plugins/database/mongo" + }, + "bugs": { + "url": "https://github.com/koishijs/koishi/issues" + }, + "homepage": "https://koishi.chat/plugins/database/mongo.html", + "keywords": [ + "bot", + "chatbot", + "koishi", + "database", + "mongo" + ], + "koishi": { + "category": "storage", + "description": { + "en": "MongoDB support", + "zh": "MongoDB 支持" + }, + "service": { + "implements": [ + "database" + ] + } + }, + "peerDependencies": { + "koishi": "^4.17.0-alpha.0" + }, + "devDependencies": { + "koishi": "^4.17.0-alpha.0" + }, + "dependencies": { + "@minatojs/driver-mongo": "^3.0.0-alpha.0" + } +} diff --git a/database/mongo/src/index.ts b/database/mongo/src/index.ts new file mode 100644 index 0000000..79cb917 --- /dev/null +++ b/database/mongo/src/index.ts @@ -0,0 +1,3 @@ +import { MongoDriver } from '@minatojs/driver-mongo' + +export default MongoDriver diff --git a/database/mongo/tsconfig.json b/database/mongo/tsconfig.json new file mode 100644 index 0000000..e193a11 --- /dev/null +++ b/database/mongo/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.base", + "compilerOptions": { + "rootDir": "src", + "outDir": "lib", + }, + "include": [ + "src", + ], +} \ No newline at end of file diff --git a/database/mysql/.npmignore b/database/mysql/.npmignore new file mode 100644 index 0000000..7e5fcbc --- /dev/null +++ b/database/mysql/.npmignore @@ -0,0 +1,2 @@ +.DS_Store +tsconfig.tsbuildinfo diff --git a/database/mysql/README.md b/database/mysql/README.md new file mode 100644 index 0000000..96ea3ad --- /dev/null +++ b/database/mysql/README.md @@ -0,0 +1,11 @@ +# @koishijs/plugin-database-mysql + +[![Status](https://img.shields.io/github/workflow/status/koishijs/koishi/CI/master?style=flat-square)](https://github.com/koishijs/koishi/actions?query=workflow:CI) +[![npm](https://img.shields.io/npm/v/@koishijs/plugin-database-mysql?style=flat-square)](https://www.npmjs.com/package/@koishijs/plugin-database-mysql) + +MySQL implementation for Koishi. + +## Usage + +- [Using Database with Koishi](https://koishi.chat/guide/using-database.html) +- [Full API Reference](https://koishi.chat/api/database.html) diff --git a/database/mysql/package.json b/database/mysql/package.json new file mode 100644 index 0000000..fe88fc9 --- /dev/null +++ b/database/mysql/package.json @@ -0,0 +1,53 @@ +{ + "name": "@koishijs/plugin-database-mysql", + "description": "MySQL support for Koishi", + "version": "6.0.0-alpha.0", + "main": "lib/index.js", + "typings": "lib/index.d.ts", + "files": [ + "lib", + "src" + ], + "author": "Shigma ", + "license": "MIT", + "scripts": { + "lint": "eslint src --ext .ts" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/koishijs/koishi.git", + "directory": "plugins/database/mysql" + }, + "bugs": { + "url": "https://github.com/koishijs/koishi/issues" + }, + "homepage": "https://koishi.chat/plugins/database/mysql.html", + "keywords": [ + "bot", + "chatbot", + "koishi", + "database", + "mysql" + ], + "koishi": { + "category": "storage", + "description": { + "en": "MySQL (MariaDB) support", + "zh": "MySQL (MariaDB) 支持" + }, + "service": { + "implements": [ + "database" + ] + } + }, + "peerDependencies": { + "koishi": "^4.17.0-alpha.0" + }, + "devDependencies": { + "koishi": "^4.17.0-alpha.0" + }, + "dependencies": { + "@minatojs/driver-mysql": "^3.0.0-alpha.0" + } +} diff --git a/database/mysql/src/index.ts b/database/mysql/src/index.ts new file mode 100644 index 0000000..998ddc8 --- /dev/null +++ b/database/mysql/src/index.ts @@ -0,0 +1,3 @@ +import { MySQLDriver } from '@minatojs/driver-mysql' + +export default MySQLDriver diff --git a/database/mysql/tsconfig.json b/database/mysql/tsconfig.json new file mode 100644 index 0000000..e193a11 --- /dev/null +++ b/database/mysql/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.base", + "compilerOptions": { + "rootDir": "src", + "outDir": "lib", + }, + "include": [ + "src", + ], +} \ No newline at end of file diff --git a/database/postgres/.npmignore b/database/postgres/.npmignore new file mode 100644 index 0000000..7e5fcbc --- /dev/null +++ b/database/postgres/.npmignore @@ -0,0 +1,2 @@ +.DS_Store +tsconfig.tsbuildinfo diff --git a/database/postgres/package.json b/database/postgres/package.json new file mode 100644 index 0000000..9224e01 --- /dev/null +++ b/database/postgres/package.json @@ -0,0 +1,54 @@ +{ + "name": "@koishijs/plugin-database-postgres", + "description": "PostgreSQL support for Koishi", + "version": "2.0.0-alpha.0", + "main": "lib/index.js", + "typings": "lib/index.d.ts", + "files": [ + "lib", + "src" + ], + "author": "Seidko ", + "contributors": [ + "Hieuzest ", + "Seidko " + ], + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/koishijs/koishi.git", + "directory": "plugins/database/postgres" + }, + "bugs": { + "url": "https://github.com/koishijs/koishi/issues" + }, + "homepage": "https://koishi.chat/plugins/database/postgres.html", + "keywords": [ + "bot", + "chatbot", + "koishi", + "database", + "postgres" + ], + "koishi": { + "category": "storage", + "description": { + "en": "PostgreSQL support", + "zh": "PostgreSQL 支持" + }, + "service": { + "implements": [ + "database" + ] + } + }, + "peerDependencies": { + "koishi": "^4.17.0-alpha.0" + }, + "devDependencies": { + "koishi": "^4.17.0-alpha.0" + }, + "dependencies": { + "@minatojs/driver-postgres": "^2.0.0-alpha.0" + } +} diff --git a/database/postgres/src/index.ts b/database/postgres/src/index.ts new file mode 100644 index 0000000..ba88b6a --- /dev/null +++ b/database/postgres/src/index.ts @@ -0,0 +1,3 @@ +import { PostgresDriver } from '@minatojs/driver-postgres' + +export default PostgresDriver diff --git a/database/postgres/tsconfig.json b/database/postgres/tsconfig.json new file mode 100644 index 0000000..e193a11 --- /dev/null +++ b/database/postgres/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.base", + "compilerOptions": { + "rootDir": "src", + "outDir": "lib", + }, + "include": [ + "src", + ], +} \ No newline at end of file diff --git a/database/sqlite/.npmignore b/database/sqlite/.npmignore new file mode 100644 index 0000000..7e5fcbc --- /dev/null +++ b/database/sqlite/.npmignore @@ -0,0 +1,2 @@ +.DS_Store +tsconfig.tsbuildinfo diff --git a/database/sqlite/README.md b/database/sqlite/README.md new file mode 100644 index 0000000..4db6a27 --- /dev/null +++ b/database/sqlite/README.md @@ -0,0 +1,3 @@ +# @koishijs/plugin-database-sqlite + +SQLite Database implementation for Koishi. diff --git a/database/sqlite/package.json b/database/sqlite/package.json new file mode 100644 index 0000000..009aa6c --- /dev/null +++ b/database/sqlite/package.json @@ -0,0 +1,62 @@ +{ + "name": "@koishijs/plugin-database-sqlite", + "description": "SQLite support for Koishi", + "version": "4.0.0-alpha.0", + "main": "lib/index.js", + "module": "lib/index.mjs", + "typings": "lib/index.d.ts", + "files": [ + "lib", + "src" + ], + "author": "thezzisu <2100012732@stu.pku.edu.cn>", + "contributors": [ + "Shigma ", + "thezzisu <2100012732@stu.pku.edu.cn>" + ], + "license": "MIT", + "scripts": { + "lint": "eslint src --ext .ts" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/koishijs/koishi.git", + "directory": "plugins/database/sqlite" + }, + "bugs": { + "url": "https://github.com/koishijs/koishi/issues" + }, + "homepage": "https://koishi.chat/plugins/database/sqlite.html", + "keywords": [ + "bot", + "chatbot", + "koishi", + "plugin", + "database", + "sqlite" + ], + "koishi": { + "browser": true, + "exports": { + "sql-wasm.wasm": "@minatojs/sql.js/dist/sql-wasm.wasm" + }, + "description": { + "en": "SQLite support", + "zh": "SQLite 支持" + }, + "service": { + "implements": [ + "database" + ] + } + }, + "peerDependencies": { + "koishi": "^4.17.0-alpha.0" + }, + "devDependencies": { + "koishi": "^4.17.0-alpha.0" + }, + "dependencies": { + "@minatojs/driver-sqlite": "^4.0.0-alpha.0" + } +} diff --git a/database/sqlite/src/index.ts b/database/sqlite/src/index.ts new file mode 100644 index 0000000..b3dce8a --- /dev/null +++ b/database/sqlite/src/index.ts @@ -0,0 +1,3 @@ +import { SQLiteDriver } from '@minatojs/driver-sqlite' + +export default SQLiteDriver diff --git a/database/sqlite/tsconfig.json b/database/sqlite/tsconfig.json new file mode 100644 index 0000000..e193a11 --- /dev/null +++ b/database/sqlite/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.base", + "compilerOptions": { + "rootDir": "src", + "outDir": "lib", + }, + "include": [ + "src", + ], +} \ No newline at end of file