@hahnpro/hpc-api 2025.3.10 → 2025.4.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/CHANGELOG.md +9 -0
- package/package.json +3 -1
- package/src/index.d.ts +2 -16
- package/src/index.js +2 -15
- package/src/lib/api-base.d.ts +3 -3
- package/src/lib/api.d.ts +6 -20
- package/src/lib/api.js +18 -32
- package/src/lib/interfaces/ai.interface.d.ts +1 -1
- package/src/lib/{alert.interface.d.ts → interfaces/alert.interface.d.ts} +1 -1
- package/src/lib/interfaces/asset.interface.d.ts +1 -2
- package/src/lib/{content.interface.d.ts → interfaces/content.interface.d.ts} +1 -2
- package/src/lib/{data.interface.d.ts → interfaces/data.interface.d.ts} +4 -4
- package/src/lib/interfaces/event.interface.d.ts +1 -1
- package/src/lib/{flow-deployment.interface.d.ts → interfaces/flow-deployment.interface.d.ts} +1 -3
- package/src/lib/{flow-module.interface.d.ts → interfaces/flow-module.interface.d.ts} +1 -1
- package/src/lib/{flow.interface.d.ts → interfaces/flow.interface.d.ts} +1 -3
- package/src/lib/interfaces/http.interface.d.ts +13 -0
- package/src/lib/interfaces/index.d.ts +29 -7
- package/src/lib/interfaces/index.js +11 -0
- package/src/lib/interfaces/invitation-representation.interface.d.ts +48 -0
- package/src/lib/interfaces/keycloak-profile.interface.d.ts +12 -0
- package/src/lib/interfaces/label.interface.d.ts +1 -1
- package/src/lib/{notification-rule.interface.d.ts → interfaces/notification-rule.interface.d.ts} +1 -1
- package/src/lib/interfaces/organization-role-representation.interface.d.ts +37 -0
- package/src/lib/interfaces/organization.interface.d.ts +74 -0
- package/src/lib/interfaces/organizations-resources.interface.d.ts +9 -0
- package/src/lib/interfaces/secret.interface.js +2 -0
- package/src/lib/interfaces/storage.interface.js +2 -0
- package/src/lib/{task.interface.d.ts → interfaces/task.interface.d.ts} +11 -8
- package/src/lib/interfaces/task.interface.js +2 -0
- package/src/lib/interfaces/user-settings.interface.js +2 -0
- package/src/lib/interfaces/vault.interface.js +2 -0
- package/src/lib/mock/ai.mock.service.d.ts +5 -8
- package/src/lib/mock/ai.mock.service.js +5 -2
- package/src/lib/mock/alert.mock.service.d.ts +6 -0
- package/src/lib/mock/alert.mock.service.js +11 -0
- package/src/lib/mock/api-base.mock.d.ts +5 -3
- package/src/lib/mock/api-base.mock.js +8 -2
- package/src/lib/mock/api.mock.d.ts +16 -47
- package/src/lib/mock/api.mock.js +28 -38
- package/src/lib/mock/asset.mock.service.d.ts +6 -12
- package/src/lib/mock/asset.mock.service.js +3 -5
- package/src/lib/mock/assetTypes.mock.service.d.ts +4 -7
- package/src/lib/mock/assetTypes.mock.service.js +3 -5
- package/src/lib/mock/content.mock.service.d.ts +4 -7
- package/src/lib/mock/content.mock.service.js +10 -12
- package/src/lib/mock/data.mock.service.d.ts +10 -13
- package/src/lib/mock/data.mock.service.js +21 -36
- package/src/lib/mock/endpoint.mock.service.d.ts +3 -3
- package/src/lib/mock/endpoint.mock.service.js +2 -2
- package/src/lib/mock/event.mock.service.d.ts +1 -1
- package/src/lib/mock/event.mock.service.js +2 -2
- package/src/lib/mock/flow-deployment.mock.service.d.ts +3 -7
- package/src/lib/mock/flow-deployment.mock.service.js +14 -6
- package/src/lib/mock/flow-functions.mock.service.d.ts +4 -5
- package/src/lib/mock/flow-functions.mock.service.js +2 -2
- package/src/lib/mock/flow-modules.mock.service.d.ts +3 -5
- package/src/lib/mock/flow-modules.mock.service.js +2 -2
- package/src/lib/mock/flow.mock.service.d.ts +5 -9
- package/src/lib/mock/flow.mock.service.js +3 -5
- package/src/lib/mock/{http.mock.service.d.ts → http-client.mock.service.d.ts} +3 -2
- package/src/lib/mock/{http.mock.service.js → http-client.mock.service.js} +4 -4
- package/src/lib/mock/index.d.ts +28 -12
- package/src/lib/mock/index.js +57 -12
- package/src/lib/mock/label.mock.service.d.ts +2 -2
- package/src/lib/mock/label.mock.service.js +2 -2
- package/src/lib/mock/notification-rules.mock.service.d.ts +5 -0
- package/src/lib/mock/notification-rules.mock.service.js +11 -0
- package/src/lib/mock/notification.mock.service.d.ts +3 -3
- package/src/lib/mock/notification.mock.service.js +2 -2
- package/src/lib/mock/organizations-administration.mock.service.d.ts +17 -0
- package/src/lib/mock/organizations-administration.mock.service.js +93 -0
- package/src/lib/mock/organizations-resources.mock.service.d.ts +12 -0
- package/src/lib/mock/organizations-resources.mock.service.js +24 -0
- package/src/lib/mock/organizations.mock.service.d.ts +29 -0
- package/src/lib/mock/organizations.mock.service.js +90 -0
- package/src/lib/mock/search.mock.service.d.ts +3 -4
- package/src/lib/mock/search.mock.service.js +2 -2
- package/src/lib/mock/secret.mock.service.d.ts +4 -7
- package/src/lib/mock/secret.mock.service.js +3 -5
- package/src/lib/mock/task.mock.service.d.ts +8 -12
- package/src/lib/mock/task.mock.service.js +4 -6
- package/src/lib/mock/timeseries.mock.service.d.ts +5 -8
- package/src/lib/mock/timeseries.mock.service.js +3 -5
- package/src/lib/mock/trash.mock.service.d.ts +6 -8
- package/src/lib/mock/trash.mock.service.js +3 -4
- package/src/lib/mock/user.mock.service.d.ts +1 -1
- package/src/lib/mock/user.mock.service.js +2 -2
- package/src/lib/mock/utils/index.d.ts +1 -0
- package/src/lib/mock/utils/index.js +5 -0
- package/src/lib/mock/utils/sort-data.function.d.ts +1 -0
- package/src/lib/mock/utils/sort-data.function.js +17 -0
- package/src/lib/mock/vault.mock.service.d.ts +3 -3
- package/src/lib/mock/vault.mock.service.js +2 -2
- package/src/lib/services/ai.service.d.ts +4 -5
- package/src/lib/services/alert.service.d.ts +5 -0
- package/src/lib/{alert.service.js → services/alert.service.js} +2 -2
- package/src/lib/services/asset.service.d.ts +6 -10
- package/src/lib/services/asset.service.js +3 -4
- package/src/lib/services/assettypes.service.d.ts +4 -7
- package/src/lib/services/assettypes.service.js +2 -3
- package/src/lib/{content.service.d.ts → services/content.service.d.ts} +5 -7
- package/src/lib/{content.service.js → services/content.service.js} +11 -12
- package/src/lib/{data.service.d.ts → services/data.service.d.ts} +4 -6
- package/src/lib/{data.service.js → services/data.service.js} +3 -21
- package/src/lib/{endpoint.service.d.ts → services/endpoint.service.d.ts} +3 -4
- package/src/lib/{endpoint.service.js → services/endpoint.service.js} +2 -2
- package/src/lib/services/event.service.d.ts +3 -4
- package/src/lib/services/event.service.js +2 -2
- package/src/lib/{flow-deployment.service.d.ts → services/flow-deployment.service.d.ts} +4 -7
- package/src/lib/{flow-deployment.service.js → services/flow-deployment.service.js} +3 -4
- package/src/lib/{flow-function.service.d.ts → services/flow-function.service.d.ts} +4 -6
- package/src/lib/{flow-function.service.js → services/flow-function.service.js} +2 -2
- package/src/lib/{flow-module.service.d.ts → services/flow-module.service.d.ts} +4 -5
- package/src/lib/{flow-module.service.js → services/flow-module.service.js} +3 -3
- package/src/lib/{flow.service.d.ts → services/flow.service.d.ts} +6 -10
- package/src/lib/{flow.service.js → services/flow.service.js} +3 -4
- package/src/lib/{http.service.d.ts → services/http-client.service.d.ts} +8 -16
- package/src/lib/{http.service.js → services/http-client.service.js} +42 -6
- package/src/lib/services/index.d.ts +20 -0
- package/src/lib/services/index.js +41 -1
- package/src/lib/services/label.service.d.ts +3 -4
- package/src/lib/services/label.service.js +2 -2
- package/src/lib/services/notification-rule.service.d.ts +5 -0
- package/src/lib/{notification-rule.service.js → services/notification-rule.service.js} +2 -2
- package/src/lib/services/notification.service.d.ts +5 -0
- package/src/lib/{notification.service.js → services/notification.service.js} +2 -2
- package/src/lib/services/organizations-administration.service.d.ts +56 -0
- package/src/lib/services/organizations-administration.service.js +84 -0
- package/src/lib/services/organizations-resources.service.d.ts +35 -0
- package/src/lib/services/organizations-resources.service.js +61 -0
- package/src/lib/services/organizations.service.d.ts +167 -0
- package/src/lib/services/organizations.service.js +216 -0
- package/src/lib/{proxy.service.d.ts → services/proxy.service.d.ts} +3 -2
- package/src/lib/services/search.service.d.ts +3 -3
- package/src/lib/services/secret.service.d.ts +11 -0
- package/src/lib/{secret.service.js → services/secret.service.js} +3 -4
- package/src/lib/{task.service.d.ts → services/task.service.d.ts} +8 -11
- package/src/lib/{task.service.js → services/task.service.js} +3 -4
- package/src/lib/services/timeseries.service.d.ts +4 -7
- package/src/lib/services/timeseries.service.js +2 -3
- package/src/lib/{trash.service.d.ts → services/trash.service.d.ts} +3 -3
- package/src/lib/{trash.service.js → services/trash.service.js} +1 -1
- package/src/lib/{user.service.d.ts → services/user.service.d.ts} +3 -3
- package/src/lib/services/vault.service.d.ts +6 -0
- package/src/lib/{vault.service.js → services/vault.service.js} +2 -2
- package/src/lib/utils.d.ts +2 -0
- package/src/lib/utils.js +21 -0
- package/src/lib/alert.service.d.ts +0 -6
- package/src/lib/mock/organization.mock.service.d.ts +0 -10
- package/src/lib/mock/organization.mock.service.js +0 -44
- package/src/lib/notification-rule.service.d.ts +0 -6
- package/src/lib/notification.service.d.ts +0 -6
- package/src/lib/organization.interface.d.ts +0 -36
- package/src/lib/organization.service.d.ts +0 -10
- package/src/lib/organization.service.js +0 -22
- package/src/lib/secret.service.d.ts +0 -13
- package/src/lib/vault.service.d.ts +0 -7
- /package/src/lib/{alert.interface.js → interfaces/alert.interface.js} +0 -0
- /package/src/lib/{content.interface.js → interfaces/content.interface.js} +0 -0
- /package/src/lib/{data.interface.js → interfaces/data.interface.js} +0 -0
- /package/src/lib/{endpoint.interface.d.ts → interfaces/endpoint.interface.d.ts} +0 -0
- /package/src/lib/{endpoint.interface.js → interfaces/endpoint.interface.js} +0 -0
- /package/src/lib/{flow-deployment.interface.js → interfaces/flow-deployment.interface.js} +0 -0
- /package/src/lib/{flow-function.interface.d.ts → interfaces/flow-function.interface.d.ts} +0 -0
- /package/src/lib/{flow-function.interface.js → interfaces/flow-function.interface.js} +0 -0
- /package/src/lib/{flow-module.interface.js → interfaces/flow-module.interface.js} +0 -0
- /package/src/lib/{flow.interface.js → interfaces/flow.interface.js} +0 -0
- /package/src/lib/{notification-rule.interface.js → interfaces/http.interface.js} +0 -0
- /package/src/lib/{notification.interface.js → interfaces/invitation-representation.interface.js} +0 -0
- /package/src/lib/{organization.interface.js → interfaces/keycloak-profile.interface.js} +0 -0
- /package/src/lib/{schema.interface.js → interfaces/notification-rule.interface.js} +0 -0
- /package/src/lib/{notification.interface.d.ts → interfaces/notification.interface.d.ts} +0 -0
- /package/src/lib/{secret.interface.js → interfaces/notification.interface.js} +0 -0
- /package/src/lib/{storage.interface.js → interfaces/organization-role-representation.interface.js} +0 -0
- /package/src/lib/{task.interface.js → interfaces/organization.interface.js} +0 -0
- /package/src/lib/{user-settings.interface.js → interfaces/organizations-resources.interface.js} +0 -0
- /package/src/lib/{schema.interface.d.ts → interfaces/schema.interface.d.ts} +0 -0
- /package/src/lib/{vault.interface.js → interfaces/schema.interface.js} +0 -0
- /package/src/lib/{secret.interface.d.ts → interfaces/secret.interface.d.ts} +0 -0
- /package/src/lib/{storage.interface.d.ts → interfaces/storage.interface.d.ts} +0 -0
- /package/src/lib/{user-settings.interface.d.ts → interfaces/user-settings.interface.d.ts} +0 -0
- /package/src/lib/{vault.interface.d.ts → interfaces/vault.interface.d.ts} +0 -0
- /package/src/lib/{Queue.d.ts → queue.d.ts} +0 -0
- /package/src/lib/{Queue.js → queue.js} +0 -0
- /package/src/lib/{proxy.service.js → services/proxy.service.js} +0 -0
- /package/src/lib/{user.service.js → services/user.service.js} +0 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OrganizationsMockService = void 0;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
class OrganizationsMockService extends _1.APIBaseMock {
|
|
7
|
+
constructor(organizations) {
|
|
8
|
+
super(null);
|
|
9
|
+
this.data = organizations;
|
|
10
|
+
}
|
|
11
|
+
addOrganizationInvitation(id, email, roles) {
|
|
12
|
+
if (!id || !email || !roles?.length) {
|
|
13
|
+
return Promise.reject('Bad Request');
|
|
14
|
+
}
|
|
15
|
+
return Promise.resolve();
|
|
16
|
+
}
|
|
17
|
+
getOrganizationIdByName(name) {
|
|
18
|
+
const id = this.data.find((org) => org.name === name)?.id;
|
|
19
|
+
return Promise.resolve({ id });
|
|
20
|
+
}
|
|
21
|
+
async addOne(dto) {
|
|
22
|
+
const dtoWithId = { id: (0, crypto_1.randomUUID)(), ...dto };
|
|
23
|
+
this.data.push(dtoWithId);
|
|
24
|
+
return Promise.resolve(dtoWithId);
|
|
25
|
+
}
|
|
26
|
+
async getOneCombined(id) {
|
|
27
|
+
const org = this.data.find((o) => o.id === id);
|
|
28
|
+
if (!org) {
|
|
29
|
+
return Promise.reject('Not Found');
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return Promise.resolve(org);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
addOrganizationRole(id, roleDto) {
|
|
36
|
+
return Promise.resolve([]);
|
|
37
|
+
}
|
|
38
|
+
checkForOrganizationUniqueness(name) {
|
|
39
|
+
return Promise.resolve(undefined);
|
|
40
|
+
}
|
|
41
|
+
deleteOrganizationData(id, elementId, kind) {
|
|
42
|
+
return Promise.resolve(undefined);
|
|
43
|
+
}
|
|
44
|
+
getActiveOrganizationOfUser() {
|
|
45
|
+
return Promise.resolve(undefined);
|
|
46
|
+
}
|
|
47
|
+
getMyOrganizations() {
|
|
48
|
+
return Promise.resolve([]);
|
|
49
|
+
}
|
|
50
|
+
getOrganizationData(id, kinds) {
|
|
51
|
+
return Promise.resolve(undefined);
|
|
52
|
+
}
|
|
53
|
+
getOrganizationMemberById(id, userId) {
|
|
54
|
+
return Promise.resolve(undefined);
|
|
55
|
+
}
|
|
56
|
+
getOrganizationNamesByIds(ids) {
|
|
57
|
+
return Promise.resolve([]);
|
|
58
|
+
}
|
|
59
|
+
getUserOrganizationRoles(ids, userId) {
|
|
60
|
+
return Promise.resolve(undefined);
|
|
61
|
+
}
|
|
62
|
+
getUserOrganizations(userId) {
|
|
63
|
+
return Promise.resolve([]);
|
|
64
|
+
}
|
|
65
|
+
grantOrRevokeRolesOfUser(id, roles, userId) {
|
|
66
|
+
return Promise.resolve(undefined);
|
|
67
|
+
}
|
|
68
|
+
hasActiveSubscription(subscriptionId) {
|
|
69
|
+
return Promise.resolve(false);
|
|
70
|
+
}
|
|
71
|
+
leaveOrganization(id) {
|
|
72
|
+
return Promise.resolve(undefined);
|
|
73
|
+
}
|
|
74
|
+
requestDeletion(id) {
|
|
75
|
+
return Promise.resolve(undefined);
|
|
76
|
+
}
|
|
77
|
+
resendOrganizationInvitation(id, invitationId) {
|
|
78
|
+
return Promise.resolve(undefined);
|
|
79
|
+
}
|
|
80
|
+
setActiveOrganizationOfUser(id) {
|
|
81
|
+
return Promise.resolve(undefined);
|
|
82
|
+
}
|
|
83
|
+
updateOne(id, dto) {
|
|
84
|
+
return Promise.resolve(undefined);
|
|
85
|
+
}
|
|
86
|
+
updateOrganizationRole(id, roleName, dto) {
|
|
87
|
+
return Promise.resolve([]);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.OrganizationsMockService = OrganizationsMockService;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TokenOption } from '../
|
|
3
|
-
import type { SearchOptions, SearchResult } from '../interfaces';
|
|
1
|
+
import { APIBaseMock } from '.';
|
|
2
|
+
import type { SearchOptions, SearchResult, TokenOption } from '../interfaces';
|
|
4
3
|
import { SearchService } from '../services';
|
|
5
|
-
export declare class SearchMockService extends
|
|
4
|
+
export declare class SearchMockService extends APIBaseMock<never> implements SearchService {
|
|
6
5
|
search<T extends {
|
|
7
6
|
id?: string;
|
|
8
7
|
}, K extends keyof T & string = keyof T & string>(query: SearchOptions<T, K>, tokenOption?: TokenOption): Promise<SearchResult<T, K>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SearchMockService = void 0;
|
|
4
|
-
const
|
|
5
|
-
class SearchMockService extends
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
class SearchMockService extends _1.APIBaseMock {
|
|
6
6
|
search(query, tokenOption = {}) {
|
|
7
7
|
throw new Error('Method not implemented.');
|
|
8
8
|
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Secret } from '../
|
|
3
|
-
import { SecretService } from '../
|
|
4
|
-
import { APIBaseMock } from './api-base.mock';
|
|
5
|
-
import { DataMockService } from './data.mock.service';
|
|
6
|
-
import { TrashMockService } from './trash.mock.service';
|
|
1
|
+
import { APIBaseMock, DataMockService, TrashMockService } from '.';
|
|
2
|
+
import { Paginated, RequestParameter, Secret } from '../interfaces';
|
|
3
|
+
import { SecretService } from '../services';
|
|
7
4
|
interface BaseService extends DataMockService<Secret>, TrashMockService<Secret> {
|
|
8
5
|
}
|
|
9
6
|
declare class BaseService extends APIBaseMock<Secret> {
|
|
@@ -11,6 +8,6 @@ declare class BaseService extends APIBaseMock<Secret> {
|
|
|
11
8
|
export declare class SecretMockService extends BaseService implements SecretService {
|
|
12
9
|
constructor(secrets: Secret[]);
|
|
13
10
|
deleteOne(contentId: string, force?: boolean): Promise<Secret>;
|
|
14
|
-
getMany(params?: RequestParameter): Promise<Paginated<Secret
|
|
11
|
+
getMany(params?: RequestParameter): Promise<Paginated<Secret>>;
|
|
15
12
|
}
|
|
16
13
|
export {};
|
|
@@ -3,13 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SecretMockService = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const ts_mixer_1 = require("ts-mixer");
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const trash_mock_service_1 = require("./trash.mock.service");
|
|
9
|
-
let BaseService = class BaseService extends api_base_mock_1.APIBaseMock {
|
|
6
|
+
const _1 = require(".");
|
|
7
|
+
let BaseService = class BaseService extends _1.APIBaseMock {
|
|
10
8
|
};
|
|
11
9
|
BaseService = tslib_1.__decorate([
|
|
12
|
-
(0, ts_mixer_1.mix)(
|
|
10
|
+
(0, ts_mixer_1.mix)(_1.DataMockService, _1.TrashMockService)
|
|
13
11
|
], BaseService);
|
|
14
12
|
class SecretMockService extends BaseService {
|
|
15
13
|
constructor(secrets) {
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TokenOption } from '../
|
|
3
|
-
import {
|
|
4
|
-
import { TaskService } from '../task.service';
|
|
5
|
-
import { APIBaseMock } from './api-base.mock';
|
|
6
|
-
import { DataMockService } from './data.mock.service';
|
|
7
|
-
import { TrashMockService } from './trash.mock.service';
|
|
1
|
+
import { APIBaseMock, DataMockService, TrashMockService } from '.';
|
|
2
|
+
import { LogbookEntry, LogbookEntryDto, Paginated, RequestParameter, Task, TokenOption } from '../interfaces';
|
|
3
|
+
import { TaskService } from '../services';
|
|
8
4
|
interface BaseService extends DataMockService<Task>, TrashMockService<Task> {
|
|
9
5
|
}
|
|
10
6
|
declare class BaseService extends APIBaseMock<Task> {
|
|
@@ -14,16 +10,16 @@ export declare class TaskMockService extends BaseService implements TaskService
|
|
|
14
10
|
constructor(tasks: Task[], logbookEntries?: LogbookEntry[]);
|
|
15
11
|
createTaskAttachedToAsset(dto: any): Promise<Task>;
|
|
16
12
|
deleteOne(taskId: string, force?: boolean): Promise<Task>;
|
|
17
|
-
getMany(params?: RequestParameter): Promise<Paginated<Task
|
|
18
|
-
findByName(name: string, options?: any): Promise<Paginated<Task
|
|
19
|
-
findByAsset(assetId: string, options?: any): Promise<Paginated<Task
|
|
20
|
-
getLogbookEntries(taskId: string, limit?: number, offset?: number, _options?: TokenOption): Promise<Paginated<LogbookEntry
|
|
13
|
+
getMany(params?: RequestParameter): Promise<Paginated<Task>>;
|
|
14
|
+
findByName(name: string, options?: any): Promise<Paginated<Task>>;
|
|
15
|
+
findByAsset(assetId: string, options?: any): Promise<Paginated<Task>>;
|
|
16
|
+
getLogbookEntries(taskId: string, limit?: number, offset?: number, _options?: TokenOption): Promise<Paginated<LogbookEntry>>;
|
|
21
17
|
addLogbookEntry(taskId: string, dto: LogbookEntryDto, _options?: TokenOption): Promise<LogbookEntry>;
|
|
22
18
|
updateLogbookEntry(taskId: string, entryId: string, dto: Partial<LogbookEntryDto>, _options?: TokenOption): Promise<LogbookEntry>;
|
|
23
19
|
deleteLogbookEntry(taskId: string, entryId: string, _options?: TokenOption): Promise<{
|
|
24
20
|
deleted: boolean;
|
|
25
21
|
}>;
|
|
26
|
-
getUserLogbookEntries(limit?: number, offset?: number, _options?: TokenOption, userId?: string): Promise<Paginated<LogbookEntry
|
|
22
|
+
getUserLogbookEntries(limit?: number, offset?: number, _options?: TokenOption, userId?: string): Promise<Paginated<LogbookEntry>>;
|
|
27
23
|
seed(entries: LogbookEntry[]): void;
|
|
28
24
|
clear(): void;
|
|
29
25
|
}
|
|
@@ -3,13 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TaskMockService = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const ts_mixer_1 = require("ts-mixer");
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const trash_mock_service_1 = require("./trash.mock.service");
|
|
9
|
-
let BaseService = class BaseService extends api_base_mock_1.APIBaseMock {
|
|
6
|
+
const _1 = require(".");
|
|
7
|
+
let BaseService = class BaseService extends _1.APIBaseMock {
|
|
10
8
|
};
|
|
11
9
|
BaseService = tslib_1.__decorate([
|
|
12
|
-
(0, ts_mixer_1.mix)(
|
|
10
|
+
(0, ts_mixer_1.mix)(_1.DataMockService, _1.TrashMockService)
|
|
13
11
|
], BaseService);
|
|
14
12
|
class TaskMockService extends BaseService {
|
|
15
13
|
constructor(tasks, logbookEntries = []) {
|
|
@@ -73,7 +71,7 @@ class TaskMockService extends BaseService {
|
|
|
73
71
|
const entry = {
|
|
74
72
|
id,
|
|
75
73
|
taskId,
|
|
76
|
-
date: dto.date ||
|
|
74
|
+
date: dto.date || new Date(),
|
|
77
75
|
duration: dto.duration ?? 0,
|
|
78
76
|
materials: dto.materials || [],
|
|
79
77
|
comment: dto.comment || '',
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TimeSeries, TimeSeriesValue, TS_GROUPS } from '../interfaces';
|
|
1
|
+
import { APIBaseMock, DataMockService, TrashMockService } from '.';
|
|
2
|
+
import { Paginated, RequestParameter, TimeSeries, TimeSeriesValue, TS_GROUPS } from '../interfaces';
|
|
3
3
|
import { TimeSeriesService } from '../services';
|
|
4
|
-
import { APIBaseMock } from './api-base.mock';
|
|
5
|
-
import { DataMockService } from './data.mock.service';
|
|
6
|
-
import { TrashMockService } from './trash.mock.service';
|
|
7
4
|
interface BaseService extends DataMockService<TimeSeries & {
|
|
8
5
|
data: TimeSeriesValue[];
|
|
9
6
|
}>, TrashMockService<TimeSeries & {
|
|
@@ -17,9 +14,9 @@ declare class BaseService extends APIBaseMock<TimeSeries & {
|
|
|
17
14
|
export declare class TimeseriesMockService extends BaseService implements TimeSeriesService {
|
|
18
15
|
constructor(timeseries: TimeSeries[], timeseriesValues: TimeSeriesValue[][]);
|
|
19
16
|
deleteOne(tsmId: string, force?: boolean): Promise<TimeSeries>;
|
|
20
|
-
getMany(params?: RequestParameter): Promise<Paginated<
|
|
17
|
+
getMany(params?: RequestParameter): Promise<Paginated<TimeSeries & {
|
|
21
18
|
data: TimeSeriesValue[];
|
|
22
|
-
}
|
|
19
|
+
}>>;
|
|
23
20
|
addAssetTimeSeriesValues(assetId: string, name: string, readPermissions: string[], readWritePermissions: string[], values: {
|
|
24
21
|
[timestamp: string]: any;
|
|
25
22
|
}, metadata?: Record<string, any>): Promise<TimeSeries>;
|
|
@@ -34,7 +31,7 @@ export declare class TimeseriesMockService extends BaseService implements TimeSe
|
|
|
34
31
|
addValue(id: string, value: {
|
|
35
32
|
[timestamp: string]: any;
|
|
36
33
|
}): Promise<void>;
|
|
37
|
-
getManyByAsset(assetId: string, names?: string[]): Promise<Paginated<TimeSeries
|
|
34
|
+
getManyByAsset(assetId: string, names?: string[]): Promise<Paginated<TimeSeries>>;
|
|
38
35
|
getMostRecentValue(id: string, before: Date): Promise<TimeSeriesValue>;
|
|
39
36
|
getValues(id: string, from: number, limit?: number, group?: TS_GROUPS): Promise<TimeSeriesValue[]>;
|
|
40
37
|
getValuesOfPeriod(id: string, from: number, to: number, group?: TS_GROUPS): Promise<TimeSeriesValue[]>;
|
|
@@ -3,13 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TimeseriesMockService = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const ts_mixer_1 = require("ts-mixer");
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const trash_mock_service_1 = require("./trash.mock.service");
|
|
9
|
-
let BaseService = class BaseService extends api_base_mock_1.APIBaseMock {
|
|
6
|
+
const _1 = require(".");
|
|
7
|
+
let BaseService = class BaseService extends _1.APIBaseMock {
|
|
10
8
|
};
|
|
11
9
|
BaseService = tslib_1.__decorate([
|
|
12
|
-
(0, ts_mixer_1.mix)(
|
|
10
|
+
(0, ts_mixer_1.mix)(_1.DataMockService, _1.TrashMockService)
|
|
13
11
|
], BaseService);
|
|
14
12
|
class TimeseriesMockService extends BaseService {
|
|
15
13
|
constructor(timeseries, timeseriesValues) {
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { APIBaseMock } from '.';
|
|
2
|
+
import { Paginated, RequestParameter } from '../interfaces';
|
|
3
|
+
import { TrashService } from '../services';
|
|
4
4
|
export declare class TrashMockService<T extends {
|
|
5
5
|
id?: string;
|
|
6
|
-
}> extends
|
|
7
|
-
data: T[];
|
|
8
|
-
protected deleteOnecbf: any;
|
|
6
|
+
}> extends APIBaseMock<T> implements TrashService<T> {
|
|
9
7
|
constructor();
|
|
10
8
|
trashRestoreAll(): Promise<T[]>;
|
|
11
9
|
trashRestoreOne(id: string): Promise<T>;
|
|
@@ -13,6 +11,6 @@ export declare class TrashMockService<T extends {
|
|
|
13
11
|
acknowledged: boolean;
|
|
14
12
|
deletedCount: number;
|
|
15
13
|
}>;
|
|
16
|
-
getTrash(params?: RequestParameter): Promise<Paginated<T
|
|
17
|
-
protected getItems(params: RequestParameter, deleted?: boolean): Paginated<T
|
|
14
|
+
getTrash(params?: RequestParameter): Promise<Paginated<T>>;
|
|
15
|
+
protected getItems(params: RequestParameter, deleted?: boolean): Paginated<T>;
|
|
18
16
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TrashMockService = void 0;
|
|
4
|
-
const
|
|
5
|
-
class TrashMockService extends
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
class TrashMockService extends _1.APIBaseMock {
|
|
6
6
|
constructor() {
|
|
7
|
-
super(null
|
|
8
|
-
this.data = [];
|
|
7
|
+
super(null);
|
|
9
8
|
}
|
|
10
9
|
trashRestoreAll() {
|
|
11
10
|
const deleted = this.data.filter((v) => v['deletedAt']);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UserMockService = void 0;
|
|
4
|
-
const
|
|
5
|
-
class UserMockService extends
|
|
4
|
+
const services_1 = require("../services");
|
|
5
|
+
class UserMockService extends services_1.UserService {
|
|
6
6
|
constructor(users) {
|
|
7
7
|
super(null);
|
|
8
8
|
this.users = users;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { sortData } from './sort-data.function';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sortData = void 0;
|
|
4
|
+
var sort_data_function_1 = require("./sort-data.function");
|
|
5
|
+
Object.defineProperty(exports, "sortData", { enumerable: true, get: function () { return sort_data_function_1.sortData; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sortData<T>(data: T[], sort: string): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sortData = sortData;
|
|
4
|
+
function sortData(data, sort) {
|
|
5
|
+
const descending = sort.startsWith('-');
|
|
6
|
+
const sortString = descending ? sort.substring(1) : sort;
|
|
7
|
+
const compareFn = (a, b) => {
|
|
8
|
+
let aValue = a[sortString];
|
|
9
|
+
let bValue = b[sortString];
|
|
10
|
+
if (['updatedAt', 'createdAt', 'deletedAt'].includes(sortString)) {
|
|
11
|
+
aValue = new Date(a[sortString]).valueOf();
|
|
12
|
+
bValue = new Date(b[sortString]).valueOf();
|
|
13
|
+
}
|
|
14
|
+
return descending ? bValue - aValue : aValue - bValue;
|
|
15
|
+
};
|
|
16
|
+
data.sort(compareFn);
|
|
17
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { DataMockService } from '.';
|
|
2
|
+
import { VaultSecret } from '../interfaces';
|
|
3
|
+
import { VaultService } from '../services';
|
|
4
4
|
export declare class VaultMockService extends DataMockService<VaultSecret> implements VaultService {
|
|
5
5
|
constructor(secrets: VaultSecret[]);
|
|
6
6
|
getSecret(name: string, version?: number): Promise<string>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VaultMockService = void 0;
|
|
4
|
-
const
|
|
5
|
-
class VaultMockService extends
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
class VaultMockService extends _1.DataMockService {
|
|
6
6
|
constructor(secrets) {
|
|
7
7
|
super();
|
|
8
8
|
this.data = secrets;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import { HttpClientService } from '.';
|
|
1
2
|
import { APIBase } from '../api-base';
|
|
2
|
-
import { Paginated } from '../
|
|
3
|
-
import { HttpClient, TokenOption } from '../http.service';
|
|
4
|
-
import { AiAssistant, Message, SpeechToken, Thread, ThreadPopulated } from '../interfaces';
|
|
3
|
+
import { AiAssistant, Message, Paginated, SpeechToken, Thread, ThreadPopulated, TokenOption } from '../interfaces';
|
|
5
4
|
export declare class AiService extends APIBase {
|
|
6
|
-
constructor(httpClient:
|
|
5
|
+
constructor(httpClient: HttpClientService);
|
|
7
6
|
addMessage(message: string, threadId?: string, assistantId?: string, context?: Record<string, unknown>): Promise<Message>;
|
|
8
7
|
createThread(assistantId: string, isEphemeral?: boolean): Promise<ThreadPopulated>;
|
|
9
8
|
getLatestAssistantThread(assistantId: string): Promise<ThreadPopulated>;
|
|
@@ -11,7 +10,7 @@ export declare class AiService extends APIBase {
|
|
|
11
10
|
getAssistant(assistantId: string): Promise<AiAssistant>;
|
|
12
11
|
getAssistants(): Promise<AiAssistant[]>;
|
|
13
12
|
getSpeechToken(): Promise<SpeechToken>;
|
|
14
|
-
getThreadMessages(threadId: string): Promise<Paginated<Message
|
|
13
|
+
getThreadMessages(threadId: string): Promise<Paginated<Message>>;
|
|
15
14
|
getThread(threadId: string): Promise<ThreadPopulated>;
|
|
16
15
|
getLatestThread(): Promise<ThreadPopulated>;
|
|
17
16
|
listThreads(assistantIds?: string[], params?: {}, options?: TokenOption): Promise<ThreadPopulated[]>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AlertService = void 0;
|
|
4
|
-
const
|
|
5
|
-
class AlertService extends
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
class AlertService extends _1.DataService {
|
|
6
6
|
constructor(httpClient) {
|
|
7
7
|
super(httpClient, '/alerts');
|
|
8
8
|
}
|
|
@@ -1,27 +1,23 @@
|
|
|
1
|
+
import { DataService, HttpClientService, TrashService } from '.';
|
|
1
2
|
import { APIBase } from '../api-base';
|
|
2
|
-
import { Filter, Paginated, RequestParameter } from '../
|
|
3
|
-
import { DataService } from '../data.service';
|
|
4
|
-
import { HttpClient, TokenOption } from '../http.service';
|
|
5
|
-
import { Asset, AssetRevision, Attachment, EventCause, EventLevelOverride } from '../interfaces';
|
|
6
|
-
import { AddToProperty, RemoveFromProperty } from '../interfaces/asset.interface';
|
|
7
|
-
import { TrashService } from '../trash.service';
|
|
3
|
+
import { AddToProperty, Asset, AssetRevision, Attachment, EventCause, EventLevelOverride, Filter, Paginated, RemoveFromProperty, RequestParameter, TokenOption } from '../interfaces';
|
|
8
4
|
import { CrossPlatformFormData } from '../utils';
|
|
9
5
|
interface BaseService extends DataService<Asset>, TrashService<Asset> {
|
|
10
6
|
}
|
|
11
7
|
declare class BaseService extends APIBase {
|
|
12
8
|
}
|
|
13
9
|
export declare class AssetService extends BaseService {
|
|
14
|
-
constructor(httpClient:
|
|
10
|
+
constructor(httpClient: HttpClientService);
|
|
15
11
|
count(filter: Filter, options?: TokenOption): Promise<number>;
|
|
16
12
|
deleteOne(id: string, force?: boolean, options?: TokenOption): Promise<any>;
|
|
17
13
|
addAttachment: (id: string, form: CrossPlatformFormData, options?: TokenOption) => Promise<Asset>;
|
|
18
14
|
addElementToProperty(id: string, dto: AddToProperty): Promise<Asset>;
|
|
19
15
|
removeElementFromProperty(id: string, dto: RemoveFromProperty): Promise<Asset>;
|
|
20
|
-
getChildren(assetId: string, params?: RequestParameter, options?: TokenOption): Promise<Paginated<Asset
|
|
21
|
-
getAttachments(assetId: string, options?: TokenOption): Promise<Paginated<Attachment
|
|
16
|
+
getChildren(assetId: string, params?: RequestParameter, options?: TokenOption): Promise<Paginated<Asset>>;
|
|
17
|
+
getAttachments(assetId: string, options?: TokenOption): Promise<Paginated<Attachment>>;
|
|
22
18
|
getEventLevelOverride(ids: string[], causes: string[], options?: TokenOption): Promise<EventLevelOverride>;
|
|
23
19
|
updateEventCausesAsset(id: string, dto: EventCause, options?: TokenOption): Promise<Asset>;
|
|
24
|
-
getRevisions(assetId: string, options?: TokenOption): Promise<Paginated<AssetRevision
|
|
20
|
+
getRevisions(assetId: string, options?: TokenOption): Promise<Paginated<AssetRevision>>;
|
|
25
21
|
rollback(assetId: string, revisionId: string, options?: TokenOption): Promise<Asset>;
|
|
26
22
|
deleteRevision(assetId: string, revisionId: string, options?: TokenOption): Promise<any>;
|
|
27
23
|
findOneExternal(key: string, options?: TokenOption): Promise<Asset>;
|
|
@@ -3,14 +3,13 @@ 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 _1 = require(".");
|
|
6
7
|
const api_base_1 = require("../api-base");
|
|
7
|
-
const data_service_1 = require("../data.service");
|
|
8
|
-
const trash_service_1 = require("../trash.service");
|
|
9
8
|
const utils_1 = require("../utils");
|
|
10
9
|
let BaseService = class BaseService extends api_base_1.APIBase {
|
|
11
10
|
};
|
|
12
11
|
BaseService = tslib_1.__decorate([
|
|
13
|
-
(0, ts_mixer_1.mix)(
|
|
12
|
+
(0, ts_mixer_1.mix)(_1.DataService, _1.TrashService)
|
|
14
13
|
], BaseService);
|
|
15
14
|
class AssetService extends BaseService {
|
|
16
15
|
constructor(httpClient) {
|
|
@@ -25,7 +24,7 @@ class AssetService extends BaseService {
|
|
|
25
24
|
};
|
|
26
25
|
}
|
|
27
26
|
count(filter, options = {}) {
|
|
28
|
-
const params = { filter:
|
|
27
|
+
const params = { filter: (0, utils_1.getFilterString)(filter) };
|
|
29
28
|
return this.httpClient.get(`${this.basePath}/count`, { params, ...options });
|
|
30
29
|
}
|
|
31
30
|
deleteOne(id, force = false, options = {}) {
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
+
import { DataService, HttpClientService, TrashService } from '.';
|
|
1
2
|
import { APIBase } from '../api-base';
|
|
2
|
-
import { Paginated } from '../
|
|
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';
|
|
3
|
+
import { AssetType, Paginated, Template, TokenOption } from '../interfaces';
|
|
7
4
|
interface BaseService extends DataService<AssetType>, TrashService<AssetType> {
|
|
8
5
|
}
|
|
9
6
|
declare class BaseService extends APIBase {
|
|
10
7
|
}
|
|
11
8
|
export declare class AssetTypesService extends BaseService {
|
|
12
|
-
constructor(httpClient:
|
|
13
|
-
getRevisions(id: string, options?: TokenOption): Promise<Paginated<AssetType
|
|
9
|
+
constructor(httpClient: HttpClientService);
|
|
10
|
+
getRevisions(id: string, options?: TokenOption): Promise<Paginated<AssetType>>;
|
|
14
11
|
rollback(id: string, revisionId: string, options?: TokenOption): Promise<AssetType>;
|
|
15
12
|
deleteRevision(id: string, revisionId: string, options?: TokenOption): Promise<any>;
|
|
16
13
|
getTemplate(id: string, templateName: string, options?: TokenOption): Promise<Template>;
|
|
@@ -3,13 +3,12 @@ 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 _1 = require(".");
|
|
6
7
|
const api_base_1 = require("../api-base");
|
|
7
|
-
const data_service_1 = require("../data.service");
|
|
8
|
-
const trash_service_1 = require("../trash.service");
|
|
9
8
|
let BaseService = class BaseService extends api_base_1.APIBase {
|
|
10
9
|
};
|
|
11
10
|
BaseService = tslib_1.__decorate([
|
|
12
|
-
(0, ts_mixer_1.mix)(
|
|
11
|
+
(0, ts_mixer_1.mix)(_1.DataService, _1.TrashService)
|
|
13
12
|
], BaseService);
|
|
14
13
|
class AssetTypesService extends BaseService {
|
|
15
14
|
constructor(httpClient) {
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { TrashService } from './trash.service';
|
|
6
|
-
import { CrossPlatformFormData } from './utils';
|
|
1
|
+
import { DataService, HttpClientService, TrashService } from '.';
|
|
2
|
+
import { APIBase } from '../api-base';
|
|
3
|
+
import { Config, Content, ReturnType, TokenOption } from '../interfaces';
|
|
4
|
+
import { CrossPlatformFormData } from '../utils';
|
|
7
5
|
interface BaseService extends DataService<Content>, TrashService<Content> {
|
|
8
6
|
}
|
|
9
7
|
declare class BaseService extends APIBase {
|
|
10
8
|
}
|
|
11
9
|
export declare class ContentService extends BaseService {
|
|
12
|
-
constructor(httpClient:
|
|
10
|
+
constructor(httpClient: HttpClientService);
|
|
13
11
|
upload: (form: CrossPlatformFormData, options?: Config) => Promise<Content>;
|
|
14
12
|
download(id: string, raw?: boolean, options?: TokenOption): Promise<Blob | ArrayBuffer>;
|
|
15
13
|
download(id: string, returnType: ReturnType.TEXT, options?: TokenOption): Promise<string>;
|
|
@@ -3,15 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ContentService = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const ts_mixer_1 = require("ts-mixer");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const utils_1 = require("./utils");
|
|
6
|
+
const _1 = require(".");
|
|
7
|
+
const api_base_1 = require("../api-base");
|
|
8
|
+
const interfaces_1 = require("../interfaces");
|
|
9
|
+
const utils_1 = require("../utils");
|
|
11
10
|
let BaseService = class BaseService extends api_base_1.APIBase {
|
|
12
11
|
};
|
|
13
12
|
BaseService = tslib_1.__decorate([
|
|
14
|
-
(0, ts_mixer_1.mix)(
|
|
13
|
+
(0, ts_mixer_1.mix)(_1.DataService, _1.TrashService)
|
|
15
14
|
], BaseService);
|
|
16
15
|
class ContentService extends BaseService {
|
|
17
16
|
constructor(httpClient) {
|
|
@@ -29,22 +28,22 @@ class ContentService extends BaseService {
|
|
|
29
28
|
async download(id, second, options = {}) {
|
|
30
29
|
let returnType;
|
|
31
30
|
if (typeof second === 'boolean' || second == null) {
|
|
32
|
-
returnType = second ?
|
|
31
|
+
returnType = second ? interfaces_1.ReturnType.ARRAYBUFFER : interfaces_1.ReturnType.BLOB;
|
|
33
32
|
}
|
|
34
33
|
else {
|
|
35
34
|
returnType = second;
|
|
36
35
|
}
|
|
37
36
|
const url = `${this.basePath}/${id}/download`;
|
|
38
37
|
switch (returnType) {
|
|
39
|
-
case
|
|
38
|
+
case interfaces_1.ReturnType.TEXT:
|
|
40
39
|
return this.httpClient.get(url, { responseType: 'text', ...options });
|
|
41
|
-
case
|
|
40
|
+
case interfaces_1.ReturnType.JSON:
|
|
42
41
|
return this.httpClient.get(url, { responseType: 'json', ...options });
|
|
43
|
-
case
|
|
42
|
+
case interfaces_1.ReturnType.NODEBUFFER:
|
|
44
43
|
return Buffer.from(new Uint8Array(await this.httpClient.get(url, { responseType: 'arraybuffer', ...options })));
|
|
45
|
-
case
|
|
44
|
+
case interfaces_1.ReturnType.BLOB:
|
|
46
45
|
return this.httpClient.get(url, { responseType: 'blob', ...options });
|
|
47
|
-
case
|
|
46
|
+
case interfaces_1.ReturnType.ARRAYBUFFER:
|
|
48
47
|
return this.httpClient.get(url, { responseType: 'arraybuffer', ...options });
|
|
49
48
|
}
|
|
50
49
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { APIBase } from '
|
|
2
|
-
import { DataInterface, Filter, Paginated, RequestParameter } from '
|
|
3
|
-
import { Config, TokenOption } from './http.service';
|
|
1
|
+
import { APIBase } from '../api-base';
|
|
2
|
+
import { Config, DataInterface, Filter, Paginated, RequestParameter, TokenOption } from '../interfaces';
|
|
4
3
|
export declare class DataService<T> extends APIBase implements DataInterface<T> {
|
|
5
4
|
addOne(dto: any, options?: TokenOption & {
|
|
6
5
|
[key: string]: any;
|
|
@@ -9,7 +8,7 @@ export declare class DataService<T> extends APIBase implements DataInterface<T>
|
|
|
9
8
|
getOne(id: string, options?: TokenOption & {
|
|
10
9
|
[key: string]: any;
|
|
11
10
|
}): Promise<T>;
|
|
12
|
-
getMany(params?: RequestParameter, options?: Config): Promise<Paginated<T
|
|
11
|
+
getMany(params?: RequestParameter, options?: Config): Promise<Paginated<T>>;
|
|
13
12
|
/**
|
|
14
13
|
* Filters the elements by the passed properties. The object with these properties has to be of the form:
|
|
15
14
|
* {
|
|
@@ -20,10 +19,9 @@ export declare class DataService<T> extends APIBase implements DataInterface<T>
|
|
|
20
19
|
* @param params Other request parameters.
|
|
21
20
|
* @param options Parameters for authentication
|
|
22
21
|
*/
|
|
23
|
-
getManyFiltered(filter: Filter, params?: RequestParameter, options?: TokenOption): Promise<Paginated<T
|
|
22
|
+
getManyFiltered(filter: Filter, params?: RequestParameter, options?: TokenOption): Promise<Paginated<T>>;
|
|
24
23
|
updateOne(id: string, dto: any, options?: TokenOption & {
|
|
25
24
|
[key: string]: any;
|
|
26
25
|
}): Promise<T>;
|
|
27
26
|
deleteOne(id: string, force?: boolean, options?: TokenOption): Promise<any>;
|
|
28
|
-
protected getFilterString(filter: Filter): string;
|
|
29
27
|
}
|