@koishijs/plugin-database-postgres 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare const _default: Plugin.Object<import("koishi").Context, T>;
2
+ export default _default;
package/lib/index.js ADDED
@@ -0,0 +1,46 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __commonJS = (cb, mod) => function __require() {
6
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
7
+ };
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // koishi/plugins/database/postgres/src/locales/zh-CN.yml
23
+ var require_zh_CN = __commonJS({
24
+ "koishi/plugins/database/postgres/src/locales/zh-CN.yml"(exports, module2) {
25
+ module2.exports = { protocol: "要使用的协议名。", host: "要连接到的主机名。", port: "要连接到的端口号。", username: "要使用的用户名。", password: "要使用的密码。", database: "要访问的数据库名。", writeConcern: { $description: "Write Concern", w: { $description: "The write concern.", $value: ["Default", "Custom", "Majority"] }, wtimeoutMS: "The write concern timeout.", journal: "The journal write concern." } };
26
+ }
27
+ });
28
+
29
+ // koishi/plugins/database/postgres/src/index.ts
30
+ var src_exports = {};
31
+ __export(src_exports, {
32
+ default: () => src_default
33
+ });
34
+ module.exports = __toCommonJS(src_exports);
35
+ var import_koishi = require("koishi");
36
+ var import_driver_postgres = require("@minatojs/driver-postgres");
37
+ var src_default = (0, import_koishi.defineDriver)(import_driver_postgres.PostgresDriver, import_koishi.Schema.object({
38
+ host: import_koishi.Schema.string().default("localhost"),
39
+ port: import_koishi.Schema.natural().max(65535).default(3306),
40
+ user: import_koishi.Schema.string().default("root"),
41
+ password: import_koishi.Schema.string().role("secret"),
42
+ database: import_koishi.Schema.string().default("koishi")
43
+ }).i18n({
44
+ "zh-CN": require_zh_CN()
45
+ }));
46
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/locales/zh-CN.yml", "../src/index.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,oEAAAA,SAAA;AAAA,IAAAA,QAAA,YAAC,UAAW,YAAW,MAAO,aAAY,MAAO,aAAY,UAAW,YAAW,UAAW,WAAU,UAAW,aAAY,cAAe,EAAC,cAAe,iBAAgB,GAAI,EAAC,cAAe,sBAAqB,QAAS,CAAC,WAAU,UAAS,UAAU,EAAC,GAAE,YAAa,8BAA6B,SAAU,6BAA4B,EAAC;AAAA;AAAA;;;ACAlV;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAqC;AACrC,6BAA+B;AAE/B,IAAO,kBAAQ,4BAAa,uCAAgB,qBAAO,OAAO;AAAA,EACxD,MAAM,qBAAO,OAAO,EAAE,QAAQ,WAAW;AAAA,EACzC,MAAM,qBAAO,QAAQ,EAAE,IAAI,KAAK,EAAE,QAAQ,IAAI;AAAA,EAC9C,MAAM,qBAAO,OAAO,EAAE,QAAQ,MAAM;AAAA,EACpC,UAAU,qBAAO,OAAO,EAAE,KAAK,QAAQ;AAAA,EACvC,UAAU,qBAAO,OAAO,EAAE,QAAQ,QAAQ;AAC5C,CAAC,EAAE,KAAK;AAAA,EACN,SAAS;AACX,CAAC,CAAC;",
5
+ "names": ["module"]
6
+ }
package/lib/utils.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { Query } from '@koishijs/orm';
2
+ import { Filter } from 'mongodb';
3
+ export declare function transformQuery(query: Query.Expr): Filter<any>;
4
+ export declare function transformEval(expr: any, onAggr?: (pipeline: any[]) => void): any;
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@koishijs/plugin-database-postgres",
3
+ "description": "PostgreSQL support for Koishi",
4
+ "version": "1.0.0",
5
+ "main": "lib/index.js",
6
+ "typings": "lib/index.d.ts",
7
+ "files": [
8
+ "lib",
9
+ "src"
10
+ ],
11
+ "author": "Seidko <seidko.coding@gmail.com>",
12
+ "contributors": [
13
+ "Hieuzest <girkirin@hotmail.com>",
14
+ "Seidko <seidko.coding@gmail.com>"
15
+ ],
16
+ "license": "MIT",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/koishijs/koishi.git",
20
+ "directory": "plugins/database/postgres"
21
+ },
22
+ "bugs": {
23
+ "url": "https://github.com/koishijs/koishi/issues"
24
+ },
25
+ "homepage": "https://koishi.chat/plugins/database/postgres.html",
26
+ "keywords": [
27
+ "bot",
28
+ "chatbot",
29
+ "koishi",
30
+ "database",
31
+ "postgres"
32
+ ],
33
+ "koishi": {
34
+ "category": "storage",
35
+ "description": {
36
+ "en": "PostgreSQL support",
37
+ "zh": "PostgreSQL 支持"
38
+ },
39
+ "service": {
40
+ "implements": [
41
+ "database"
42
+ ]
43
+ }
44
+ },
45
+ "peerDependencies": {
46
+ "koishi": "^4.15.5"
47
+ },
48
+ "devDependencies": {
49
+ "koishi": "^4.15.5"
50
+ },
51
+ "dependencies": {
52
+ "@minatojs/driver-postgres": "^1.0.0"
53
+ }
54
+ }
package/src/index.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { defineDriver, Schema } from 'koishi'
2
+ import { PostgresDriver } from '@minatojs/driver-postgres'
3
+
4
+ export default defineDriver(PostgresDriver, Schema.object({
5
+ host: Schema.string().default('localhost'),
6
+ port: Schema.natural().max(65535).default(5432),
7
+ user: Schema.string().default('root'),
8
+ password: Schema.string().role('secret'),
9
+ database: Schema.string().default('koishi'),
10
+ }).i18n({
11
+ 'zh-CN': require('./locales/zh-CN'),
12
+ }))
@@ -0,0 +1,6 @@
1
+ protocol: 要使用的协议名。
2
+ host: 要连接到的主机名。
3
+ port: 要连接到的端口号。
4
+ username: 要使用的用户名。
5
+ password: 要使用的密码。
6
+ database: 要访问的数据库名。
@@ -0,0 +1,16 @@
1
+ protocol: The protocol to use.
2
+ host: The host to connect to.
3
+ port: The port number to be connected.
4
+ username: The username used for authentication.
5
+ password: The password used for authentication.
6
+ database: The name of the database we want to use.
7
+ writeConcern:
8
+ $description: Write Concern
9
+ w:
10
+ $description: The write concern.
11
+ $value:
12
+ - Default
13
+ - Custom
14
+ - Majority
15
+ wtimeoutMS: The write concern timeout.
16
+ journal: The journal write concern.
@@ -0,0 +1,6 @@
1
+ protocol: 要使用的协议名。
2
+ host: 要连接到的主机名。
3
+ port: 要连接到的端口号。
4
+ username: 要使用的用户名。
5
+ password: 要使用的密码。
6
+ database: 要访问的数据库名。
@@ -0,0 +1,6 @@
1
+ protocol: 要使用的协议名。
2
+ host: 要连接到的主机名。
3
+ port: 要连接到的端口号。
4
+ username: 要使用的用户名。
5
+ password: 要使用的密码。
6
+ database: 要访问的数据库名。
@@ -0,0 +1,6 @@
1
+ protocol: 要使用的协议名。
2
+ host: 要连接到的主机名。
3
+ port: 要连接到的端口号。
4
+ username: 要使用的用户名。
5
+ password: 要使用的密码。
6
+ database: 要访问的数据库名。
@@ -0,0 +1,16 @@
1
+ protocol: 要使用的协议名。
2
+ host: 要连接到的主机名。
3
+ port: 要连接到的端口号。
4
+ username: 要使用的用户名。
5
+ password: 要使用的密码。
6
+ database: 要访问的数据库名。
7
+ writeConcern:
8
+ $description: Write Concern
9
+ w:
10
+ $description: The write concern.
11
+ $value:
12
+ - Default
13
+ - Custom
14
+ - Majority
15
+ wtimeoutMS: The write concern timeout.
16
+ journal: The journal write concern.
@@ -0,0 +1,6 @@
1
+ protocol: 要使用的協議名。
2
+ host: 要連接到的主機名。
3
+ port: 要連接到的端口號。
4
+ username: 要使用的使用者名。
5
+ password: 要使用的密碼。
6
+ database: 要訪問的數據庫名。