@storehouse/mongodb 2.3.0 → 2.4.1
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/README.md +2 -2
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/package.json +26 -17
- package/.eslintrc.json +0 -22
- package/tsconfig.json +0 -35
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ MongoDB driver manager for @storehouse/core.
|
|
|
9
9
|
Make sure you have [@storehouse/core](https://www.npmjs.com/package/@storehouse/core) and [mongodb](https://www.npmjs.com/package/mongodb) installed.
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
|
|
12
|
+
npm install @storehouse/mongodb
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
@@ -65,7 +65,7 @@ if (conn) {
|
|
|
65
65
|
const localManager = Storehouse.getManager<MongoDBManager>('local');
|
|
66
66
|
if (localManager) {
|
|
67
67
|
// model
|
|
68
|
-
const moviesModel =
|
|
68
|
+
const moviesModel = localManager.getModel<Collection<Movie>>('movies');
|
|
69
69
|
if (moviesModel) {
|
|
70
70
|
console.log('nb movies', await moviesModel.countDocuments());
|
|
71
71
|
}
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MongoDBManager =
|
|
3
|
+
exports.MongoDBManager = void 0;
|
|
4
|
+
exports.getModel = getModel;
|
|
5
|
+
exports.getManager = getManager;
|
|
6
|
+
exports.getConnection = getConnection;
|
|
4
7
|
const tslib_1 = require("tslib");
|
|
5
8
|
const mongodb_1 = require("mongodb");
|
|
6
9
|
const logger_1 = tslib_1.__importDefault(require("@novice1/logger"));
|
|
@@ -19,7 +22,6 @@ function getModel(registry, managerName, modelName) {
|
|
|
19
22
|
}
|
|
20
23
|
return model;
|
|
21
24
|
}
|
|
22
|
-
exports.getModel = getModel;
|
|
23
25
|
function getManager(registry, managerName) {
|
|
24
26
|
const manager = registry.getManager(managerName);
|
|
25
27
|
if (!manager) {
|
|
@@ -30,7 +32,6 @@ function getManager(registry, managerName) {
|
|
|
30
32
|
}
|
|
31
33
|
return manager;
|
|
32
34
|
}
|
|
33
|
-
exports.getManager = getManager;
|
|
34
35
|
function getConnection(registry, managerName) {
|
|
35
36
|
const conn = registry.getConnection(managerName);
|
|
36
37
|
if (!conn) {
|
|
@@ -38,7 +39,6 @@ function getConnection(registry, managerName) {
|
|
|
38
39
|
}
|
|
39
40
|
return conn;
|
|
40
41
|
}
|
|
41
|
-
exports.getConnection = getConnection;
|
|
42
42
|
class MongoDBManager extends mongodb_1.MongoClient {
|
|
43
43
|
constructor(settings) {
|
|
44
44
|
var _a;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AA2BA,4BAMC;AAED,gCASC;AAED,sCAMC;;AAlDD,qCAKiB;AACjB,qEAAqC;AAGrC,MAAM,GAAG,GAAG,gBAAM,CAAC,QAAQ,CAAC,6BAA6B,CAAC,CAAC;AAS3D;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAgC,QAAkB,EAAE,WAAmB,EAAE,SAAkB;IACjH,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAgB,WAAW,EAAE,SAAS,CAAC,CAAC;IACvE,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,cAAc,CAAC,yBAAyB,SAAS,IAAI,WAAW,GAAG,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAgB,UAAU,CAA4C,QAAkB,EAAE,WAAoB;IAC5G,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAI,WAAW,CAAC,CAAC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AC;QACpD,CAAC;aAAM,CAAC;YACN,KAAK,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,UAAU,CAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;;AAxDH,wCAyDC;AAxDiB,mBAAI,GAAG,qBAAqB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storehouse/mongodb",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"description": "MongoDB manager for @storehouse/core",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"doc": "typedoc",
|
|
8
8
|
"build": "tsc",
|
|
9
|
-
"lint": "eslint
|
|
10
|
-
"test": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\", \"noUnusedParameters\": false}' kaukau --require ts-node/register --config kaukau-src.
|
|
11
|
-
"testlib": "kaukau --config kaukau-lib.
|
|
9
|
+
"lint": "eslint .",
|
|
10
|
+
"test": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\", \"noUnusedParameters\": false}' kaukau --require ts-node/register --config kaukau-src.mjs",
|
|
11
|
+
"testlib": "kaukau --config kaukau-lib.mjs",
|
|
12
|
+
"test:local": "dotenvx run -f .env.test -- kaukau --require ts-node/register --config kaukau-src.mjs",
|
|
13
|
+
"testlib:local": "dotenvx run -f .env.test -- kaukau --config kaukau-lib.mjs"
|
|
12
14
|
},
|
|
13
15
|
"repository": {
|
|
14
16
|
"type": "git",
|
|
@@ -25,21 +27,28 @@
|
|
|
25
27
|
},
|
|
26
28
|
"homepage": "https://kisiwu.github.io/storehouse/mongodb/latest/",
|
|
27
29
|
"devDependencies": {
|
|
28
|
-
"@
|
|
29
|
-
"@
|
|
30
|
-
"@
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"
|
|
34
|
-
"
|
|
30
|
+
"@dotenvx/dotenvx": "^1.51.0",
|
|
31
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
32
|
+
"@eslint/js": "^9.36.0",
|
|
33
|
+
"@stylistic/eslint-plugin": "^5.4.0",
|
|
34
|
+
"@types/chai": "^5.2.2",
|
|
35
|
+
"@types/mocha": "^10.0.10",
|
|
36
|
+
"@types/node": "^24.6.2",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^8.45.0",
|
|
38
|
+
"@typescript-eslint/parser": "^8.45.0",
|
|
39
|
+
"chai": "^6.2.0",
|
|
40
|
+
"eslint": "^9.36.0",
|
|
41
|
+
"eslint-plugin-mocha": "^11.2.0",
|
|
42
|
+
"kaukau": "^4.1.6",
|
|
35
43
|
"ts-node": "^10.9.2",
|
|
36
|
-
"typedoc": "^0.
|
|
37
|
-
"typescript": "^5.
|
|
44
|
+
"typedoc": "^0.28.13",
|
|
45
|
+
"typescript": "^5.9.3",
|
|
46
|
+
"typescript-eslint": "^8.45.0"
|
|
38
47
|
},
|
|
39
48
|
"dependencies": {
|
|
40
|
-
"@novice1/logger": "^1.
|
|
41
|
-
"@storehouse/core": "^1.
|
|
42
|
-
"mongodb": "^6.
|
|
43
|
-
"tslib": "^2.
|
|
49
|
+
"@novice1/logger": "^1.6.0",
|
|
50
|
+
"@storehouse/core": "^1.2.1",
|
|
51
|
+
"mongodb": "^6.20.0",
|
|
52
|
+
"tslib": "^2.8.1"
|
|
44
53
|
}
|
|
45
54
|
}
|
package/.eslintrc.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"browser": true,
|
|
4
|
-
"es6": true
|
|
5
|
-
},
|
|
6
|
-
"extends": [
|
|
7
|
-
"eslint:recommended",
|
|
8
|
-
"plugin:@typescript-eslint/recommended"
|
|
9
|
-
],
|
|
10
|
-
"parser": "@typescript-eslint/parser",
|
|
11
|
-
"parserOptions": {
|
|
12
|
-
"ecmaVersion": 6,
|
|
13
|
-
"sourceType": "module"
|
|
14
|
-
},
|
|
15
|
-
"plugins": [
|
|
16
|
-
"@typescript-eslint"
|
|
17
|
-
],
|
|
18
|
-
"rules": {
|
|
19
|
-
"quotes": [1, "single"],
|
|
20
|
-
"quote-props": [1, "as-needed"]
|
|
21
|
-
}
|
|
22
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// see https://www.typescriptlang.org/tsconfig to better understand tsconfigs
|
|
3
|
-
"include": ["src"],
|
|
4
|
-
"exclude": ["node_modules"],
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
"typeRoots": ["types", "node_modules/@types"],
|
|
7
|
-
"module": "CommonJS",
|
|
8
|
-
"lib": ["DOM", "ES6"],
|
|
9
|
-
"target": "ES6",
|
|
10
|
-
"importHelpers": true,
|
|
11
|
-
// output .d.ts declaration files for consumers
|
|
12
|
-
"declaration": true,
|
|
13
|
-
// output .js.map sourcemap files for consumers
|
|
14
|
-
"sourceMap": true,
|
|
15
|
-
"outDir": "./lib",
|
|
16
|
-
// match output dir to input dir. e.g. lib/index instead of lib/src/index
|
|
17
|
-
"rootDir": "./src",
|
|
18
|
-
// stricter type-checking for stronger correctness. Recommended by TS
|
|
19
|
-
"strict": true,
|
|
20
|
-
// linter checks for common issues
|
|
21
|
-
"noImplicitReturns": true,
|
|
22
|
-
"noFallthroughCasesInSwitch": true,
|
|
23
|
-
// noUnused* overlap with @typescript-eslint/no-unused-vars, can disable if duplicative
|
|
24
|
-
"noUnusedLocals": true,
|
|
25
|
-
"noUnusedParameters": true,
|
|
26
|
-
// use Node's module resolution algorithm, instead of the legacy TS one
|
|
27
|
-
"moduleResolution": "node",
|
|
28
|
-
// interop between ESM and CJS modules. Recommended by TS
|
|
29
|
-
"esModuleInterop": true,
|
|
30
|
-
// significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS
|
|
31
|
-
"skipLibCheck": true,
|
|
32
|
-
// error out if import and file system have a casing mismatch. Recommended by TS
|
|
33
|
-
"forceConsistentCasingInFileNames": true
|
|
34
|
-
}
|
|
35
|
-
}
|