@hahnpro/hpc-api 5.3.4 → 2024.4.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -24
- package/src/index.d.ts +20 -0
- package/src/index.js +20 -0
- package/{dist → src/lib}/Queue.js +2 -7
- package/src/lib/api-base.js +6 -0
- package/src/lib/api.js +60 -0
- package/src/lib/asset.interface.js +1 -0
- package/src/lib/asset.service.d.ts +24 -0
- package/src/lib/asset.service.js +51 -0
- package/{dist → src/lib}/assettypes.service.d.ts +4 -4
- package/src/lib/assettypes.service.js +24 -0
- package/{dist → src/lib}/content.interface.js +2 -5
- package/src/lib/content.service.d.ts +23 -0
- package/src/lib/content.service.js +49 -0
- package/src/lib/data.interface.d.ts +38 -0
- package/src/lib/data.interface.js +3 -0
- package/src/lib/data.service.d.ts +27 -0
- package/src/lib/data.service.js +57 -0
- package/src/lib/endpoint.interface.js +1 -0
- package/src/lib/endpoint.service.d.ts +8 -0
- package/src/lib/endpoint.service.js +12 -0
- package/src/lib/events.interface.js +1 -0
- package/{dist → src/lib}/events.service.d.ts +2 -2
- package/src/lib/events.service.js +9 -0
- package/src/lib/flow-deployment.interface.js +1 -0
- package/{dist → src/lib}/flow-deployment.service.d.ts +15 -13
- package/src/lib/flow-deployment.service.js +68 -0
- package/src/lib/flow-function.interface.js +1 -0
- package/src/lib/flow-function.service.d.ts +11 -0
- package/src/lib/flow-function.service.js +20 -0
- package/src/lib/flow-module.interface.js +1 -0
- package/src/lib/flow-module.service.d.ts +11 -0
- package/{dist → src/lib}/flow-module.service.js +9 -12
- package/src/lib/flow.interface.js +1 -0
- package/src/lib/flow.service.d.ts +26 -0
- package/src/lib/flow.service.js +49 -0
- package/{dist → src/lib}/http.service.d.ts +12 -6
- package/src/lib/http.service.js +179 -0
- package/src/lib/label.interface.js +1 -0
- package/src/lib/label.service.d.ts +9 -0
- package/src/lib/label.service.js +15 -0
- package/src/lib/mock/api-base.mock.js +7 -0
- package/src/lib/mock/api.mock.js +199 -0
- package/{dist → src/lib}/mock/asset.mock.service.js +30 -41
- package/{dist → src/lib}/mock/assetTypes.mock.service.js +19 -27
- package/{dist → src/lib}/mock/content.mock.service.js +21 -24
- package/src/lib/mock/data.mock.service.js +93 -0
- package/{dist → src/lib}/mock/endpoint.mock.service.js +2 -6
- package/src/lib/mock/events.mock.service.js +10 -0
- package/src/lib/mock/flow-deployment.mock.service.js +118 -0
- package/{dist → src/lib}/mock/flow-functions.mock.service.js +12 -21
- package/src/lib/mock/flow-modules.mock.service.js +20 -0
- package/src/lib/mock/flow.mock.service.js +81 -0
- package/src/lib/mock/index.js +11 -0
- package/src/lib/mock/label.mock.service.js +13 -0
- package/src/lib/mock/notification.mock.service.js +7 -0
- package/src/lib/mock/secret.mock.service.js +28 -0
- package/src/lib/mock/task.mock.service.js +32 -0
- package/{dist → src/lib}/mock/timeseries.mock.service.js +40 -49
- package/{dist → src/lib}/mock/trash.mock.service.js +8 -15
- package/src/lib/mock/user.mock.service.js +10 -0
- package/{dist → src/lib}/mock/vault.mock.service.js +2 -6
- package/src/lib/notification.interface.js +1 -0
- package/src/lib/notification.service.js +6 -0
- package/src/lib/proxy.service.d.ts +11 -0
- package/{dist → src/lib}/proxy.service.js +1 -5
- package/src/lib/resource.interface.js +1 -0
- package/src/lib/schema.interface.js +1 -0
- package/src/lib/secret.interface.js +1 -0
- package/src/lib/secret.service.js +15 -0
- package/src/lib/storage.interface.js +1 -0
- package/src/lib/task.interface.js +1 -0
- package/{dist → src/lib}/task.service.d.ts +2 -2
- package/src/lib/task.service.js +19 -0
- package/src/lib/timeseries.interface.js +1 -0
- package/{dist → src/lib}/timeseries.service.d.ts +10 -8
- package/src/lib/timeseries.service.js +92 -0
- package/{dist → src/lib}/token-set.d.ts +3 -1
- package/src/lib/token-set.js +23 -0
- package/{dist → src/lib}/trash.service.js +2 -6
- package/src/lib/user-settings.interface.js +1 -0
- package/src/lib/user.service.d.ts +11 -0
- package/src/lib/user.service.js +26 -0
- package/src/lib/vault.interface.js +1 -0
- package/{dist → src/lib}/vault.service.d.ts +2 -2
- package/src/lib/vault.service.js +10 -0
- package/LICENSE +0 -21
- package/dist/api-base.js +0 -10
- package/dist/api.js +0 -62
- package/dist/asset.interface.js +0 -2
- package/dist/asset.service.d.ts +0 -24
- package/dist/asset.service.js +0 -53
- package/dist/assettypes.service.js +0 -28
- package/dist/content.service.d.ts +0 -23
- package/dist/content.service.js +0 -50
- package/dist/data.interface.d.ts +0 -31
- package/dist/data.interface.js +0 -6
- package/dist/data.service.d.ts +0 -21
- package/dist/data.service.js +0 -50
- package/dist/endpoint.interface.js +0 -2
- package/dist/endpoint.service.d.ts +0 -8
- package/dist/endpoint.service.js +0 -16
- package/dist/events.interface.js +0 -2
- package/dist/events.service.js +0 -13
- package/dist/flow-deployment.interface.js +0 -2
- package/dist/flow-deployment.service.js +0 -74
- package/dist/flow-function.interface.js +0 -2
- package/dist/flow-function.service.d.ts +0 -11
- package/dist/flow-function.service.js +0 -23
- package/dist/flow-module.interface.js +0 -2
- package/dist/flow-module.service.d.ts +0 -11
- package/dist/flow.interface.js +0 -2
- package/dist/flow.service.d.ts +0 -24
- package/dist/flow.service.js +0 -54
- package/dist/http.service.js +0 -161
- package/dist/index.d.ts +0 -20
- package/dist/index.js +0 -23
- package/dist/label.interface.js +0 -2
- package/dist/label.service.d.ts +0 -9
- package/dist/label.service.js +0 -19
- package/dist/mock/api-base.mock.js +0 -11
- package/dist/mock/api.mock.js +0 -128
- package/dist/mock/data.mock.service.js +0 -96
- package/dist/mock/events.mock.service.js +0 -14
- package/dist/mock/flow-deployment.mock.service.js +0 -142
- package/dist/mock/flow-modules.mock.service.js +0 -27
- package/dist/mock/flow.mock.service.js +0 -93
- package/dist/mock/index.js +0 -14
- package/dist/mock/label.mock.service.js +0 -17
- package/dist/mock/notification.mock.service.js +0 -11
- package/dist/mock/secret.mock.service.js +0 -31
- package/dist/mock/task.mock.service.js +0 -37
- package/dist/mock/user.mock.service.js +0 -14
- package/dist/notification.interface.js +0 -2
- package/dist/notification.service.js +0 -10
- package/dist/proxy.service.d.ts +0 -11
- package/dist/resource.interface.js +0 -2
- package/dist/schema.interface.js +0 -2
- package/dist/secret.interface.js +0 -2
- package/dist/secret.service.js +0 -19
- package/dist/storage.interface.js +0 -2
- package/dist/task.interface.js +0 -2
- package/dist/task.service.js +0 -22
- package/dist/timeseries.interface.js +0 -2
- package/dist/timeseries.service.js +0 -56
- package/dist/token-set.js +0 -23
- package/dist/user-settings.interface.js +0 -2
- package/dist/user.service.d.ts +0 -11
- package/dist/user.service.js +0 -33
- package/dist/vault.interface.js +0 -2
- package/dist/vault.service.js +0 -14
- package/{dist → src/lib}/Queue.d.ts +0 -0
- package/{dist → src/lib}/api-base.d.ts +0 -0
- package/{dist → src/lib}/api.d.ts +6 -6
- package/{dist → src/lib}/asset.interface.d.ts +0 -0
- package/{dist → src/lib}/content.interface.d.ts +0 -0
- package/{dist → src/lib}/endpoint.interface.d.ts +0 -0
- package/{dist → src/lib}/events.interface.d.ts +0 -0
- package/{dist → src/lib}/flow-deployment.interface.d.ts +1 -1
- package/{dist → src/lib}/flow-function.interface.d.ts +0 -0
- package/{dist → src/lib}/flow-module.interface.d.ts +0 -0
- package/{dist → src/lib}/flow.interface.d.ts +1 -1
- package/{dist → src/lib}/label.interface.d.ts +0 -0
- package/{dist → src/lib}/mock/api-base.mock.d.ts +0 -0
- package/{dist → src/lib}/mock/api.mock.d.ts +18 -18
- package/{dist → src/lib}/mock/asset.mock.service.d.ts +1 -1
- package/{dist → src/lib}/mock/assetTypes.mock.service.d.ts +0 -0
- package/{dist → src/lib}/mock/content.mock.service.d.ts +1 -1
- package/{dist → src/lib}/mock/data.mock.service.d.ts +0 -0
- package/{dist → src/lib}/mock/endpoint.mock.service.d.ts +0 -0
- package/{dist → src/lib}/mock/events.mock.service.d.ts +0 -0
- package/{dist → src/lib}/mock/flow-deployment.mock.service.d.ts +2 -2
- package/{dist → src/lib}/mock/flow-functions.mock.service.d.ts +1 -1
- package/{dist → src/lib}/mock/flow-modules.mock.service.d.ts +2 -2
- package/{dist → src/lib}/mock/flow.mock.service.d.ts +1 -1
- package/{dist → src/lib}/mock/index.d.ts +0 -0
- package/{dist → src/lib}/mock/label.mock.service.d.ts +1 -1
- package/{dist → src/lib}/mock/notification.mock.service.d.ts +1 -1
- package/{dist → src/lib}/mock/secret.mock.service.d.ts +1 -1
- package/{dist → src/lib}/mock/task.mock.service.d.ts +0 -0
- package/{dist → src/lib}/mock/timeseries.mock.service.d.ts +0 -0
- package/{dist → src/lib}/mock/trash.mock.service.d.ts +1 -1
- package/{dist → src/lib}/mock/user.mock.service.d.ts +0 -0
- package/{dist → src/lib}/mock/vault.mock.service.d.ts +1 -1
- package/{dist → src/lib}/notification.interface.d.ts +0 -0
- package/{dist → src/lib}/notification.service.d.ts +1 -1
- /package/{dist → src/lib}/resource.interface.d.ts +0 -0
- /package/{dist → src/lib}/schema.interface.d.ts +0 -0
- /package/{dist → src/lib}/secret.interface.d.ts +0 -0
- /package/{dist → src/lib}/secret.service.d.ts +0 -0
- /package/{dist → src/lib}/storage.interface.d.ts +0 -0
- /package/{dist → src/lib}/task.interface.d.ts +0 -0
- /package/{dist → src/lib}/timeseries.interface.d.ts +0 -0
- /package/{dist → src/lib}/trash.service.d.ts +0 -0
- /package/{dist → src/lib}/user-settings.interface.d.ts +0 -0
- /package/{dist → src/lib}/vault.interface.d.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { APIBase } from './api-base';
|
|
2
2
|
import { DataService } from './data.service';
|
|
3
|
-
import { HttpClient } from './http.service';
|
|
3
|
+
import { HttpClient, TokenOption } from './http.service';
|
|
4
4
|
import { Task } from './task.interface';
|
|
5
5
|
import { TrashService } from './trash.service';
|
|
6
6
|
interface BaseService extends DataService<Task>, TrashService<Task> {
|
|
@@ -9,6 +9,6 @@ declare class BaseService extends APIBase {
|
|
|
9
9
|
}
|
|
10
10
|
export declare class TaskService extends BaseService {
|
|
11
11
|
constructor(httpClient: HttpClient);
|
|
12
|
-
createTaskAttachedToAsset(dto: any): Promise<Task>;
|
|
12
|
+
createTaskAttachedToAsset(dto: any, options?: TokenOption): Promise<Task>;
|
|
13
13
|
}
|
|
14
14
|
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { mix } from 'ts-mixer';
|
|
3
|
+
import { APIBase } from './api-base';
|
|
4
|
+
import { DataService } from './data.service';
|
|
5
|
+
import { TrashService } from './trash.service';
|
|
6
|
+
let BaseService = class BaseService extends APIBase {
|
|
7
|
+
};
|
|
8
|
+
BaseService = __decorate([
|
|
9
|
+
mix(DataService, TrashService)
|
|
10
|
+
], BaseService);
|
|
11
|
+
export class TaskService extends BaseService {
|
|
12
|
+
constructor(httpClient) {
|
|
13
|
+
super(httpClient, '/tasks');
|
|
14
|
+
}
|
|
15
|
+
// we may not need this method (already have the addOne method from DataService)
|
|
16
|
+
createTaskAttachedToAsset(dto, options = {}) {
|
|
17
|
+
return this.httpClient.post(this.basePath, dto, options);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { APIBase } from './api-base';
|
|
2
2
|
import { Paginated } from './data.interface';
|
|
3
3
|
import { DataService } from './data.service';
|
|
4
|
-
import { HttpClient } from './http.service';
|
|
4
|
+
import { HttpClient, TokenOption } from './http.service';
|
|
5
5
|
import { TimeSeries, TimeSeriesValue, TS_GROUPS } from './timeseries.interface';
|
|
6
6
|
import { TrashService } from './trash.service';
|
|
7
7
|
interface BaseService extends DataService<TimeSeries>, TrashService<TimeSeries> {
|
|
@@ -12,7 +12,7 @@ export declare class TimeSeriesService extends BaseService {
|
|
|
12
12
|
constructor(httpClient: HttpClient);
|
|
13
13
|
addValue(id: string, value: {
|
|
14
14
|
[timestamp: string]: any;
|
|
15
|
-
}): Promise<void>;
|
|
15
|
+
}, options?: TokenOption): Promise<void>;
|
|
16
16
|
/**
|
|
17
17
|
* Adds time series values to an asset by the name of the time series.
|
|
18
18
|
* If the time series does not exist, it is created.
|
|
@@ -25,11 +25,12 @@ export declare class TimeSeriesService extends BaseService {
|
|
|
25
25
|
* [timestamp: string]: any, // The timestamp and value pairs
|
|
26
26
|
* ...
|
|
27
27
|
* }
|
|
28
|
+
* @param options
|
|
28
29
|
* @returns a promise that resolves to the time series that was added.
|
|
29
30
|
*/
|
|
30
31
|
addAssetTimeSeriesValues(assetId: string, name: string, readPermissions: string[], readWritePermissions: string[], values: {
|
|
31
32
|
[timestamp: string]: any;
|
|
32
|
-
}): Promise<TimeSeries>;
|
|
33
|
+
}, options?: TokenOption): Promise<TimeSeries>;
|
|
33
34
|
/**
|
|
34
35
|
* Adds multiple time series values to an asset by the name of the time series.
|
|
35
36
|
* If the time series does not exist, it is created.
|
|
@@ -46,6 +47,7 @@ export declare class TimeSeriesService extends BaseService {
|
|
|
46
47
|
* },
|
|
47
48
|
* ...
|
|
48
49
|
* }
|
|
50
|
+
* @param options
|
|
49
51
|
* @returns a promise that resolves to an array of objects containing the results of the operation.
|
|
50
52
|
* Each object has the following structure:
|
|
51
53
|
* {
|
|
@@ -58,10 +60,10 @@ export declare class TimeSeriesService extends BaseService {
|
|
|
58
60
|
[timeSeriesName: string]: {
|
|
59
61
|
[timestamp: string]: any;
|
|
60
62
|
};
|
|
61
|
-
}): Promise<PromiseSettledResult<TimeSeries>[]>;
|
|
62
|
-
getMostRecentValue(id: string, before?: Date): Promise<TimeSeriesValue>;
|
|
63
|
-
getValues(id: string, from: number, limit?: number, group?: TS_GROUPS): Promise<TimeSeriesValue[]>;
|
|
64
|
-
getValuesOfPeriod(id: string, from: number, to: number, group?: TS_GROUPS): Promise<TimeSeriesValue[]>;
|
|
65
|
-
getManyByAsset(assetId: string, names?: string[]): Promise<Paginated<TimeSeries[]>>;
|
|
63
|
+
}, options?: TokenOption): Promise<PromiseSettledResult<TimeSeries>[]>;
|
|
64
|
+
getMostRecentValue(id: string, before?: Date, options?: TokenOption): Promise<TimeSeriesValue>;
|
|
65
|
+
getValues(id: string, from: number, limit?: number, group?: TS_GROUPS, options?: TokenOption): Promise<TimeSeriesValue[]>;
|
|
66
|
+
getValuesOfPeriod(id: string, from: number, to: number, group?: TS_GROUPS, options?: TokenOption): Promise<TimeSeriesValue[]>;
|
|
67
|
+
getManyByAsset(assetId: string, names?: string[], options?: TokenOption): Promise<Paginated<TimeSeries[]>>;
|
|
66
68
|
}
|
|
67
69
|
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { mix } from 'ts-mixer';
|
|
3
|
+
import { APIBase } from './api-base';
|
|
4
|
+
import { DataService } from './data.service';
|
|
5
|
+
import { TrashService } from './trash.service';
|
|
6
|
+
let BaseService = class BaseService extends APIBase {
|
|
7
|
+
};
|
|
8
|
+
BaseService = __decorate([
|
|
9
|
+
mix(DataService, TrashService)
|
|
10
|
+
], BaseService);
|
|
11
|
+
export class TimeSeriesService extends BaseService {
|
|
12
|
+
constructor(httpClient) {
|
|
13
|
+
super(httpClient, '/tsm');
|
|
14
|
+
}
|
|
15
|
+
addValue(id, value, options = {}) {
|
|
16
|
+
return this.httpClient.post(`${this.basePath}/${id}`, value, options);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Adds time series values to an asset by the name of the time series.
|
|
20
|
+
* If the time series does not exist, it is created.
|
|
21
|
+
* @param assetId - The ID of the asset to which the time series values are added.
|
|
22
|
+
* @param name - The name of the time series.
|
|
23
|
+
* @param readPermissions - an array of permissions that allow the user to read the time series.
|
|
24
|
+
* @param readWritePermissions - an array of permissions that allow the user to read and write the time series.
|
|
25
|
+
* @param values - The time series values are specified as an object with the following structure:
|
|
26
|
+
* {
|
|
27
|
+
* [timestamp: string]: any, // The timestamp and value pairs
|
|
28
|
+
* ...
|
|
29
|
+
* }
|
|
30
|
+
* @param options
|
|
31
|
+
* @returns a promise that resolves to the time series that was added.
|
|
32
|
+
*/
|
|
33
|
+
addAssetTimeSeriesValues(assetId, name, readPermissions, readWritePermissions, values, options = {}) {
|
|
34
|
+
const dto = {
|
|
35
|
+
name,
|
|
36
|
+
readPermissions,
|
|
37
|
+
readWritePermissions,
|
|
38
|
+
values,
|
|
39
|
+
};
|
|
40
|
+
return this.httpClient.post(`${this.basePath}/assets/${assetId}`, dto, options);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Adds multiple time series values to an asset by the name of the time series.
|
|
44
|
+
* If the time series does not exist, it is created.
|
|
45
|
+
* If the operation is successful, the value property contains the time series that was added.
|
|
46
|
+
* If the operation fails, the reason property contains the error that caused the operation to fail.
|
|
47
|
+
* @param assetId - The ID of the asset to which the time series values are added.
|
|
48
|
+
* @param readPermissions - an array of permissions that allow the user to read the time series.
|
|
49
|
+
* @param readWritePermissions - an array of permissions that allow the user to read and write the time series.
|
|
50
|
+
* @param timeSeries - The time series values are specified as an object with the following structure:
|
|
51
|
+
* {
|
|
52
|
+
* [timeSeriesName: string]: { // The name of the time series
|
|
53
|
+
* [timestamp: string]: any, // The timestamp and value pairs
|
|
54
|
+
* ...
|
|
55
|
+
* },
|
|
56
|
+
* ...
|
|
57
|
+
* }
|
|
58
|
+
* @param options
|
|
59
|
+
* @returns a promise that resolves to an array of objects containing the results of the operation.
|
|
60
|
+
* Each object has the following structure:
|
|
61
|
+
* {
|
|
62
|
+
* status: "fulfilled" | "rejected",
|
|
63
|
+
* value?: TimeSeries,
|
|
64
|
+
* reason?: Error,
|
|
65
|
+
* }
|
|
66
|
+
*/
|
|
67
|
+
addManyAssetTimeSeriesValues(assetId, readPermissions, readWritePermissions, timeSeries, options = {}) {
|
|
68
|
+
const dtos = Object.entries(timeSeries).map(([name, values]) => ({
|
|
69
|
+
name,
|
|
70
|
+
readPermissions,
|
|
71
|
+
readWritePermissions,
|
|
72
|
+
values,
|
|
73
|
+
}));
|
|
74
|
+
return this.httpClient.post(`${this.basePath}/assets/${assetId}/bulk`, dtos, options);
|
|
75
|
+
}
|
|
76
|
+
getMostRecentValue(id, before, options = {}) {
|
|
77
|
+
const params = before ? { before: before.toISOString() } : {};
|
|
78
|
+
return this.httpClient.get(`${this.basePath}/${id}/recent`, { params, ...options });
|
|
79
|
+
}
|
|
80
|
+
getValues(id, from, limit, group, options = {}) {
|
|
81
|
+
const params = { limit, group };
|
|
82
|
+
return this.httpClient.get(`${this.basePath}/${id}/${from}`, { params, ...options });
|
|
83
|
+
}
|
|
84
|
+
getValuesOfPeriod(id, from, to, group, options = {}) {
|
|
85
|
+
const params = { group };
|
|
86
|
+
return this.httpClient.get(`${this.basePath}/${id}/${from}/${to}`, { params, ...options });
|
|
87
|
+
}
|
|
88
|
+
getManyByAsset(assetId, names, options = {}) {
|
|
89
|
+
const params = Array.isArray(names) ? { names: names.join() } : {};
|
|
90
|
+
return this.httpClient.get(`${this.basePath}/asset/${assetId}`, { params, ...options });
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export declare class TokenSet {
|
|
2
2
|
private readonly _accessToken;
|
|
3
3
|
private readonly _expiresAt;
|
|
4
|
-
|
|
4
|
+
private readonly _provided;
|
|
5
|
+
constructor(access_token: string, expires_in: number, provided?: boolean);
|
|
5
6
|
get accessToken(): string;
|
|
6
7
|
get expiresAt(): number;
|
|
7
8
|
get expiresIn(): number;
|
|
9
|
+
get provided(): boolean;
|
|
8
10
|
isExpired(): boolean;
|
|
9
11
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const TOKEN_EXPIRATION_BUFFER = 20; // 20 seconds
|
|
2
|
+
export class TokenSet {
|
|
3
|
+
constructor(access_token, expires_in, provided = false) {
|
|
4
|
+
this._accessToken = access_token;
|
|
5
|
+
this._expiresAt = Math.floor(Date.now() / 1000) + Number(expires_in);
|
|
6
|
+
this._provided = provided;
|
|
7
|
+
}
|
|
8
|
+
get accessToken() {
|
|
9
|
+
return this._accessToken;
|
|
10
|
+
}
|
|
11
|
+
get expiresAt() {
|
|
12
|
+
return this._expiresAt;
|
|
13
|
+
}
|
|
14
|
+
get expiresIn() {
|
|
15
|
+
return Math.max(this.expiresAt - Math.ceil(Date.now() / 1000), 0);
|
|
16
|
+
}
|
|
17
|
+
get provided() {
|
|
18
|
+
return this._provided;
|
|
19
|
+
}
|
|
20
|
+
isExpired() {
|
|
21
|
+
return this.expiresIn <= (this.provided ? 0 : TOKEN_EXPIRATION_BUFFER); // Use the entire time of provided token to avoid throwing 'expired' error early
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.TrashService = void 0;
|
|
4
|
-
const api_base_1 = require("./api-base");
|
|
5
|
-
class TrashService extends api_base_1.APIBase {
|
|
1
|
+
import { APIBase } from './api-base';
|
|
2
|
+
export class TrashService extends APIBase {
|
|
6
3
|
trashRestoreAll() {
|
|
7
4
|
return this.httpClient.put(`${this.basePath}/trash/restore`, {});
|
|
8
5
|
}
|
|
@@ -18,4 +15,3 @@ class TrashService extends api_base_1.APIBase {
|
|
|
18
15
|
return this.httpClient.get(`${this.basePath}/trash`, { params });
|
|
19
16
|
}
|
|
20
17
|
}
|
|
21
|
-
exports.TrashService = TrashService;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HttpClient, TokenOption } from './http.service';
|
|
2
|
+
import { UserSettings } from './user-settings.interface';
|
|
3
|
+
export declare class UserService {
|
|
4
|
+
private httpClient;
|
|
5
|
+
private readonly basePath;
|
|
6
|
+
constructor(httpClient: HttpClient);
|
|
7
|
+
getCurrentUserRoles(): Promise<string[]>;
|
|
8
|
+
getUserSettings(options?: TokenOption): Promise<UserSettings>;
|
|
9
|
+
updateUserSettings(settings: UserSettings, options?: TokenOption): Promise<UserSettings>;
|
|
10
|
+
deleteUserSettings(options?: TokenOption): Promise<UserSettings>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jwtDecode } from 'jwt-decode';
|
|
2
|
+
export class UserService {
|
|
3
|
+
constructor(httpClient) {
|
|
4
|
+
this.httpClient = httpClient;
|
|
5
|
+
this.basePath = '/user';
|
|
6
|
+
}
|
|
7
|
+
async getCurrentUserRoles() {
|
|
8
|
+
try {
|
|
9
|
+
const token = await this.httpClient.getAccessToken();
|
|
10
|
+
const decode = jwtDecode(token);
|
|
11
|
+
return decode.realm_access.roles;
|
|
12
|
+
}
|
|
13
|
+
catch (err) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
getUserSettings(options = {}) {
|
|
18
|
+
return this.httpClient.get(this.basePath, options);
|
|
19
|
+
}
|
|
20
|
+
updateUserSettings(settings, options = {}) {
|
|
21
|
+
return this.httpClient.put(this.basePath, settings, options);
|
|
22
|
+
}
|
|
23
|
+
deleteUserSettings(options = {}) {
|
|
24
|
+
return this.httpClient.delete(this.basePath, options);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DataService } from './data.service';
|
|
2
|
+
import { HttpClient, TokenOption } from './http.service';
|
|
2
3
|
import { VaultSecret } from './vault.interface';
|
|
3
|
-
import { HttpClient } from './http.service';
|
|
4
4
|
export declare class VaultService extends DataService<VaultSecret> {
|
|
5
5
|
constructor(httpClient: HttpClient);
|
|
6
|
-
getSecret(name: string, version?: number): Promise<string>;
|
|
6
|
+
getSecret(name: string, version?: number, options?: TokenOption): Promise<string>;
|
|
7
7
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DataService } from './data.service';
|
|
2
|
+
export class VaultService extends DataService {
|
|
3
|
+
constructor(httpClient) {
|
|
4
|
+
super(httpClient, '/vault/secrets');
|
|
5
|
+
}
|
|
6
|
+
getSecret(name, version, options = {}) {
|
|
7
|
+
const params = version ? { version } : {};
|
|
8
|
+
return this.httpClient.get(`${this.basePath}/${name}/secret`, { params, ...options });
|
|
9
|
+
}
|
|
10
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 Hahn PRO
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/dist/api-base.js
DELETED
package/dist/api.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.API = void 0;
|
|
4
|
-
const asset_service_1 = require("./asset.service");
|
|
5
|
-
const assettypes_service_1 = require("./assettypes.service");
|
|
6
|
-
const content_service_1 = require("./content.service");
|
|
7
|
-
const endpoint_service_1 = require("./endpoint.service");
|
|
8
|
-
const events_service_1 = require("./events.service");
|
|
9
|
-
const http_service_1 = require("./http.service");
|
|
10
|
-
const proxy_service_1 = require("./proxy.service");
|
|
11
|
-
const secret_service_1 = require("./secret.service");
|
|
12
|
-
const task_service_1 = require("./task.service");
|
|
13
|
-
const timeseries_service_1 = require("./timeseries.service");
|
|
14
|
-
const user_service_1 = require("./user.service");
|
|
15
|
-
const flow_service_1 = require("./flow.service");
|
|
16
|
-
const flow_function_service_1 = require("./flow-function.service");
|
|
17
|
-
const flow_module_service_1 = require("./flow-module.service");
|
|
18
|
-
const flow_deployment_service_1 = require("./flow-deployment.service");
|
|
19
|
-
const label_service_1 = require("./label.service");
|
|
20
|
-
const vault_service_1 = require("./vault.service");
|
|
21
|
-
const notification_service_1 = require("./notification.service");
|
|
22
|
-
class API {
|
|
23
|
-
constructor(httpClient, context) {
|
|
24
|
-
this.httpClient = httpClient;
|
|
25
|
-
if (!httpClient) {
|
|
26
|
-
const normalizePath = (value = '', defaultValue = '') => value.replace(/(?:^\/+)|(?:\/+$)/g, '') || defaultValue;
|
|
27
|
-
let apiBaseUrl = process.env.API_BASE_URL || 'https://testing.hahnpro.com';
|
|
28
|
-
if (!apiBaseUrl.startsWith('https') && !apiBaseUrl.startsWith('http')) {
|
|
29
|
-
console.info('no protocol specified - using HTTPS');
|
|
30
|
-
apiBaseUrl = `https://${apiBaseUrl}`;
|
|
31
|
-
}
|
|
32
|
-
const apiUrl = apiBaseUrl + '/' + normalizePath(process.env.API_BASE_PATH, 'api');
|
|
33
|
-
const authBaseUrl = process.env.AUTH_BASE_URL || apiBaseUrl;
|
|
34
|
-
const authUrl = authBaseUrl + '/' + normalizePath(process.env.AUTH_BASE_PATH, 'auth');
|
|
35
|
-
const realm = process.env.AUTH_REALM || 'hpc';
|
|
36
|
-
const client = process.env.API_USER || 'flow-executor-service';
|
|
37
|
-
const secret = process.env.AUTH_SECRET;
|
|
38
|
-
if (!secret) {
|
|
39
|
-
throw new Error('"API_BASE_URL", "API_USER", "AUTH_REALM" and "AUTH_SECRET" environment variables must be set');
|
|
40
|
-
}
|
|
41
|
-
this.httpClient = new http_service_1.HttpClient(apiUrl, authUrl, realm, client, secret, context === null || context === void 0 ? void 0 : context.tokenSubject);
|
|
42
|
-
}
|
|
43
|
-
this.assets = new asset_service_1.AssetService(this.httpClient);
|
|
44
|
-
this.assetTypes = new assettypes_service_1.AssetTypesService(this.httpClient);
|
|
45
|
-
this.contents = new content_service_1.ContentService(this.httpClient);
|
|
46
|
-
this.endpoints = new endpoint_service_1.EndpointService(this.httpClient);
|
|
47
|
-
this.events = new events_service_1.EventsService(this.httpClient);
|
|
48
|
-
this.flows = new flow_service_1.FlowService(this.httpClient);
|
|
49
|
-
this.flowDeployments = new flow_deployment_service_1.FlowDeploymentService(this.httpClient);
|
|
50
|
-
this.flowFunctions = new flow_function_service_1.FlowFunctionService(this.httpClient);
|
|
51
|
-
this.flowModules = new flow_module_service_1.FlowModuleService(this.httpClient);
|
|
52
|
-
this.labels = new label_service_1.LabelService(this.httpClient);
|
|
53
|
-
this.proxy = new proxy_service_1.ProxyService(this.httpClient);
|
|
54
|
-
this.secrets = new secret_service_1.SecretService(this.httpClient);
|
|
55
|
-
this.tasks = new task_service_1.TaskService(this.httpClient);
|
|
56
|
-
this.timeSeries = new timeseries_service_1.TimeSeriesService(this.httpClient);
|
|
57
|
-
this.users = new user_service_1.UserService(this.httpClient);
|
|
58
|
-
this.vault = new vault_service_1.VaultService(this.httpClient);
|
|
59
|
-
this.notifications = new notification_service_1.NotificationService(this.httpClient);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.API = API;
|
package/dist/asset.interface.js
DELETED
package/dist/asset.service.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import FormData from 'form-data';
|
|
2
|
-
import { APIBase } from './api-base';
|
|
3
|
-
import { Asset, AssetRevision, Attachment, EventCause, EventLevelOverride } from './asset.interface';
|
|
4
|
-
import { Paginated, RequestParameter } from './data.interface';
|
|
5
|
-
import { DataService } from './data.service';
|
|
6
|
-
import { HttpClient } from './http.service';
|
|
7
|
-
import { TrashService } from './trash.service';
|
|
8
|
-
interface BaseService extends DataService<Asset>, TrashService<Asset> {
|
|
9
|
-
}
|
|
10
|
-
declare class BaseService extends APIBase {
|
|
11
|
-
}
|
|
12
|
-
export declare class AssetService extends BaseService {
|
|
13
|
-
constructor(httpClient: HttpClient);
|
|
14
|
-
deleteOne(id: string, force?: boolean): Promise<any>;
|
|
15
|
-
addAttachment: (id: string, form: FormData) => Promise<Asset>;
|
|
16
|
-
getChildren(assetId: string, params?: RequestParameter): Promise<Paginated<Asset[]>>;
|
|
17
|
-
getAttachments(assetId: string): Promise<Paginated<Attachment[]>>;
|
|
18
|
-
getEventLevelOverride(ids: string[], causes: string[]): Promise<EventLevelOverride>;
|
|
19
|
-
updateEventCausesAsset(id: string, dto: EventCause): Promise<Asset>;
|
|
20
|
-
getRevisions(assetId: string): Promise<Paginated<AssetRevision[]>>;
|
|
21
|
-
rollback(assetId: string, revisionId: string): Promise<Asset>;
|
|
22
|
-
deleteRevision(assetId: string, revisionId: string): Promise<any>;
|
|
23
|
-
}
|
|
24
|
-
export {};
|
package/dist/asset.service.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AssetService = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const ts_mixer_1 = require("ts-mixer");
|
|
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
|
-
let BaseService = class BaseService extends api_base_1.APIBase {
|
|
10
|
-
};
|
|
11
|
-
BaseService = tslib_1.__decorate([
|
|
12
|
-
(0, ts_mixer_1.mix)(data_service_1.DataService, trash_service_1.TrashService)
|
|
13
|
-
], BaseService);
|
|
14
|
-
class AssetService extends BaseService {
|
|
15
|
-
constructor(httpClient) {
|
|
16
|
-
super(httpClient, '/assets');
|
|
17
|
-
this.addAttachment = (id, form) => {
|
|
18
|
-
const headers = Object.assign({}, form.getHeaders());
|
|
19
|
-
return this.httpClient.post(`${this.basePath}/${id}/attachment`, form, {
|
|
20
|
-
headers,
|
|
21
|
-
maxBodyLength: Infinity,
|
|
22
|
-
maxContentLength: Infinity,
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
deleteOne(id, force = false) {
|
|
27
|
-
return this.httpClient.delete(`${this.basePath}/${id}`, { params: { force } });
|
|
28
|
-
}
|
|
29
|
-
getChildren(assetId, params = {}) {
|
|
30
|
-
return this.getManyFiltered({ parent: assetId }, params);
|
|
31
|
-
}
|
|
32
|
-
getAttachments(assetId) {
|
|
33
|
-
return this.httpClient.get(`${this.basePath}/${assetId}/attachments`);
|
|
34
|
-
}
|
|
35
|
-
getEventLevelOverride(ids, causes) {
|
|
36
|
-
return this.httpClient.get(`${this.basePath}/eventcauses`, {
|
|
37
|
-
params: { ids: ids.join(','), causes: causes.join(',') },
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
updateEventCausesAsset(id, dto) {
|
|
41
|
-
return this.httpClient.put(`${this.basePath}/${id}/eventcauses`, dto);
|
|
42
|
-
}
|
|
43
|
-
getRevisions(assetId) {
|
|
44
|
-
return this.httpClient.get(`${this.basePath}/${assetId}/revisions`);
|
|
45
|
-
}
|
|
46
|
-
rollback(assetId, revisionId) {
|
|
47
|
-
return this.httpClient.put(`${this.basePath}/${assetId}/rollback`, { revisionId });
|
|
48
|
-
}
|
|
49
|
-
deleteRevision(assetId, revisionId) {
|
|
50
|
-
return this.httpClient.delete(`${this.basePath}/${assetId}/revisions/${revisionId}`);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.AssetService = AssetService;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AssetTypesService = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const ts_mixer_1 = require("ts-mixer");
|
|
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
|
-
let BaseService = class BaseService extends api_base_1.APIBase {
|
|
10
|
-
};
|
|
11
|
-
BaseService = tslib_1.__decorate([
|
|
12
|
-
(0, ts_mixer_1.mix)(data_service_1.DataService, trash_service_1.TrashService)
|
|
13
|
-
], BaseService);
|
|
14
|
-
class AssetTypesService extends BaseService {
|
|
15
|
-
constructor(httpClient) {
|
|
16
|
-
super(httpClient, '/assettypes');
|
|
17
|
-
}
|
|
18
|
-
getRevisions(id) {
|
|
19
|
-
return this.httpClient.get(`${this.basePath}/${id}/revisions`);
|
|
20
|
-
}
|
|
21
|
-
rollback(id, revisionId) {
|
|
22
|
-
return this.httpClient.put(`${this.basePath}/${id}/rollback`, { revisionId });
|
|
23
|
-
}
|
|
24
|
-
deleteRevision(id, revisionId) {
|
|
25
|
-
return this.httpClient.delete(`${this.basePath}/${id}/revisions/${revisionId}`);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.AssetTypesService = AssetTypesService;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import FormData from 'form-data';
|
|
2
|
-
import { Readable } from 'stream';
|
|
3
|
-
import { APIBase } from './api-base';
|
|
4
|
-
import { Content, ReturnType } from './content.interface';
|
|
5
|
-
import { DataService } from './data.service';
|
|
6
|
-
import { HttpClient } from './http.service';
|
|
7
|
-
import { TrashService } from './trash.service';
|
|
8
|
-
interface BaseService extends DataService<Content>, TrashService<Content> {
|
|
9
|
-
}
|
|
10
|
-
declare class BaseService extends APIBase {
|
|
11
|
-
}
|
|
12
|
-
export declare class ContentService extends BaseService {
|
|
13
|
-
constructor(httpClient: HttpClient);
|
|
14
|
-
upload: (form: FormData) => Promise<Content>;
|
|
15
|
-
download(id: string, raw?: boolean): Promise<Blob | ArrayBuffer>;
|
|
16
|
-
download(id: string, returnType: ReturnType.TEXT): Promise<string>;
|
|
17
|
-
download(id: string, returnType: ReturnType.JSON): Promise<Record<string, unknown>>;
|
|
18
|
-
download(id: string, returnType: ReturnType.NODEBUFFER): Promise<Buffer>;
|
|
19
|
-
download(id: string, returnType: ReturnType.BLOB): Promise<Blob>;
|
|
20
|
-
download(id: string, returnType: ReturnType.ARRAYBUFFER): Promise<ArrayBuffer>;
|
|
21
|
-
download(id: string, returnType: ReturnType.NODESTREAM): Promise<Readable>;
|
|
22
|
-
}
|
|
23
|
-
export {};
|
package/dist/content.service.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ContentService = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const ts_mixer_1 = require("ts-mixer");
|
|
6
|
-
const api_base_1 = require("./api-base");
|
|
7
|
-
const content_interface_1 = require("./content.interface");
|
|
8
|
-
const data_service_1 = require("./data.service");
|
|
9
|
-
const trash_service_1 = require("./trash.service");
|
|
10
|
-
let BaseService = class BaseService extends api_base_1.APIBase {
|
|
11
|
-
};
|
|
12
|
-
BaseService = tslib_1.__decorate([
|
|
13
|
-
(0, ts_mixer_1.mix)(data_service_1.DataService, trash_service_1.TrashService)
|
|
14
|
-
], BaseService);
|
|
15
|
-
class ContentService extends BaseService {
|
|
16
|
-
constructor(httpClient) {
|
|
17
|
-
super(httpClient, '/contents');
|
|
18
|
-
this.upload = (form) => {
|
|
19
|
-
const headers = Object.assign({}, form.getHeaders());
|
|
20
|
-
return this.httpClient.post(`${this.basePath}`, form, { headers, maxBodyLength: Infinity, maxContentLength: Infinity });
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
download(id, second) {
|
|
24
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
let returnType;
|
|
26
|
-
if (typeof second === 'boolean' || second == null) {
|
|
27
|
-
returnType = second ? content_interface_1.ReturnType.ARRAYBUFFER : content_interface_1.ReturnType.BLOB;
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
returnType = second;
|
|
31
|
-
}
|
|
32
|
-
const url = `${this.basePath}/${id}/download`;
|
|
33
|
-
switch (returnType) {
|
|
34
|
-
case content_interface_1.ReturnType.TEXT:
|
|
35
|
-
return this.httpClient.get(url, { responseType: 'text' });
|
|
36
|
-
case content_interface_1.ReturnType.JSON:
|
|
37
|
-
return this.httpClient.get(url, { responseType: 'json' });
|
|
38
|
-
case content_interface_1.ReturnType.NODEBUFFER:
|
|
39
|
-
return Buffer.from(new Uint8Array(yield this.httpClient.get(url, { responseType: 'arraybuffer' })));
|
|
40
|
-
case content_interface_1.ReturnType.BLOB:
|
|
41
|
-
return this.httpClient.get(url, { responseType: 'blob' });
|
|
42
|
-
case content_interface_1.ReturnType.ARRAYBUFFER:
|
|
43
|
-
return this.httpClient.get(url, { responseType: 'arraybuffer' });
|
|
44
|
-
case content_interface_1.ReturnType.NODESTREAM:
|
|
45
|
-
return this.httpClient.get(url, { responseType: 'stream' });
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.ContentService = ContentService;
|
package/dist/data.interface.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export interface Paginated<T> {
|
|
2
|
-
docs: T;
|
|
3
|
-
total: number;
|
|
4
|
-
limit: number;
|
|
5
|
-
page?: number;
|
|
6
|
-
pages?: number;
|
|
7
|
-
offset?: number;
|
|
8
|
-
}
|
|
9
|
-
export interface RequestParameter {
|
|
10
|
-
filter?: string;
|
|
11
|
-
limit?: number;
|
|
12
|
-
page?: number;
|
|
13
|
-
populate?: string;
|
|
14
|
-
sort?: string;
|
|
15
|
-
}
|
|
16
|
-
interface TimePeriod {
|
|
17
|
-
from: Date;
|
|
18
|
-
to: Date;
|
|
19
|
-
}
|
|
20
|
-
export declare function instanceOfTimePeriod(object: any): object is TimePeriod;
|
|
21
|
-
export type Filter = Record<string, string | string[] | TimePeriod>;
|
|
22
|
-
export interface DataInterface<T> {
|
|
23
|
-
addOne(dto: any): Promise<T>;
|
|
24
|
-
addMany(dto: any[]): Promise<T[]>;
|
|
25
|
-
getOne(id: string, options?: any): Promise<T>;
|
|
26
|
-
getMany(params?: RequestParameter, parentId?: string): Promise<Paginated<T[]>>;
|
|
27
|
-
getManyFiltered(filter: Filter, params?: RequestParameter, parentId?: string): Promise<Paginated<T[]>>;
|
|
28
|
-
updateOne(id: string, dto: any): Promise<T>;
|
|
29
|
-
deleteOne(id: string): Promise<any>;
|
|
30
|
-
}
|
|
31
|
-
export {};
|