@hahnpro/hpc-api 1.0.1 → 2.0.0
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/LICENSE +21 -0
- package/dist/api.js +4 -1
- package/dist/asset.interface.d.ts +22 -18
- package/dist/asset.service.js +1 -1
- package/dist/assettypes.service.js +1 -1
- package/dist/content.service.js +1 -1
- package/dist/endpoint.interface.d.ts +13 -3
- package/dist/endpoint.service.d.ts +2 -2
- package/dist/endpoint.service.js +3 -4
- package/dist/events.service.js +1 -1
- package/dist/http.service.d.ts +1 -1
- package/dist/http.service.js +4 -5
- package/dist/mock/api.mock.d.ts +24 -113
- package/dist/mock/api.mock.js +3 -6
- package/dist/mock/endpoint.mock.service.d.ts +2 -2
- package/dist/mock/endpoint.mock.service.js +1 -1
- package/dist/proxy.service.js +1 -1
- package/dist/secret.service.js +1 -1
- package/dist/sidriveiq.service.js +1 -1
- package/dist/task.service.js +1 -1
- package/dist/timeseries.service.js +1 -1
- package/package.json +3 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Hahn PRO
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/api.js
CHANGED
|
@@ -15,19 +15,22 @@ const timeseries_service_1 = require("./timeseries.service");
|
|
|
15
15
|
const user_service_1 = require("./user.service");
|
|
16
16
|
class API {
|
|
17
17
|
constructor() {
|
|
18
|
+
const normalizePath = (value = '', defaultValue = '') => value.replace(/^\/+|\/+$/g, '') || defaultValue;
|
|
18
19
|
let apiBaseUrl = process.env.API_BASE_URL || 'https://testing.hahnpro.com';
|
|
19
20
|
if (!apiBaseUrl.startsWith('https') && !apiBaseUrl.startsWith('http')) {
|
|
20
21
|
console.info('no protocol specified - using HTTPS');
|
|
21
22
|
apiBaseUrl = `https://${apiBaseUrl}`;
|
|
22
23
|
}
|
|
24
|
+
const apiUrl = apiBaseUrl + '/' + normalizePath(process.env.API_BASE_PATH, 'api');
|
|
23
25
|
const authBaseUrl = process.env.AUTH_BASE_URL || apiBaseUrl;
|
|
26
|
+
const authUrl = authBaseUrl + '/' + normalizePath(process.env.AUTH_BASE_PATH, 'auth');
|
|
24
27
|
const realm = process.env.AUTH_REALM || 'hpc';
|
|
25
28
|
const client = process.env.API_USER || 'flow-executor-service';
|
|
26
29
|
const secret = process.env.AUTH_SECRET;
|
|
27
30
|
if (!secret) {
|
|
28
31
|
throw new Error('"API_BASE_URL", "API_USER", "AUTH_REALM" and "AUTH_SECRET" environment variables must be set');
|
|
29
32
|
}
|
|
30
|
-
this.httpClient = new http_service_1.HttpClient(
|
|
33
|
+
this.httpClient = new http_service_1.HttpClient(apiUrl, authUrl, realm, client, secret);
|
|
31
34
|
this.assets = new asset_service_1.AssetService(this.httpClient);
|
|
32
35
|
this.assetTypes = new assettypes_service_1.AssetTypesService(this.httpClient);
|
|
33
36
|
this.contents = new content_service_1.ContentService(this.httpClient);
|
|
@@ -1,33 +1,37 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface AssetType {
|
|
2
2
|
id?: string;
|
|
3
3
|
name: string;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
tags?: string[];
|
|
5
|
+
allowedParents?: string[];
|
|
6
|
+
allowedParent$name?: string;
|
|
6
7
|
readPermissions: string[];
|
|
7
8
|
readWritePermissions: string[];
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
attachments?: string[];
|
|
13
|
-
image?: string;
|
|
9
|
+
supertype?: string;
|
|
10
|
+
supertype$name?: string;
|
|
11
|
+
typeSchema: any;
|
|
12
|
+
uiSchema: any;
|
|
14
13
|
actions?: string[];
|
|
15
|
-
notificationEndpoints?: string[];
|
|
16
14
|
createdAt?: string;
|
|
17
15
|
updatedAt?: string;
|
|
18
16
|
}
|
|
19
|
-
export interface
|
|
17
|
+
export interface Asset {
|
|
20
18
|
id?: string;
|
|
21
19
|
name: string;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
allowedParent$name?: string;
|
|
20
|
+
type: string | AssetType;
|
|
21
|
+
type$name?: string;
|
|
25
22
|
readPermissions: string[];
|
|
26
23
|
readWritePermissions: string[];
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
parent?: any | Asset;
|
|
25
|
+
parent$name?: string;
|
|
26
|
+
ancestors?: string[];
|
|
27
|
+
tags?: string[];
|
|
28
|
+
relations?: any[];
|
|
29
|
+
data?: any;
|
|
30
|
+
image?: string;
|
|
31
|
+
author?: string;
|
|
32
|
+
revision?: number;
|
|
33
|
+
attachments?: string[];
|
|
34
|
+
notificationEndpoints?: string[];
|
|
31
35
|
actions?: string[];
|
|
32
36
|
createdAt?: string;
|
|
33
37
|
updatedAt?: string;
|
package/dist/asset.service.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.AssetService = void 0;
|
|
|
4
4
|
const data_service_1 = require("./data.service");
|
|
5
5
|
class AssetService extends data_service_1.DataService {
|
|
6
6
|
constructor(httpClient) {
|
|
7
|
-
super(httpClient,
|
|
7
|
+
super(httpClient, '/assets');
|
|
8
8
|
this.addAttachment = (id, form) => {
|
|
9
9
|
const headers = Object.assign({}, form.getHeaders());
|
|
10
10
|
return this.httpClient.post(`${this.basePath}/${id}/attachment`, form, {
|
|
@@ -4,7 +4,7 @@ exports.AssetTypesService = void 0;
|
|
|
4
4
|
const data_service_1 = require("./data.service");
|
|
5
5
|
class AssetTypesService extends data_service_1.DataService {
|
|
6
6
|
constructor(httpClient) {
|
|
7
|
-
super(httpClient, '
|
|
7
|
+
super(httpClient, '/assettypes');
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
exports.AssetTypesService = AssetTypesService;
|
package/dist/content.service.js
CHANGED
|
@@ -5,7 +5,7 @@ const content_interface_1 = require("./content.interface");
|
|
|
5
5
|
const data_service_1 = require("./data.service");
|
|
6
6
|
class ContentService extends data_service_1.DataService {
|
|
7
7
|
constructor(httpClient) {
|
|
8
|
-
super(httpClient,
|
|
8
|
+
super(httpClient, '/contents');
|
|
9
9
|
this.upload = (form) => {
|
|
10
10
|
const headers = Object.assign({}, form.getHeaders());
|
|
11
11
|
return this.httpClient.post(`${this.basePath}`, form, { headers, maxBodyLength: Infinity, maxContentLength: Infinity });
|
|
@@ -9,9 +9,9 @@ export interface Endpoint {
|
|
|
9
9
|
authToken: string;
|
|
10
10
|
recipients?: string[];
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
notificationCheckInterval: number;
|
|
13
|
+
notificationPauseInterval: number;
|
|
14
|
+
nbOfNotificationsBetweenPauseInterval: number;
|
|
15
15
|
readPermissions: string[];
|
|
16
16
|
readWritePermissions: string[];
|
|
17
17
|
}
|
|
@@ -23,3 +23,13 @@ export interface EndpointLog {
|
|
|
23
23
|
group?: string;
|
|
24
24
|
updatedAt?: string;
|
|
25
25
|
}
|
|
26
|
+
export interface NotificationPayload {
|
|
27
|
+
subject: string;
|
|
28
|
+
message: string;
|
|
29
|
+
group?: string;
|
|
30
|
+
level?: string;
|
|
31
|
+
eventLink?: string;
|
|
32
|
+
assetId?: string;
|
|
33
|
+
assetName?: string;
|
|
34
|
+
assetLink?: string;
|
|
35
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { HttpClient } from './http.service';
|
|
2
2
|
import { DataService } from './data.service';
|
|
3
|
-
import { Endpoint, EndpointLog } from './endpoint.interface';
|
|
3
|
+
import { Endpoint, NotificationPayload, EndpointLog } from './endpoint.interface';
|
|
4
4
|
export declare class EndpointService extends DataService<Endpoint> {
|
|
5
5
|
constructor(httpClient: HttpClient);
|
|
6
|
-
sendNotification(endpointId: string,
|
|
6
|
+
sendNotification(endpointId: string, payload: NotificationPayload): Promise<void>;
|
|
7
7
|
readLastLogByGroup(endpointId: string, group: string): Promise<EndpointLog>;
|
|
8
8
|
}
|
package/dist/endpoint.service.js
CHANGED
|
@@ -4,11 +4,10 @@ exports.EndpointService = void 0;
|
|
|
4
4
|
const data_service_1 = require("./data.service");
|
|
5
5
|
class EndpointService extends data_service_1.DataService {
|
|
6
6
|
constructor(httpClient) {
|
|
7
|
-
super(httpClient,
|
|
7
|
+
super(httpClient, '/notification/endpoints');
|
|
8
8
|
}
|
|
9
|
-
sendNotification(endpointId,
|
|
10
|
-
|
|
11
|
-
return this.httpClient.post(`${this.basePath}/${endpointId}`, body);
|
|
9
|
+
sendNotification(endpointId, payload) {
|
|
10
|
+
return this.httpClient.post(`${this.basePath}/${endpointId}`, payload);
|
|
12
11
|
}
|
|
13
12
|
readLastLogByGroup(endpointId, group) {
|
|
14
13
|
return this.httpClient.get(`${this.basePath}/${endpointId}/logs/${group}/last`);
|
package/dist/events.service.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.EventsService = void 0;
|
|
|
4
4
|
const data_service_1 = require("./data.service");
|
|
5
5
|
class EventsService extends data_service_1.DataService {
|
|
6
6
|
constructor(httpClient) {
|
|
7
|
-
super(httpClient,
|
|
7
|
+
super(httpClient, '/events');
|
|
8
8
|
}
|
|
9
9
|
getLastEventByAssetAndGroup(assetId, group) {
|
|
10
10
|
return this.httpClient.get(`${this.basePath}/last/${assetId}/${group}`);
|
package/dist/http.service.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare class HttpClient {
|
|
|
8
8
|
private readonly requestQueue;
|
|
9
9
|
private accessToken;
|
|
10
10
|
private accessTokenExpiration;
|
|
11
|
-
constructor(
|
|
11
|
+
constructor(baseURL: string, authbaseURL: string, realm: string, client: string, secret: string);
|
|
12
12
|
getQueueStats: () => {
|
|
13
13
|
peak: number;
|
|
14
14
|
pending: number;
|
package/dist/http.service.js
CHANGED
|
@@ -6,7 +6,7 @@ const axios_1 = (0, tslib_1.__importDefault)(require("axios"));
|
|
|
6
6
|
const Queue_1 = require("./Queue");
|
|
7
7
|
const EXPIRATION_BUFFER = 30 * 1000;
|
|
8
8
|
class HttpClient {
|
|
9
|
-
constructor(
|
|
9
|
+
constructor(baseURL, authbaseURL, realm, client, secret) {
|
|
10
10
|
this.realm = realm;
|
|
11
11
|
this.client = client;
|
|
12
12
|
this.secret = secret;
|
|
@@ -50,7 +50,7 @@ class HttpClient {
|
|
|
50
50
|
]);
|
|
51
51
|
const headers = { 'Content-Type': 'application/x-www-form-urlencoded' };
|
|
52
52
|
this.authAxiosInstance
|
|
53
|
-
.post(`/
|
|
53
|
+
.post(`/realms/${this.realm}/protocol/openid-connect/token`, params.toString(), { headers })
|
|
54
54
|
.then((res) => {
|
|
55
55
|
var _a;
|
|
56
56
|
if (((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.access_token) && res.data.expires_in) {
|
|
@@ -65,9 +65,8 @@ class HttpClient {
|
|
|
65
65
|
.catch(reject);
|
|
66
66
|
});
|
|
67
67
|
};
|
|
68
|
-
|
|
69
|
-
this.
|
|
70
|
-
this.authAxiosInstance = axios_1.default.create({ baseURL: authBaseUrl, timeout: 10000 });
|
|
68
|
+
this.axiosInstance = axios_1.default.create({ baseURL, timeout: 60000 });
|
|
69
|
+
this.authAxiosInstance = axios_1.default.create({ baseURL: authbaseURL || baseURL, timeout: 10000 });
|
|
71
70
|
this.requestQueue = new Queue_1.Queue({ concurrency: 1, timeout: 70000, throwOnTimeout: true });
|
|
72
71
|
}
|
|
73
72
|
}
|
package/dist/mock/api.mock.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { API } from '../api';
|
|
2
|
-
import { Asset } from '../asset.interface';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { Asset, AssetType } from '../asset.interface';
|
|
3
|
+
import { Content } from '../content.interface';
|
|
4
|
+
import { Secret } from '../secret.interface';
|
|
5
|
+
import { TimeSeries, TimeSeriesValue } from '../timeseries.interface';
|
|
5
6
|
import { AssetMockService } from './asset.mock.service';
|
|
6
7
|
import { AssetTypesMockService } from './assetTypes.mock.service';
|
|
7
8
|
import { ContentMockService } from './content.mock.service';
|
|
9
|
+
import { Endpoint } from '../endpoint.interface';
|
|
8
10
|
import { EndpointMockService } from './endpoint.mock.service';
|
|
11
|
+
import { Event } from '../events.interface';
|
|
9
12
|
import { EventsMockService } from './events.mock.service';
|
|
10
13
|
import { SecretMockService } from './secret.mock.service';
|
|
14
|
+
import { Task } from '../task.interface';
|
|
11
15
|
import { TimeseriesMockService } from './timeseries.mock.service';
|
|
12
16
|
import { TaskMockService } from './task.mock.service';
|
|
13
17
|
import { UserMockService } from './user.mock.service';
|
|
@@ -43,119 +47,26 @@ export declare class MockAPI implements API {
|
|
|
43
47
|
users?: UserInit;
|
|
44
48
|
});
|
|
45
49
|
}
|
|
46
|
-
export
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
parent$name?: string;
|
|
57
|
-
data?: any;
|
|
58
|
-
actions?: string[];
|
|
59
|
-
image?: string;
|
|
60
|
-
attachments?: string[];
|
|
61
|
-
createdAt?: string;
|
|
62
|
-
updatedAt?: string;
|
|
63
|
-
}
|
|
64
|
-
export interface AssetTypeInit {
|
|
65
|
-
id: string;
|
|
66
|
-
name: string;
|
|
67
|
-
allowedParent?: string;
|
|
68
|
-
allowedParent$name?: string;
|
|
69
|
-
readPermissions?: string[];
|
|
70
|
-
readWritePermissions?: string[];
|
|
71
|
-
typeSchema?: any;
|
|
72
|
-
uiSchema?: any;
|
|
73
|
-
supertype?: string;
|
|
74
|
-
supertype$name?: string;
|
|
75
|
-
actions?: string[];
|
|
76
|
-
}
|
|
77
|
-
export interface ContentInit {
|
|
78
|
-
id: string;
|
|
79
|
-
fileId?: string;
|
|
80
|
-
filename: string;
|
|
50
|
+
export declare type Identity<T> = {
|
|
51
|
+
[P in keyof T]: T[P];
|
|
52
|
+
};
|
|
53
|
+
export declare type AtLeast<T, K extends keyof T> = Identity<Partial<T> & Pick<T, K>>;
|
|
54
|
+
export declare type Replace<T, K extends keyof T, TReplace> = Identity<Pick<T, Exclude<keyof T, K>> & {
|
|
55
|
+
[P in K]: TReplace;
|
|
56
|
+
}>;
|
|
57
|
+
export declare type AssetInit = Replace<AtLeast<Asset, 'id' | 'name' | 'type'>, 'type', AssetTypeInit | string>;
|
|
58
|
+
export declare type AssetTypeInit = AtLeast<AssetType, 'id' | 'name'>;
|
|
59
|
+
export declare type ContentInit = Identity<AtLeast<Content, 'id' | 'filename'> & {
|
|
81
60
|
filePath?: string;
|
|
82
|
-
mimetype?: string;
|
|
83
|
-
size?: number;
|
|
84
|
-
readPermissions?: string[];
|
|
85
|
-
readWritePermissions?: string[];
|
|
86
|
-
tags?: string[];
|
|
87
|
-
assets?: string[];
|
|
88
|
-
files?: Storage[];
|
|
89
|
-
createdAt?: string;
|
|
90
|
-
updatedAt?: string;
|
|
91
61
|
data?: any;
|
|
92
|
-
}
|
|
93
|
-
export
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
description?: string;
|
|
97
|
-
status?: string;
|
|
98
|
-
config?: {
|
|
99
|
-
type: string;
|
|
100
|
-
url?: string;
|
|
101
|
-
authToken: string;
|
|
102
|
-
recipients?: string[];
|
|
103
|
-
};
|
|
104
|
-
notificationCheck?: number;
|
|
105
|
-
notificationCount?: number;
|
|
106
|
-
notificationPause?: number;
|
|
107
|
-
readPermissions?: string[];
|
|
108
|
-
readWritePermissions?: string[];
|
|
109
|
-
}
|
|
110
|
-
export interface SecretInit {
|
|
111
|
-
id?: string;
|
|
112
|
-
name: string;
|
|
113
|
-
key: string;
|
|
114
|
-
readPermissions?: string[];
|
|
115
|
-
readWritePermissions?: string[];
|
|
116
|
-
}
|
|
117
|
-
export interface TimeSeriesInit {
|
|
118
|
-
id: string;
|
|
119
|
-
name: string;
|
|
120
|
-
assetRef?: string;
|
|
121
|
-
assetRef$name?: string;
|
|
122
|
-
assetTsId?: string;
|
|
123
|
-
minDate?: Date;
|
|
124
|
-
tsRef?: [string];
|
|
125
|
-
metrics?: string[];
|
|
62
|
+
}>;
|
|
63
|
+
export declare type EndpointInit = AtLeast<Endpoint, 'name'>;
|
|
64
|
+
export declare type SecretInit = AtLeast<Secret, 'name' | 'key'>;
|
|
65
|
+
export declare type TimeSeriesInit = Identity<AtLeast<TimeSeries, 'id' | 'name'> & {
|
|
126
66
|
values: TimeSeriesValue[];
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
export interface TaskInit {
|
|
131
|
-
id?: string;
|
|
132
|
-
name: string;
|
|
133
|
-
readPermissions?: string[];
|
|
134
|
-
readWritePermissions?: string[];
|
|
135
|
-
assetRef?: string;
|
|
136
|
-
assetRef$name?: string;
|
|
137
|
-
subTasks?: string[];
|
|
138
|
-
assignedTo: string[];
|
|
139
|
-
status?: string;
|
|
140
|
-
acceptedBy?: string;
|
|
141
|
-
}
|
|
142
|
-
export interface EventInit {
|
|
143
|
-
id?: string;
|
|
144
|
-
name: string;
|
|
145
|
-
tags?: string[];
|
|
146
|
-
readPermissions?: string[];
|
|
147
|
-
readWritePermissions?: string[];
|
|
148
|
-
assetRef?: string;
|
|
149
|
-
assetRef$name?: string;
|
|
150
|
-
alertRef?: string;
|
|
151
|
-
alertRef$name?: string;
|
|
152
|
-
tsRef?: string;
|
|
153
|
-
tsRef$name?: string;
|
|
154
|
-
eventRef?: string;
|
|
155
|
-
cause?: string;
|
|
156
|
-
level?: string;
|
|
157
|
-
group?: string;
|
|
158
|
-
}
|
|
67
|
+
}>;
|
|
68
|
+
export declare type TaskInit = AtLeast<Task, 'name' | 'assignedTo'>;
|
|
69
|
+
export declare type EventInit = AtLeast<Event, 'name'>;
|
|
159
70
|
export interface UserInit {
|
|
160
71
|
roles: string[];
|
|
161
72
|
}
|
package/dist/mock/api.mock.js
CHANGED
|
@@ -58,9 +58,9 @@ class MockAPI {
|
|
|
58
58
|
description: value.description,
|
|
59
59
|
status: value.status,
|
|
60
60
|
config: value.config,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
notificationCheckInterval: value.notificationCheckInterval,
|
|
62
|
+
notificationPauseInterval: value.notificationPauseInterval,
|
|
63
|
+
nbOfNotificationsBetweenPauseInterval: value.nbOfNotificationsBetweenPauseInterval,
|
|
64
64
|
readPermissions: [],
|
|
65
65
|
readWritePermissions: [],
|
|
66
66
|
}));
|
|
@@ -70,7 +70,6 @@ class MockAPI {
|
|
|
70
70
|
readPermissions: [],
|
|
71
71
|
readWritePermissions: [],
|
|
72
72
|
assetRef: v.assetRef,
|
|
73
|
-
assetRef$name: v.assetRef$name,
|
|
74
73
|
subTasks: [],
|
|
75
74
|
assignedTo: v.assignedTo,
|
|
76
75
|
status: v.status,
|
|
@@ -84,9 +83,7 @@ class MockAPI {
|
|
|
84
83
|
assetRef: v.assetRef,
|
|
85
84
|
assetRef$name: v.assetRef$name,
|
|
86
85
|
alertRef: v.alertRef,
|
|
87
|
-
alertRef$name: v.alertRef$name,
|
|
88
86
|
tsRef: v.tsRef,
|
|
89
|
-
tsRef$name: v.tsRef$name,
|
|
90
87
|
tags: v.tags,
|
|
91
88
|
cause: v.cause,
|
|
92
89
|
level: v.level,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Endpoint } from '../endpoint.interface';
|
|
1
|
+
import { Endpoint, NotificationPayload } from '../endpoint.interface';
|
|
2
2
|
import { EndpointService } from '../endpoint.service';
|
|
3
3
|
import { DataMockService } from './data.mock.service';
|
|
4
4
|
export declare class EndpointMockService extends DataMockService<Endpoint> implements EndpointService {
|
|
5
5
|
constructor(endpoints: Endpoint[]);
|
|
6
|
-
sendNotification(endpointId: string,
|
|
6
|
+
sendNotification(endpointId: string, payload: NotificationPayload): Promise<void>;
|
|
7
7
|
readLastLogByGroup(endpointId: string, group: string): Promise<{
|
|
8
8
|
id: string;
|
|
9
9
|
endpoint: string;
|
|
@@ -7,7 +7,7 @@ class EndpointMockService extends data_mock_service_1.DataMockService {
|
|
|
7
7
|
super();
|
|
8
8
|
this.data = endpoints;
|
|
9
9
|
}
|
|
10
|
-
sendNotification(endpointId,
|
|
10
|
+
sendNotification(endpointId, payload) {
|
|
11
11
|
return Promise.resolve();
|
|
12
12
|
}
|
|
13
13
|
readLastLogByGroup(endpointId, group) {
|
package/dist/proxy.service.js
CHANGED
package/dist/secret.service.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.SecretService = void 0;
|
|
|
4
4
|
const data_service_1 = require("./data.service");
|
|
5
5
|
class SecretService extends data_service_1.DataService {
|
|
6
6
|
constructor(httpClient) {
|
|
7
|
-
super(httpClient,
|
|
7
|
+
super(httpClient, '/secrets');
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
exports.SecretService = SecretService;
|
|
@@ -4,7 +4,7 @@ exports.SiDriveIqService = void 0;
|
|
|
4
4
|
class SiDriveIqService {
|
|
5
5
|
constructor(httpClient) {
|
|
6
6
|
this.httpClient = httpClient;
|
|
7
|
-
this.basePath = '
|
|
7
|
+
this.basePath = '/proxy/sidrive/api/v0';
|
|
8
8
|
}
|
|
9
9
|
getAssets(params = {}) {
|
|
10
10
|
return this.httpClient.get(`${this.basePath}/assets`, { params });
|
package/dist/task.service.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.TaskService = void 0;
|
|
|
4
4
|
const data_service_1 = require("./data.service");
|
|
5
5
|
class TaskService extends data_service_1.DataService {
|
|
6
6
|
constructor(httpClient) {
|
|
7
|
-
super(httpClient,
|
|
7
|
+
super(httpClient, '/tasks');
|
|
8
8
|
}
|
|
9
9
|
createTaskAttachedToAsset(dto) {
|
|
10
10
|
return this.httpClient.post(this.basePath, dto);
|
|
@@ -4,7 +4,7 @@ exports.TimeSeriesService = void 0;
|
|
|
4
4
|
const data_service_1 = require("./data.service");
|
|
5
5
|
class TimeSeriesService extends data_service_1.DataService {
|
|
6
6
|
constructor(httpClient) {
|
|
7
|
-
super(httpClient,
|
|
7
|
+
super(httpClient, '/tsm');
|
|
8
8
|
}
|
|
9
9
|
addValue(id, value) {
|
|
10
10
|
return this.httpClient.post(`${this.basePath}/${id}`, value);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hahnpro/hpc-api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Module for easy access to the HahnPRO API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "git@
|
|
12
|
+
"url": "git@github.com:hahnprojects/flow.git"
|
|
13
13
|
},
|
|
14
14
|
"directories": {
|
|
15
15
|
"lib": "lib",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"axios": "^0.
|
|
27
|
+
"axios": "^0.25.0",
|
|
28
28
|
"form-data": "^4.0.0",
|
|
29
29
|
"jwt-decode": "^3.1.2",
|
|
30
30
|
"p-queue": "^6.6.2"
|