@e22m4u/js-repository-mongodb-adapter 0.3.2 → 0.4.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/README.md CHANGED
@@ -1,20 +1,18 @@
1
1
  ## @e22m4u/js-repository-mongodb-adapter
2
2
 
3
- *English | [Русский](README-ru.md)*
3
+ MongoDB адаптер для [@e22m4u/js-repository](https://www.npmjs.com/package/@e22m4u/js-repository)
4
4
 
5
- MongoDB adapter for [@e22m4u/js-repository](https://www.npmjs.com/package/@e22m4u/js-repository)
6
-
7
- ## Installation
5
+ ## Установка
8
6
 
9
7
  ```bash
10
8
  npm install @e22m4u/js-repository-mongodb-adapter
11
9
  ```
12
10
 
13
- ## Configuration
11
+ ## Параметры
14
12
 
15
- All parameters are optional:
13
+ Все указанные параметры опциональны:
16
14
 
17
- | name | default value |
15
+ | название | значение по умолчанию |
18
16
  |----------|-----------------------|
19
17
  | protocol | `'mongodb'` |
20
18
  | host | `'127.0.0.1'` |
@@ -23,34 +21,34 @@ All parameters are optional:
23
21
  | username | `undefined` |
24
22
  | password | `undefined` |
25
23
 
26
- Example:
24
+ Пример:
27
25
 
28
26
  ```js
29
27
  import {Schema} from '@e22m4u/js-repository';
30
28
 
31
29
  const schema = new Schema();
32
30
 
33
- // define datasource
31
+ // объявление источника
34
32
  schema.defineDatasource({
35
- name: 'myMongo', // datasource name
36
- adapter: 'mongodb', // adapter name
37
- // configuration
33
+ name: 'myMongo', // название источника
34
+ adapter: 'mongodb', // имя адаптера
35
+ // параметры
38
36
  host: '127.0.0.1',
39
37
  port: 27017,
40
38
  database: 'myDatabase',
41
39
  });
42
40
 
43
- // define model
41
+ // объявление модели
44
42
  schema.defineModel({
45
- name: 'user', // model name
46
- datasource: 'myMongo', // datasource name (see above)
47
- properties: { // model fields
43
+ name: 'user', // название модели
44
+ datasource: 'myMongo', // используемый источник (см. выше)
45
+ properties: { // поля модели
48
46
  name: 'string',
49
47
  surname: 'string',
50
48
  },
51
49
  });
52
50
 
53
- // get repository by model name and create a record
51
+ // получаем репозиторий по названию модели и создаем запись
54
52
  const userRep = schema.getRepository('user');
55
53
  const user = await userRep.create({name: 'John', surname: 'Doe'});
56
54
 
@@ -62,20 +60,20 @@ console.log(user);
62
60
  // }
63
61
  ```
64
62
 
65
- ## Testing
63
+ ## Тесты
66
64
 
67
- Start `mongo:latest` container using `setup.sh` script.
65
+ Запуск контейнера `mongo:latest` скриптом `setup.sh`
68
66
 
69
67
  ```bash
70
68
  ./setup.sh
71
69
  ```
72
70
 
73
- Run tests
71
+ Выполнение тестов
74
72
 
75
73
  ```bash
76
74
  npm run test
77
75
  ```
78
76
 
79
- ## License
77
+ ## Лицензия
80
78
 
81
79
  MIT
@@ -18,11 +18,11 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
20
  // src/index.js
21
- var src_exports = {};
22
- __export(src_exports, {
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
23
  MongodbAdapter: () => MongodbAdapter
24
24
  });
25
- module.exports = __toCommonJS(src_exports);
25
+ module.exports = __toCommonJS(index_exports);
26
26
 
27
27
  // src/mongodb-adapter.js
28
28
  var import_mongodb2 = require("mongodb");
package/eslint.config.js CHANGED
@@ -19,7 +19,7 @@ export default [{
19
19
  rules: {
20
20
  ...eslintJs.configs.recommended.rules,
21
21
  ...eslintPrettierConfig.rules,
22
- ...eslintMochaPlugin.configs.flat.recommended.rules,
22
+ ...eslintMochaPlugin.configs.recommended.rules,
23
23
  ...eslintChaiExpectPlugin.configs['recommended-flat'].rules,
24
24
  },
25
25
  files: ['src/**/*.js'],
package/package.json CHANGED
@@ -1,7 +1,23 @@
1
1
  {
2
2
  "name": "@e22m4u/js-repository-mongodb-adapter",
3
- "version": "0.3.2",
4
- "description": "MongoDB adapter for @e22m4u/js-repository",
3
+ "version": "0.4.0",
4
+ "description": "MongoDB адаптер для @e22m4u/js-repository",
5
+ "author": "e22m4u <e22m4u@yandex.ru>",
6
+ "license": "MIT",
7
+ "keywords": [
8
+ "MongoDB",
9
+ "Repository",
10
+ "ORM",
11
+ "ODM",
12
+ "Database",
13
+ "Datasource",
14
+ "Relations"
15
+ ],
16
+ "homepage": "https://github.com/e22m4u/js-repository-mongodb-adapter",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/e22m4u/js-repository-mongodb-adapter.git"
20
+ },
5
21
  "type": "module",
6
22
  "module": "./src/index.js",
7
23
  "main": "./dist/cjs/index.cjs",
@@ -21,24 +37,8 @@
21
37
  "build:cjs": "rimraf ./dist/cjs && node --no-warnings=ExperimentalWarning build-cjs.js",
22
38
  "prepare": "husky"
23
39
  },
24
- "repository": {
25
- "type": "git",
26
- "url": "git+https://github.com/e22m4u/js-repository-mongodb-adapter.git"
27
- },
28
- "keywords": [
29
- "MongoDB",
30
- "Repository",
31
- "ORM",
32
- "ODM",
33
- "Database",
34
- "Datasource",
35
- "Relations"
36
- ],
37
- "author": "e22m4u <e22m4u@yandex.ru>",
38
- "license": "MIT",
39
- "homepage": "https://github.com/e22m4u/js-repository-mongodb-adapter",
40
40
  "dependencies": {
41
- "mongodb": "6.11.0"
41
+ "mongodb": "6.16.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@e22m4u/js-format": "~0.1.0",
@@ -46,22 +46,22 @@
46
46
  "@e22m4u/js-service": "~0.2.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@commitlint/cli": "~19.6.0",
50
- "@commitlint/config-conventional": "~19.6.0",
51
- "@eslint/js": "~9.16.0",
52
- "c8": "~10.1.2",
53
- "chai": "~5.1.2",
49
+ "@commitlint/cli": "~19.8.1",
50
+ "@commitlint/config-conventional": "~19.8.1",
51
+ "@eslint/js": "~9.26.0",
52
+ "c8": "~10.1.3",
53
+ "chai": "~5.2.0",
54
54
  "chai-as-promised": "~8.0.1",
55
- "dotenv": "~16.4.7",
56
- "esbuild": "~0.24.0",
57
- "eslint": "~9.16.0",
58
- "eslint-config-prettier": "~9.1.0",
55
+ "dotenv": "~16.5.0",
56
+ "esbuild": "~0.25.4",
57
+ "eslint": "~9.26.0",
58
+ "eslint-config-prettier": "~10.1.5",
59
59
  "eslint-plugin-chai-expect": "~3.1.0",
60
- "eslint-plugin-mocha": "~10.5.0",
61
- "globals": "~15.13.0",
60
+ "eslint-plugin-mocha": "~11.0.0",
61
+ "globals": "~16.1.0",
62
62
  "husky": "~9.1.7",
63
- "mocha": "~11.0.1",
64
- "prettier": "~3.4.2",
63
+ "mocha": "~11.2.2",
64
+ "prettier": "~3.5.3",
65
65
  "rimraf": "~6.0.1"
66
66
  }
67
67
  }
package/README-ru.md DELETED
@@ -1,81 +0,0 @@
1
- ## @e22m4u/js-repository-mongodb-adapter
2
-
3
- *[English](README.md) | Русский*
4
-
5
- MongoDB адаптер для [@e22m4u/js-repository](https://www.npmjs.com/package/@e22m4u/js-repository)
6
-
7
- ## Установка
8
-
9
- ```bash
10
- npm install @e22m4u/js-repository-mongodb-adapter
11
- ```
12
-
13
- ## Параметры
14
-
15
- Все указанные параметры опциональны:
16
-
17
- | название | значение по умолчанию |
18
- |----------|-----------------------|
19
- | protocol | `'mongodb'` |
20
- | host | `'127.0.0.1'` |
21
- | port | `27017` |
22
- | database | `'database'` |
23
- | username | `undefined` |
24
- | password | `undefined` |
25
-
26
- Пример:
27
-
28
- ```js
29
- import {Schema} from '@e22m4u/js-repository';
30
-
31
- const schema = new Schema();
32
-
33
- // объявление источника
34
- schema.defineDatasource({
35
- name: 'myMongo', // название источника
36
- adapter: 'mongodb', // имя адаптера
37
- // параметры
38
- host: '127.0.0.1',
39
- port: 27017,
40
- database: 'myDatabase',
41
- });
42
-
43
- // объявление модели
44
- schema.defineModel({
45
- name: 'user', // название модели
46
- datasource: 'myMongo', // используемый источник (см. выше)
47
- properties: { // поля модели
48
- name: 'string',
49
- surname: 'string',
50
- },
51
- });
52
-
53
- // получаем репозиторий по названию модели и создаем запись
54
- const userRep = schema.getRepository('user');
55
- const user = await userRep.create({name: 'John', surname: 'Doe'});
56
-
57
- console.log(user);
58
- // {
59
- // id: '64f3454e5e0893c13f9bf47e',
60
- // name: 'John',
61
- // surname: 'Doe',
62
- // }
63
- ```
64
-
65
- ## Тесты
66
-
67
- Запуск контейнера `mongo:latest` скриптом `setup.sh`
68
-
69
- ```bash
70
- ./setup.sh
71
- ```
72
-
73
- Выполнение тестов
74
-
75
- ```bash
76
- npm run test
77
- ```
78
-
79
- ## Лицензия
80
-
81
- MIT