@uns-kit/api 2.0.17 → 2.0.19
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/uns-api-proxy.js +4 -3
- package/package.json +2 -2
package/dist/uns-api-proxy.js
CHANGED
|
@@ -10,6 +10,7 @@ import { UnsPacket } from "@uns-kit/core/uns/uns-packet.js";
|
|
|
10
10
|
import UnsProxy from "@uns-kit/core/uns/uns-proxy.js";
|
|
11
11
|
import { UnsTopicMatcher } from "@uns-kit/core/uns/uns-topic-matcher.js";
|
|
12
12
|
import { DataSizeMeasurements, PhysicalMeasurements } from "@uns-kit/core/uns/uns-measurements.js";
|
|
13
|
+
import { buildUnsRoutePath } from "@uns-kit/core/uns/uns-path.js";
|
|
13
14
|
import App from "./app.js";
|
|
14
15
|
const packageJsonPath = path.join(basePath, "package.json");
|
|
15
16
|
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
@@ -82,7 +83,7 @@ export default class UnsApiProxy extends UnsProxy {
|
|
|
82
83
|
* @param method - The HTTP method (e.g., "GET", "POST", "PUT", "DELETE").
|
|
83
84
|
*/
|
|
84
85
|
async unregister(topic, asset, objectType, objectId, attribute, method) {
|
|
85
|
-
const fullPath =
|
|
86
|
+
const fullPath = buildUnsRoutePath(topic, asset, objectType, objectId, attribute);
|
|
86
87
|
const apiPath = `${this.apiBasePrefix}${fullPath}`.replace(/\/{2,}/g, "/");
|
|
87
88
|
const methodKey = method.toLowerCase(); // Express stores method keys in lowercase
|
|
88
89
|
// Remove route from router
|
|
@@ -117,7 +118,7 @@ export default class UnsApiProxy extends UnsProxy {
|
|
|
117
118
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
118
119
|
}
|
|
119
120
|
const time = UnsPacket.formatToISO8601(new Date());
|
|
120
|
-
const fullPath =
|
|
121
|
+
const fullPath = buildUnsRoutePath(topic, asset, objectType, objectId, attribute);
|
|
121
122
|
const apiPath = `${this.apiBasePrefix}${fullPath}`.replace(/\/{2,}/g, "/");
|
|
122
123
|
const swaggerPath = buildSwaggerPath(this.swaggerBasePrefix, this.processName, this.instanceName);
|
|
123
124
|
try {
|
|
@@ -289,7 +290,7 @@ export default class UnsApiProxy extends UnsProxy {
|
|
|
289
290
|
}
|
|
290
291
|
}
|
|
291
292
|
catch (error) {
|
|
292
|
-
logger.error(`${this.instanceNameWithSuffix} - Error publishing message to
|
|
293
|
+
logger.error(`${this.instanceNameWithSuffix} - Error publishing message to route ${fullPath}: ${error.message}`);
|
|
293
294
|
}
|
|
294
295
|
}
|
|
295
296
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uns-kit/api",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.19",
|
|
4
4
|
"description": "Express-powered API gateway plugin for UnsProxyProcess with JWT/JWKS support.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"cookie-parser": "^1.4.7",
|
|
36
36
|
"express": "^5.1.0",
|
|
37
37
|
"multer": "^2.0.2",
|
|
38
|
-
"@uns-kit/core": "2.0.
|
|
38
|
+
"@uns-kit/core": "2.0.19"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/jsonwebtoken": "^9.0.10",
|