@rsdk/core 2.6.0-next.6 → 2.6.0-next.7
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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.6.0-next.7](https://github.com/R-Vision/rsdk/compare/v2.6.0-next.6...v2.6.0-next.7) (2023-07-23)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **@rsdk/common:** add Case static class ([c8dc5b4](https://github.com/R-Vision/rsdk/commit/c8dc5b4e6306093541091c12c698263accbe55c1))
|
|
11
|
+
|
|
6
12
|
# [2.6.0-next.6](https://github.com/R-Vision/rsdk/compare/v2.6.0-next.5...v2.6.0-next.6) (2023-07-22)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Vars = exports.SetResult = void 0;
|
|
4
|
+
const common_1 = require("@rsdk/common");
|
|
4
5
|
const lodash_1 = require("lodash");
|
|
5
6
|
const exceptions_1 = require("./exceptions");
|
|
6
7
|
var SetResult;
|
|
@@ -20,7 +21,7 @@ class Vars {
|
|
|
20
21
|
this.prefix = prefix;
|
|
21
22
|
}
|
|
22
23
|
set(key, value) {
|
|
23
|
-
const preparedKey =
|
|
24
|
+
const preparedKey = common_1.Case.toUpperSnake(key);
|
|
24
25
|
const preparedValue = Array.isArray(value)
|
|
25
26
|
? (0, lodash_1.cloneDeep)(value).sort()
|
|
26
27
|
: value;
|
|
@@ -53,9 +54,9 @@ class Vars {
|
|
|
53
54
|
}
|
|
54
55
|
extract(propertyMetadata) {
|
|
55
56
|
const { key, parser, defaultValue } = propertyMetadata;
|
|
56
|
-
const preparedKey =
|
|
57
|
+
const preparedKey = common_1.Case.toUpperSnake(key);
|
|
57
58
|
const withPrefix = this.prefix
|
|
58
|
-
? `${
|
|
59
|
+
? `${common_1.Case.toUpperSnake(this.prefix)}_${preparedKey}`
|
|
59
60
|
: preparedKey;
|
|
60
61
|
const raw = this.values.get(withPrefix) ?? this.values.get(preparedKey);
|
|
61
62
|
if (raw === undefined) {
|
|
@@ -78,9 +79,6 @@ class Vars {
|
|
|
78
79
|
});
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
|
-
toUpperSnakeCase(key) {
|
|
82
|
-
return key.replaceAll(/[^\dA-Za-z]+/g, '_').toUpperCase();
|
|
83
|
-
}
|
|
84
82
|
}
|
|
85
83
|
exports.Vars = Vars;
|
|
86
84
|
//# sourceMappingURL=vars.class.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vars.class.js","sourceRoot":"","sources":["../../src/config/vars.class.ts"],"names":[],"mappings":";;;AAAA,mCAA4C;AAE5C,6CAAiD;AAGjD,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,+CAAO,CAAA;IACP,+CAAO,CAAA;IACP,mDAAS,CAAA;AACX,CAAC,EAJW,SAAS,yBAAT,SAAS,QAIpB;AAED,MAAa,IAAI;IAOc;IANZ,MAAM,GAAG,IAAI,GAAG,EAAmB,CAAC;IAErD;;;OAGG;IACH,YAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAE/C,GAAG,CAAC,GAAW,EAAE,KAAc;QAC7B,MAAM,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"vars.class.js","sourceRoot":"","sources":["../../src/config/vars.class.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AACpC,mCAA4C;AAE5C,6CAAiD;AAGjD,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,+CAAO,CAAA;IACP,+CAAO,CAAA;IACP,mDAAS,CAAA;AACX,CAAC,EAJW,SAAS,yBAAT,S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
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdk/core",
|
|
3
|
-
"version": "2.6.0-next.
|
|
3
|
+
"version": "2.6.0-next.7",
|
|
4
4
|
"description": "Nestjs based microservice chassis",
|
|
5
5
|
"license": "Apache License 2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -30,15 +30,15 @@
|
|
|
30
30
|
"@nestjs/common": "^9.0.0",
|
|
31
31
|
"@nestjs/core": "^9.0.0",
|
|
32
32
|
"@nestjs/microservices": "^9.0.0",
|
|
33
|
-
"@rsdk/autodoc.protocol": "^2.6.0-next.
|
|
34
|
-
"@rsdk/common": "^2.
|
|
35
|
-
"@rsdk/decorators": "^2.
|
|
36
|
-
"@rsdk/logging": "^2.
|
|
37
|
-
"@rsdk/metadata": "^2.6.0-next.
|
|
33
|
+
"@rsdk/autodoc.protocol": "^2.6.0-next.7",
|
|
34
|
+
"@rsdk/common": "^2.6.0-next.7",
|
|
35
|
+
"@rsdk/decorators": "^2.6.0-next.7",
|
|
36
|
+
"@rsdk/logging": "^2.6.0-next.7",
|
|
37
|
+
"@rsdk/metadata": "^2.6.0-next.7",
|
|
38
38
|
"@rsdk/nest-tools": "^2.6.0-next.3",
|
|
39
39
|
"axios": "^1.1.3",
|
|
40
40
|
"reflect-metadata": "^0.1.13",
|
|
41
41
|
"rxjs": "^7.0.0"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "f1f0dcab638a726e7728ad979232c93adf1cfaf9"
|
|
44
44
|
}
|
package/src/config/vars.class.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Case } from '@rsdk/common';
|
|
1
2
|
import { cloneDeep, isEqual } from 'lodash';
|
|
2
3
|
|
|
3
4
|
import { PropertyException } from './exceptions';
|
|
@@ -19,7 +20,7 @@ export class Vars {
|
|
|
19
20
|
constructor(private readonly prefix: string) {}
|
|
20
21
|
|
|
21
22
|
set(key: string, value: unknown): [SetResult, string] {
|
|
22
|
-
const preparedKey =
|
|
23
|
+
const preparedKey = Case.toUpperSnake(key);
|
|
23
24
|
const preparedValue = Array.isArray(value)
|
|
24
25
|
? cloneDeep(value).sort()
|
|
25
26
|
: value;
|
|
@@ -65,10 +66,10 @@ export class Vars {
|
|
|
65
66
|
|
|
66
67
|
extract<T>(propertyMetadata: PropertyMetadata<T>): T | undefined {
|
|
67
68
|
const { key, parser, defaultValue } = propertyMetadata;
|
|
68
|
-
const preparedKey =
|
|
69
|
+
const preparedKey = Case.toUpperSnake(key);
|
|
69
70
|
|
|
70
71
|
const withPrefix = this.prefix
|
|
71
|
-
? `${
|
|
72
|
+
? `${Case.toUpperSnake(this.prefix)}_${preparedKey}`
|
|
72
73
|
: preparedKey;
|
|
73
74
|
|
|
74
75
|
const raw = this.values.get(withPrefix) ?? this.values.get(preparedKey);
|
|
@@ -94,8 +95,4 @@ export class Vars {
|
|
|
94
95
|
});
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
|
-
|
|
98
|
-
private toUpperSnakeCase(key: string): string {
|
|
99
|
-
return key.replaceAll(/[^\dA-Za-z]+/g, '_').toUpperCase();
|
|
100
|
-
}
|
|
101
98
|
}
|