@lad-tech/nsc-toolkit 2.0.3 → 2.0.5
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 +7 -2
- package/dist/Container.js +5 -10
- package/dist/Root.js +3 -4
- package/dist/Service.js +1 -1
- package/dist/types/Container.d.ts +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
## [2.0.
|
|
1
|
+
## [2.0.5](https://github.com/lad-tech/nsc-toolkit/compare/v2.0.4...v2.0.5) (2026-02-12)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
*
|
|
6
|
+
* ci/cd ([#163](https://github.com/lad-tech/nsc-toolkit/issues/163)) ([783b7eb](https://github.com/lad-tech/nsc-toolkit/commit/783b7ebe649962d7ffed08f20150d922258257d5))
|
|
7
|
+
* fix ci/cd ([#165](https://github.com/lad-tech/nsc-toolkit/issues/165)) ([c899213](https://github.com/lad-tech/nsc-toolkit/commit/c899213f1c429e9689218230b83a1da580e4e57e))
|
|
8
|
+
* Logic create singleton object ([#159](https://github.com/lad-tech/nsc-toolkit/issues/159)) ([eaadf01](https://github.com/lad-tech/nsc-toolkit/commit/eaadf015f9f6b733c0b4d891e8b385ca22a14106))
|
|
9
|
+
* publish ci/cd ([#161](https://github.com/lad-tech/nsc-toolkit/issues/161)) ([0138bfc](https://github.com/lad-tech/nsc-toolkit/commit/0138bfcd35c406637d64369f75c5d3f3e383158b))
|
|
10
|
+
* return npm token ([#169](https://github.com/lad-tech/nsc-toolkit/issues/169)) ([3d6a40f](https://github.com/lad-tech/nsc-toolkit/commit/3d6a40f271e775861ef8c7002c9abf7b98ff5943))
|
|
11
|
+
* up semantic release version ([#167](https://github.com/lad-tech/nsc-toolkit/issues/167)) ([d1d6d99](https://github.com/lad-tech/nsc-toolkit/commit/d1d6d99bf124ff6d4fc2094d1107b1155fca9d76))
|
package/dist/Container.js
CHANGED
|
@@ -6,15 +6,10 @@ class Container {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
this.container = new Map();
|
|
8
8
|
this.singletons = new Map();
|
|
9
|
+
this.initializedKeys = new Set();
|
|
9
10
|
}
|
|
10
11
|
buildDependency(key) {
|
|
11
|
-
|
|
12
|
-
if (this.isAdapterDependency(deepDependency.dependency)) {
|
|
13
|
-
return new deepDependency.dependency.value(...deepDependency.constructor);
|
|
14
|
-
}
|
|
15
|
-
if (this.isConstantDependency(deepDependency.dependency)) {
|
|
16
|
-
return deepDependency.dependency.value;
|
|
17
|
-
}
|
|
12
|
+
return this.getInstance(key);
|
|
18
13
|
}
|
|
19
14
|
inject(dependency) {
|
|
20
15
|
if (this.isServiceDependency(dependency)) {
|
|
@@ -107,14 +102,14 @@ class Container {
|
|
|
107
102
|
throw new Error(`Unknown dependency type for key ${key.toString()}`);
|
|
108
103
|
}
|
|
109
104
|
async initDependencies() {
|
|
110
|
-
var _a
|
|
105
|
+
var _a;
|
|
111
106
|
const initialized = [];
|
|
112
107
|
for await (const [key, dependency] of this.container) {
|
|
113
|
-
if (this.isAdapterDependency(dependency) && ((_a = dependency.options) === null || _a === void 0 ? void 0 : _a.init) && !this.
|
|
108
|
+
if (this.isAdapterDependency(dependency) && ((_a = dependency.options) === null || _a === void 0 ? void 0 : _a.init) && !this.initializedKeys.has(key)) {
|
|
114
109
|
const instance = this.getInstance(key);
|
|
115
110
|
await (instance === null || instance === void 0 ? void 0 : instance.init());
|
|
116
111
|
initialized.push(instance);
|
|
117
|
-
this.
|
|
112
|
+
this.initializedKeys.add(key);
|
|
118
113
|
}
|
|
119
114
|
}
|
|
120
115
|
return initialized;
|
package/dist/Root.js
CHANGED
|
@@ -42,13 +42,12 @@ class Root {
|
|
|
42
42
|
}
|
|
43
43
|
getExpired(expired, ownTimeout) {
|
|
44
44
|
try {
|
|
45
|
-
if (!expired) {
|
|
46
|
-
const timeout =
|
|
45
|
+
if (!expired && !ownTimeout) {
|
|
46
|
+
const timeout = this.castToNumber(this.getSettingFromEnv('DEFAULT_RESPONSE_TIMEOUT'));
|
|
47
47
|
return Date.now() + timeout;
|
|
48
48
|
}
|
|
49
49
|
if (ownTimeout) {
|
|
50
|
-
|
|
51
|
-
return Math.min(customExpired, expired);
|
|
50
|
+
return Date.now() + ownTimeout;
|
|
52
51
|
}
|
|
53
52
|
return expired;
|
|
54
53
|
}
|
package/dist/Service.js
CHANGED
|
@@ -266,7 +266,7 @@ class Service extends Root_1.Root {
|
|
|
266
266
|
this.rootSpans.set(newBaggage.traceId, span);
|
|
267
267
|
return {
|
|
268
268
|
...newBaggage,
|
|
269
|
-
expired: this.getExpired(
|
|
269
|
+
expired: this.getExpired(newBaggage.expired, ownTimeout),
|
|
270
270
|
};
|
|
271
271
|
}
|
|
272
272
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lad-tech/nsc-toolkit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "Toolkit for create microservices around NATS",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@commitlint/cli": "^17.2.0",
|
|
16
16
|
"@commitlint/config-conventional": "^17.2.0",
|
|
17
17
|
"@semantic-release/changelog": "^6.0.2",
|
|
18
|
-
"@semantic-release/npm": "^
|
|
18
|
+
"@semantic-release/npm": "^13.1.4",
|
|
19
19
|
"@types/jest": "^27.5.2",
|
|
20
20
|
"@types/node": "^22.13.13",
|
|
21
21
|
"eslint": "^7.32.0",
|