@uns-kit/api 2.0.40 → 2.0.42

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.
@@ -1,70 +1,70 @@
1
- import { UnsAttribute } from "@uns-kit/core/uns/uns-interfaces.js";
2
- import UnsProxy from "@uns-kit/core/uns/uns-proxy.js";
3
- import { UnsTopics } from "@uns-kit/core/uns/uns-topics.js";
4
- import { IApiProxyOptions, IGetEndpointOptions, IPostEndpointOptions } 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";
7
- export default class UnsApiProxy extends UnsProxy {
8
- instanceName: string;
9
- private topicBuilder;
10
- private processName;
11
- protected processStatusTopic: string;
12
- private app;
13
- private options;
14
- private apiBasePrefix;
15
- private swaggerBasePrefix;
16
- private jwksCache?;
17
- private catchAllRouteRegistered;
18
- private startedAt;
19
- private statusInterval;
20
- private readonly statusIntervalMs;
21
- constructor(processName: string, instanceName: string, options: IApiProxyOptions);
22
- /**
23
- * Unregister endpoint
24
- * @param topic - The API topic
25
- * @param attribute - The attribute for the topic.
26
- * @param method - The HTTP method (e.g., "GET", "POST", "PUT", "DELETE").
27
- */
28
- unregister(topic: UnsTopics, asset: UnsAsset, objectType: UnsObjectType, objectId: UnsObjectId, attribute: UnsAttribute, method: "GET" | "POST" | "PUT" | "DELETE"): Promise<void>;
29
- /**
30
- * Register a GET endpoint with optional JWT path filter.
31
- * @param topic - The API topic
32
- * @param attribute - The attribute for the topic.
33
- * @param options.description - Optional description.
34
- * @param options.tags - Optional tags.
35
- */
36
- get(topic: UnsTopics, asset: UnsAsset, objectType: UnsObjectType, objectId: UnsObjectId, attribute: UnsAttribute, options?: IGetEndpointOptions): Promise<void>;
37
- /**
38
- * Register a catch-all API mapping for a topic prefix (e.g., "sij/acroni/#").
39
- * Does not create individual API attribute nodes; the controller treats this as a fallback.
40
- *
41
- * This is intended for use by the uns-api-global microservice, which acts as a
42
- * catch-all gateway for an entire topic namespace. Regular microservices should
43
- * NOT call this — use registerGetEndpoint() for individual attribute endpoints instead.
44
- */
45
- registerCatchAll(topicPrefix: string, options?: {
46
- apiBase?: string;
47
- apiBasePath?: string;
48
- swaggerPath?: string;
49
- swaggerDoc?: Record<string, unknown>;
50
- apiDescription?: string;
51
- tags?: string[];
52
- queryParams?: IGetEndpointOptions["queryParams"];
53
- }): Promise<void>;
54
- /**
55
- * Register a POST endpoint.
56
- * @param topic - The API topic
57
- * @param attribute - The attribute for the topic.
58
- * @param options.apiDescription - Optional description.
59
- * @param options.tags - Optional tags.
60
- * @param options.requestBody - Optional request body schema for Swagger.
61
- */
62
- post(topic: UnsTopics, asset: UnsAsset, objectType: UnsObjectType, objectId: UnsObjectId, attribute: UnsAttribute, options?: IPostEndpointOptions): Promise<void>;
63
- private emitStatusMetrics;
64
- private registerHealthEndpoint;
65
- private extractBearerToken;
66
- private getPublicKeyFromJwks;
67
- private fetchJwksKeys;
68
- private certFromX5c;
69
- stop(): Promise<void>;
70
- }
1
+ import { UnsAttribute } from "@uns-kit/core/uns/uns-interfaces.js";
2
+ import UnsProxy from "@uns-kit/core/uns/uns-proxy.js";
3
+ import { UnsTopics } from "@uns-kit/core/uns/uns-topics.js";
4
+ import { IApiProxyOptions, IGetEndpointOptions, IPostEndpointOptions } 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";
7
+ export default class UnsApiProxy extends UnsProxy {
8
+ instanceName: string;
9
+ private topicBuilder;
10
+ private processName;
11
+ protected processStatusTopic: string;
12
+ private app;
13
+ private options;
14
+ private apiBasePrefix;
15
+ private swaggerBasePrefix;
16
+ private jwksCache?;
17
+ private catchAllRouteRegistered;
18
+ private startedAt;
19
+ private statusInterval;
20
+ private readonly statusIntervalMs;
21
+ constructor(processName: string, instanceName: string, options: IApiProxyOptions);
22
+ /**
23
+ * Unregister endpoint
24
+ * @param topic - The API topic
25
+ * @param attribute - The attribute for the topic.
26
+ * @param method - The HTTP method (e.g., "GET", "POST", "PUT", "DELETE").
27
+ */
28
+ unregister(topic: UnsTopics, asset: UnsAsset, objectType: UnsObjectType, objectId: UnsObjectId, attribute: UnsAttribute, method: "GET" | "POST" | "PUT" | "DELETE"): Promise<void>;
29
+ /**
30
+ * Register a GET endpoint with optional JWT path filter.
31
+ * @param topic - The API topic
32
+ * @param attribute - The attribute for the topic.
33
+ * @param options.description - Optional description.
34
+ * @param options.tags - Optional tags.
35
+ */
36
+ get(topic: UnsTopics, asset: UnsAsset, objectType: UnsObjectType, objectId: UnsObjectId, attribute: UnsAttribute, options?: IGetEndpointOptions): Promise<void>;
37
+ /**
38
+ * Register a catch-all API mapping for a topic prefix (e.g., "sij/acroni/#").
39
+ * Does not create individual API attribute nodes; the controller treats this as a fallback.
40
+ *
41
+ * This is intended for use by the uns-api-global microservice, which acts as a
42
+ * catch-all gateway for an entire topic namespace. Regular microservices should
43
+ * NOT call this — use registerGetEndpoint() for individual attribute endpoints instead.
44
+ */
45
+ registerCatchAll(topicPrefix: string, options?: {
46
+ apiBase?: string;
47
+ apiBasePath?: string;
48
+ swaggerPath?: string;
49
+ swaggerDoc?: Record<string, unknown>;
50
+ apiDescription?: string;
51
+ tags?: string[];
52
+ queryParams?: IGetEndpointOptions["queryParams"];
53
+ }): Promise<void>;
54
+ /**
55
+ * Register a POST endpoint.
56
+ * @param topic - The API topic
57
+ * @param attribute - The attribute for the topic.
58
+ * @param options.apiDescription - Optional description.
59
+ * @param options.tags - Optional tags.
60
+ * @param options.requestBody - Optional request body schema for Swagger.
61
+ */
62
+ post(topic: UnsTopics, asset: UnsAsset, objectType: UnsObjectType, objectId: UnsObjectId, attribute: UnsAttribute, options?: IPostEndpointOptions): Promise<void>;
63
+ private emitStatusMetrics;
64
+ private registerHealthEndpoint;
65
+ private extractBearerToken;
66
+ private getPublicKeyFromJwks;
67
+ private fetchJwksKeys;
68
+ private certFromX5c;
69
+ stop(): Promise<void>;
70
+ }