@hahnpro/hpc-api 2026.9.1 → 2026.9.3
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 +6 -0
- package/package.json +7 -2
- package/src/lib/interfaces/dataspace.interface.d.ts +1 -1
- package/src/lib/interfaces/dataspace.interface.js +1 -1
- package/src/lib/mock/api.mock.d.ts +5 -1
- package/src/lib/mock/api.mock.js +3 -3
- package/src/lib/mock/asset.mock.service.d.ts +7 -2
- package/src/lib/mock/asset.mock.service.js +8 -1
- package/src/lib/mock/dataspace.mock.service.d.ts +2 -1
- package/src/lib/mock/dataspace.mock.service.js +2 -2
- package/src/lib/services/asset.service.d.ts +3 -1
- package/src/lib/services/asset.service.js +6 -0
- package/src/lib/services/dataspace.service.d.ts +1 -1
- package/src/lib/services/dataspace.service.js +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @hahnpro/hpc-api
|
|
2
2
|
|
|
3
|
+
# 2026.9.3
|
|
4
|
+
|
|
5
|
+
- Added `getAssetsByAttachment` to asset service
|
|
6
|
+
- Added `getTranslation` endpoint to asset service
|
|
7
|
+
- Updated `checkSharingStatus` endpoint in dataspace service
|
|
8
|
+
|
|
3
9
|
# 2026.9.1
|
|
4
10
|
|
|
5
11
|
- Added `transcribeAudio` (`POST /ai/audio/transcription`) for server-side audio transcription and removed `getSpeechToken` (`GET /ai/speech/token`)
|
package/package.json
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hahnpro/hpc-api",
|
|
3
|
-
"version": "2026.9.
|
|
3
|
+
"version": "2026.9.3",
|
|
4
4
|
"description": "Module for easy access to the HahnPRO Cloud API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Hahn Projects GmbH",
|
|
8
8
|
"url": "https://hahnpro.com"
|
|
9
9
|
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/hahnprojects/hpc.git",
|
|
13
|
+
"directory": "lib/hpc-api"
|
|
14
|
+
},
|
|
10
15
|
"dependencies": {
|
|
11
16
|
"@microsoft/fetch-event-source": "2.0.1",
|
|
12
17
|
"axios": "1.20.0",
|
|
13
18
|
"eventsource": "5.1.1",
|
|
14
|
-
"jose": "6.2.
|
|
19
|
+
"jose": "6.2.11",
|
|
15
20
|
"jwt-decode": "4.0.0",
|
|
16
21
|
"p-queue": "9.3.3",
|
|
17
22
|
"rxjs": "7.8.2",
|
|
@@ -2,7 +2,7 @@ export declare enum DataspaceWorkflowType {
|
|
|
2
2
|
Share = "dataspaceShare",
|
|
3
3
|
Delete = "dataspaceDelete"
|
|
4
4
|
}
|
|
5
|
-
export declare const DataspaceAllowedResourceTypes: readonly ["asset", "event", "content"
|
|
5
|
+
export declare const DataspaceAllowedResourceTypes: readonly ["asset", "event", "content"];
|
|
6
6
|
export type DataspaceAllowedResourceType = (typeof DataspaceAllowedResourceTypes)[number];
|
|
7
7
|
export type DataspaceWorkflowStatus = 'finished' | 'failed';
|
|
8
8
|
export interface ShareInDataspaceDto {
|
|
@@ -6,4 +6,4 @@ var DataspaceWorkflowType;
|
|
|
6
6
|
DataspaceWorkflowType["Share"] = "dataspaceShare";
|
|
7
7
|
DataspaceWorkflowType["Delete"] = "dataspaceDelete";
|
|
8
8
|
})(DataspaceWorkflowType || (exports.DataspaceWorkflowType = DataspaceWorkflowType = {}));
|
|
9
|
-
exports.DataspaceAllowedResourceTypes = ['asset', 'event', 'content'
|
|
9
|
+
exports.DataspaceAllowedResourceTypes = ['asset', 'event', 'content'];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { API } from '../api';
|
|
2
|
-
import { Artifact, Asset, AssetRevision, AssetType, Content, Endpoint, Event, FlowDeployment, FlowDiagram, FlowDto, FlowFunctionDto, FlowFunctionRevision, FlowModule, FlowRevision, Label, LogbookEntry, Notification, ObjectReference, Organization, Secret, Task, TimeSeries, TimeSeriesValue, VaultSecret } from '../interfaces';
|
|
2
|
+
import { Artifact, Asset, AssetRevision, AssetType, Content, Endpoint, Event, FlowDeployment, FlowDiagram, FlowDto, FlowFunctionDto, FlowFunctionRevision, FlowModule, FlowRevision, Label, LogbookEntry, Notification, ObjectReference, Organization, Secret, Task, TimeSeries, TimeSeriesValue, Translation, VaultSecret } from '../interfaces';
|
|
3
3
|
import { AiMockService } from './ai.mock.service';
|
|
4
4
|
import { AlertMockService } from './alert.mock.service';
|
|
5
5
|
import { AssetMockService } from './asset.mock.service';
|
|
@@ -53,6 +53,7 @@ export interface MockAPIInitData {
|
|
|
53
53
|
organizations?: OrganizationInit[];
|
|
54
54
|
objectReferences?: ObjectReferenceInit[];
|
|
55
55
|
resourceSetNames?: string[];
|
|
56
|
+
translations?: TranslationInit[];
|
|
56
57
|
}
|
|
57
58
|
export declare class MockAPI implements API {
|
|
58
59
|
ai: AiMockService;
|
|
@@ -99,6 +100,9 @@ export type LogbookEntryInit = AtLeast<LogbookEntry, 'id' | 'taskId' | 'date' |
|
|
|
99
100
|
export type AssetInit = Replace<AtLeast<Asset, 'id' | 'name' | 'type'>, 'type', AssetTypeInit | string>;
|
|
100
101
|
export type AssetRevisionInit = Replace<AtLeast<AssetRevision, 'id' | 'name' | 'type' | 'originalId'>, 'type', AssetTypeInit | string>;
|
|
101
102
|
export type AssetTypeInit = AtLeast<AssetType, 'id' | 'name'>;
|
|
103
|
+
export type TranslationInit = Identity<AtLeast<Translation, 'de' | 'en'> & {
|
|
104
|
+
id: string;
|
|
105
|
+
}>;
|
|
102
106
|
export type ContentInit = Identity<AtLeast<Content, 'id' | 'filename'> & {
|
|
103
107
|
filePath?: string;
|
|
104
108
|
data?: any;
|
package/src/lib/mock/api.mock.js
CHANGED
|
@@ -34,7 +34,7 @@ const vault_mock_service_1 = require("./vault.mock.service");
|
|
|
34
34
|
class MockAPI {
|
|
35
35
|
constructor(initData) {
|
|
36
36
|
this.proxy = null;
|
|
37
|
-
const { assets = [], assetRevisions = [], contents = [], endpoints = [], secrets = [], timeSeries = [], tasks = [], events = [], users, flows = [], flowRevisions = [], deployments = [], functions = [], functionRevisions = [], modules = [], diagrams = [], labels = [], logbookEntries = [], vault = [], notifications = [], organizations = [], objectReferences = [], resourceSetNames = [], } = initData;
|
|
37
|
+
const { assets = [], assetRevisions = [], contents = [], endpoints = [], secrets = [], timeSeries = [], tasks = [], events = [], users, flows = [], flowRevisions = [], deployments = [], functions = [], functionRevisions = [], modules = [], diagrams = [], labels = [], logbookEntries = [], vault = [], notifications = [], organizations = [], objectReferences = [], resourceSetNames = [], translations = [], } = initData;
|
|
38
38
|
// convert init data to normal data that the services usually use
|
|
39
39
|
const assetTypes = assets
|
|
40
40
|
.map((v) => v.type)
|
|
@@ -54,7 +54,7 @@ class MockAPI {
|
|
|
54
54
|
readPermissions: v.readPermissions ?? [],
|
|
55
55
|
readWritePermissions: v.readWritePermissions ?? [],
|
|
56
56
|
type: assetTypes[index],
|
|
57
|
-
attachments: [],
|
|
57
|
+
attachments: v.attachments ?? [],
|
|
58
58
|
}));
|
|
59
59
|
const assetRevisions1 = assetRevisions.map((v, index) => ({
|
|
60
60
|
...v,
|
|
@@ -213,7 +213,7 @@ class MockAPI {
|
|
|
213
213
|
}));
|
|
214
214
|
this.ai = new ai_mock_service_1.AiMockService();
|
|
215
215
|
this.alerts = new alert_mock_service_1.AlertMockService([]);
|
|
216
|
-
this.assets = new asset_mock_service_1.AssetMockService(this, assets1, assetRevisions1);
|
|
216
|
+
this.assets = new asset_mock_service_1.AssetMockService(this, assets1, assetRevisions1, translations);
|
|
217
217
|
this.assetTypes = new assetTypes_mock_service_1.AssetTypesMockService(assetTypes, []);
|
|
218
218
|
this.authz = new authz_1.AuthzMockService();
|
|
219
219
|
this.contents = new content_mock_service_1.ContentMockService(contents1, contentData);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddToProperty, Asset, AssetRevision, Attachment, DeleteQuery, EventCause, EventLevelOverride, Filter, Paginated, RemoveFromProperty, RequestParameter, SearchResultItem, TokenOption } from '../interfaces';
|
|
1
|
+
import { AddToProperty, Asset, AssetRevision, Attachment, DeleteQuery, EventCause, EventLevelOverride, Filter, Paginated, RemoveFromProperty, RequestParameter, SearchResultItem, TokenOption, Translation } from '../interfaces';
|
|
2
2
|
import { AssetService } from '../services';
|
|
3
3
|
import { CrossPlatformFormData } from '../utils';
|
|
4
4
|
import type { MockAPI } from './api.mock';
|
|
@@ -15,7 +15,10 @@ declare class BaseService extends BaseService_base {
|
|
|
15
15
|
export declare class AssetMockService extends BaseService implements AssetService {
|
|
16
16
|
private api;
|
|
17
17
|
private revisions;
|
|
18
|
-
|
|
18
|
+
private translations;
|
|
19
|
+
constructor(api: MockAPI, assets: Asset[], revisions: AssetRevision[], translations?: Array<Translation & {
|
|
20
|
+
id: string;
|
|
21
|
+
}>);
|
|
19
22
|
addElementToProperty(id: string, dto: AddToProperty): Promise<Asset>;
|
|
20
23
|
removeElementFromProperty(id: string, dto: RemoveFromProperty): Promise<Asset>;
|
|
21
24
|
private getAssets;
|
|
@@ -26,6 +29,7 @@ export declare class AssetMockService extends BaseService implements AssetServic
|
|
|
26
29
|
updateOne(assetId: string, dto: Asset): Promise<Asset>;
|
|
27
30
|
addAttachment(id: string, form: CrossPlatformFormData): Promise<Asset>;
|
|
28
31
|
getAttachments(assetId: string): Promise<Paginated<Attachment>>;
|
|
32
|
+
getAssetsByAttachment(contentId: string, params?: RequestParameter): Promise<Paginated<Asset>>;
|
|
29
33
|
getChildren(assetId: string, params?: RequestParameter): Promise<Paginated<Asset>>;
|
|
30
34
|
getEventLevelOverride(ids: string[], causes: string[]): Promise<EventLevelOverride>;
|
|
31
35
|
updateEventCausesAsset(id: string, dto: EventCause): Promise<Asset>;
|
|
@@ -35,6 +39,7 @@ export declare class AssetMockService extends BaseService implements AssetServic
|
|
|
35
39
|
findOneExternal(key: string, options?: TokenOption): Promise<Asset>;
|
|
36
40
|
updateOneExternal(key: string, dto: any, options?: TokenOption): Promise<Asset>;
|
|
37
41
|
findTranslatedNames(lang: string, translationIds: string[], options?: TokenOption): Promise<Record<string, string>>;
|
|
42
|
+
getTranslation(translationId: string, options?: TokenOption): Promise<Translation>;
|
|
38
43
|
link(id: string, elementId: string, targetProperty: string, options?: TokenOption & {
|
|
39
44
|
[key: string]: any;
|
|
40
45
|
}): Promise<void>;
|
|
@@ -8,10 +8,11 @@ const trash_mock_service_1 = require("./trash.mock.service");
|
|
|
8
8
|
class BaseService extends (0, ts_mixer_1.Mixin)((data_mock_service_1.DataMockService), (share_mock_service_1.ShareMockService), (trash_mock_service_1.TrashMockService)) {
|
|
9
9
|
}
|
|
10
10
|
class AssetMockService extends BaseService {
|
|
11
|
-
constructor(api, assets, revisions) {
|
|
11
|
+
constructor(api, assets, revisions, translations = []) {
|
|
12
12
|
super(assets);
|
|
13
13
|
this.api = api;
|
|
14
14
|
this.revisions = revisions;
|
|
15
|
+
this.translations = translations;
|
|
15
16
|
}
|
|
16
17
|
addElementToProperty(id, dto) {
|
|
17
18
|
throw new Error('Method not implemented.');
|
|
@@ -70,6 +71,9 @@ class AssetMockService extends BaseService {
|
|
|
70
71
|
const docs = contents.docs.filter((c) => c.assets?.includes?.(assetId));
|
|
71
72
|
return { docs, total: docs.length, limit: 0 };
|
|
72
73
|
}
|
|
74
|
+
getAssetsByAttachment(contentId, params = {}) {
|
|
75
|
+
return this.getManyFiltered({ attachments: contentId }, params);
|
|
76
|
+
}
|
|
73
77
|
getChildren(assetId, params = {}) {
|
|
74
78
|
return this.getManyFiltered({ parent: assetId }, params);
|
|
75
79
|
}
|
|
@@ -128,6 +132,9 @@ class AssetMockService extends BaseService {
|
|
|
128
132
|
findTranslatedNames(lang, translationIds, options) {
|
|
129
133
|
throw new Error('Method not implemented.');
|
|
130
134
|
}
|
|
135
|
+
getTranslation(translationId, options) {
|
|
136
|
+
return Promise.resolve(this.translations.find((translation) => translation.id === translationId));
|
|
137
|
+
}
|
|
131
138
|
link(id, elementId, targetProperty, options = {}) {
|
|
132
139
|
throw new Error('Method not implemented.');
|
|
133
140
|
}
|
|
@@ -7,6 +7,7 @@ export declare class DataspaceMockService extends APIBaseMock<DataspaceWorkflowR
|
|
|
7
7
|
readonly checkSharingStatusCalls: Array<{
|
|
8
8
|
resourceId: string;
|
|
9
9
|
resourceType: DataspaceAllowedResourceType;
|
|
10
|
+
assetRefs: string[];
|
|
10
11
|
}>;
|
|
11
12
|
readonly checkSharingWorkflowStatusCalls: string[];
|
|
12
13
|
readonly awaitSharingWorkflowResultCalls: string[];
|
|
@@ -19,7 +20,7 @@ export declare class DataspaceMockService extends APIBaseMock<DataspaceWorkflowR
|
|
|
19
20
|
deleteWorkflowResult: DataspaceWorkflowResult | null | undefined;
|
|
20
21
|
constructor();
|
|
21
22
|
shareInDataspace(dto: ShareInDataspaceDto, _options?: TokenOption): Promise<DataspaceWorkflowResult>;
|
|
22
|
-
checkSharingStatus(resourceId: string, resourceType: DataspaceAllowedResourceType, _options?: TokenOption): Promise<boolean>;
|
|
23
|
+
checkSharingStatus(resourceId: string, resourceType: DataspaceAllowedResourceType, assetRefs?: string[], _options?: TokenOption): Promise<boolean>;
|
|
23
24
|
checkSharingWorkflowStatus(resourceId: string, _options?: TokenOption): Promise<boolean>;
|
|
24
25
|
awaitSharingWorkflowResult(resourceId: string, _options?: TokenOption): Promise<DataspaceWorkflowResult | null>;
|
|
25
26
|
deleteFromDataspace(dto: ShareInDataspaceDto, _options?: TokenOption): Promise<DataspaceWorkflowResult>;
|
|
@@ -21,8 +21,8 @@ class DataspaceMockService extends api_base_mock_1.APIBaseMock {
|
|
|
21
21
|
this.data.push(this.shareResult);
|
|
22
22
|
return this.shareResult;
|
|
23
23
|
}
|
|
24
|
-
async checkSharingStatus(resourceId, resourceType, _options = {}) {
|
|
25
|
-
this.checkSharingStatusCalls.push({ resourceId, resourceType });
|
|
24
|
+
async checkSharingStatus(resourceId, resourceType, assetRefs = [], _options = {}) {
|
|
25
|
+
this.checkSharingStatusCalls.push({ resourceId, resourceType, assetRefs });
|
|
26
26
|
return this.checkStatusResult;
|
|
27
27
|
}
|
|
28
28
|
async checkSharingWorkflowStatus(resourceId, _options = {}) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddToProperty, Asset, AssetRevision, Attachment, DeleteAssetQuery, EventCause, EventLevelOverride, Filter, Paginated, RemoveFromProperty, RequestParameter, SearchResultItem, TokenOption } from '../interfaces';
|
|
1
|
+
import { AddToProperty, Asset, AssetRevision, Attachment, DeleteAssetQuery, EventCause, EventLevelOverride, Filter, Paginated, RemoveFromProperty, RequestParameter, SearchResultItem, TokenOption, Translation } from '../interfaces';
|
|
2
2
|
import { CrossPlatformFormData } from '../utils';
|
|
3
3
|
import { DataService } from './data.service';
|
|
4
4
|
import { HttpClientService } from './http-client.service';
|
|
@@ -20,6 +20,7 @@ export declare class AssetService extends BaseService {
|
|
|
20
20
|
removeElementFromProperty(id: string, dto: RemoveFromProperty): Promise<Asset>;
|
|
21
21
|
getChildren(assetId: string, params?: RequestParameter, options?: TokenOption): Promise<Paginated<Asset>>;
|
|
22
22
|
getAttachments(assetId: string, params?: RequestParameter, options?: TokenOption): Promise<Paginated<Attachment>>;
|
|
23
|
+
getAssetsByAttachment(contentId: string, params?: RequestParameter, options?: TokenOption): Promise<Paginated<Asset>>;
|
|
23
24
|
getEventLevelOverride(ids: string[], causes: string[], options?: TokenOption): Promise<EventLevelOverride>;
|
|
24
25
|
updateEventCausesAsset(id: string, dto: EventCause, options?: TokenOption): Promise<Asset>;
|
|
25
26
|
getRevisions(assetId: string, options?: TokenOption): Promise<Paginated<AssetRevision>>;
|
|
@@ -28,6 +29,7 @@ export declare class AssetService extends BaseService {
|
|
|
28
29
|
findOneExternal(key: string, options?: TokenOption): Promise<Asset>;
|
|
29
30
|
updateOneExternal(key: string, dto: any, options?: TokenOption): Promise<Asset>;
|
|
30
31
|
findTranslatedNames(lang: string, translationIds: string[], options?: TokenOption): Promise<Record<string, string>>;
|
|
32
|
+
getTranslation(translationId: string, options?: TokenOption): Promise<Translation>;
|
|
31
33
|
link(id: string, elementId: string, targetProperty: string, options?: TokenOption & {
|
|
32
34
|
[key: string]: any;
|
|
33
35
|
}): Promise<void>;
|
|
@@ -39,6 +39,9 @@ class AssetService extends BaseService {
|
|
|
39
39
|
getAttachments(assetId, params = {}, options = {}) {
|
|
40
40
|
return this.httpClient.get(`${this.basePath}/${assetId}/attachments`, { params, ...options });
|
|
41
41
|
}
|
|
42
|
+
getAssetsByAttachment(contentId, params = {}, options = {}) {
|
|
43
|
+
return this.getManyFiltered({ attachments: contentId }, params, options);
|
|
44
|
+
}
|
|
42
45
|
getEventLevelOverride(ids, causes, options = {}) {
|
|
43
46
|
return this.httpClient.post(`${this.basePath}/event-causes`, { ids, causes }, options);
|
|
44
47
|
}
|
|
@@ -63,6 +66,9 @@ class AssetService extends BaseService {
|
|
|
63
66
|
findTranslatedNames(lang, translationIds, options = {}) {
|
|
64
67
|
return this.httpClient.get(`${this.basePath}/translations/names/${lang}?translationIds=${translationIds.join(',')}`, options);
|
|
65
68
|
}
|
|
69
|
+
getTranslation(translationId, options = {}) {
|
|
70
|
+
return this.httpClient.get(`${this.basePath}/translations/${translationId}`, options);
|
|
71
|
+
}
|
|
66
72
|
link(id, elementId, targetProperty, options = {}) {
|
|
67
73
|
return this.httpClient.post(`${this.basePath}/${id}/link`, {
|
|
68
74
|
elementId,
|
|
@@ -9,5 +9,5 @@ export declare class DataspaceService extends APIBase {
|
|
|
9
9
|
deleteFromDataspace(dto: ShareInDataspaceDto, options?: TokenOption): Promise<DataspaceWorkflowResult>;
|
|
10
10
|
checkDeleteWorkflowStatus(resourceId: string, options?: TokenOption): Promise<boolean>;
|
|
11
11
|
awaitDeleteWorkflowResult(resourceId: string, options?: TokenOption): Promise<DataspaceWorkflowResult | null>;
|
|
12
|
-
checkSharingStatus(resourceId: string, resourceType: DataspaceAllowedResourceType, options?: TokenOption): Promise<boolean>;
|
|
12
|
+
checkSharingStatus(resourceId: string, resourceType: DataspaceAllowedResourceType, assetRefs?: string[], options?: TokenOption): Promise<boolean>;
|
|
13
13
|
}
|
|
@@ -32,10 +32,13 @@ class DataspaceService extends api_base_1.APIBase {
|
|
|
32
32
|
params.append('resourceId', resourceId);
|
|
33
33
|
return this.httpClient.get(`${this.basePath}/delete/workflow-result`, { params, ...options });
|
|
34
34
|
}
|
|
35
|
-
checkSharingStatus(resourceId, resourceType, options = {}) {
|
|
35
|
+
checkSharingStatus(resourceId, resourceType, assetRefs = [], options = {}) {
|
|
36
36
|
const params = new URLSearchParams();
|
|
37
37
|
params.append('resourceId', resourceId);
|
|
38
38
|
params.append('resourceType', resourceType);
|
|
39
|
+
for (const assetRef of assetRefs) {
|
|
40
|
+
params.append('assetRefs', assetRef);
|
|
41
|
+
}
|
|
39
42
|
return this.httpClient.get(`${this.basePath}/status`, { params, ...options });
|
|
40
43
|
}
|
|
41
44
|
}
|