@koishijs/plugin-database-mongo 3.3.2 → 3.4.2
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 +2 -5
- package/lib/index.js +22 -34
- package/lib/index.js.map +3 -3
- package/package.json +5 -4
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { Context, Schema } from 'koishi';
|
|
2
1
|
import MongoDriver from '@minatojs/driver-mongo';
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export declare const Config: Schema<Config>;
|
|
6
|
-
export declare function apply(ctx: Context, config: Config): void;
|
|
2
|
+
declare const _default: import("koishi").Plugin.Object<MongoDriver.Config, any>;
|
|
3
|
+
export default _default;
|
package/lib/index.js
CHANGED
|
@@ -4,52 +4,40 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
7
|
var __export = (target, all) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
10
|
};
|
|
14
|
-
var
|
|
15
|
-
if (
|
|
16
|
-
for (let key of __getOwnPropNames(
|
|
17
|
-
if (!__hasOwnProp.call(
|
|
18
|
-
__defProp(
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
16
|
}
|
|
20
|
-
return
|
|
21
|
-
};
|
|
22
|
-
var __toModule = (module2) => {
|
|
23
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
17
|
+
return to;
|
|
24
18
|
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
24
|
|
|
26
25
|
// plugins/database/mongo/src/index.ts
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
name: () => name
|
|
26
|
+
var src_exports = {};
|
|
27
|
+
__export(src_exports, {
|
|
28
|
+
default: () => src_default
|
|
31
29
|
});
|
|
32
|
-
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
var
|
|
30
|
+
module.exports = __toCommonJS(src_exports);
|
|
31
|
+
var import_koishi = require("koishi");
|
|
32
|
+
var import_driver_mongo = __toESM(require("@minatojs/driver-mongo"));
|
|
33
|
+
var src_default = (0, import_koishi.defineDriver)(import_driver_mongo.default, import_koishi.Schema.object({
|
|
36
34
|
protocol: import_koishi.Schema.string().description("要使用的协议名。").default("mongodb"),
|
|
37
35
|
host: import_koishi.Schema.string().description("要连接到的主机名。").default("localhost"),
|
|
38
36
|
port: import_koishi.Schema.natural().max(65535).description("要连接到的端口号。"),
|
|
39
37
|
username: import_koishi.Schema.string().description("要使用的用户名。"),
|
|
40
38
|
password: import_koishi.Schema.string().description("要使用的密码。").role("secret"),
|
|
41
39
|
database: import_koishi.Schema.string().description("要访问的数据库名。").default("koishi")
|
|
42
|
-
});
|
|
43
|
-
function apply(ctx, config) {
|
|
44
|
-
const driver = new import_driver_mongo.default(ctx.model, config);
|
|
45
|
-
ctx.on("ready", () => driver.start());
|
|
46
|
-
ctx.on("dispose", () => driver.stop());
|
|
47
|
-
}
|
|
48
|
-
__name(apply, "apply");
|
|
40
|
+
}));
|
|
49
41
|
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
-
0 && (module.exports = {
|
|
51
|
-
Config,
|
|
52
|
-
apply,
|
|
53
|
-
name
|
|
54
|
-
});
|
|
42
|
+
0 && (module.exports = {});
|
|
55
43
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import { defineDriver, Schema } from 'koishi'\nimport MongoDriver from '@minatojs/driver-mongo'\n\nexport default defineDriver(MongoDriver, Schema.object({\n protocol: Schema.string().description('要使用的协议名。').default('mongodb'),\n host: Schema.string().description('要连接到的主机名。').default('localhost'),\n port: Schema.natural().max(65535).description('要连接到的端口号。'),\n username: Schema.string().description('要使用的用户名。'),\n password: Schema.string().description('要使用的密码。').role('secret'),\n database: Schema.string().description('要访问的数据库名。').default('koishi'),\n}))\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAqC;AACrC,0BAAwB;AAExB,IAAO,kBAAQ,4BAAa,oBAAAA,SAAa,qBAAO,OAAO;AAAA,EACrD,UAAU,qBAAO,OAAO,EAAE,YAAY,UAAU,EAAE,QAAQ,SAAS;AAAA,EACnE,MAAM,qBAAO,OAAO,EAAE,YAAY,WAAW,EAAE,QAAQ,WAAW;AAAA,EAClE,MAAM,qBAAO,QAAQ,EAAE,IAAI,KAAK,EAAE,YAAY,WAAW;AAAA,EACzD,UAAU,qBAAO,OAAO,EAAE,YAAY,UAAU;AAAA,EAChD,UAAU,qBAAO,OAAO,EAAE,YAAY,SAAS,EAAE,KAAK,QAAQ;AAAA,EAC9D,UAAU,qBAAO,OAAO,EAAE,YAAY,WAAW,EAAE,QAAQ,QAAQ;AACrE,CAAC,CAAC;",
|
|
6
|
+
"names": ["MongoDriver"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koishijs/plugin-database-mongo",
|
|
3
3
|
"description": "MongoDB support for Koishi",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.4.2",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"mongo"
|
|
31
31
|
],
|
|
32
32
|
"koishi": {
|
|
33
|
+
"category": "storage",
|
|
33
34
|
"description": {
|
|
34
35
|
"en": "MongoDB support",
|
|
35
36
|
"zh": "MongoDB 支持"
|
|
@@ -41,9 +42,9 @@
|
|
|
41
42
|
}
|
|
42
43
|
},
|
|
43
44
|
"peerDependencies": {
|
|
44
|
-
"koishi": "^4.
|
|
45
|
+
"koishi": "^4.8.5"
|
|
45
46
|
},
|
|
46
47
|
"dependencies": {
|
|
47
|
-
"@minatojs/driver-mongo": "^1.1
|
|
48
|
+
"@minatojs/driver-mongo": "^1.2.1"
|
|
48
49
|
}
|
|
49
|
-
}
|
|
50
|
+
}
|