@hahnpro/hpc-api 3.7.1 → 3.8.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/api.d.ts CHANGED
@@ -16,6 +16,7 @@ import { FlowModuleService } from './flow-module.service';
16
16
  import { FlowDeploymentService } from './flow-deployment.service';
17
17
  import { LabelService } from './label.service';
18
18
  import { VaultService } from './vault.service';
19
+ import { NotificationService } from './notification.service';
19
20
  export declare class API {
20
21
  httpClient: HttpClient;
21
22
  assets: AssetService;
@@ -34,6 +35,7 @@ export declare class API {
34
35
  timeSeries: TimeSeriesService;
35
36
  users: UserService;
36
37
  vault: VaultService;
38
+ notifications: NotificationService;
37
39
  /**
38
40
  * @deprecated use "assets" instead
39
41
  */
package/dist/api.js CHANGED
@@ -19,6 +19,7 @@ const flow_module_service_1 = require("./flow-module.service");
19
19
  const flow_deployment_service_1 = require("./flow-deployment.service");
20
20
  const label_service_1 = require("./label.service");
21
21
  const vault_service_1 = require("./vault.service");
22
+ const notification_service_1 = require("./notification.service");
22
23
  class API {
23
24
  constructor() {
24
25
  const normalizePath = (value = '', defaultValue = '') => value.replace(/(?:^\/+)|(?:\/+$)/g, '') || defaultValue;
@@ -53,6 +54,7 @@ class API {
53
54
  this.timeSeries = new timeseries_service_1.TimeSeriesService(this.httpClient);
54
55
  this.users = new user_service_1.UserService(this.httpClient);
55
56
  this.vault = new vault_service_1.VaultService(this.httpClient);
57
+ this.notifications = new notification_service_1.NotificationService(this.httpClient);
56
58
  this.assetManager = this.assets;
57
59
  this.contentManager = this.contents;
58
60
  this.endpointManager = this.endpoints;
package/dist/index.d.ts CHANGED
@@ -17,4 +17,5 @@ export * from './flow.interface';
17
17
  export * from './resource.interface';
18
18
  export * from './schema.interface';
19
19
  export * from './vault.interface';
20
+ export * from './notification.interface';
20
21
  export * as SiDrive from './sidriveiq.interface';
package/dist/index.js CHANGED
@@ -21,4 +21,5 @@ tslib_1.__exportStar(require("./flow.interface"), exports);
21
21
  tslib_1.__exportStar(require("./resource.interface"), exports);
22
22
  tslib_1.__exportStar(require("./schema.interface"), exports);
23
23
  tslib_1.__exportStar(require("./vault.interface"), exports);
24
+ tslib_1.__exportStar(require("./notification.interface"), exports);
24
25
  exports.SiDrive = tslib_1.__importStar(require("./sidriveiq.interface"));
@@ -28,6 +28,8 @@ import { LabelMockService } from './label.mock.service';
28
28
  import { Label } from '../label.interface';
29
29
  import { VaultSecret } from '../vault.interface';
30
30
  import { VaultMockService } from './vault.mock.service';
31
+ import { Notification } from '../notification.interface';
32
+ import { NotificationMockService } from './notification.mock.service';
31
33
  export declare class MockAPI implements API {
32
34
  httpClient: any;
33
35
  assets: AssetMockService;
@@ -46,6 +48,7 @@ export declare class MockAPI implements API {
46
48
  timeSeries: TimeseriesMockService;
47
49
  users: UserMockService;
48
50
  vault: VaultMockService;
51
+ notifications: NotificationMockService;
49
52
  assetManager: AssetMockService;
50
53
  contentManager: ContentMockService;
51
54
  endpointManager: EndpointMockService;
@@ -74,6 +77,7 @@ export declare class MockAPI implements API {
74
77
  diagrams?: FlowDiagramInit[];
75
78
  labels?: LabelInit[];
76
79
  vault?: VaultSecretInit[];
80
+ notifications?: NotificationInit[];
77
81
  });
78
82
  }
79
83
  export type Identity<T> = {
@@ -109,6 +113,7 @@ export type ArtifactInit = AtLeast<Artifact & {
109
113
  export type FlowDiagramInit = AtLeast<FlowDiagram, 'id' | 'flow'>;
110
114
  export type LabelInit = AtLeast<Label, 'id' | 'name'>;
111
115
  export type VaultSecretInit = AtLeast<VaultSecret, 'name' | 'secret'>;
116
+ export type NotificationInit = AtLeast<Notification, 'id' | 'name' | 'userId' | 'notificationType'>;
112
117
  export interface UserInit {
113
118
  roles: string[];
114
119
  }
@@ -18,12 +18,13 @@ const flow_modules_mock_service_1 = require("./flow-modules.mock.service");
18
18
  const crypto_1 = require("crypto");
19
19
  const label_mock_service_1 = require("./label.mock.service");
20
20
  const vault_mock_service_1 = require("./vault.mock.service");
21
+ const notification_mock_service_1 = require("./notification.mock.service");
21
22
  class MockAPI {
22
23
  constructor(initData) {
23
24
  this.httpClient = null;
24
25
  this.proxy = null;
25
26
  this.siDrive = null;
26
- const { assets = [], assetRevisions = [], contents = [], endpoints = [], secrets = [], timeSeries = [], tasks = [], events = [], users, flows = [], flowRevisions = [], deployments = [], functions = [], functionRevisions = [], modules = [], diagrams = [], labels = [], vault = [], } = initData;
27
+ const { assets = [], assetRevisions = [], contents = [], endpoints = [], secrets = [], timeSeries = [], tasks = [], events = [], users, flows = [], flowRevisions = [], deployments = [], functions = [], functionRevisions = [], modules = [], diagrams = [], labels = [], vault = [], notifications = [], } = initData;
27
28
  const assetTypes = assets
28
29
  .map((v) => v.type)
29
30
  .map((v) => {
@@ -96,6 +97,7 @@ class MockAPI {
96
97
  cause: v.cause,
97
98
  level: v.level,
98
99
  group: v.group,
100
+ createdAt: v.createdAt,
99
101
  }));
100
102
  const timeseriesValues = timeSeries.map((v) => v.values);
101
103
  const diagrams1 = diagrams.map((v) => (Object.assign(Object.assign({}, v), { json: '', author: 'nobody' })));
@@ -113,6 +115,7 @@ class MockAPI {
113
115
  });
114
116
  const labels1 = labels.map((label) => (Object.assign(Object.assign({}, label), { color: '', description: '', readPermissions: [], readWritePermissions: [] })));
115
117
  const vaultSecrets1 = vault.map((v) => (Object.assign(Object.assign({}, v), { readPermissions: [], readWritePermissions: [] })));
118
+ const notifications1 = notifications.map((n) => (Object.assign(Object.assign({}, n), { link: '', description: '', read: false })));
116
119
  this.assets = new asset_mock_service_1.AssetMockService(this, assets1, assetRevisions1);
117
120
  this.contents = new content_mock_service_1.ContentMockService(contents1, contentData);
118
121
  this.endpoints = new endpoint_mock_service_1.EndpointMockService(endpoint1);
@@ -127,6 +130,7 @@ class MockAPI {
127
130
  this.flowModules = new flow_modules_mock_service_1.FlowModulesMockService(modules1);
128
131
  this.labels = new label_mock_service_1.LabelMockService(labels1);
129
132
  this.vault = new vault_mock_service_1.VaultMockService(vaultSecrets1);
133
+ this.notifications = new notification_mock_service_1.NotificationMockService(notifications1);
130
134
  this.assetManager = this.assets;
131
135
  this.contentManager = this.contents;
132
136
  this.endpointManager = this.endpoints;
@@ -8,3 +8,4 @@ export * from './timeseries.mock.service';
8
8
  export * from './task.mock.service';
9
9
  export * from './events.mock.service';
10
10
  export * from './vault.mock.service';
11
+ export * from './notification.mock.service';
@@ -11,3 +11,4 @@ tslib_1.__exportStar(require("./timeseries.mock.service"), exports);
11
11
  tslib_1.__exportStar(require("./task.mock.service"), exports);
12
12
  tslib_1.__exportStar(require("./events.mock.service"), exports);
13
13
  tslib_1.__exportStar(require("./vault.mock.service"), exports);
14
+ tslib_1.__exportStar(require("./notification.mock.service"), exports);
@@ -0,0 +1,6 @@
1
+ import { DataMockService } from './data.mock.service';
2
+ import { Notification } from '../notification.interface';
3
+ import { NotificationService } from '../notification.service';
4
+ export declare class NotificationMockService extends DataMockService<Notification> implements NotificationService {
5
+ constructor(notifications: Notification[]);
6
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotificationMockService = void 0;
4
+ const data_mock_service_1 = require("./data.mock.service");
5
+ class NotificationMockService extends data_mock_service_1.DataMockService {
6
+ constructor(notifications) {
7
+ super();
8
+ this.data = notifications;
9
+ }
10
+ }
11
+ exports.NotificationMockService = NotificationMockService;
@@ -53,7 +53,7 @@ class TimeseriesMockService extends BaseService {
53
53
  };
54
54
  return this.addOne(dto);
55
55
  }
56
- ts.data = [...ts.data, ...data];
56
+ ts.data = ts.data ? [...ts.data, ...data] : data;
57
57
  return Promise.resolve(ts);
58
58
  }
59
59
  async addValue(id, value) {
@@ -0,0 +1,10 @@
1
+ export type NotificationType = 'INFO' | 'WARNING' | 'CRITICAL';
2
+ export interface Notification {
3
+ id?: string;
4
+ name: string;
5
+ description: string;
6
+ userId: string;
7
+ read?: boolean;
8
+ link: string;
9
+ notificationType: NotificationType;
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ import { DataService } from './data.service';
2
+ import { Notification } from './notification.interface';
3
+ import { HttpClient } from './http.service';
4
+ export declare class NotificationService extends DataService<Notification> {
5
+ constructor(httpClient: HttpClient);
6
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotificationService = void 0;
4
+ const data_service_1 = require("./data.service");
5
+ class NotificationService extends data_service_1.DataService {
6
+ constructor(httpClient) {
7
+ super(httpClient, '/notifications');
8
+ }
9
+ }
10
+ exports.NotificationService = NotificationService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hahnpro/hpc-api",
3
- "version": "3.7.1",
3
+ "version": "3.8.1",
4
4
  "description": "Module for easy access to the HahnPRO API",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -24,18 +24,18 @@
24
24
  "access": "public"
25
25
  },
26
26
  "dependencies": {
27
- "axios": "~1.3.4",
27
+ "axios": "~1.3.6",
28
28
  "eventsource": "^2.0.2",
29
29
  "form-data": "^4.0.0",
30
- "jose": "^4.13.1",
30
+ "jose": "^4.14.1",
31
31
  "jwt-decode": "^3.1.2",
32
32
  "p-queue": "^6.6.2",
33
33
  "ts-mixer": "^6.0.3",
34
34
  "uuid": "^9.0.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@types/eventsource": "1.1.10",
38
- "axios-mock-adapter": "^1.21.2"
37
+ "@types/eventsource": "1.1.11",
38
+ "axios-mock-adapter": "^1.21.4"
39
39
  },
40
40
  "engines": {
41
41
  "node": ">=v14.13"