@hahnpro/flow-sdk 4.16.0 → 4.19.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/dist/FlowApplication.d.ts +2 -2
- package/dist/FlowApplication.js +2 -2
- package/dist/FlowElement.d.ts +2 -1
- package/dist/FlowElement.js +14 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +12 -16
- package/dist/api/Queue.d.ts +0 -15
- package/dist/api/Queue.js +0 -27
- package/dist/api/api.d.ts +0 -62
- package/dist/api/api.js +0 -52
- package/dist/api/asset.interface.d.ts +0 -54
- package/dist/api/asset.interface.js +0 -2
- package/dist/api/asset.service.d.ts +0 -10
- package/dist/api/asset.service.js +0 -21
- package/dist/api/assettypes.service.d.ts +0 -6
- package/dist/api/assettypes.service.js +0 -10
- package/dist/api/content.interface.d.ts +0 -35
- package/dist/api/content.interface.js +0 -12
- package/dist/api/content.service.d.ts +0 -17
- package/dist/api/content.service.js +0 -39
- package/dist/api/data.interface.d.ts +0 -29
- package/dist/api/data.interface.js +0 -2
- package/dist/api/data.service.d.ts +0 -15
- package/dist/api/data.service.js +0 -49
- package/dist/api/endpoint.interface.d.ts +0 -22
- package/dist/api/endpoint.interface.js +0 -2
- package/dist/api/endpoint.service.d.ts +0 -8
- package/dist/api/endpoint.service.js +0 -17
- package/dist/api/events.interface.d.ts +0 -16
- package/dist/api/events.interface.js +0 -2
- package/dist/api/events.service.d.ts +0 -7
- package/dist/api/events.service.js +0 -13
- package/dist/api/http.service.d.ts +0 -26
- package/dist/api/http.service.js +0 -74
- package/dist/api/index.d.ts +0 -12
- package/dist/api/index.js +0 -16
- package/dist/api/mock/api.mock.d.ts +0 -158
- package/dist/api/mock/api.mock.js +0 -111
- package/dist/api/mock/asset.mock.service.d.ts +0 -12
- package/dist/api/mock/asset.mock.service.js +0 -21
- package/dist/api/mock/assetTypes.mock.service.d.ts +0 -6
- package/dist/api/mock/assetTypes.mock.service.js +0 -11
- package/dist/api/mock/content.mock.service.d.ts +0 -18
- package/dist/api/mock/content.mock.service.js +0 -64
- package/dist/api/mock/data.mock.service.d.ts +0 -13
- package/dist/api/mock/data.mock.service.js +0 -52
- package/dist/api/mock/endpoint.mock.service.d.ts +0 -15
- package/dist/api/mock/endpoint.mock.service.js +0 -24
- package/dist/api/mock/events.mock.service.d.ts +0 -7
- package/dist/api/mock/events.mock.service.js +0 -14
- package/dist/api/mock/index.d.ts +0 -9
- package/dist/api/mock/index.js +0 -12
- package/dist/api/mock/secret.mock.service.d.ts +0 -6
- package/dist/api/mock/secret.mock.service.js +0 -11
- package/dist/api/mock/task.mock.service.d.ts +0 -7
- package/dist/api/mock/task.mock.service.js +0 -15
- package/dist/api/mock/timeseries.mock.service.d.ts +0 -19
- package/dist/api/mock/timeseries.mock.service.js +0 -69
- package/dist/api/mock/user.mock.service.d.ts +0 -7
- package/dist/api/mock/user.mock.service.js +0 -14
- package/dist/api/proxy.service.d.ts +0 -11
- package/dist/api/proxy.service.js +0 -17
- package/dist/api/secret.interface.d.ts +0 -7
- package/dist/api/secret.interface.js +0 -2
- package/dist/api/secret.service.d.ts +0 -6
- package/dist/api/secret.service.js +0 -10
- package/dist/api/sidriveiq.interface.d.ts +0 -104
- package/dist/api/sidriveiq.interface.js +0 -2
- package/dist/api/sidriveiq.service.d.ts +0 -97
- package/dist/api/sidriveiq.service.js +0 -97
- package/dist/api/task.interface.d.ts +0 -22
- package/dist/api/task.interface.js +0 -2
- package/dist/api/task.service.d.ts +0 -7
- package/dist/api/task.service.js +0 -13
- package/dist/api/timeseries.interface.d.ts +0 -39
- package/dist/api/timeseries.interface.js +0 -2
- package/dist/api/timeseries.service.d.ts +0 -17
- package/dist/api/timeseries.service.js +0 -38
- package/dist/api/user.service.d.ts +0 -6
- package/dist/api/user.service.js +0 -21
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DataMockService = void 0;
|
|
4
|
-
const data_service_1 = require("../data.service");
|
|
5
|
-
class DataMockService extends data_service_1.DataService {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(null, null);
|
|
8
|
-
this.data = [];
|
|
9
|
-
}
|
|
10
|
-
async addMany(dto) {
|
|
11
|
-
const map = dto.map((v) => this.addOne(v));
|
|
12
|
-
return Promise.all(map);
|
|
13
|
-
}
|
|
14
|
-
addOne(dto) {
|
|
15
|
-
this.data.push(dto);
|
|
16
|
-
return Promise.resolve(dto);
|
|
17
|
-
}
|
|
18
|
-
deleteOne(id) {
|
|
19
|
-
const index = this.data.findIndex((v) => v.id === id);
|
|
20
|
-
this.data.splice(index, 1);
|
|
21
|
-
return Promise.resolve(undefined);
|
|
22
|
-
}
|
|
23
|
-
getMany(params) {
|
|
24
|
-
const data = this.data;
|
|
25
|
-
const page = {
|
|
26
|
-
docs: data,
|
|
27
|
-
limit: params && params.limit ? params.limit : Number.MAX_SAFE_INTEGER,
|
|
28
|
-
total: data.length,
|
|
29
|
-
};
|
|
30
|
-
return Promise.resolve(page);
|
|
31
|
-
}
|
|
32
|
-
async getManyFiltered(filter, params = {}) {
|
|
33
|
-
const paginated = await this.getMany(params);
|
|
34
|
-
const newData = paginated.docs.filter((v) => { var _a; return filter.parent === v.parent || ((_a = filter.tags) === null || _a === void 0 ? void 0 : _a.some((tag) => { var _a; return (_a = v.tags) === null || _a === void 0 ? void 0 : _a.contains(tag); })) || filter.type === v.tag; });
|
|
35
|
-
const page = {
|
|
36
|
-
docs: newData,
|
|
37
|
-
limit: paginated.limit || Number.MAX_SAFE_INTEGER,
|
|
38
|
-
total: newData.length,
|
|
39
|
-
};
|
|
40
|
-
return Promise.resolve(page);
|
|
41
|
-
}
|
|
42
|
-
getOne(id, options) {
|
|
43
|
-
const t = this.data.find((v) => v.id === id);
|
|
44
|
-
return Promise.resolve(t);
|
|
45
|
-
}
|
|
46
|
-
async updateOne(id, dto) {
|
|
47
|
-
await this.deleteOne(id);
|
|
48
|
-
const t = await this.addOne(dto);
|
|
49
|
-
return Promise.resolve(t);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.DataMockService = DataMockService;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Endpoint } from '../endpoint.interface';
|
|
2
|
-
import { EndpointService } from '../endpoint.service';
|
|
3
|
-
import { DataMockService } from './data.mock.service';
|
|
4
|
-
export declare class EndpointMockService extends DataMockService<Endpoint> implements EndpointService {
|
|
5
|
-
constructor(endpoints: Endpoint[]);
|
|
6
|
-
sendNotification(endpointId: string, subject: string, message: string, group: string, eventLink?: string): Promise<void>;
|
|
7
|
-
readLastLogByGroup(endpointId: string, group: string): Promise<{
|
|
8
|
-
id: string;
|
|
9
|
-
endpoint: string;
|
|
10
|
-
group: string;
|
|
11
|
-
data: string;
|
|
12
|
-
createdAt: string;
|
|
13
|
-
updatedAt: string;
|
|
14
|
-
}>;
|
|
15
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EndpointMockService = void 0;
|
|
4
|
-
const data_mock_service_1 = require("./data.mock.service");
|
|
5
|
-
class EndpointMockService extends data_mock_service_1.DataMockService {
|
|
6
|
-
constructor(endpoints) {
|
|
7
|
-
super();
|
|
8
|
-
this.data = endpoints;
|
|
9
|
-
}
|
|
10
|
-
sendNotification(endpointId, subject, message, group, eventLink) {
|
|
11
|
-
return Promise.resolve();
|
|
12
|
-
}
|
|
13
|
-
readLastLogByGroup(endpointId, group) {
|
|
14
|
-
return Promise.resolve({
|
|
15
|
-
id: 'endpointlog1',
|
|
16
|
-
endpoint: '',
|
|
17
|
-
group: 'test',
|
|
18
|
-
data: 'OK',
|
|
19
|
-
createdAt: new Date().toISOString(),
|
|
20
|
-
updatedAt: new Date().toISOString(),
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.EndpointMockService = EndpointMockService;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Event } from '../events.interface';
|
|
2
|
-
import { EventsService } from '../events.service';
|
|
3
|
-
import { DataMockService } from './data.mock.service';
|
|
4
|
-
export declare class EventsMockService extends DataMockService<Event> implements EventsService {
|
|
5
|
-
constructor(events: Event[]);
|
|
6
|
-
getLastEventByAssetAndGroup(assetId: string, group: string): Promise<Event>;
|
|
7
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EventsMockService = void 0;
|
|
4
|
-
const data_mock_service_1 = require("./data.mock.service");
|
|
5
|
-
class EventsMockService extends data_mock_service_1.DataMockService {
|
|
6
|
-
constructor(events) {
|
|
7
|
-
super();
|
|
8
|
-
this.data = events;
|
|
9
|
-
}
|
|
10
|
-
getLastEventByAssetAndGroup(assetId, group) {
|
|
11
|
-
return Promise.resolve(this.data[this.data.length - 1]);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.EventsMockService = EventsMockService;
|
package/dist/api/mock/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from './api.mock';
|
|
2
|
-
export * from './asset.mock.service';
|
|
3
|
-
export * from './assetTypes.mock.service';
|
|
4
|
-
export * from './content.mock.service';
|
|
5
|
-
export * from './data.mock.service';
|
|
6
|
-
export * from './secret.mock.service';
|
|
7
|
-
export * from './timeseries.mock.service';
|
|
8
|
-
export * from './task.mock.service';
|
|
9
|
-
export * from './events.mock.service';
|
package/dist/api/mock/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
(0, tslib_1.__exportStar)(require("./api.mock"), exports);
|
|
5
|
-
(0, tslib_1.__exportStar)(require("./asset.mock.service"), exports);
|
|
6
|
-
(0, tslib_1.__exportStar)(require("./assetTypes.mock.service"), exports);
|
|
7
|
-
(0, tslib_1.__exportStar)(require("./content.mock.service"), exports);
|
|
8
|
-
(0, tslib_1.__exportStar)(require("./data.mock.service"), exports);
|
|
9
|
-
(0, tslib_1.__exportStar)(require("./secret.mock.service"), exports);
|
|
10
|
-
(0, tslib_1.__exportStar)(require("./timeseries.mock.service"), exports);
|
|
11
|
-
(0, tslib_1.__exportStar)(require("./task.mock.service"), exports);
|
|
12
|
-
(0, tslib_1.__exportStar)(require("./events.mock.service"), exports);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Secret } from '../secret.interface';
|
|
2
|
-
import { SecretService } from '../secret.service';
|
|
3
|
-
import { DataMockService } from './data.mock.service';
|
|
4
|
-
export declare class SecretMockService extends DataMockService<Secret> implements SecretService {
|
|
5
|
-
constructor(secrets: Secret[]);
|
|
6
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SecretMockService = void 0;
|
|
4
|
-
const data_mock_service_1 = require("./data.mock.service");
|
|
5
|
-
class SecretMockService extends data_mock_service_1.DataMockService {
|
|
6
|
-
constructor(secrets) {
|
|
7
|
-
super();
|
|
8
|
-
this.data = secrets;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.SecretMockService = SecretMockService;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Task } from '../task.interface';
|
|
2
|
-
import { TaskService } from '../task.service';
|
|
3
|
-
import { DataMockService } from './data.mock.service';
|
|
4
|
-
export declare class TaskMockService extends DataMockService<Task> implements TaskService {
|
|
5
|
-
constructor(tasks: Task[]);
|
|
6
|
-
createTaskAttachedToAsset(dto: any): Promise<Task>;
|
|
7
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TaskMockService = void 0;
|
|
4
|
-
const data_mock_service_1 = require("./data.mock.service");
|
|
5
|
-
class TaskMockService extends data_mock_service_1.DataMockService {
|
|
6
|
-
constructor(tasks) {
|
|
7
|
-
super();
|
|
8
|
-
this.data = tasks;
|
|
9
|
-
}
|
|
10
|
-
async createTaskAttachedToAsset(dto) {
|
|
11
|
-
this.data.push(dto);
|
|
12
|
-
return Promise.resolve(dto);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.TaskMockService = TaskMockService;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Paginated } from '../data.interface';
|
|
2
|
-
import { TS_GROUPS, TimeSeries, TimeSeriesValue } from '../timeseries.interface';
|
|
3
|
-
import { TimeSeriesService } from '../timeseries.service';
|
|
4
|
-
import { DataMockService } from './data.mock.service';
|
|
5
|
-
export declare class TimeseriesMockService extends DataMockService<TimeSeries & {
|
|
6
|
-
data: TimeSeriesValue[];
|
|
7
|
-
}> implements TimeSeriesService {
|
|
8
|
-
constructor(timeseries: TimeSeries[], timeseriesValues: TimeSeriesValue[][]);
|
|
9
|
-
addAssetTimeSeriesValues(assetId: string, name: string, readPermissions: string[], readWritePermissions: string[], values: {
|
|
10
|
-
[p: string]: any;
|
|
11
|
-
}): Promise<TimeSeries>;
|
|
12
|
-
addValue(id: string, value: {
|
|
13
|
-
[p: string]: any;
|
|
14
|
-
}): Promise<void>;
|
|
15
|
-
getManyByAsset(assetId: string, names?: string[]): Promise<Paginated<TimeSeries[]>>;
|
|
16
|
-
getMostRecentValue(id: string, before: Date): Promise<TimeSeriesValue>;
|
|
17
|
-
getValues(id: string, from: number, limit?: number, group?: TS_GROUPS): Promise<TimeSeriesValue[]>;
|
|
18
|
-
getValuesOfPeriod(id: string, from: number, to: number, group?: TS_GROUPS): Promise<TimeSeriesValue[]>;
|
|
19
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TimeseriesMockService = void 0;
|
|
4
|
-
const data_mock_service_1 = require("./data.mock.service");
|
|
5
|
-
class TimeseriesMockService extends data_mock_service_1.DataMockService {
|
|
6
|
-
constructor(timeseries, timeseriesValues) {
|
|
7
|
-
super();
|
|
8
|
-
this.data = timeseries.map((value, index) => (Object.assign(Object.assign({}, value), { data: timeseriesValues[index] })));
|
|
9
|
-
}
|
|
10
|
-
addAssetTimeSeriesValues(assetId, name, readPermissions, readWritePermissions, values) {
|
|
11
|
-
const ts = this.data.find((v) => v.assetRef === assetId);
|
|
12
|
-
if (!ts) {
|
|
13
|
-
const data = values.map((v) => (Object.assign({ timestamp: Date.now() }, v)));
|
|
14
|
-
const dto = {
|
|
15
|
-
autoDelBucket: undefined,
|
|
16
|
-
autoDelData: undefined,
|
|
17
|
-
description: '',
|
|
18
|
-
maxBucketTimeRange: 0,
|
|
19
|
-
minDate: undefined,
|
|
20
|
-
name,
|
|
21
|
-
readPermissions,
|
|
22
|
-
readWritePermissions,
|
|
23
|
-
assetRef: assetId,
|
|
24
|
-
data,
|
|
25
|
-
};
|
|
26
|
-
return this.addOne(dto);
|
|
27
|
-
}
|
|
28
|
-
ts.data = Object.assign(Object.assign({}, ts.data), values);
|
|
29
|
-
return Promise.resolve(ts);
|
|
30
|
-
}
|
|
31
|
-
async addValue(id, value) {
|
|
32
|
-
const ts = await this.getOne(id, {});
|
|
33
|
-
ts.data.push({ timestamp: new Date().getDate(), value });
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
getManyByAsset(assetId, names) {
|
|
37
|
-
const page = { docs: [], limit: 10, total: 0 };
|
|
38
|
-
for (const datum of this.data) {
|
|
39
|
-
if (datum.assetRef === assetId) {
|
|
40
|
-
page.docs.push(datum);
|
|
41
|
-
}
|
|
42
|
-
if (page.docs.length === page.limit) {
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
page.total = page.docs.length;
|
|
47
|
-
return Promise.resolve(page);
|
|
48
|
-
}
|
|
49
|
-
async getMostRecentValue(id, before) {
|
|
50
|
-
const ts = await this.getOne(id, {});
|
|
51
|
-
for (const datum of ts.data) {
|
|
52
|
-
if (datum.timestamp < before.getDate()) {
|
|
53
|
-
return datum;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
async getValues(id, from, limit, group) {
|
|
58
|
-
let timeSeriesValues = await this.getValuesOfPeriod(id, from, new Date().getDate(), group);
|
|
59
|
-
if (limit) {
|
|
60
|
-
timeSeriesValues = timeSeriesValues.slice(0, limit);
|
|
61
|
-
}
|
|
62
|
-
return timeSeriesValues;
|
|
63
|
-
}
|
|
64
|
-
async getValuesOfPeriod(id, from, to, group) {
|
|
65
|
-
const ts = await this.getOne(id, {});
|
|
66
|
-
return ts.data.filter((v) => v.timestamp < to && v.timestamp > from);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.TimeseriesMockService = TimeseriesMockService;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UserMockService = void 0;
|
|
4
|
-
const user_service_1 = require("../user.service");
|
|
5
|
-
class UserMockService extends user_service_1.UserService {
|
|
6
|
-
constructor(users) {
|
|
7
|
-
super(null);
|
|
8
|
-
this.users = users;
|
|
9
|
-
}
|
|
10
|
-
getCurrentUserRoles() {
|
|
11
|
-
return Promise.resolve(this.users.roles);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.UserMockService = UserMockService;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import { HttpClient } from './http.service';
|
|
3
|
-
export declare class ProxyService {
|
|
4
|
-
private readonly httpClient;
|
|
5
|
-
constructor(httpClient: HttpClient);
|
|
6
|
-
delete: <T>(proxyId: string, path: string, config?: AxiosRequestConfig) => Promise<T>;
|
|
7
|
-
get: <T>(proxyId: string, path: string, config?: AxiosRequestConfig) => Promise<T>;
|
|
8
|
-
post: <T>(proxyId: string, path: string, data: any, config?: AxiosRequestConfig) => Promise<T>;
|
|
9
|
-
put: <T>(proxyId: string, path: string, data: any, config?: AxiosRequestConfig) => Promise<T>;
|
|
10
|
-
private url;
|
|
11
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProxyService = void 0;
|
|
4
|
-
class ProxyService {
|
|
5
|
-
constructor(httpClient) {
|
|
6
|
-
this.httpClient = httpClient;
|
|
7
|
-
this.delete = (proxyId, path, config) => this.httpClient.delete(this.url(proxyId, path), config);
|
|
8
|
-
this.get = (proxyId, path, config) => this.httpClient.get(this.url(proxyId, path), config);
|
|
9
|
-
this.post = (proxyId, path, data, config) => this.httpClient.post(this.url(proxyId, path), data, config);
|
|
10
|
-
this.put = (proxyId, path, data, config) => this.httpClient.put(this.url(proxyId, path), data, config);
|
|
11
|
-
}
|
|
12
|
-
url(proxyId, path = '/') {
|
|
13
|
-
path = path.startsWith('/') ? path : `/${path}`;
|
|
14
|
-
return `api/${proxyId}${path}`;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.ProxyService = ProxyService;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SecretService = void 0;
|
|
4
|
-
const data_service_1 = require("./data.service");
|
|
5
|
-
class SecretService extends data_service_1.DataService {
|
|
6
|
-
constructor(httpClient) {
|
|
7
|
-
super(httpClient, process.env.DEBUG_SECRET_URL || '/api/secrets');
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.SecretService = SecretService;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
export interface Asset {
|
|
2
|
-
id: string;
|
|
3
|
-
type_id: string;
|
|
4
|
-
name: string;
|
|
5
|
-
description: string;
|
|
6
|
-
tag: string;
|
|
7
|
-
agent_id: string;
|
|
8
|
-
is_active: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface File {
|
|
11
|
-
id: string;
|
|
12
|
-
name: string;
|
|
13
|
-
status: string;
|
|
14
|
-
content_type: string;
|
|
15
|
-
created_at: string;
|
|
16
|
-
length: number;
|
|
17
|
-
}
|
|
18
|
-
export interface List<T> {
|
|
19
|
-
cursor: string;
|
|
20
|
-
values: T[];
|
|
21
|
-
}
|
|
22
|
-
export interface Log {
|
|
23
|
-
ref_id: string;
|
|
24
|
-
ref_type: RefType;
|
|
25
|
-
severity: Severity;
|
|
26
|
-
created_at: string;
|
|
27
|
-
text: string;
|
|
28
|
-
actor: string;
|
|
29
|
-
category: string;
|
|
30
|
-
item_type: string;
|
|
31
|
-
gone_at: string;
|
|
32
|
-
}
|
|
33
|
-
export interface Mail {
|
|
34
|
-
from: string;
|
|
35
|
-
to: string;
|
|
36
|
-
cc?: string;
|
|
37
|
-
subject: string;
|
|
38
|
-
body: string;
|
|
39
|
-
is_html: boolean;
|
|
40
|
-
}
|
|
41
|
-
export interface Property {
|
|
42
|
-
path: string;
|
|
43
|
-
name: string;
|
|
44
|
-
unit: string;
|
|
45
|
-
data_type: string;
|
|
46
|
-
is_mandatory: boolean;
|
|
47
|
-
}
|
|
48
|
-
export declare type RefType = 'Unknown' | 'Asset' | 'AssetType' | 'Container' | 'ContainerType' | 'Action' | 'AssetReport' | 'ReportType';
|
|
49
|
-
export declare type Severity = 'Info' | 'Warning' | 'Error' | 'All';
|
|
50
|
-
export interface Subset {
|
|
51
|
-
id: string;
|
|
52
|
-
name: string;
|
|
53
|
-
}
|
|
54
|
-
export interface TimeSeries {
|
|
55
|
-
ts: string;
|
|
56
|
-
v: any;
|
|
57
|
-
}
|
|
58
|
-
export interface RangeParams {
|
|
59
|
-
from?: string | Date;
|
|
60
|
-
to?: string | Date;
|
|
61
|
-
}
|
|
62
|
-
export interface CursorParams {
|
|
63
|
-
limit?: number;
|
|
64
|
-
cursor?: string;
|
|
65
|
-
}
|
|
66
|
-
export interface PaginationParams {
|
|
67
|
-
page?: number;
|
|
68
|
-
page_size?: number;
|
|
69
|
-
sort?: string;
|
|
70
|
-
}
|
|
71
|
-
export interface AssetsParams extends CursorParams {
|
|
72
|
-
name_filter?: string;
|
|
73
|
-
type_filter?: string;
|
|
74
|
-
tag_filter?: string;
|
|
75
|
-
agent_filter?: string;
|
|
76
|
-
}
|
|
77
|
-
export interface PropertiesParams extends CursorParams {
|
|
78
|
-
path_filter?: string;
|
|
79
|
-
subset_filter?: string;
|
|
80
|
-
only_assigned?: boolean;
|
|
81
|
-
only_mandatory?: boolean;
|
|
82
|
-
}
|
|
83
|
-
export interface TimeSeriesParams extends CursorParams, RangeParams {
|
|
84
|
-
}
|
|
85
|
-
export interface FilesCountParams extends RangeParams {
|
|
86
|
-
name_filter?: string;
|
|
87
|
-
status_filter?: 'Imported' | 'Scanned' | 'ScannedButEmpty';
|
|
88
|
-
exclude?: string;
|
|
89
|
-
}
|
|
90
|
-
export interface FilesParams extends FilesCountParams, PaginationParams {
|
|
91
|
-
}
|
|
92
|
-
export interface LogsParams extends PaginationParams, RangeParams {
|
|
93
|
-
categories: string[];
|
|
94
|
-
severity?: Severity;
|
|
95
|
-
filter?: string;
|
|
96
|
-
}
|
|
97
|
-
export interface LogDto {
|
|
98
|
-
text: string;
|
|
99
|
-
severity: Severity;
|
|
100
|
-
created_at: string;
|
|
101
|
-
actor: string;
|
|
102
|
-
category: string;
|
|
103
|
-
gone_at: string;
|
|
104
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import FormData from 'form-data';
|
|
2
|
-
import { HttpClient } from './http.service';
|
|
3
|
-
import { Asset, AssetsParams, File, FilesParams, FilesCountParams, List, Log, LogsParams, LogDto, Mail, Property, PropertiesParams, RangeParams, Subset, TimeSeries, TimeSeriesParams } from './sidriveiq.interface';
|
|
4
|
-
export declare class SiDriveIqService {
|
|
5
|
-
private readonly httpClient;
|
|
6
|
-
private basePath;
|
|
7
|
-
constructor(httpClient: HttpClient);
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated
|
|
10
|
-
*/
|
|
11
|
-
getAssets(params?: AssetsParams): Promise<List<Asset>>;
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated
|
|
14
|
-
*/
|
|
15
|
-
getAssetCount(params?: AssetsParams): Promise<number>;
|
|
16
|
-
/**
|
|
17
|
-
* @deprecated
|
|
18
|
-
*/
|
|
19
|
-
getAsset(assetId: string | number): Promise<Asset>;
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated
|
|
22
|
-
*/
|
|
23
|
-
getProperties(assetId: string | number, params?: PropertiesParams): Promise<List<Property>>;
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated
|
|
26
|
-
*/
|
|
27
|
-
getProperty(assetId: string | number, path: string): Promise<Property>;
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated
|
|
30
|
-
*/
|
|
31
|
-
getSubsets(assetId: string | number): Promise<List<TimeSeries>>;
|
|
32
|
-
/**
|
|
33
|
-
* @deprecated
|
|
34
|
-
*/
|
|
35
|
-
getSubset(assetId: string | number, subsetId: string): Promise<Subset>;
|
|
36
|
-
/**
|
|
37
|
-
* @deprecated
|
|
38
|
-
*/
|
|
39
|
-
getSubsetProperties(assetId: string | number, subsetId: string, pathFilter?: string): Promise<List<Property>>;
|
|
40
|
-
/**
|
|
41
|
-
* @deprecated
|
|
42
|
-
*/
|
|
43
|
-
getTimeSeries(assetId: string | number, path: string, params?: TimeSeriesParams): Promise<List<TimeSeries>>;
|
|
44
|
-
/**
|
|
45
|
-
* @deprecated
|
|
46
|
-
*/
|
|
47
|
-
getTimeSeriesCount(assetId: string | number, path: string, params?: RangeParams): Promise<number>;
|
|
48
|
-
/**
|
|
49
|
-
* @deprecated
|
|
50
|
-
*/
|
|
51
|
-
getRecentTimeSeries(assetId: string | number, path: string, timestamp?: Date): Promise<TimeSeries>;
|
|
52
|
-
/**
|
|
53
|
-
* @deprecated
|
|
54
|
-
*/
|
|
55
|
-
addTimeSeries(assetId: string | number, path: string, values: TimeSeries[]): Promise<void>;
|
|
56
|
-
/**
|
|
57
|
-
* @deprecated
|
|
58
|
-
*/
|
|
59
|
-
getFiles(assetId: string | number, params?: FilesParams): Promise<File[]>;
|
|
60
|
-
/**
|
|
61
|
-
* @deprecated
|
|
62
|
-
*/
|
|
63
|
-
getFileCount(assetId: string | number, params?: FilesCountParams): Promise<number>;
|
|
64
|
-
/**
|
|
65
|
-
* @deprecated
|
|
66
|
-
*/
|
|
67
|
-
getFile(assetId: string | number, fileId: string): Promise<File>;
|
|
68
|
-
/**
|
|
69
|
-
* @deprecated
|
|
70
|
-
*/
|
|
71
|
-
downloadFile(assetId: string | number, fileId: string): Promise<ArrayBuffer>;
|
|
72
|
-
/**
|
|
73
|
-
* @deprecated
|
|
74
|
-
*/
|
|
75
|
-
uploadFile(assetId: string | number, form: FormData): Promise<string>;
|
|
76
|
-
/**
|
|
77
|
-
* @deprecated
|
|
78
|
-
*/
|
|
79
|
-
deleteFile(assetId: string | number, fileId: string): Promise<void>;
|
|
80
|
-
/**
|
|
81
|
-
* @deprecated
|
|
82
|
-
*/
|
|
83
|
-
getLogs(assetId: string | number, params: LogsParams): Promise<List<Log>>;
|
|
84
|
-
/**
|
|
85
|
-
* @deprecated
|
|
86
|
-
*/
|
|
87
|
-
getLogCount(assetId: string | number, params: LogsParams): Promise<number>;
|
|
88
|
-
/**
|
|
89
|
-
* @deprecated
|
|
90
|
-
*/
|
|
91
|
-
addLog(assetId: string | number, item: LogDto): Promise<void>;
|
|
92
|
-
/**
|
|
93
|
-
* @deprecated
|
|
94
|
-
*/
|
|
95
|
-
sendMail(mail: Mail): Promise<string>;
|
|
96
|
-
private convertDates;
|
|
97
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SiDriveIqService = void 0;
|
|
4
|
-
class SiDriveIqService {
|
|
5
|
-
constructor(httpClient) {
|
|
6
|
-
this.httpClient = httpClient;
|
|
7
|
-
this.basePath = 'api/sidrive/api/v0';
|
|
8
|
-
}
|
|
9
|
-
getAssets(params = {}) {
|
|
10
|
-
return this.httpClient.get(`${this.basePath}/assets`, { params });
|
|
11
|
-
}
|
|
12
|
-
getAssetCount(params = {}) {
|
|
13
|
-
return this.httpClient.get(`${this.basePath}/assets/count`, { params });
|
|
14
|
-
}
|
|
15
|
-
getAsset(assetId) {
|
|
16
|
-
return this.httpClient.get(`${this.basePath}/assets/${assetId}`);
|
|
17
|
-
}
|
|
18
|
-
getProperties(assetId, params = {}) {
|
|
19
|
-
return this.httpClient.get(`${this.basePath}/assets/${assetId}/properties`, { params });
|
|
20
|
-
}
|
|
21
|
-
getProperty(assetId, path) {
|
|
22
|
-
return this.httpClient.get(`${this.basePath}/assets/${assetId}/properties/${path}`);
|
|
23
|
-
}
|
|
24
|
-
getSubsets(assetId) {
|
|
25
|
-
return this.httpClient.get(`${this.basePath}/assets/${assetId}/subsets`);
|
|
26
|
-
}
|
|
27
|
-
getSubset(assetId, subsetId) {
|
|
28
|
-
return this.httpClient.get(`${this.basePath}/assets/${assetId}/subsets/${subsetId}`);
|
|
29
|
-
}
|
|
30
|
-
getSubsetProperties(assetId, subsetId, pathFilter) {
|
|
31
|
-
const params = Object.assign({}, (pathFilter && { path_filter: pathFilter }));
|
|
32
|
-
return this.httpClient.get(`${this.basePath}/assets/${assetId}/subsets/${subsetId}/properties`, { params });
|
|
33
|
-
}
|
|
34
|
-
getTimeSeries(assetId, path, params = {}) {
|
|
35
|
-
params = this.convertDates(params);
|
|
36
|
-
return this.httpClient.get(`${this.basePath}/assets/${assetId}/properties/${path}/timeseries`, { params });
|
|
37
|
-
}
|
|
38
|
-
getTimeSeriesCount(assetId, path, params = {}) {
|
|
39
|
-
params = this.convertDates(params);
|
|
40
|
-
return this.httpClient.get(`${this.basePath}/assets/${assetId}/properties/${path}/timeseries/count`, { params });
|
|
41
|
-
}
|
|
42
|
-
getRecentTimeSeries(assetId, path, timestamp) {
|
|
43
|
-
const params = Object.assign({}, (timestamp && { timestamp: timestamp.toISOString() }));
|
|
44
|
-
return this.httpClient.get(`${this.basePath}/assets/${assetId}/properties/${path}/timeseries/recent`, { params });
|
|
45
|
-
}
|
|
46
|
-
addTimeSeries(assetId, path, values) {
|
|
47
|
-
return this.httpClient.post(`${this.basePath}/assets/${assetId}/properties/${path}/timeseries`, values);
|
|
48
|
-
}
|
|
49
|
-
getFiles(assetId, params = {}) {
|
|
50
|
-
params = this.convertDates(params);
|
|
51
|
-
return this.httpClient.get(`${this.basePath}/assets/${assetId}/files/import`, { params });
|
|
52
|
-
}
|
|
53
|
-
getFileCount(assetId, params = {}) {
|
|
54
|
-
params = this.convertDates(params);
|
|
55
|
-
return this.httpClient.get(`${this.basePath}/assets/${assetId}/files/import/count`, { params });
|
|
56
|
-
}
|
|
57
|
-
getFile(assetId, fileId) {
|
|
58
|
-
return this.httpClient.get(`${this.basePath}/assets/${assetId}/files/import/${fileId}`);
|
|
59
|
-
}
|
|
60
|
-
downloadFile(assetId, fileId) {
|
|
61
|
-
return this.httpClient.get(`${this.basePath}/assets/${assetId}/files/import/${fileId}/download`, {
|
|
62
|
-
headers: { 'response-type': 'arraybuffer' },
|
|
63
|
-
responseType: 'arraybuffer',
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
uploadFile(assetId, form) {
|
|
67
|
-
const headers = Object.assign({}, form.getHeaders());
|
|
68
|
-
return this.httpClient.post(`${this.basePath}/assets/${assetId}/files/import`, form, { headers });
|
|
69
|
-
}
|
|
70
|
-
deleteFile(assetId, fileId) {
|
|
71
|
-
return this.httpClient.delete(`${this.basePath}/assets/${assetId}/files/import/${fileId}`);
|
|
72
|
-
}
|
|
73
|
-
getLogs(assetId, params) {
|
|
74
|
-
params = this.convertDates(params);
|
|
75
|
-
return this.httpClient.get(`${this.basePath}/assets/${assetId}/logs`, { params });
|
|
76
|
-
}
|
|
77
|
-
getLogCount(assetId, params) {
|
|
78
|
-
params = this.convertDates(params);
|
|
79
|
-
return this.httpClient.get(`${this.basePath}/assets/${assetId}/logs/count`, { params });
|
|
80
|
-
}
|
|
81
|
-
addLog(assetId, item) {
|
|
82
|
-
return this.httpClient.post(`${this.basePath}/assets/${assetId}/logs`, item);
|
|
83
|
-
}
|
|
84
|
-
sendMail(mail) {
|
|
85
|
-
return this.httpClient.post(`${this.basePath}/mails`, mail);
|
|
86
|
-
}
|
|
87
|
-
convertDates(params) {
|
|
88
|
-
if (params.from) {
|
|
89
|
-
params.from = new Date(params.from).toISOString();
|
|
90
|
-
}
|
|
91
|
-
if (params.to) {
|
|
92
|
-
params.to = new Date(params.to).toISOString();
|
|
93
|
-
}
|
|
94
|
-
return params;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
exports.SiDriveIqService = SiDriveIqService;
|