@uns-kit/api 0.0.23 → 0.0.27
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.d.ts +4 -2
- package/dist/uns-api-proxy.js +6 -3
- package/package.json +2 -2
package/dist/uns-api-proxy.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { UnsAttribute } from "@uns-kit/core/uns/uns-interfaces.js";
|
|
|
2
2
|
import UnsProxy from "@uns-kit/core/uns/uns-proxy.js";
|
|
3
3
|
import { UnsTopics } from "@uns-kit/core/uns/uns-topics.js";
|
|
4
4
|
import { IApiProxyOptions, IGetEndpointOptions } from "@uns-kit/core/uns/uns-interfaces.js";
|
|
5
|
+
import { UnsAsset } from "@uns-kit/core/uns/uns-asset.js";
|
|
6
|
+
import { UnsObjectType, UnsObjectId } from "@uns-kit/core/uns/uns-object.js";
|
|
5
7
|
export default class UnsApiProxy extends UnsProxy {
|
|
6
8
|
instanceName: string;
|
|
7
9
|
private topicBuilder;
|
|
@@ -17,7 +19,7 @@ export default class UnsApiProxy extends UnsProxy {
|
|
|
17
19
|
* @param attribute - The attribute for the topic.
|
|
18
20
|
* @param method - The HTTP method (e.g., "GET", "POST", "PUT", "DELETE").
|
|
19
21
|
*/
|
|
20
|
-
unregister(topic: UnsTopics, attribute: UnsAttribute, method: "GET" | "POST" | "PUT" | "DELETE"): Promise<void>;
|
|
22
|
+
unregister(topic: UnsTopics, asset: UnsAsset, objectType: UnsObjectType, objectId: UnsObjectId, attribute: UnsAttribute, method: "GET" | "POST" | "PUT" | "DELETE"): Promise<void>;
|
|
21
23
|
/**
|
|
22
24
|
* Register a GET endpoint with optional JWT path filter.
|
|
23
25
|
* @param topic - The API topic
|
|
@@ -25,7 +27,7 @@ export default class UnsApiProxy extends UnsProxy {
|
|
|
25
27
|
* @param options.description - Optional description.
|
|
26
28
|
* @param options.tags - Optional tags.
|
|
27
29
|
*/
|
|
28
|
-
get(topic: UnsTopics, attribute: UnsAttribute, options?: IGetEndpointOptions): Promise<void>;
|
|
30
|
+
get(topic: UnsTopics, asset: UnsAsset, objectType: UnsObjectType, objectId: UnsObjectId, attribute: UnsAttribute, options?: IGetEndpointOptions): Promise<void>;
|
|
29
31
|
post(..._args: any[]): any;
|
|
30
32
|
private extractBearerToken;
|
|
31
33
|
private getPublicKeyFromJwks;
|
package/dist/uns-api-proxy.js
CHANGED
|
@@ -42,7 +42,7 @@ export default class UnsApiProxy extends UnsProxy {
|
|
|
42
42
|
* @param attribute - The attribute for the topic.
|
|
43
43
|
* @param method - The HTTP method (e.g., "GET", "POST", "PUT", "DELETE").
|
|
44
44
|
*/
|
|
45
|
-
async unregister(topic, attribute, method) {
|
|
45
|
+
async unregister(topic, asset, objectType, objectId, attribute, method) {
|
|
46
46
|
const fullPath = `/${topic}${attribute}`;
|
|
47
47
|
const apiPath = `/api${fullPath}`;
|
|
48
48
|
const methodKey = method.toLowerCase(); // Express stores method keys in lowercase
|
|
@@ -63,7 +63,7 @@ export default class UnsApiProxy extends UnsProxy {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
// Unregister from internal endpoint tracking
|
|
66
|
-
this.unregisterApiEndpoint(topic, attribute);
|
|
66
|
+
this.unregisterApiEndpoint(topic, asset, objectType, objectId, attribute);
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
69
|
* Register a GET endpoint with optional JWT path filter.
|
|
@@ -72,7 +72,7 @@ export default class UnsApiProxy extends UnsProxy {
|
|
|
72
72
|
* @param options.description - Optional description.
|
|
73
73
|
* @param options.tags - Optional tags.
|
|
74
74
|
*/
|
|
75
|
-
async get(topic, attribute, options) {
|
|
75
|
+
async get(topic, asset, objectType, objectId, attribute, options) {
|
|
76
76
|
// Wait until the API server is started
|
|
77
77
|
while (this.app.server.listening === false) {
|
|
78
78
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
@@ -102,6 +102,9 @@ export default class UnsApiProxy extends UnsProxy {
|
|
|
102
102
|
apiDescription: options?.apiDescription,
|
|
103
103
|
attributeType: UnsAttributeType.Api,
|
|
104
104
|
apiSwaggerEndpoint: `/${this.processName}/${this.instanceName}/swagger.json`,
|
|
105
|
+
asset,
|
|
106
|
+
objectType,
|
|
107
|
+
objectId
|
|
105
108
|
});
|
|
106
109
|
const fullPath = `/${topic}${attribute}`;
|
|
107
110
|
const handler = (req, res) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uns-kit/api",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.27",
|
|
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": "1.0.
|
|
38
|
+
"@uns-kit/core": "1.0.9"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/jsonwebtoken": "^9.0.10",
|