@biorate/nestjs-tools 2.0.0 → 2.1.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/dist/cjs/src/app/infrastructure/adapters/client.repository.adapter.js +2 -2
- package/dist/cjs/src/http/controllers/locales.js +2 -2
- package/dist/cjs/src/middlewares/proxy-middleware.js +3 -3
- package/dist/esm/src/app/infrastructure/adapters/client.repository.adapter.js +1 -1
- package/dist/esm/src/http/controllers/locales.js +1 -1
- package/dist/esm/src/middlewares/proxy-middleware.js +1 -1
- package/package.json +9 -9
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.ClientRepositoryAdapter = void 0;
|
|
10
|
-
const
|
|
10
|
+
const lodash_es_1 = require("lodash-es");
|
|
11
11
|
const fs_1 = require("fs");
|
|
12
12
|
const common_1 = require("@nestjs/common");
|
|
13
13
|
const tools_1 = require("@biorate/tools");
|
|
@@ -24,7 +24,7 @@ let ClientRepositoryAdapter = class ClientRepositoryAdapter {
|
|
|
24
24
|
try {
|
|
25
25
|
const directory = tools_1.path.create(process.cwd(), 'locales', namespace);
|
|
26
26
|
(0, fs_1.mkdirSync)(directory, { recursive: true });
|
|
27
|
-
(0, fs_1.writeFileSync)(tools_1.path.create(directory, `${lang}.json`), JSON.stringify((0,
|
|
27
|
+
(0, fs_1.writeFileSync)(tools_1.path.create(directory, `${lang}.json`), JSON.stringify((0, lodash_es_1.merge)(this.getLang(lang, namespace), data), null, ' '), 'utf-8');
|
|
28
28
|
}
|
|
29
29
|
catch (e) {
|
|
30
30
|
console.warn(e);
|
|
@@ -18,7 +18,7 @@ const common_1 = require("@nestjs/common");
|
|
|
18
18
|
const swagger_1 = require("@nestjs/swagger");
|
|
19
19
|
const tools_1 = require("@biorate/tools");
|
|
20
20
|
const fs_1 = require("fs");
|
|
21
|
-
const
|
|
21
|
+
const lodash_es_1 = require("lodash-es");
|
|
22
22
|
const dto_1 = require("../dto");
|
|
23
23
|
let LocalesController = LocalesController_1 = class LocalesController {
|
|
24
24
|
static async getFile(namespace, lang) {
|
|
@@ -52,7 +52,7 @@ let LocalesController = LocalesController_1 = class LocalesController {
|
|
|
52
52
|
}
|
|
53
53
|
async post(param, body) {
|
|
54
54
|
const data = LocalesController_1.getFileSync(param.namespace, param.lang);
|
|
55
|
-
const result = (0,
|
|
55
|
+
const result = (0, lodash_es_1.merge)(data, body);
|
|
56
56
|
LocalesController_1.putFile(param.namespace, param.lang, result);
|
|
57
57
|
}
|
|
58
58
|
};
|
|
@@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var ProxyPrometheusMiddleware_1;
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.ProxyPrometheusMiddleware = void 0;
|
|
14
|
-
const
|
|
14
|
+
const lodash_es_1 = require("lodash-es");
|
|
15
15
|
const http_proxy_middleware_1 = require("http-proxy-middleware");
|
|
16
16
|
const common_1 = require("@nestjs/common");
|
|
17
17
|
const prometheus_1 = require("@biorate/prometheus");
|
|
@@ -23,7 +23,7 @@ let ProxyPrometheusMiddleware = ProxyPrometheusMiddleware_1 = class ProxyPrometh
|
|
|
23
23
|
}
|
|
24
24
|
constructor(options = {}) {
|
|
25
25
|
this.time = new WeakMap();
|
|
26
|
-
const { onProxyReq, onProxyRes } = (0,
|
|
26
|
+
const { onProxyReq, onProxyRes } = (0, lodash_es_1.pick)(options, 'onProxyReq', 'onProxyRes');
|
|
27
27
|
if (!ProxyPrometheusMiddleware_1.histogram)
|
|
28
28
|
ProxyPrometheusMiddleware_1.histogram = new prometheus_1.Histogram({
|
|
29
29
|
name: 'http_proxy_server_requests_seconds',
|
|
@@ -33,7 +33,7 @@ let ProxyPrometheusMiddleware = ProxyPrometheusMiddleware_1 = class ProxyPrometh
|
|
|
33
33
|
registers: [prometheus_1.Prometheus.registry],
|
|
34
34
|
});
|
|
35
35
|
this.handler = (0, http_proxy_middleware_1.createProxyMiddleware)({
|
|
36
|
-
...(0,
|
|
36
|
+
...(0, lodash_es_1.omit)(options, 'onProxyReq', 'onProxyRes'),
|
|
37
37
|
onProxyReq: (proxyReq, req, res, options) => {
|
|
38
38
|
this.time.set(req, { time: tools_1.time.diff() });
|
|
39
39
|
return onProxyReq?.(proxyReq, req, res, options);
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { merge } from 'lodash';
|
|
7
|
+
import { merge } from 'lodash-es';
|
|
8
8
|
import { mkdirSync, writeFileSync, readFileSync } from 'fs';
|
|
9
9
|
import { Injectable } from '@nestjs/common';
|
|
10
10
|
import { path } from '@biorate/tools';
|
|
@@ -15,7 +15,7 @@ import { Controller, Get, Post, Param, Body, Header } from '@nestjs/common';
|
|
|
15
15
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
|
16
16
|
import { path } from '@biorate/tools';
|
|
17
17
|
import { promises as fs, readFileSync, writeFileSync, mkdirSync } from 'fs';
|
|
18
|
-
import { merge } from 'lodash';
|
|
18
|
+
import { merge } from 'lodash-es';
|
|
19
19
|
import { GetLocalesDTO, PostLocalesDTO } from '../dto/index.js';
|
|
20
20
|
let LocalesController = LocalesController_1 = class LocalesController {
|
|
21
21
|
static async getFile(namespace, lang) {
|
|
@@ -8,7 +8,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
var ProxyPrometheusMiddleware_1;
|
|
11
|
-
import { pick, omit } from 'lodash';
|
|
11
|
+
import { pick, omit } from 'lodash-es';
|
|
12
12
|
import { createProxyMiddleware } from 'http-proxy-middleware';
|
|
13
13
|
import { Injectable } from '@nestjs/common';
|
|
14
14
|
import { counter, Counter, Histogram, Prometheus } from '@biorate/prometheus';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@biorate/nestjs-tools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "NestJS tools",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"keywords": [],
|
|
46
46
|
"author": "llevkin",
|
|
47
47
|
"license": "MIT",
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "ca18c1129712e77a6ec8fb2033a54f94e5620ce0",
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@nestjs/common": ">=10.4.15",
|
|
51
51
|
"@nestjs/core": ">=10.4.15",
|
|
@@ -54,18 +54,18 @@
|
|
|
54
54
|
"express": ">=4.21.2",
|
|
55
55
|
"http-proxy": ">=1.18.1",
|
|
56
56
|
"http-proxy-middleware": "=2.0.6",
|
|
57
|
-
"lodash": ">=4.17.21",
|
|
57
|
+
"lodash-es": ">=4.17.21",
|
|
58
58
|
"rxjs": ">=7.8.2",
|
|
59
59
|
"ws": ">=8.18.0"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@biorate/axios": "3.
|
|
63
|
-
"@biorate/config": "3.
|
|
62
|
+
"@biorate/axios": "3.1.0",
|
|
63
|
+
"@biorate/config": "3.1.0",
|
|
64
64
|
"@biorate/errors": "3.0.0",
|
|
65
|
-
"@biorate/inversion": "3.0.
|
|
66
|
-
"@biorate/opentelemetry": "2.0.
|
|
67
|
-
"@biorate/prometheus": "3.0.
|
|
68
|
-
"@biorate/tools": "3.0.
|
|
65
|
+
"@biorate/inversion": "3.0.2",
|
|
66
|
+
"@biorate/opentelemetry": "2.0.2",
|
|
67
|
+
"@biorate/prometheus": "3.0.2",
|
|
68
|
+
"@biorate/tools": "3.0.1",
|
|
69
69
|
"http-proxy": "1.18.1",
|
|
70
70
|
"http-proxy-middleware": "2.0.6",
|
|
71
71
|
"json-stringify-safe": "5.0.1",
|