@hahnpro/hpc-api 2025.2.13 → 2025.3.1
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 +13 -3
- package/package.json +3 -3
- package/src/lib/data.service.js +1 -1
- package/src/lib/interfaces/ai.interface.d.ts +6 -0
- package/src/lib/interfaces/timeseries.interface.d.ts +1 -0
- package/src/lib/mock/ai.mock.service.d.ts +1 -0
- package/src/lib/mock/ai.mock.service.js +3 -0
- package/src/lib/mock/timeseries.mock.service.d.ts +5 -2
- package/src/lib/mock/timeseries.mock.service.js +4 -2
- package/src/lib/services/ai.service.d.ts +1 -0
- package/src/lib/services/ai.service.js +3 -0
- package/src/lib/services/asset.service.js +2 -5
- package/src/lib/services/timeseries.service.d.ts +11 -4
- package/src/lib/services/timeseries.service.js +10 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @hahnpro/hpc-api
|
|
2
2
|
|
|
3
|
+
## 2025.3.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- URL and method of the `asset::getEventLevelOverride` and `asset:updateEventCausesAsset` have been changed.
|
|
8
|
+
|
|
9
|
+
## 2025.2.15
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- **Breaking Change:** The signature of `timeseries::addAssetTimeSeriesValues` has been changed. Now it includes an additional _metadata_ parameter.
|
|
14
|
+
- **Breaking Change:** The signature of `timeseries::addManyAssetTimeSeriesValues` has been changed. The _timeSeries_ parameter now includes _values_ and _metadata_ fields.
|
|
15
|
+
|
|
3
16
|
## 2025.2.0
|
|
4
17
|
|
|
5
18
|
### Major Changes
|
|
@@ -26,13 +39,11 @@
|
|
|
26
39
|
The third option is to overwrite the `getAccessToken()` method of the `HttpClient`.
|
|
27
40
|
|
|
28
41
|
The hierarchy of options is:
|
|
29
|
-
|
|
30
42
|
1. token from api-call
|
|
31
43
|
2. token from `provideExternalToken`
|
|
32
44
|
3. token from `getAccessToken`
|
|
33
45
|
|
|
34
46
|
# Breaking Changes
|
|
35
|
-
|
|
36
47
|
1. The signature of `flowDeployments::updateOne` has been changed. The positional parameter `force` is now part of the `options` object (where you can also provide a token as described above).
|
|
37
48
|
|
|
38
49
|
## 5.3.4
|
|
@@ -130,7 +141,6 @@
|
|
|
130
141
|
- 19af51f: Updated dependencies to reduce vulnerabilities
|
|
131
142
|
|
|
132
143
|
**Breaking changes**
|
|
133
|
-
|
|
134
144
|
- Raise minimum Node.js version to v18 for hpc-api and flow-sdk packages
|
|
135
145
|
|
|
136
146
|
## 4.1.2
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hahnpro/hpc-api",
|
|
3
|
-
"version": "2025.
|
|
3
|
+
"version": "2025.3.1",
|
|
4
4
|
"description": "Module for easy access to the HahnPRO Cloud API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"url": "https://hahnpro.com"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"axios": "1.
|
|
11
|
+
"axios": "1.10.0",
|
|
12
12
|
"eventsource": "4.0.0",
|
|
13
|
-
"form-data": "4.0.
|
|
13
|
+
"form-data": "4.0.4",
|
|
14
14
|
"jose": "5.10.0",
|
|
15
15
|
"jwt-decode": "4.0.0",
|
|
16
16
|
"p-queue": "6.6.2",
|
package/src/lib/data.service.js
CHANGED
|
@@ -12,7 +12,7 @@ class DataService extends api_base_1.APIBase {
|
|
|
12
12
|
}
|
|
13
13
|
getOne(id, options = {}) {
|
|
14
14
|
const params = options.populate ? { populate: options.populate } : {};
|
|
15
|
-
return this.httpClient.get(`${this.basePath}/${id}`, { params });
|
|
15
|
+
return this.httpClient.get(`${this.basePath}/${id}`, { params, ...options });
|
|
16
16
|
}
|
|
17
17
|
getMany(params = {}, options = {}) {
|
|
18
18
|
params.limit = params.limit || 0;
|
|
@@ -41,6 +41,11 @@ export interface AssistantMessage extends BaseMessage {
|
|
|
41
41
|
}[];
|
|
42
42
|
contextVariables?: Record<string, unknown>;
|
|
43
43
|
finishReason?: 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
|
|
44
|
+
traceId?: string;
|
|
45
|
+
feedback?: {
|
|
46
|
+
value: number;
|
|
47
|
+
comment?: string;
|
|
48
|
+
};
|
|
44
49
|
}
|
|
45
50
|
export interface SystemMessage extends BaseMessage {
|
|
46
51
|
role: 'system';
|
|
@@ -60,6 +65,7 @@ export interface UserMessage extends BaseMessage {
|
|
|
60
65
|
role: 'user';
|
|
61
66
|
content?: string;
|
|
62
67
|
hidden?: boolean;
|
|
68
|
+
useWebSearch?: boolean;
|
|
63
69
|
}
|
|
64
70
|
export type Message = AssistantMessage | SystemMessage | ToolMessage | UserMessage;
|
|
65
71
|
export interface SpeechToken {
|
|
@@ -17,5 +17,6 @@ export declare class AiMockService extends APIBase implements AiService {
|
|
|
17
17
|
getLatestThread(): Promise<ThreadPopulated>;
|
|
18
18
|
listThreads(): Promise<ThreadPopulated[]>;
|
|
19
19
|
listAssistantThreads(assistantId: string): Promise<ThreadPopulated[]>;
|
|
20
|
+
provideFeedback(traceId: string, value: number, comment?: string): Promise<void>;
|
|
20
21
|
deleteThread(threadId: string): Promise<Thread>;
|
|
21
22
|
}
|
|
@@ -36,6 +36,9 @@ class AiMockService extends api_base_1.APIBase {
|
|
|
36
36
|
listAssistantThreads(assistantId) {
|
|
37
37
|
throw new Error('Method not implemented.');
|
|
38
38
|
}
|
|
39
|
+
provideFeedback(traceId, value, comment) {
|
|
40
|
+
throw new Error('Method not implemented.');
|
|
41
|
+
}
|
|
39
42
|
deleteThread(threadId) {
|
|
40
43
|
throw new Error('Method not implemented.');
|
|
41
44
|
}
|
|
@@ -22,10 +22,13 @@ export declare class TimeseriesMockService extends BaseService implements TimeSe
|
|
|
22
22
|
})[]>>;
|
|
23
23
|
addAssetTimeSeriesValues(assetId: string, name: string, readPermissions: string[], readWritePermissions: string[], values: {
|
|
24
24
|
[timestamp: string]: any;
|
|
25
|
-
}): Promise<TimeSeries>;
|
|
25
|
+
}, metadata?: Record<string, any>): Promise<TimeSeries>;
|
|
26
26
|
addManyAssetTimeSeriesValues(assetId: string, readPermissions: string[], readWritePermissions: string[], timeSeries: {
|
|
27
27
|
[timeSeriesName: string]: {
|
|
28
|
-
|
|
28
|
+
values: {
|
|
29
|
+
[timestamp: string]: any;
|
|
30
|
+
};
|
|
31
|
+
metadata?: Record<string, any>;
|
|
29
32
|
};
|
|
30
33
|
}): Promise<PromiseSettledResult<TimeSeries>[]>;
|
|
31
34
|
addValue(id: string, value: {
|
|
@@ -29,7 +29,7 @@ class TimeseriesMockService extends BaseService {
|
|
|
29
29
|
const page = this.getItems(params, false);
|
|
30
30
|
return Promise.resolve(page);
|
|
31
31
|
}
|
|
32
|
-
addAssetTimeSeriesValues(assetId, name, readPermissions, readWritePermissions, values) {
|
|
32
|
+
addAssetTimeSeriesValues(assetId, name, readPermissions, readWritePermissions, values, metadata) {
|
|
33
33
|
const ts = this.data.find((v) => v.assetRef === assetId);
|
|
34
34
|
const data = Object.entries(values).map(([timestamp, value]) => {
|
|
35
35
|
if (value !== null && typeof value === 'object') {
|
|
@@ -52,6 +52,7 @@ class TimeseriesMockService extends BaseService {
|
|
|
52
52
|
readWritePermissions,
|
|
53
53
|
assetRef: assetId,
|
|
54
54
|
data,
|
|
55
|
+
metadata,
|
|
55
56
|
};
|
|
56
57
|
return this.addOne(dto);
|
|
57
58
|
}
|
|
@@ -61,7 +62,7 @@ class TimeseriesMockService extends BaseService {
|
|
|
61
62
|
addManyAssetTimeSeriesValues(assetId, readPermissions, readWritePermissions, timeSeries) {
|
|
62
63
|
const ts = this.data.find((v) => v.assetRef === assetId);
|
|
63
64
|
const psr = [];
|
|
64
|
-
for (const [tsName, values] of Object.entries(timeSeries)) {
|
|
65
|
+
for (const [tsName, { values, metadata }] of Object.entries(timeSeries)) {
|
|
65
66
|
const data = Object.entries(values).map(([timestamp, value]) => {
|
|
66
67
|
if (value !== null && typeof value === 'object') {
|
|
67
68
|
return { timestamp, ...value };
|
|
@@ -83,6 +84,7 @@ class TimeseriesMockService extends BaseService {
|
|
|
83
84
|
readWritePermissions,
|
|
84
85
|
assetRef: assetId,
|
|
85
86
|
data,
|
|
87
|
+
metadata,
|
|
86
88
|
};
|
|
87
89
|
this.addOne(dto).then((v) => psr.push({ status: 'fulfilled', value: v }));
|
|
88
90
|
}
|
|
@@ -15,5 +15,6 @@ export declare class AiService extends APIBase {
|
|
|
15
15
|
getThread(threadId: string): Promise<ThreadPopulated>;
|
|
16
16
|
getLatestThread(): Promise<ThreadPopulated>;
|
|
17
17
|
listThreads(assistantIds?: string[], params?: {}, options?: TokenOption): Promise<ThreadPopulated[]>;
|
|
18
|
+
provideFeedback(traceId: string, value: number, comment?: string): Promise<void>;
|
|
18
19
|
deleteThread(threadId: string): Promise<Thread>;
|
|
19
20
|
}
|
|
@@ -42,6 +42,9 @@ class AiService extends api_base_1.APIBase {
|
|
|
42
42
|
}
|
|
43
43
|
return this.httpClient.get(`${this.basePath}/threads`, { params, ...options });
|
|
44
44
|
}
|
|
45
|
+
provideFeedback(traceId, value, comment) {
|
|
46
|
+
return this.httpClient.post(`${this.basePath}/feedback`, { traceId, value, comment });
|
|
47
|
+
}
|
|
45
48
|
deleteThread(threadId) {
|
|
46
49
|
return this.httpClient.delete(`${this.basePath}/threads/${threadId}`);
|
|
47
50
|
}
|
|
@@ -34,13 +34,10 @@ class AssetService extends BaseService {
|
|
|
34
34
|
return this.httpClient.get(`${this.basePath}/${assetId}/attachments`, options);
|
|
35
35
|
}
|
|
36
36
|
getEventLevelOverride(ids, causes, options = {}) {
|
|
37
|
-
return this.httpClient.
|
|
38
|
-
params: { ids: ids.join(','), causes: causes.join(',') },
|
|
39
|
-
...options,
|
|
40
|
-
});
|
|
37
|
+
return this.httpClient.post(`${this.basePath}/event-causes`, { ids, causes }, options);
|
|
41
38
|
}
|
|
42
39
|
updateEventCausesAsset(id, dto, options = {}) {
|
|
43
|
-
return this.httpClient.put(`${this.basePath}/${id}/
|
|
40
|
+
return this.httpClient.put(`${this.basePath}/${id}/event-causes`, dto, options);
|
|
44
41
|
}
|
|
45
42
|
getRevisions(assetId, options = {}) {
|
|
46
43
|
return this.httpClient.get(`${this.basePath}/${assetId}/revisions`, options);
|
|
@@ -26,11 +26,12 @@ export declare class TimeSeriesService extends BaseService {
|
|
|
26
26
|
* ...
|
|
27
27
|
* }
|
|
28
28
|
* @param options
|
|
29
|
+
* @param metadata - Optional metadata to be associated with the time series.
|
|
29
30
|
* @returns a promise that resolves to the time series that was added.
|
|
30
31
|
*/
|
|
31
32
|
addAssetTimeSeriesValues(assetId: string, name: string, readPermissions: string[], readWritePermissions: string[], values: {
|
|
32
33
|
[timestamp: string]: any;
|
|
33
|
-
}, options?: TokenOption): Promise<TimeSeries>;
|
|
34
|
+
}, metadata?: Record<string, any>, options?: TokenOption): Promise<TimeSeries>;
|
|
34
35
|
/**
|
|
35
36
|
* Adds multiple time series values to an asset by the name of the time series.
|
|
36
37
|
* If the time series does not exist, it is created.
|
|
@@ -42,8 +43,11 @@ export declare class TimeSeriesService extends BaseService {
|
|
|
42
43
|
* @param timeSeries - The time series values are specified as an object with the following structure:
|
|
43
44
|
* {
|
|
44
45
|
* [timeSeriesName: string]: { // The name of the time series
|
|
45
|
-
*
|
|
46
|
-
*
|
|
46
|
+
* values: { // The time series values are specified as an object with the following structure:
|
|
47
|
+
* [timestamp: string]: any, // The timestamp and value pairs
|
|
48
|
+
* ...
|
|
49
|
+
* },
|
|
50
|
+
* metadata?: Record<string, any>, // Optional metadata to be associated with the time series
|
|
47
51
|
* },
|
|
48
52
|
* ...
|
|
49
53
|
* }
|
|
@@ -58,7 +62,10 @@ export declare class TimeSeriesService extends BaseService {
|
|
|
58
62
|
*/
|
|
59
63
|
addManyAssetTimeSeriesValues(assetId: string, readPermissions: string[], readWritePermissions: string[], timeSeries: {
|
|
60
64
|
[timeSeriesName: string]: {
|
|
61
|
-
|
|
65
|
+
values: {
|
|
66
|
+
[timestamp: string]: any;
|
|
67
|
+
};
|
|
68
|
+
metadata?: Record<string, any>;
|
|
62
69
|
};
|
|
63
70
|
}, options?: TokenOption): Promise<PromiseSettledResult<TimeSeries>[]>;
|
|
64
71
|
getMostRecentValue(id: string, before?: Date, options?: TokenOption): Promise<TimeSeriesValue>;
|
|
@@ -31,14 +31,16 @@ class TimeSeriesService extends BaseService {
|
|
|
31
31
|
* ...
|
|
32
32
|
* }
|
|
33
33
|
* @param options
|
|
34
|
+
* @param metadata - Optional metadata to be associated with the time series.
|
|
34
35
|
* @returns a promise that resolves to the time series that was added.
|
|
35
36
|
*/
|
|
36
|
-
addAssetTimeSeriesValues(assetId, name, readPermissions, readWritePermissions, values, options = {}) {
|
|
37
|
+
addAssetTimeSeriesValues(assetId, name, readPermissions, readWritePermissions, values, metadata, options = {}) {
|
|
37
38
|
const dto = {
|
|
38
39
|
name,
|
|
39
40
|
readPermissions,
|
|
40
41
|
readWritePermissions,
|
|
41
42
|
values,
|
|
43
|
+
metadata,
|
|
42
44
|
};
|
|
43
45
|
return this.httpClient.post(`${this.basePath}/assets/${assetId}`, dto, options);
|
|
44
46
|
}
|
|
@@ -53,8 +55,11 @@ class TimeSeriesService extends BaseService {
|
|
|
53
55
|
* @param timeSeries - The time series values are specified as an object with the following structure:
|
|
54
56
|
* {
|
|
55
57
|
* [timeSeriesName: string]: { // The name of the time series
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
+
* values: { // The time series values are specified as an object with the following structure:
|
|
59
|
+
* [timestamp: string]: any, // The timestamp and value pairs
|
|
60
|
+
* ...
|
|
61
|
+
* },
|
|
62
|
+
* metadata?: Record<string, any>, // Optional metadata to be associated with the time series
|
|
58
63
|
* },
|
|
59
64
|
* ...
|
|
60
65
|
* }
|
|
@@ -68,11 +73,12 @@ class TimeSeriesService extends BaseService {
|
|
|
68
73
|
* }
|
|
69
74
|
*/
|
|
70
75
|
addManyAssetTimeSeriesValues(assetId, readPermissions, readWritePermissions, timeSeries, options = {}) {
|
|
71
|
-
const dtos = Object.entries(timeSeries).map(([name, values]) => ({
|
|
76
|
+
const dtos = Object.entries(timeSeries).map(([name, { values, metadata }]) => ({
|
|
72
77
|
name,
|
|
73
78
|
readPermissions,
|
|
74
79
|
readWritePermissions,
|
|
75
80
|
values,
|
|
81
|
+
metadata,
|
|
76
82
|
}));
|
|
77
83
|
return this.httpClient.post(`${this.basePath}/assets/${assetId}/bulk`, dtos, options);
|
|
78
84
|
}
|