@hahnpro/hpc-api 2025.2.3 → 2025.2.5
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/package.json +2 -2
- package/src/index.d.ts +0 -4
- package/src/index.js +0 -4
- package/src/lib/alert.interface.d.ts +43 -0
- package/src/lib/alert.interface.js +17 -0
- package/src/lib/alert.service.d.ts +6 -0
- package/src/lib/alert.service.js +10 -0
- package/src/lib/api.d.ts +6 -6
- package/src/lib/api.js +8 -8
- package/src/lib/content.interface.d.ts +4 -0
- package/src/lib/flow-deployment.interface.d.ts +1 -1
- package/src/lib/flow-deployment.service.d.ts +1 -1
- package/src/lib/flow.interface.d.ts +1 -1
- package/src/lib/interfaces/ai.interface.d.ts +78 -0
- package/src/lib/{asset.interface.d.ts → interfaces/asset.interface.d.ts} +13 -1
- package/src/lib/interfaces/event.interface.d.ts +21 -0
- package/src/lib/interfaces/index.d.ts +5 -1
- package/src/lib/{resource.interface.d.ts → interfaces/resource.interface.d.ts} +21 -19
- package/src/lib/interfaces/resource.interface.js +8 -0
- package/src/lib/mock/ai.mock.service.d.ts +21 -0
- package/src/lib/mock/ai.mock.service.js +43 -0
- package/src/lib/mock/api.mock.d.ts +10 -6
- package/src/lib/mock/api.mock.js +2 -2
- package/src/lib/mock/asset.mock.service.d.ts +2 -2
- package/src/lib/mock/assetTypes.mock.service.d.ts +3 -2
- package/src/lib/mock/assetTypes.mock.service.js +3 -0
- package/src/lib/mock/event.mock.service.d.ts +8 -0
- package/src/lib/mock/{events.mock.service.js → event.mock.service.js} +6 -3
- package/src/lib/mock/flow-deployment.mock.service.d.ts +1 -1
- package/src/lib/mock/index.d.ts +1 -1
- package/src/lib/mock/index.js +1 -1
- package/src/lib/mock/timeseries.mock.service.d.ts +3 -2
- package/src/lib/mock/timeseries.mock.service.js +3 -0
- package/src/lib/notification-rule.interface.d.ts +28 -0
- package/src/lib/notification-rule.service.d.ts +6 -0
- package/src/lib/notification-rule.service.js +10 -0
- package/src/lib/organization.interface.d.ts +2 -1
- package/src/lib/services/ai.service.d.ts +14 -2
- package/src/lib/services/ai.service.js +36 -2
- package/src/lib/{asset.service.d.ts → services/asset.service.d.ts} +6 -6
- package/src/lib/{asset.service.js → services/asset.service.js} +3 -3
- package/src/lib/{assettypes.service.d.ts → services/assettypes.service.d.ts} +7 -6
- package/src/lib/{assettypes.service.js → services/assettypes.service.js} +6 -3
- package/src/lib/services/event.service.d.ts +8 -0
- package/src/lib/services/event.service.js +17 -0
- package/src/lib/services/index.d.ts +4 -0
- package/src/lib/services/index.js +9 -1
- package/src/lib/{timeseries.service.d.ts → services/timeseries.service.d.ts} +7 -6
- package/src/lib/{timeseries.service.js → services/timeseries.service.js} +7 -3
- package/src/lib/user-settings.interface.d.ts +1 -0
- package/src/lib/events.interface.d.ts +0 -18
- package/src/lib/events.service.d.ts +0 -7
- package/src/lib/events.service.js +0 -13
- package/src/lib/mock/events.mock.service.d.ts +0 -7
- /package/src/lib/{asset.interface.js → interfaces/asset.interface.js} +0 -0
- /package/src/lib/{events.interface.js → interfaces/event.interface.js} +0 -0
- /package/src/lib/{timeseries.interface.d.ts → interfaces/timeseries.interface.d.ts} +0 -0
- /package/src/lib/{timeseries.interface.js → interfaces/timeseries.interface.js} +0 -0
- /package/src/lib/{resource.interface.js → notification-rule.interface.js} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hahnpro/hpc-api",
|
|
3
|
-
"version": "2025.2.
|
|
3
|
+
"version": "2025.2.5",
|
|
4
4
|
"description": "Module for easy access to the HahnPRO Cloud API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"url": "https://hahnpro.com"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"axios": "1.8.
|
|
11
|
+
"axios": "1.8.4",
|
|
12
12
|
"eventsource": "3.0.5",
|
|
13
13
|
"form-data": "4.0.2",
|
|
14
14
|
"jose": "5.10.0",
|
package/src/index.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
export * from './lib/api';
|
|
2
2
|
export type * from './lib/interfaces';
|
|
3
|
-
export * from './lib/asset.interface';
|
|
4
3
|
export * from './lib/content.interface';
|
|
5
4
|
export * from './lib/data.interface';
|
|
6
5
|
export * from './lib/data.service';
|
|
7
6
|
export * from './lib/endpoint.interface';
|
|
8
|
-
export * from './lib/events.interface';
|
|
9
7
|
export * from './lib/flow.interface';
|
|
10
8
|
export * from './lib/flow-deployment.interface';
|
|
11
9
|
export * from './lib/flow-function.interface';
|
|
@@ -13,9 +11,7 @@ export * from './lib/http.service';
|
|
|
13
11
|
export * from './lib/label.interface';
|
|
14
12
|
export * from './lib/mock';
|
|
15
13
|
export * from './lib/notification.interface';
|
|
16
|
-
export * from './lib/resource.interface';
|
|
17
14
|
export * from './lib/schema.interface';
|
|
18
15
|
export * from './lib/secret.interface';
|
|
19
16
|
export * from './lib/task.interface';
|
|
20
|
-
export * from './lib/timeseries.interface';
|
|
21
17
|
export * from './lib/vault.interface';
|
package/src/index.js
CHANGED
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./lib/api"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./lib/asset.interface"), exports);
|
|
6
5
|
tslib_1.__exportStar(require("./lib/content.interface"), exports);
|
|
7
6
|
tslib_1.__exportStar(require("./lib/data.interface"), exports);
|
|
8
7
|
tslib_1.__exportStar(require("./lib/data.service"), exports);
|
|
9
8
|
tslib_1.__exportStar(require("./lib/endpoint.interface"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./lib/events.interface"), exports);
|
|
11
9
|
tslib_1.__exportStar(require("./lib/flow.interface"), exports);
|
|
12
10
|
tslib_1.__exportStar(require("./lib/flow-deployment.interface"), exports);
|
|
13
11
|
tslib_1.__exportStar(require("./lib/flow-function.interface"), exports);
|
|
@@ -15,9 +13,7 @@ tslib_1.__exportStar(require("./lib/http.service"), exports);
|
|
|
15
13
|
tslib_1.__exportStar(require("./lib/label.interface"), exports);
|
|
16
14
|
tslib_1.__exportStar(require("./lib/mock"), exports);
|
|
17
15
|
tslib_1.__exportStar(require("./lib/notification.interface"), exports);
|
|
18
|
-
tslib_1.__exportStar(require("./lib/resource.interface"), exports);
|
|
19
16
|
tslib_1.__exportStar(require("./lib/schema.interface"), exports);
|
|
20
17
|
tslib_1.__exportStar(require("./lib/secret.interface"), exports);
|
|
21
18
|
tslib_1.__exportStar(require("./lib/task.interface"), exports);
|
|
22
|
-
tslib_1.__exportStar(require("./lib/timeseries.interface"), exports);
|
|
23
19
|
tslib_1.__exportStar(require("./lib/vault.interface"), exports);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Author, Owner } from './interfaces';
|
|
2
|
+
export interface Alert {
|
|
3
|
+
id?: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
tsRefs: TimeSeriesReference[];
|
|
7
|
+
status: string;
|
|
8
|
+
condition: AlertCondition;
|
|
9
|
+
messageTmpl?: string;
|
|
10
|
+
tags?: string[];
|
|
11
|
+
readPermissions: string[];
|
|
12
|
+
readWritePermissions: string[];
|
|
13
|
+
createdBy?: Author;
|
|
14
|
+
updatedBy?: Author;
|
|
15
|
+
owner?: Owner;
|
|
16
|
+
}
|
|
17
|
+
export interface AlertCondition {
|
|
18
|
+
type: AlertType;
|
|
19
|
+
level: AlertLevel;
|
|
20
|
+
operator?: string;
|
|
21
|
+
range?: number[];
|
|
22
|
+
value?: number;
|
|
23
|
+
change?: string;
|
|
24
|
+
period?: string;
|
|
25
|
+
stopPeriod?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface TimeSeriesReference {
|
|
28
|
+
alias?: string;
|
|
29
|
+
id: string;
|
|
30
|
+
field: string;
|
|
31
|
+
}
|
|
32
|
+
export declare enum AlertType {
|
|
33
|
+
Threshold = "threshold",
|
|
34
|
+
Relative = "relative",
|
|
35
|
+
Deadman = "deadman"
|
|
36
|
+
}
|
|
37
|
+
export declare enum AlertLevel {
|
|
38
|
+
CRITICAL = "CRITICAL",
|
|
39
|
+
WARNING = "WARNING",
|
|
40
|
+
INFO = "INFO",
|
|
41
|
+
OK = "OK",
|
|
42
|
+
ANY = "ANY"
|
|
43
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AlertLevel = exports.AlertType = void 0;
|
|
4
|
+
var AlertType;
|
|
5
|
+
(function (AlertType) {
|
|
6
|
+
AlertType["Threshold"] = "threshold";
|
|
7
|
+
AlertType["Relative"] = "relative";
|
|
8
|
+
AlertType["Deadman"] = "deadman";
|
|
9
|
+
})(AlertType || (exports.AlertType = AlertType = {}));
|
|
10
|
+
var AlertLevel;
|
|
11
|
+
(function (AlertLevel) {
|
|
12
|
+
AlertLevel["CRITICAL"] = "CRITICAL";
|
|
13
|
+
AlertLevel["WARNING"] = "WARNING";
|
|
14
|
+
AlertLevel["INFO"] = "INFO";
|
|
15
|
+
AlertLevel["OK"] = "OK";
|
|
16
|
+
AlertLevel["ANY"] = "ANY";
|
|
17
|
+
})(AlertLevel || (exports.AlertLevel = AlertLevel = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AlertService = void 0;
|
|
4
|
+
const data_service_1 = require("./data.service");
|
|
5
|
+
class AlertService extends data_service_1.DataService {
|
|
6
|
+
constructor(httpClient) {
|
|
7
|
+
super(httpClient, '/alerts');
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.AlertService = AlertService;
|
package/src/lib/api.d.ts
CHANGED
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AssetTypesService } from './assettypes.service';
|
|
1
|
+
import { AlertService } from './alert.service';
|
|
3
2
|
import { ContentService } from './content.service';
|
|
4
3
|
import { EndpointService } from './endpoint.service';
|
|
5
|
-
import { EventsService } from './events.service';
|
|
6
4
|
import { FlowDeploymentService } from './flow-deployment.service';
|
|
7
5
|
import { FlowFunctionService } from './flow-function.service';
|
|
8
6
|
import { FlowModuleService } from './flow-module.service';
|
|
9
7
|
import { FlowService } from './flow.service';
|
|
10
8
|
import { HttpClient } from './http.service';
|
|
11
9
|
import { LabelService } from './label.service';
|
|
10
|
+
import { NotificationRuleService } from './notification-rule.service';
|
|
12
11
|
import { NotificationService } from './notification.service';
|
|
13
12
|
import { OrganizationService } from './organization.service';
|
|
14
13
|
import { ProxyService } from './proxy.service';
|
|
15
14
|
import { SecretService } from './secret.service';
|
|
16
|
-
import { AiService } from './services';
|
|
15
|
+
import { AiService, AssetService, AssetTypesService, EventService, TimeSeriesService } from './services';
|
|
17
16
|
import { TaskService } from './task.service';
|
|
18
|
-
import { TimeSeriesService } from './timeseries.service';
|
|
19
17
|
import { UserService } from './user.service';
|
|
20
18
|
import { VaultService } from './vault.service';
|
|
21
19
|
export declare class API {
|
|
22
20
|
readonly httpClient?: HttpClient;
|
|
23
21
|
ai: AiService;
|
|
22
|
+
alerts: AlertService;
|
|
24
23
|
assets: AssetService;
|
|
25
24
|
assetTypes: AssetTypesService;
|
|
26
25
|
contents: ContentService;
|
|
27
26
|
endpoints: EndpointService;
|
|
28
|
-
events:
|
|
27
|
+
events: EventService;
|
|
29
28
|
flows: FlowService;
|
|
30
29
|
flowDeployments: FlowDeploymentService;
|
|
31
30
|
flowFunctions: FlowFunctionService;
|
|
@@ -39,6 +38,7 @@ export declare class API {
|
|
|
39
38
|
users: UserService;
|
|
40
39
|
vault: VaultService;
|
|
41
40
|
notifications: NotificationService;
|
|
41
|
+
notificationRules: NotificationRuleService;
|
|
42
42
|
constructor(httpClient?: HttpClient, context?: {
|
|
43
43
|
tokenSubject?: string;
|
|
44
44
|
});
|
package/src/lib/api.js
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.API = void 0;
|
|
4
|
-
const
|
|
5
|
-
const assettypes_service_1 = require("./assettypes.service");
|
|
4
|
+
const alert_service_1 = require("./alert.service");
|
|
6
5
|
const content_service_1 = require("./content.service");
|
|
7
6
|
const endpoint_service_1 = require("./endpoint.service");
|
|
8
|
-
const events_service_1 = require("./events.service");
|
|
9
7
|
const flow_deployment_service_1 = require("./flow-deployment.service");
|
|
10
8
|
const flow_function_service_1 = require("./flow-function.service");
|
|
11
9
|
const flow_module_service_1 = require("./flow-module.service");
|
|
12
10
|
const flow_service_1 = require("./flow.service");
|
|
13
11
|
const http_service_1 = require("./http.service");
|
|
14
12
|
const label_service_1 = require("./label.service");
|
|
13
|
+
const notification_rule_service_1 = require("./notification-rule.service");
|
|
15
14
|
const notification_service_1 = require("./notification.service");
|
|
16
15
|
const organization_service_1 = require("./organization.service");
|
|
17
16
|
const proxy_service_1 = require("./proxy.service");
|
|
18
17
|
const secret_service_1 = require("./secret.service");
|
|
19
18
|
const services_1 = require("./services");
|
|
20
19
|
const task_service_1 = require("./task.service");
|
|
21
|
-
const timeseries_service_1 = require("./timeseries.service");
|
|
22
20
|
const user_service_1 = require("./user.service");
|
|
23
21
|
const vault_service_1 = require("./vault.service");
|
|
24
22
|
class API {
|
|
@@ -45,11 +43,12 @@ class API {
|
|
|
45
43
|
this.httpClient = new http_service_1.HttpClient(apiUrl, authUrl, realm, client, secret, context?.tokenSubject);
|
|
46
44
|
}
|
|
47
45
|
this.ai = new services_1.AiService(this.httpClient);
|
|
48
|
-
this.
|
|
49
|
-
this.
|
|
46
|
+
this.alerts = new alert_service_1.AlertService(this.httpClient);
|
|
47
|
+
this.assets = new services_1.AssetService(this.httpClient);
|
|
48
|
+
this.assetTypes = new services_1.AssetTypesService(this.httpClient);
|
|
50
49
|
this.contents = new content_service_1.ContentService(this.httpClient);
|
|
51
50
|
this.endpoints = new endpoint_service_1.EndpointService(this.httpClient);
|
|
52
|
-
this.events = new
|
|
51
|
+
this.events = new services_1.EventService(this.httpClient);
|
|
53
52
|
this.flows = new flow_service_1.FlowService(this.httpClient);
|
|
54
53
|
this.flowDeployments = new flow_deployment_service_1.FlowDeploymentService(this.httpClient);
|
|
55
54
|
this.flowFunctions = new flow_function_service_1.FlowFunctionService(this.httpClient);
|
|
@@ -59,10 +58,11 @@ class API {
|
|
|
59
58
|
this.proxy = new proxy_service_1.ProxyService(this.httpClient);
|
|
60
59
|
this.secrets = new secret_service_1.SecretService(this.httpClient);
|
|
61
60
|
this.tasks = new task_service_1.TaskService(this.httpClient);
|
|
62
|
-
this.timeSeries = new
|
|
61
|
+
this.timeSeries = new services_1.TimeSeriesService(this.httpClient);
|
|
63
62
|
this.users = new user_service_1.UserService(this.httpClient);
|
|
64
63
|
this.vault = new vault_service_1.VaultService(this.httpClient);
|
|
65
64
|
this.notifications = new notification_service_1.NotificationService(this.httpClient);
|
|
65
|
+
this.notificationRules = new notification_rule_service_1.NotificationRuleService(this.httpClient);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
exports.API = API;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Author, Owner } from './interfaces';
|
|
1
2
|
import { Storage } from './storage.interface';
|
|
2
3
|
export interface Content {
|
|
3
4
|
id?: string;
|
|
@@ -10,6 +11,9 @@ export interface Content {
|
|
|
10
11
|
tags?: string[];
|
|
11
12
|
assets?: string[];
|
|
12
13
|
files?: Storage[];
|
|
14
|
+
owner?: Owner;
|
|
15
|
+
createdBy?: Author;
|
|
16
|
+
updatedBy?: Author;
|
|
13
17
|
createdAt?: string;
|
|
14
18
|
updatedAt?: string;
|
|
15
19
|
deletedAt?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FlowDiagram, FlowDto } from './flow.interface';
|
|
2
|
-
import { Resource } from './
|
|
2
|
+
import { Resource } from './interfaces';
|
|
3
3
|
import { Storage } from './storage.interface';
|
|
4
4
|
export interface FlowDeployment extends Resource {
|
|
5
5
|
flow: string | FlowDto;
|
|
@@ -2,7 +2,7 @@ import { APIBase } from './api-base';
|
|
|
2
2
|
import { DataService } from './data.service';
|
|
3
3
|
import { FlowDeployment, FlowDeploymentMetrics, FlowDeploymentStatistic, FlowLog } from './flow-deployment.interface';
|
|
4
4
|
import { HttpClient, TokenOption } from './http.service';
|
|
5
|
-
import { ResourceReference } from './
|
|
5
|
+
import { ResourceReference } from './interfaces';
|
|
6
6
|
import { TrashService } from './trash.service';
|
|
7
7
|
interface BaseService extends DataService<FlowDeployment>, TrashService<FlowDeployment> {
|
|
8
8
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FlowDeployment } from './flow-deployment.interface';
|
|
2
|
-
import { Resource } from './
|
|
2
|
+
import { Resource } from './interfaces';
|
|
3
3
|
import { JsonSchemaForm } from './schema.interface';
|
|
4
4
|
export interface FlowDto extends Resource {
|
|
5
5
|
diagram: string | FlowDiagram;
|
|
@@ -1,4 +1,82 @@
|
|
|
1
|
+
import { Owner } from './resource.interface';
|
|
2
|
+
export interface AiAssistant {
|
|
3
|
+
id: string;
|
|
4
|
+
agent?: string;
|
|
5
|
+
pipeline?: string[];
|
|
6
|
+
i18n: Record<AvailableLanguages, AssistantLabels>;
|
|
7
|
+
icon?: string;
|
|
8
|
+
readPermissions?: string[];
|
|
9
|
+
}
|
|
10
|
+
type AvailableLanguages = 'de' | 'en';
|
|
11
|
+
interface AssistantLabels {
|
|
12
|
+
name: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
welcomeMessage?: string;
|
|
15
|
+
}
|
|
16
|
+
interface BaseMessage {
|
|
17
|
+
id?: string;
|
|
18
|
+
thread: string;
|
|
19
|
+
createdAt?: string;
|
|
20
|
+
updatedAt?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface AssistantMessage extends BaseMessage {
|
|
23
|
+
role: 'assistant';
|
|
24
|
+
content?: string;
|
|
25
|
+
agentStack?: string[];
|
|
26
|
+
status?: 'pending' | 'processing' | 'completed' | 'failed';
|
|
27
|
+
toolCalls?: {
|
|
28
|
+
type: 'tool-call';
|
|
29
|
+
toolCallId: string;
|
|
30
|
+
toolName: string;
|
|
31
|
+
args: any;
|
|
32
|
+
}[];
|
|
33
|
+
toolResults?: {
|
|
34
|
+
type: 'tool-result';
|
|
35
|
+
toolCallId: string;
|
|
36
|
+
toolName: string;
|
|
37
|
+
args: any;
|
|
38
|
+
result: any;
|
|
39
|
+
}[];
|
|
40
|
+
contextVariables?: Record<string, unknown>;
|
|
41
|
+
finishReason?: 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
|
|
42
|
+
}
|
|
43
|
+
export interface SystemMessage extends BaseMessage {
|
|
44
|
+
role: 'system';
|
|
45
|
+
}
|
|
46
|
+
export interface ToolMessage extends BaseMessage {
|
|
47
|
+
role: 'user';
|
|
48
|
+
toolCallId?: string;
|
|
49
|
+
toolName?: string;
|
|
50
|
+
toolType?: 'handoff' | 'choice' | 'action';
|
|
51
|
+
agentStack?: string[];
|
|
52
|
+
status?: 'pending' | 'processing' | 'completed' | 'failed';
|
|
53
|
+
result?: any;
|
|
54
|
+
args?: any;
|
|
55
|
+
contextVariables?: Record<string, unknown>;
|
|
56
|
+
}
|
|
57
|
+
export interface UserMessage extends BaseMessage {
|
|
58
|
+
role: 'user';
|
|
59
|
+
content?: string;
|
|
60
|
+
hidden?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export type Message = AssistantMessage | SystemMessage | ToolMessage | UserMessage;
|
|
1
63
|
export interface SpeechToken {
|
|
2
64
|
token: string;
|
|
3
65
|
region: string;
|
|
4
66
|
}
|
|
67
|
+
export interface Thread {
|
|
68
|
+
id: string;
|
|
69
|
+
assistantId: string;
|
|
70
|
+
owner: Owner;
|
|
71
|
+
messages: string[] | Message[];
|
|
72
|
+
isEphemeral: boolean;
|
|
73
|
+
firstMessage?: string | Message;
|
|
74
|
+
lastMessage?: string | Message;
|
|
75
|
+
createdAt: string;
|
|
76
|
+
updatedAt: string;
|
|
77
|
+
}
|
|
78
|
+
export interface ThreadPopulated extends Thread {
|
|
79
|
+
firstMessage?: Message;
|
|
80
|
+
lastMessage?: Message;
|
|
81
|
+
}
|
|
82
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Content } from '
|
|
1
|
+
import { Content } from '../content.interface';
|
|
2
|
+
import { Author, Owner } from './resource.interface';
|
|
2
3
|
export interface AssetType {
|
|
3
4
|
id?: string;
|
|
4
5
|
name: string;
|
|
@@ -14,6 +15,9 @@ export interface AssetType {
|
|
|
14
15
|
actions?: string[];
|
|
15
16
|
author?: string;
|
|
16
17
|
revision?: number;
|
|
18
|
+
owner?: Owner;
|
|
19
|
+
createdBy?: Author;
|
|
20
|
+
updatedBy?: Author;
|
|
17
21
|
createdAt?: string;
|
|
18
22
|
updatedAt?: string;
|
|
19
23
|
deletedAt?: string;
|
|
@@ -40,6 +44,9 @@ export interface Asset {
|
|
|
40
44
|
actions?: string[];
|
|
41
45
|
author?: string;
|
|
42
46
|
revision?: number;
|
|
47
|
+
owner?: Owner;
|
|
48
|
+
createdBy?: Author;
|
|
49
|
+
updatedBy?: Author;
|
|
43
50
|
createdAt?: string;
|
|
44
51
|
updatedAt?: string;
|
|
45
52
|
deletedAt?: string;
|
|
@@ -76,3 +83,8 @@ export interface EventLevelOverride {
|
|
|
76
83
|
[eventCause: string]: string;
|
|
77
84
|
};
|
|
78
85
|
}
|
|
86
|
+
export interface Template {
|
|
87
|
+
id: string;
|
|
88
|
+
name: string;
|
|
89
|
+
template: Record<string, any>;
|
|
90
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Author, Owner, Resource } from './resource.interface';
|
|
2
|
+
export interface Event extends Resource {
|
|
3
|
+
data?: {
|
|
4
|
+
tsField: string;
|
|
5
|
+
timestamp: string;
|
|
6
|
+
value: number;
|
|
7
|
+
};
|
|
8
|
+
assetRef?: string;
|
|
9
|
+
assetRef$name?: string;
|
|
10
|
+
alertRef?: string;
|
|
11
|
+
tsRef?: string;
|
|
12
|
+
eventRef?: string;
|
|
13
|
+
cause: string;
|
|
14
|
+
level: EventLevel;
|
|
15
|
+
group?: string;
|
|
16
|
+
owner?: Owner;
|
|
17
|
+
createdBy?: Author;
|
|
18
|
+
updatedBy?: Author;
|
|
19
|
+
}
|
|
20
|
+
export type EventLevel = 'INFO' | 'OK' | 'WARNING' | 'CRITICAL';
|
|
21
|
+
export type CreateEventDto = Omit<Event, 'id' | 'assetRef$name' | 'createdAt' | 'updatedAt'>;
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { Resource, ResourceReference, Owner, OwnerType, Author } from './resource.interface';
|
|
2
|
+
export type { AiAssistant, AssistantMessage, Message, SpeechToken, SystemMessage, Thread, ThreadPopulated, ToolMessage, UserMessage, } from './ai.interface';
|
|
3
|
+
export type { Action, ActionRevision, Asset, AssetRevision, AssetType, AssetTypeRevision, Attachment, EventCause, EventLevelOverride, Template, } from './asset.interface';
|
|
4
|
+
export type { Event, EventLevel, CreateEventDto } from './event.interface';
|
|
5
|
+
export type { TimeSeries, TimeSeriesBucket, TimeSeriesCondition, TimeSeriesValue, TS_GROUPS } from './timeseries.interface';
|
|
@@ -1,32 +1,34 @@
|
|
|
1
|
-
export interface ResourceReference {
|
|
2
|
-
id: string;
|
|
3
|
-
resourceType: string;
|
|
4
|
-
dependent?: boolean;
|
|
5
|
-
}
|
|
6
1
|
export interface Resource {
|
|
7
|
-
id
|
|
8
|
-
owner?: Owner;
|
|
2
|
+
id?: string;
|
|
9
3
|
name: string;
|
|
10
|
-
readPermissions: string[];
|
|
11
|
-
readWritePermissions: string[];
|
|
12
4
|
description?: string;
|
|
13
|
-
author?: string;
|
|
14
5
|
tags?: string[];
|
|
15
6
|
refs?: ResourceReference[];
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
readPermissions: string[];
|
|
8
|
+
readWritePermissions: string[];
|
|
9
|
+
owner?: Owner;
|
|
10
|
+
createdAt?: string;
|
|
20
11
|
createdBy?: Author;
|
|
12
|
+
updatedAt?: string;
|
|
21
13
|
updatedBy?: Author;
|
|
14
|
+
deletedAt?: string;
|
|
22
15
|
}
|
|
23
|
-
export interface
|
|
16
|
+
export interface ResourceReference {
|
|
24
17
|
id: string;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
impersonatorUsername?: string;
|
|
18
|
+
resourceType: string;
|
|
19
|
+
dependent?: boolean;
|
|
28
20
|
}
|
|
29
21
|
export interface Owner {
|
|
30
22
|
id: string;
|
|
31
|
-
type:
|
|
23
|
+
type: OwnerType;
|
|
24
|
+
}
|
|
25
|
+
export declare enum OwnerType {
|
|
26
|
+
ORG = "org",
|
|
27
|
+
USER = "user"
|
|
28
|
+
}
|
|
29
|
+
export interface Author {
|
|
30
|
+
id: string;
|
|
31
|
+
username?: string;
|
|
32
|
+
impersonatorId?: string;
|
|
33
|
+
impersonatorUsername?: string;
|
|
32
34
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OwnerType = void 0;
|
|
4
|
+
var OwnerType;
|
|
5
|
+
(function (OwnerType) {
|
|
6
|
+
OwnerType["ORG"] = "org";
|
|
7
|
+
OwnerType["USER"] = "user";
|
|
8
|
+
})(OwnerType || (exports.OwnerType = OwnerType = {}));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { APIBase } from '../api-base';
|
|
2
|
+
import { Paginated } from '../data.interface';
|
|
3
|
+
import { HttpClient } from '../http.service';
|
|
4
|
+
import { AiAssistant, Message, SpeechToken, Thread, ThreadPopulated } from '../interfaces';
|
|
5
|
+
import { AiService } from '../services';
|
|
6
|
+
export declare class AiMockService extends APIBase implements AiService {
|
|
7
|
+
httpClient: HttpClient;
|
|
8
|
+
basePath: string;
|
|
9
|
+
message(message: string, threadId?: string, assistantId?: string): Promise<Message>;
|
|
10
|
+
createThread(assistantId: string): Promise<ThreadPopulated>;
|
|
11
|
+
getLatestAssistantThread(assistantId: string): Promise<ThreadPopulated>;
|
|
12
|
+
getAssistant(assistantId: string): Promise<AiAssistant>;
|
|
13
|
+
getAssistants(): Promise<AiAssistant[]>;
|
|
14
|
+
getSpeechToken(): Promise<SpeechToken>;
|
|
15
|
+
getThreadMessages(threadId: string): Promise<Paginated<Message[]>>;
|
|
16
|
+
getThread(threadId: string): Promise<ThreadPopulated>;
|
|
17
|
+
getLatestThread(): Promise<ThreadPopulated>;
|
|
18
|
+
listThreads(): Promise<ThreadPopulated[]>;
|
|
19
|
+
listAssistantThreads(assistantId: string): Promise<ThreadPopulated[]>;
|
|
20
|
+
deleteThread(threadId: string): Promise<Thread>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AiMockService = void 0;
|
|
4
|
+
const api_base_1 = require("../api-base");
|
|
5
|
+
class AiMockService extends api_base_1.APIBase {
|
|
6
|
+
message(message, threadId, assistantId) {
|
|
7
|
+
throw new Error('Method not implemented.');
|
|
8
|
+
}
|
|
9
|
+
createThread(assistantId) {
|
|
10
|
+
throw new Error('Method not implemented.');
|
|
11
|
+
}
|
|
12
|
+
getLatestAssistantThread(assistantId) {
|
|
13
|
+
throw new Error('Method not implemented.');
|
|
14
|
+
}
|
|
15
|
+
getAssistant(assistantId) {
|
|
16
|
+
throw new Error('Method not implemented.');
|
|
17
|
+
}
|
|
18
|
+
getAssistants() {
|
|
19
|
+
throw new Error('Method not implemented.');
|
|
20
|
+
}
|
|
21
|
+
getSpeechToken() {
|
|
22
|
+
throw new Error('Method not implemented.');
|
|
23
|
+
}
|
|
24
|
+
getThreadMessages(threadId) {
|
|
25
|
+
throw new Error('Method not implemented.');
|
|
26
|
+
}
|
|
27
|
+
getThread(threadId) {
|
|
28
|
+
throw new Error('Method not implemented.');
|
|
29
|
+
}
|
|
30
|
+
getLatestThread() {
|
|
31
|
+
throw new Error('Method not implemented.');
|
|
32
|
+
}
|
|
33
|
+
listThreads() {
|
|
34
|
+
throw new Error('Method not implemented.');
|
|
35
|
+
}
|
|
36
|
+
listAssistantThreads(assistantId) {
|
|
37
|
+
throw new Error('Method not implemented.');
|
|
38
|
+
}
|
|
39
|
+
deleteThread(threadId) {
|
|
40
|
+
throw new Error('Method not implemented.');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.AiMockService = AiMockService;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import { AlertService } from '../alert.service';
|
|
1
2
|
import { API } from '../api';
|
|
2
|
-
import { Asset, AssetRevision, AssetType } from '../asset.interface';
|
|
3
3
|
import { Content } from '../content.interface';
|
|
4
4
|
import { Endpoint } from '../endpoint.interface';
|
|
5
|
-
import { Event } from '../events.interface';
|
|
6
5
|
import { FlowDeployment } from '../flow-deployment.interface';
|
|
7
6
|
import { FlowDeploymentService } from '../flow-deployment.service';
|
|
8
7
|
import { FlowFunctionDto, FlowFunctionRevision } from '../flow-function.interface';
|
|
@@ -11,19 +10,21 @@ import { FlowModule } from '../flow-module.interface';
|
|
|
11
10
|
import { FlowModuleService } from '../flow-module.service';
|
|
12
11
|
import { FlowDiagram, FlowDto, FlowRevision } from '../flow.interface';
|
|
13
12
|
import { FlowService } from '../flow.service';
|
|
13
|
+
import { Asset, AssetRevision, AssetType, Event, TimeSeries, TimeSeriesValue } from '../interfaces';
|
|
14
14
|
import { Label } from '../label.interface';
|
|
15
|
+
import { NotificationRuleService } from '../notification-rule.service';
|
|
15
16
|
import { Notification } from '../notification.interface';
|
|
16
17
|
import { Organization } from '../organization.interface';
|
|
17
18
|
import { Secret } from '../secret.interface';
|
|
19
|
+
import { AiService } from '../services';
|
|
18
20
|
import { Artifact } from '../storage.interface';
|
|
19
21
|
import { Task } from '../task.interface';
|
|
20
|
-
import { TimeSeries, TimeSeriesValue } from '../timeseries.interface';
|
|
21
22
|
import { VaultSecret } from '../vault.interface';
|
|
22
23
|
import { AssetMockService } from './asset.mock.service';
|
|
23
24
|
import { AssetTypesMockService } from './assetTypes.mock.service';
|
|
24
25
|
import { ContentMockService } from './content.mock.service';
|
|
25
26
|
import { EndpointMockService } from './endpoint.mock.service';
|
|
26
|
-
import {
|
|
27
|
+
import { EventMockService } from './event.mock.service';
|
|
27
28
|
import { HttpMockService } from './http.mock.service';
|
|
28
29
|
import { LabelMockService } from './label.mock.service';
|
|
29
30
|
import { NotificationMockService } from './notification.mock.service';
|
|
@@ -55,18 +56,21 @@ export interface MockAPIInitData {
|
|
|
55
56
|
notifications?: NotificationInit[];
|
|
56
57
|
organizations?: OrganizationInit[];
|
|
57
58
|
}
|
|
58
|
-
export declare class MockAPI implements
|
|
59
|
+
export declare class MockAPI implements API {
|
|
59
60
|
httpClient: HttpMockService;
|
|
61
|
+
ai: AiService;
|
|
62
|
+
alerts: AlertService;
|
|
60
63
|
assets: AssetMockService;
|
|
61
64
|
assetTypes: AssetTypesMockService;
|
|
62
65
|
contents: ContentMockService;
|
|
63
66
|
endpoints: EndpointMockService;
|
|
64
|
-
events:
|
|
67
|
+
events: EventMockService;
|
|
65
68
|
flows: FlowService;
|
|
66
69
|
flowDeployments: FlowDeploymentService;
|
|
67
70
|
flowFunctions: FlowFunctionService;
|
|
68
71
|
flowModules: FlowModuleService;
|
|
69
72
|
labels: LabelMockService;
|
|
73
|
+
notificationRules: NotificationRuleService;
|
|
70
74
|
proxy: any;
|
|
71
75
|
secrets: SecretMockService;
|
|
72
76
|
tasks: TaskMockService;
|
package/src/lib/mock/api.mock.js
CHANGED
|
@@ -8,7 +8,7 @@ const asset_mock_service_1 = require("./asset.mock.service");
|
|
|
8
8
|
const assetTypes_mock_service_1 = require("./assetTypes.mock.service");
|
|
9
9
|
const content_mock_service_1 = require("./content.mock.service");
|
|
10
10
|
const endpoint_mock_service_1 = require("./endpoint.mock.service");
|
|
11
|
-
const
|
|
11
|
+
const event_mock_service_1 = require("./event.mock.service");
|
|
12
12
|
const flow_deployment_mock_service_1 = require("./flow-deployment.mock.service");
|
|
13
13
|
const flow_functions_mock_service_1 = require("./flow-functions.mock.service");
|
|
14
14
|
const flow_modules_mock_service_1 = require("./flow-modules.mock.service");
|
|
@@ -194,7 +194,7 @@ class MockAPI {
|
|
|
194
194
|
this.secrets = new secret_mock_service_1.SecretMockService(secrets1);
|
|
195
195
|
this.timeSeries = new timeseries_mock_service_1.TimeseriesMockService(timeSeries1, timeSeriesValues);
|
|
196
196
|
this.tasks = new task_mock_service_1.TaskMockService(tasks1);
|
|
197
|
-
this.events = new
|
|
197
|
+
this.events = new event_mock_service_1.EventMockService(events1);
|
|
198
198
|
this.users = new user_mock_service_1.UserMockService(users);
|
|
199
199
|
this.flows = new flow_mock_service_1.FlowMockService(flows1, diagrams1, flowRevisions1);
|
|
200
200
|
this.flowDeployments = new flow_deployment_mock_service_1.FlowDeploymentMockService(deployments1, this);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import FormData from 'form-data';
|
|
2
|
-
import { Asset, AssetRevision, Attachment, EventCause, EventLevelOverride } from '../asset.interface';
|
|
3
|
-
import { AssetService } from '../asset.service';
|
|
4
2
|
import { Paginated, RequestParameter } from '../data.interface';
|
|
3
|
+
import { Asset, AssetRevision, Attachment, EventCause, EventLevelOverride } from '../interfaces';
|
|
4
|
+
import { AssetService } from '../services';
|
|
5
5
|
import { APIBaseMock } from './api-base.mock';
|
|
6
6
|
import { MockAPI } from './api.mock';
|
|
7
7
|
import { DataMockService } from './data.mock.service';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AssetType, AssetTypeRevision } from '../asset.interface';
|
|
2
|
-
import { AssetTypesService } from '../assettypes.service';
|
|
3
1
|
import { Paginated, RequestParameter } from '../data.interface';
|
|
2
|
+
import { AssetType, AssetTypeRevision, Template } from '../interfaces';
|
|
3
|
+
import { AssetTypesService } from '../services';
|
|
4
4
|
import { APIBaseMock } from './api-base.mock';
|
|
5
5
|
import { DataMockService } from './data.mock.service';
|
|
6
6
|
import { TrashMockService } from './trash.mock.service';
|
|
@@ -18,5 +18,6 @@ export declare class AssetTypesMockService extends BaseService implements AssetT
|
|
|
18
18
|
getRevisions(id: string): Promise<Paginated<AssetTypeRevision[]>>;
|
|
19
19
|
rollback(id: string, revisionId: string): Promise<AssetType>;
|
|
20
20
|
deleteRevision(assetId: string, revisionId: string): Promise<any>;
|
|
21
|
+
getTemplate(id: string, templateName: string): Promise<Template>;
|
|
21
22
|
}
|
|
22
23
|
export {};
|
|
@@ -72,5 +72,8 @@ class AssetTypesMockService extends BaseService {
|
|
|
72
72
|
this.revisions.splice(index, 1);
|
|
73
73
|
return Promise.resolve(revisionId);
|
|
74
74
|
}
|
|
75
|
+
getTemplate(id, templateName) {
|
|
76
|
+
throw new Error('Method not implemented.');
|
|
77
|
+
}
|
|
75
78
|
}
|
|
76
79
|
exports.AssetTypesMockService = AssetTypesMockService;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Event } from '../interfaces';
|
|
2
|
+
import { EventService } from '../services';
|
|
3
|
+
import { DataMockService } from './data.mock.service';
|
|
4
|
+
export declare class EventMockService extends DataMockService<Event> implements EventService {
|
|
5
|
+
constructor(events: Event[]);
|
|
6
|
+
getLastEventByAssetAndGroup(assetId: string, group: string): Promise<Event>;
|
|
7
|
+
getLastEventByAssetAndGroups(assetId: string, groups: string[]): Promise<Record<string, string>>;
|
|
8
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.EventMockService = void 0;
|
|
4
4
|
const data_mock_service_1 = require("./data.mock.service");
|
|
5
|
-
class
|
|
5
|
+
class EventMockService extends data_mock_service_1.DataMockService {
|
|
6
6
|
constructor(events) {
|
|
7
7
|
super();
|
|
8
8
|
this.data = events;
|
|
@@ -10,5 +10,8 @@ class EventsMockService extends data_mock_service_1.DataMockService {
|
|
|
10
10
|
getLastEventByAssetAndGroup(assetId, group) {
|
|
11
11
|
return Promise.resolve(this.data[this.data.length - 1]);
|
|
12
12
|
}
|
|
13
|
+
getLastEventByAssetAndGroups(assetId, groups) {
|
|
14
|
+
throw new Error('Method not implemented.');
|
|
15
|
+
}
|
|
13
16
|
}
|
|
14
|
-
exports.
|
|
17
|
+
exports.EventMockService = EventMockService;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FlowDeployment, FlowDeploymentMetrics, FlowDeploymentStatistic, FlowLog } from '../flow-deployment.interface';
|
|
2
2
|
import { FlowDeploymentService } from '../flow-deployment.service';
|
|
3
|
-
import { ResourceReference } from '../
|
|
3
|
+
import { ResourceReference } from '../interfaces';
|
|
4
4
|
import { APIBaseMock } from './api-base.mock';
|
|
5
5
|
import { MockAPI } from './api.mock';
|
|
6
6
|
import { DataMockService } from './data.mock.service';
|
package/src/lib/mock/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export * from './http.mock.service';
|
|
|
7
7
|
export * from './secret.mock.service';
|
|
8
8
|
export * from './timeseries.mock.service';
|
|
9
9
|
export * from './task.mock.service';
|
|
10
|
-
export * from './
|
|
10
|
+
export * from './event.mock.service';
|
|
11
11
|
export * from './vault.mock.service';
|
|
12
12
|
export * from './notification.mock.service';
|
|
13
13
|
export * from './organization.mock.service';
|
package/src/lib/mock/index.js
CHANGED
|
@@ -10,7 +10,7 @@ tslib_1.__exportStar(require("./http.mock.service"), exports);
|
|
|
10
10
|
tslib_1.__exportStar(require("./secret.mock.service"), exports);
|
|
11
11
|
tslib_1.__exportStar(require("./timeseries.mock.service"), exports);
|
|
12
12
|
tslib_1.__exportStar(require("./task.mock.service"), exports);
|
|
13
|
-
tslib_1.__exportStar(require("./
|
|
13
|
+
tslib_1.__exportStar(require("./event.mock.service"), exports);
|
|
14
14
|
tslib_1.__exportStar(require("./vault.mock.service"), exports);
|
|
15
15
|
tslib_1.__exportStar(require("./notification.mock.service"), exports);
|
|
16
16
|
tslib_1.__exportStar(require("./organization.mock.service"), exports);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Paginated, RequestParameter } from '../data.interface';
|
|
2
|
-
import { TimeSeries, TimeSeriesValue, TS_GROUPS } from '../
|
|
3
|
-
import { TimeSeriesService } from '../
|
|
2
|
+
import { TimeSeries, TimeSeriesValue, TS_GROUPS } from '../interfaces';
|
|
3
|
+
import { TimeSeriesService } from '../services';
|
|
4
4
|
import { APIBaseMock } from './api-base.mock';
|
|
5
5
|
import { DataMockService } from './data.mock.service';
|
|
6
6
|
import { TrashMockService } from './trash.mock.service';
|
|
@@ -35,5 +35,6 @@ export declare class TimeseriesMockService extends BaseService implements TimeSe
|
|
|
35
35
|
getMostRecentValue(id: string, before: Date): Promise<TimeSeriesValue>;
|
|
36
36
|
getValues(id: string, from: number, limit?: number, group?: TS_GROUPS): Promise<TimeSeriesValue[]>;
|
|
37
37
|
getValuesOfPeriod(id: string, from: number, to: number, group?: TS_GROUPS): Promise<TimeSeriesValue[]>;
|
|
38
|
+
getMostRecentTimeSeriesValueByAssetAndTimeSeriesName(assetId: string, timeSeriesNames: string[]): Promise<Record<string, any>>;
|
|
38
39
|
}
|
|
39
40
|
export {};
|
|
@@ -138,5 +138,8 @@ class TimeseriesMockService extends BaseService {
|
|
|
138
138
|
const ts = await this.getOne(id, {});
|
|
139
139
|
return ts.data.filter((v) => v.timestamp < to && v.timestamp > from);
|
|
140
140
|
}
|
|
141
|
+
getMostRecentTimeSeriesValueByAssetAndTimeSeriesName(assetId, timeSeriesNames) {
|
|
142
|
+
throw new Error('Method not implemented.');
|
|
143
|
+
}
|
|
141
144
|
}
|
|
142
145
|
exports.TimeseriesMockService = TimeseriesMockService;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Author, Owner } from './interfaces';
|
|
2
|
+
export interface NotificationRule {
|
|
3
|
+
id?: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
endpointRef: string;
|
|
7
|
+
status: string;
|
|
8
|
+
every: string;
|
|
9
|
+
offset?: string;
|
|
10
|
+
statusRule: StatusRule;
|
|
11
|
+
tagRules?: TagRule[];
|
|
12
|
+
messageTemplate: string;
|
|
13
|
+
tags?: string[];
|
|
14
|
+
readPermissions: string[];
|
|
15
|
+
readWritePermissions: string[];
|
|
16
|
+
owner?: Owner;
|
|
17
|
+
createdBy?: Author;
|
|
18
|
+
updatedBy?: Author;
|
|
19
|
+
}
|
|
20
|
+
export interface StatusRule {
|
|
21
|
+
previousLevel?: string;
|
|
22
|
+
currentLevel: string;
|
|
23
|
+
}
|
|
24
|
+
export interface TagRule {
|
|
25
|
+
id?: string;
|
|
26
|
+
operator: 'equal' | 'notEqual';
|
|
27
|
+
value: string;
|
|
28
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HttpClient } from '@shr/api';
|
|
2
|
+
import { DataService } from './data.service';
|
|
3
|
+
import { NotificationRule } from './notification-rule.interface';
|
|
4
|
+
export declare class NotificationRuleService extends DataService<NotificationRule> {
|
|
5
|
+
constructor(httpClient: HttpClient);
|
|
6
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotificationRuleService = void 0;
|
|
4
|
+
const data_service_1 = require("./data.service");
|
|
5
|
+
class NotificationRuleService extends data_service_1.DataService {
|
|
6
|
+
constructor(httpClient) {
|
|
7
|
+
super(httpClient, '/notification/rules');
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.NotificationRuleService = NotificationRuleService;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Author } from './
|
|
1
|
+
import { Author } from './interfaces';
|
|
2
2
|
export interface Organization {
|
|
3
3
|
id?: string;
|
|
4
4
|
name: string;
|
|
@@ -18,6 +18,7 @@ export interface Organization {
|
|
|
18
18
|
previousSubscriptions?: string[];
|
|
19
19
|
assetId?: string;
|
|
20
20
|
verified?: boolean;
|
|
21
|
+
deletionRequested?: boolean;
|
|
21
22
|
createdAt?: Date | string;
|
|
22
23
|
updatedAt?: Date | string;
|
|
23
24
|
createdBy?: Author;
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { APIBase } from '../api-base';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { Paginated } from '../data.interface';
|
|
3
|
+
import { HttpClient, TokenOption } from '../http.service';
|
|
4
|
+
import { AiAssistant, Message, SpeechToken, Thread, ThreadPopulated } from '../interfaces';
|
|
4
5
|
export declare class AiService extends APIBase {
|
|
5
6
|
constructor(httpClient: HttpClient);
|
|
7
|
+
message(message: string, threadId?: string, assistantId?: string): Promise<Message>;
|
|
8
|
+
createThread(assistantId: string, isEphemeral?: boolean): Promise<ThreadPopulated>;
|
|
9
|
+
getLatestAssistantThread(assistantId: string): Promise<ThreadPopulated>;
|
|
10
|
+
listAssistantThreads(assistantId: string): Promise<ThreadPopulated[]>;
|
|
11
|
+
getAssistant(assistantId: string): Promise<AiAssistant>;
|
|
12
|
+
getAssistants(): Promise<AiAssistant[]>;
|
|
6
13
|
getSpeechToken(): Promise<SpeechToken>;
|
|
14
|
+
getThreadMessages(threadId: string): Promise<Paginated<Message[]>>;
|
|
15
|
+
getThread(threadId: string): Promise<ThreadPopulated>;
|
|
16
|
+
getLatestThread(): Promise<ThreadPopulated>;
|
|
17
|
+
listThreads(assistantIds?: string[], params?: {}, options?: TokenOption): Promise<ThreadPopulated[]>;
|
|
18
|
+
deleteThread(threadId: string): Promise<Thread>;
|
|
7
19
|
}
|
|
@@ -4,10 +4,44 @@ exports.AiService = void 0;
|
|
|
4
4
|
const api_base_1 = require("../api-base");
|
|
5
5
|
class AiService extends api_base_1.APIBase {
|
|
6
6
|
constructor(httpClient) {
|
|
7
|
-
super(httpClient, '/
|
|
7
|
+
super(httpClient, '/ai');
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
message(message, threadId, assistantId) {
|
|
10
|
+
return this.httpClient.post(`${this.basePath}/message`, { message, threadId, assistantId });
|
|
11
|
+
}
|
|
12
|
+
createThread(assistantId, isEphemeral) {
|
|
13
|
+
return this.httpClient.post(`${this.basePath}/threads`, { assistantId, isEphemeral });
|
|
14
|
+
}
|
|
15
|
+
getLatestAssistantThread(assistantId) {
|
|
16
|
+
return this.httpClient.get(`${this.basePath}/assistants/${assistantId}/threads/latest`);
|
|
17
|
+
}
|
|
18
|
+
listAssistantThreads(assistantId) {
|
|
19
|
+
return this.httpClient.get(`${this.basePath}/assistants/${assistantId}/threads`);
|
|
20
|
+
}
|
|
21
|
+
getAssistant(assistantId) {
|
|
22
|
+
return this.httpClient.get(`${this.basePath}/assistants/${assistantId}`);
|
|
23
|
+
}
|
|
24
|
+
getAssistants() {
|
|
25
|
+
return this.httpClient.get(`${this.basePath}/assistants`);
|
|
26
|
+
}
|
|
27
|
+
getSpeechToken() {
|
|
10
28
|
return this.httpClient.get(`${this.basePath}/speech/token`);
|
|
11
29
|
}
|
|
30
|
+
getThreadMessages(threadId) {
|
|
31
|
+
return this.httpClient.get(`${this.basePath}/threads/${threadId}/messages`);
|
|
32
|
+
}
|
|
33
|
+
getThread(threadId) {
|
|
34
|
+
return this.httpClient.get(`${this.basePath}/threads/${threadId}`);
|
|
35
|
+
}
|
|
36
|
+
getLatestThread() {
|
|
37
|
+
return this.httpClient.get(`${this.basePath}/threads/latest`);
|
|
38
|
+
}
|
|
39
|
+
listThreads(assistantIds, params = {}, options = {}) {
|
|
40
|
+
params = { ...params, assistantIds: assistantIds?.join(',') };
|
|
41
|
+
return this.httpClient.get(`${this.basePath}/threads`, { params, ...options });
|
|
42
|
+
}
|
|
43
|
+
deleteThread(threadId) {
|
|
44
|
+
return this.httpClient.delete(`${this.basePath}/threads/${threadId}`);
|
|
45
|
+
}
|
|
12
46
|
}
|
|
13
47
|
exports.AiService = AiService;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import FormData from 'form-data';
|
|
2
|
-
import { APIBase } from '
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { TrashService } from '
|
|
2
|
+
import { APIBase } from '../api-base';
|
|
3
|
+
import { Paginated, RequestParameter } from '../data.interface';
|
|
4
|
+
import { DataService } from '../data.service';
|
|
5
|
+
import { HttpClient, TokenOption } from '../http.service';
|
|
6
|
+
import { Asset, AssetRevision, Attachment, EventCause, EventLevelOverride } from '../interfaces';
|
|
7
|
+
import { TrashService } from '../trash.service';
|
|
8
8
|
interface BaseService extends DataService<Asset>, TrashService<Asset> {
|
|
9
9
|
}
|
|
10
10
|
declare class BaseService extends APIBase {
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AssetService = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const ts_mixer_1 = require("ts-mixer");
|
|
6
|
-
const api_base_1 = require("
|
|
7
|
-
const data_service_1 = require("
|
|
8
|
-
const trash_service_1 = require("
|
|
6
|
+
const api_base_1 = require("../api-base");
|
|
7
|
+
const data_service_1 = require("../data.service");
|
|
8
|
+
const trash_service_1 = require("../trash.service");
|
|
9
9
|
let BaseService = class BaseService extends api_base_1.APIBase {
|
|
10
10
|
};
|
|
11
11
|
BaseService = tslib_1.__decorate([
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { APIBase } from '
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { TrashService } from '
|
|
1
|
+
import { APIBase } from '../api-base';
|
|
2
|
+
import { Paginated } from '../data.interface';
|
|
3
|
+
import { DataService } from '../data.service';
|
|
4
|
+
import { HttpClient, TokenOption } from '../http.service';
|
|
5
|
+
import { AssetType, Template } from '../interfaces';
|
|
6
|
+
import { TrashService } from '../trash.service';
|
|
7
7
|
interface BaseService extends DataService<AssetType>, TrashService<AssetType> {
|
|
8
8
|
}
|
|
9
9
|
declare class BaseService extends APIBase {
|
|
@@ -13,5 +13,6 @@ export declare class AssetTypesService extends BaseService {
|
|
|
13
13
|
getRevisions(id: string, options?: TokenOption): Promise<Paginated<AssetType[]>>;
|
|
14
14
|
rollback(id: string, revisionId: string, options?: TokenOption): Promise<AssetType>;
|
|
15
15
|
deleteRevision(id: string, revisionId: string, options?: TokenOption): Promise<any>;
|
|
16
|
+
getTemplate(id: string, templateName: string, options?: TokenOption): Promise<Template>;
|
|
16
17
|
}
|
|
17
18
|
export {};
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AssetTypesService = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const ts_mixer_1 = require("ts-mixer");
|
|
6
|
-
const api_base_1 = require("
|
|
7
|
-
const data_service_1 = require("
|
|
8
|
-
const trash_service_1 = require("
|
|
6
|
+
const api_base_1 = require("../api-base");
|
|
7
|
+
const data_service_1 = require("../data.service");
|
|
8
|
+
const trash_service_1 = require("../trash.service");
|
|
9
9
|
let BaseService = class BaseService extends api_base_1.APIBase {
|
|
10
10
|
};
|
|
11
11
|
BaseService = tslib_1.__decorate([
|
|
@@ -24,5 +24,8 @@ class AssetTypesService extends BaseService {
|
|
|
24
24
|
deleteRevision(id, revisionId, options = {}) {
|
|
25
25
|
return this.httpClient.delete(`${this.basePath}/${id}/revisions/${revisionId}`, options);
|
|
26
26
|
}
|
|
27
|
+
getTemplate(id, templateName, options = {}) {
|
|
28
|
+
return this.httpClient.get(`${this.basePath}/${id}/templates/${templateName}`, options);
|
|
29
|
+
}
|
|
27
30
|
}
|
|
28
31
|
exports.AssetTypesService = AssetTypesService;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DataService } from '../data.service';
|
|
2
|
+
import { HttpClient, TokenOption } from '../http.service';
|
|
3
|
+
import { Event } from '../interfaces';
|
|
4
|
+
export declare class EventService extends DataService<Event> {
|
|
5
|
+
constructor(httpClient: HttpClient);
|
|
6
|
+
getLastEventByAssetAndGroup(assetId: string, group: string, options?: TokenOption): Promise<Event>;
|
|
7
|
+
getLastEventByAssetAndGroups(assetId: string, groups: string[], options?: TokenOption): Promise<Record<string, string>>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EventService = void 0;
|
|
4
|
+
const data_service_1 = require("../data.service");
|
|
5
|
+
class EventService extends data_service_1.DataService {
|
|
6
|
+
constructor(httpClient) {
|
|
7
|
+
super(httpClient, '/events');
|
|
8
|
+
}
|
|
9
|
+
getLastEventByAssetAndGroup(assetId, group, options = {}) {
|
|
10
|
+
return this.httpClient.get(`${this.basePath}/last/${assetId}/${group}`, options);
|
|
11
|
+
}
|
|
12
|
+
getLastEventByAssetAndGroups(assetId, groups, options = {}) {
|
|
13
|
+
const params = Array.isArray(groups) ? { groups: groups.join() } : {};
|
|
14
|
+
return this.httpClient.get(`${this.basePath}/asset/${assetId}/last`, { params, ...options });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.EventService = EventService;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AiService = void 0;
|
|
3
|
+
exports.TimeSeriesService = exports.EventService = exports.AssetTypesService = exports.AssetService = exports.AiService = void 0;
|
|
4
4
|
var ai_service_1 = require("./ai.service");
|
|
5
5
|
Object.defineProperty(exports, "AiService", { enumerable: true, get: function () { return ai_service_1.AiService; } });
|
|
6
|
+
var asset_service_1 = require("./asset.service");
|
|
7
|
+
Object.defineProperty(exports, "AssetService", { enumerable: true, get: function () { return asset_service_1.AssetService; } });
|
|
8
|
+
var assettypes_service_1 = require("./assettypes.service");
|
|
9
|
+
Object.defineProperty(exports, "AssetTypesService", { enumerable: true, get: function () { return assettypes_service_1.AssetTypesService; } });
|
|
10
|
+
var event_service_1 = require("./event.service");
|
|
11
|
+
Object.defineProperty(exports, "EventService", { enumerable: true, get: function () { return event_service_1.EventService; } });
|
|
12
|
+
var timeseries_service_1 = require("./timeseries.service");
|
|
13
|
+
Object.defineProperty(exports, "TimeSeriesService", { enumerable: true, get: function () { return timeseries_service_1.TimeSeriesService; } });
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { APIBase } from '
|
|
2
|
-
import { Paginated } from '
|
|
3
|
-
import { DataService } from '
|
|
4
|
-
import { HttpClient, TokenOption } from '
|
|
5
|
-
import { TimeSeries, TimeSeriesValue, TS_GROUPS } from '
|
|
6
|
-
import { TrashService } from '
|
|
1
|
+
import { APIBase } from '../api-base';
|
|
2
|
+
import { Paginated } from '../data.interface';
|
|
3
|
+
import { DataService } from '../data.service';
|
|
4
|
+
import { HttpClient, TokenOption } from '../http.service';
|
|
5
|
+
import { TimeSeries, TimeSeriesValue, TS_GROUPS } from '../interfaces';
|
|
6
|
+
import { TrashService } from '../trash.service';
|
|
7
7
|
interface BaseService extends DataService<TimeSeries>, TrashService<TimeSeries> {
|
|
8
8
|
}
|
|
9
9
|
declare class BaseService extends APIBase {
|
|
@@ -65,5 +65,6 @@ export declare class TimeSeriesService extends BaseService {
|
|
|
65
65
|
getValues(id: string, from: number, limit?: number, group?: TS_GROUPS, options?: TokenOption): Promise<TimeSeriesValue[]>;
|
|
66
66
|
getValuesOfPeriod(id: string, from: number, to: number, group?: TS_GROUPS, options?: TokenOption): Promise<TimeSeriesValue[]>;
|
|
67
67
|
getManyByAsset(assetId: string, names?: string[], options?: TokenOption): Promise<Paginated<TimeSeries[]>>;
|
|
68
|
+
getMostRecentTimeSeriesValueByAssetAndTimeSeriesName(assetId: string, timeSeriesNames: string[], options?: TokenOption): Promise<Record<string, any>>;
|
|
68
69
|
}
|
|
69
70
|
export {};
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TimeSeriesService = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const ts_mixer_1 = require("ts-mixer");
|
|
6
|
-
const api_base_1 = require("
|
|
7
|
-
const data_service_1 = require("
|
|
8
|
-
const trash_service_1 = require("
|
|
6
|
+
const api_base_1 = require("../api-base");
|
|
7
|
+
const data_service_1 = require("../data.service");
|
|
8
|
+
const trash_service_1 = require("../trash.service");
|
|
9
9
|
let BaseService = class BaseService extends api_base_1.APIBase {
|
|
10
10
|
};
|
|
11
11
|
BaseService = tslib_1.__decorate([
|
|
@@ -92,5 +92,9 @@ class TimeSeriesService extends BaseService {
|
|
|
92
92
|
const params = Array.isArray(names) ? { names: names.join() } : {};
|
|
93
93
|
return this.httpClient.get(`${this.basePath}/asset/${assetId}`, { params, ...options });
|
|
94
94
|
}
|
|
95
|
+
getMostRecentTimeSeriesValueByAssetAndTimeSeriesName(assetId, timeSeriesNames, options = {}) {
|
|
96
|
+
const params = Array.isArray(timeSeriesNames) ? { names: timeSeriesNames.join() } : {};
|
|
97
|
+
return this.httpClient.get(`${this.basePath}/asset/${assetId}/recent`, { params, ...options });
|
|
98
|
+
}
|
|
95
99
|
}
|
|
96
100
|
exports.TimeSeriesService = TimeSeriesService;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export interface Event {
|
|
2
|
-
id?: string;
|
|
3
|
-
name: string;
|
|
4
|
-
description?: string;
|
|
5
|
-
tags?: string[];
|
|
6
|
-
readPermissions: string[];
|
|
7
|
-
readWritePermissions: string[];
|
|
8
|
-
assetRef?: string;
|
|
9
|
-
assetRef$name?: string;
|
|
10
|
-
alertRef?: string;
|
|
11
|
-
tsRef?: string;
|
|
12
|
-
eventRef?: string;
|
|
13
|
-
cause: string;
|
|
14
|
-
level: string;
|
|
15
|
-
group?: string;
|
|
16
|
-
createdAt?: string;
|
|
17
|
-
updatedAt?: string;
|
|
18
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { DataService } from './data.service';
|
|
2
|
-
import { Event } from './events.interface';
|
|
3
|
-
import { HttpClient, TokenOption } from './http.service';
|
|
4
|
-
export declare class EventsService extends DataService<Event> {
|
|
5
|
-
constructor(httpClient: HttpClient);
|
|
6
|
-
getLastEventByAssetAndGroup(assetId: string, group: string, options?: TokenOption): Promise<Event>;
|
|
7
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EventsService = void 0;
|
|
4
|
-
const data_service_1 = require("./data.service");
|
|
5
|
-
class EventsService extends data_service_1.DataService {
|
|
6
|
-
constructor(httpClient) {
|
|
7
|
-
super(httpClient, '/events');
|
|
8
|
-
}
|
|
9
|
-
getLastEventByAssetAndGroup(assetId, group, options = {}) {
|
|
10
|
-
return this.httpClient.get(`${this.basePath}/last/${assetId}/${group}`, options);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.EventsService = EventsService;
|
|
@@ -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
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|