@hahnpro/hpc-api 2026.6.2 → 2026.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/lib/interfaces/flow-deployment.interface.d.ts +9 -0
- package/src/lib/interfaces/flow-deployment.interface.js +2 -1
- package/src/lib/interfaces/index.d.ts +2 -2
- package/src/lib/interfaces/index.js +3 -2
- package/src/lib/interfaces/nats.interface.d.ts +1 -0
- package/src/lib/interfaces/nats.interface.js +1 -0
- package/src/lib/mock/flow-deployment.mock.service.d.ts +8 -1
- package/src/lib/mock/flow-deployment.mock.service.js +19 -0
- package/src/lib/services/flow-deployment.service.d.ts +7 -1
- package/src/lib/services/flow-deployment.service.js +9 -0
- package/src/lib/services/organizations.service.d.ts +1 -1
- package/src/lib/services/organizations.service.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hahnpro/hpc-api",
|
|
3
|
-
"version": "2026.6.
|
|
3
|
+
"version": "2026.6.4",
|
|
4
4
|
"description": "Module for easy access to the HahnPRO Cloud API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@microsoft/fetch-event-source": "2.0.1",
|
|
12
|
-
"axios": "1.
|
|
12
|
+
"axios": "1.18.0",
|
|
13
13
|
"eventsource": "4.1.0",
|
|
14
14
|
"jose": "5.10.0",
|
|
15
15
|
"jwt-decode": "4.0.0",
|
|
@@ -78,3 +78,12 @@ export interface FlowLog {
|
|
|
78
78
|
time: string;
|
|
79
79
|
type: string;
|
|
80
80
|
}
|
|
81
|
+
export type NatsFlowTriggerData = {
|
|
82
|
+
correlationId: string;
|
|
83
|
+
} & Record<string, unknown>;
|
|
84
|
+
export type NatsFlowTriggerStatus = 'failed' | 'in progress' | 'finished';
|
|
85
|
+
export declare const NATS_FLOW_TRIGGER_STATUSES: NatsFlowTriggerStatus[];
|
|
86
|
+
export interface NatsFlowTriggerState {
|
|
87
|
+
status: NatsFlowTriggerStatus;
|
|
88
|
+
progress: number;
|
|
89
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FlowDeployment = void 0;
|
|
3
|
+
exports.NATS_FLOW_TRIGGER_STATUSES = exports.FlowDeployment = void 0;
|
|
4
4
|
const resource_interface_1 = require("./resource.interface");
|
|
5
5
|
class FlowDeployment extends resource_interface_1.ResourceClass {
|
|
6
6
|
}
|
|
7
7
|
exports.FlowDeployment = FlowDeployment;
|
|
8
|
+
exports.NATS_FLOW_TRIGGER_STATUSES = ['failed', 'in progress', 'finished'];
|
|
@@ -13,7 +13,7 @@ export type { EdgeDeviceRequestResponse, EdgeDeviceResult, WebIOData } from './e
|
|
|
13
13
|
export type { AdditionalNotificationData, Endpoint, EndpointConfig, EndpointLog, NotificationEndpoint, NotificationEndpointLog, NotificationLogType, NotificationPayload, SearchEndpointResult, } from './endpoint.interface';
|
|
14
14
|
export type { CreateEventDto, Event, EventCountByAsset } from './event.interface';
|
|
15
15
|
export type { BookedExaminee, Examination, ReviewScore, TimeSlot, WorkStation } from './flange-skill-control.interface';
|
|
16
|
-
export type { FlowConnection, FlowDeploymentMetrics, FlowDeploymentStatistic, FlowElement, FlowLog, FlowModel, Metrics, Stats, StatsValues, } from './flow-deployment.interface';
|
|
16
|
+
export type { FlowConnection, FlowDeploymentMetrics, FlowDeploymentStatistic, FlowElement, FlowLog, FlowModel, NatsFlowTriggerState, NatsFlowTriggerStatus, Metrics, NatsFlowTriggerData, Stats, StatsValues, } from './flow-deployment.interface';
|
|
17
17
|
export type { BillingEventsData, DeploymentId, DeploymentTriggerResponse, Executor, ExecutorEnvironment, ExecutorEventType, ExecutorId, ExecutorStats, WorkerId, } from './flow-executor.interface';
|
|
18
18
|
export type { DataDescription, FlowFunction, FlowFunctionDto, FlowFunctionRevision, SearchFlowTypeResult, Stream, } from './flow-function.interface';
|
|
19
19
|
export type { FlowModule, FlowModuleArtifact } from './flow-module.interface';
|
|
@@ -53,7 +53,7 @@ export { NotificationEndpointSpamProtection, NotificationEndpointStatus, Notific
|
|
|
53
53
|
export { EventLevel, EventLevelOverrideWrapper, eventLevels } from './event.interface';
|
|
54
54
|
export { APPLICATION_AREA, TimeSlotStatus } from './flange-skill-control.interface';
|
|
55
55
|
export { ERROR_STATES, FlowDeploymentStatus, PROCESSING_STATES, RUNNING_STATES, STOPPED_STATES, UNKOWN_STATES, } from './flow-deployment-status.interface';
|
|
56
|
-
export { FlowDeployment } from './flow-deployment.interface';
|
|
56
|
+
export { FlowDeployment, NATS_FLOW_TRIGGER_STATUSES } from './flow-deployment.interface';
|
|
57
57
|
export { Flow, FlowDiagram } from './flow.interface';
|
|
58
58
|
export { LABEL_COLORS } from './label.interface';
|
|
59
59
|
export { SubscriptionType } from './marketplace.interface';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.WebSocketMessageType = exports.SecretType = exports.isUserMessage = exports.isTask = exports.isStorage = exports.isOwner = exports.isLogbookEntry = exports.isEvent = exports.isContentAnalysis = exports.isContent = exports.isAuthor = exports.isAssignee = exports.isAsset = exports.TranslationEditData = exports.RETENTION_VALUES = exports.TaskStatus = exports.Priority = exports.INACTIVE_TASK_STATUSES = exports.buildTaskStatusFilter = exports.AssigneeType = exports.ACTIVE_TASK_STATUSES = exports.ResourceType = exports.resourceApiPathToTypeMap = exports.ResourceApiPath = exports.PermissionType = exports.isPopulated = exports.EventType = exports.CommandType = exports.arePopulated = exports.ObjectReferenceType = exports.OwnerType = exports.OrganizationMembersInviteOrAdd = void 0;
|
|
3
|
+
exports.NatsStreams = exports.natsHpcPrefix = exports.natsFlowsPrefix = exports.NatsConsumers = exports.SubscriptionType = exports.LABEL_COLORS = exports.FlowDiagram = exports.Flow = exports.NATS_FLOW_TRIGGER_STATUSES = exports.FlowDeployment = exports.UNKOWN_STATES = exports.STOPPED_STATES = exports.RUNNING_STATES = exports.PROCESSING_STATES = exports.FlowDeploymentStatus = exports.ERROR_STATES = exports.TimeSlotStatus = exports.APPLICATION_AREA = exports.eventLevels = exports.EventLevelOverrideWrapper = exports.EventLevel = exports.NotificationEndpointType = exports.NotificationEndpointStatus = exports.NotificationEndpointSpamProtection = exports.instanceOfTimePeriod = exports.ReturnType = exports.IndexingStatus = exports.ContentAnalysisStatus = exports.BillingResourceType = exports.ChangeAction = exports.DEFAULT_THRESHOLD_CONDITION = exports.DEFAULT_RELATIVE_CONDITION = exports.DEFAULT_DEADMAN_CONDITION = exports.AlertType = exports.AlertStatus = exports.AlertLevel = exports.ToolType = exports.ToolName = exports.ToolMessageStatus = exports.Role = exports.ReturnToReferrerTool = exports.ReferenceType = exports.HandOffTool = exports.FinishReason = exports.ErrorMessageType = exports.AvailableLanguages = exports.AttachmentHandlingMode = exports.AssistantMessageStatus = exports.AiAssistantId = exports.AgentId = void 0;
|
|
4
|
+
exports.WebSocketMessageType = exports.SecretType = exports.isUserMessage = exports.isTask = exports.isStorage = exports.isOwner = exports.isLogbookEntry = exports.isEvent = exports.isContentAnalysis = exports.isContent = exports.isAuthor = exports.isAssignee = exports.isAsset = exports.TranslationEditData = exports.RETENTION_VALUES = exports.TaskStatus = exports.Priority = exports.INACTIVE_TASK_STATUSES = exports.buildTaskStatusFilter = exports.AssigneeType = exports.ACTIVE_TASK_STATUSES = exports.ResourceType = exports.resourceApiPathToTypeMap = exports.ResourceApiPath = exports.PermissionType = exports.isPopulated = exports.EventType = exports.CommandType = exports.arePopulated = exports.ObjectReferenceType = exports.OwnerType = exports.OrganizationMembersInviteOrAdd = exports.NotificationRuleStatus = void 0;
|
|
5
5
|
var ai_interface_1 = require("./ai.interface");
|
|
6
6
|
Object.defineProperty(exports, "AgentId", { enumerable: true, get: function () { return ai_interface_1.AgentId; } });
|
|
7
7
|
Object.defineProperty(exports, "AiAssistantId", { enumerable: true, get: function () { return ai_interface_1.AiAssistantId; } });
|
|
@@ -54,6 +54,7 @@ Object.defineProperty(exports, "STOPPED_STATES", { enumerable: true, get: functi
|
|
|
54
54
|
Object.defineProperty(exports, "UNKOWN_STATES", { enumerable: true, get: function () { return flow_deployment_status_interface_1.UNKOWN_STATES; } });
|
|
55
55
|
var flow_deployment_interface_1 = require("./flow-deployment.interface");
|
|
56
56
|
Object.defineProperty(exports, "FlowDeployment", { enumerable: true, get: function () { return flow_deployment_interface_1.FlowDeployment; } });
|
|
57
|
+
Object.defineProperty(exports, "NATS_FLOW_TRIGGER_STATUSES", { enumerable: true, get: function () { return flow_deployment_interface_1.NATS_FLOW_TRIGGER_STATUSES; } });
|
|
57
58
|
var flow_interface_1 = require("./flow.interface");
|
|
58
59
|
Object.defineProperty(exports, "Flow", { enumerable: true, get: function () { return flow_interface_1.Flow; } });
|
|
59
60
|
Object.defineProperty(exports, "FlowDiagram", { enumerable: true, get: function () { return flow_interface_1.FlowDiagram; } });
|
|
@@ -43,6 +43,7 @@ export declare const NatsConsumers: {
|
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
45
|
readonly flows: {
|
|
46
|
+
readonly FlowTrigger: "flow-trigger";
|
|
46
47
|
readonly FlowDeploymentTrigger: "flow-deployment-trigger";
|
|
47
48
|
readonly FlowDeploymentDeploy: "flow-deployment-deploy";
|
|
48
49
|
readonly FlowDeploymentHealth: "flow-deployment-health";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { APIBaseMock, DataMockService, MockAPI, TrashMockService } from '.';
|
|
2
|
-
import { FlowDeployment, FlowDeploymentMetrics, FlowDeploymentStatistic, FlowLog, ResourceReference } from '../interfaces';
|
|
2
|
+
import { FlowDeployment, FlowDeploymentMetrics, FlowDeploymentStatistic, FlowLog, NatsFlowTriggerData, NatsFlowTriggerState, ResourceReference } from '../interfaces';
|
|
3
3
|
import { FlowDeploymentService } from '../services';
|
|
4
4
|
import { ShareMockService } from './share.mock.service';
|
|
5
5
|
interface BaseService extends DataMockService<FlowDeployment>, ShareMockService<FlowDeployment>, TrashMockService<FlowDeployment> {
|
|
@@ -8,6 +8,7 @@ declare class BaseService extends APIBaseMock<FlowDeployment> {
|
|
|
8
8
|
}
|
|
9
9
|
export declare class FlowDeploymentMockService extends BaseService implements FlowDeploymentService {
|
|
10
10
|
private api;
|
|
11
|
+
private readonly flowTriggerStates;
|
|
11
12
|
constructor(deployments: FlowDeployment[], api: MockAPI);
|
|
12
13
|
subscribeToStatus(id: string, listener: (event: MessageEvent<any>) => void, errorListener?: (event: MessageEvent<any>) => void): Promise<string>;
|
|
13
14
|
subscribeToLogs(id: string, listener: (event: MessageEvent<any>) => void, errorListener?: (event: MessageEvent) => void): Promise<string>;
|
|
@@ -26,6 +27,12 @@ export declare class FlowDeploymentMockService extends BaseService implements Fl
|
|
|
26
27
|
tags?: string[];
|
|
27
28
|
}): Promise<FlowDeployment>;
|
|
28
29
|
deleteOne(id: string): Promise<FlowDeployment>;
|
|
30
|
+
triggerFlow(dto: {
|
|
31
|
+
flowDeploymentId: string;
|
|
32
|
+
data?: Record<string, unknown>;
|
|
33
|
+
}): Promise<NatsFlowTriggerData>;
|
|
34
|
+
sendWebhookCallback(correlationId: string, dto: NatsFlowTriggerState): Promise<void>;
|
|
35
|
+
subscribeToNatsFlowWebhookState(correlationId: string, listener: (event: MessageEvent<string>) => void, errorListener?: (event: MessageEvent) => void): Promise<string>;
|
|
29
36
|
private getReferences;
|
|
30
37
|
}
|
|
31
38
|
export {};
|
|
@@ -16,6 +16,7 @@ class FlowDeploymentMockService extends BaseService {
|
|
|
16
16
|
constructor(deployments, api) {
|
|
17
17
|
super(deployments);
|
|
18
18
|
this.api = api;
|
|
19
|
+
this.flowTriggerStates = new Map();
|
|
19
20
|
}
|
|
20
21
|
subscribeToStatus(id, listener, errorListener) {
|
|
21
22
|
listener(new MessageEvent('message', { data: 'running' }));
|
|
@@ -120,6 +121,24 @@ class FlowDeploymentMockService extends BaseService {
|
|
|
120
121
|
await this.api.flows.updateOne(flow.id, flow);
|
|
121
122
|
return super.deleteOne(id);
|
|
122
123
|
}
|
|
124
|
+
triggerFlow(dto) {
|
|
125
|
+
const correlationId = globalThis.crypto.randomUUID();
|
|
126
|
+
this.flowTriggerStates.set(correlationId, { status: 'in progress', progress: 0 });
|
|
127
|
+
return Promise.resolve({ correlationId, ...dto });
|
|
128
|
+
}
|
|
129
|
+
sendWebhookCallback(correlationId, dto) {
|
|
130
|
+
const state = this.flowTriggerStates.get(correlationId);
|
|
131
|
+
if (!state) {
|
|
132
|
+
return Promise.reject();
|
|
133
|
+
}
|
|
134
|
+
this.flowTriggerStates.set(correlationId, { status: dto.status, progress: dto.progress });
|
|
135
|
+
return Promise.resolve();
|
|
136
|
+
}
|
|
137
|
+
subscribeToNatsFlowWebhookState(correlationId, listener, errorListener) {
|
|
138
|
+
const state = this.flowTriggerStates.get(correlationId);
|
|
139
|
+
listener(new MessageEvent('message', { data: JSON.stringify(state ?? { status: 'in progress', progress: 0 }) }));
|
|
140
|
+
return Promise.resolve(correlationId);
|
|
141
|
+
}
|
|
123
142
|
async getReferences(properties) {
|
|
124
143
|
// super simplified version of real resolver
|
|
125
144
|
return Promise.all(Object.keys(properties).map(async (prop) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DataService, HttpClientService, TrashService } from '.';
|
|
2
2
|
import { APIBase } from '../api-base';
|
|
3
|
-
import { DeleteQuery, FlowDeployment, FlowDeploymentMetrics, FlowDeploymentStatistic, FlowLog, ResourceReference, TokenOption } from '../interfaces';
|
|
3
|
+
import { DeleteQuery, FlowDeployment, FlowDeploymentMetrics, FlowDeploymentStatistic, FlowLog, NatsFlowTriggerData, NatsFlowTriggerState, ResourceReference, TokenOption } from '../interfaces';
|
|
4
4
|
import { ShareService } from './share.service';
|
|
5
5
|
interface BaseService extends DataService<FlowDeployment>, ShareService, TrashService<FlowDeployment> {
|
|
6
6
|
}
|
|
@@ -28,6 +28,12 @@ export declare class FlowDeploymentService extends BaseService {
|
|
|
28
28
|
readWritePermissions?: string[];
|
|
29
29
|
tags?: string[];
|
|
30
30
|
}, options?: TokenOption): Promise<FlowDeployment>;
|
|
31
|
+
triggerFlow(dto: {
|
|
32
|
+
flowDeploymentId: string;
|
|
33
|
+
data?: Record<string, unknown>;
|
|
34
|
+
}, options?: TokenOption): Promise<NatsFlowTriggerData>;
|
|
35
|
+
sendWebhookCallback(correlationId: string, dto: NatsFlowTriggerState, options?: TokenOption): Promise<void>;
|
|
36
|
+
subscribeToNatsFlowWebhookState(correlationId: string, listener: (event: MessageEvent<string>) => void, errorListener?: (event: MessageEvent) => void, options?: TokenOption): Promise<string>;
|
|
31
37
|
subscribeToStatus(id: string, listener: (event: MessageEvent<any>) => void, errorListener?: (event: MessageEvent) => void, options?: TokenOption): Promise<string>;
|
|
32
38
|
subscribeToLogs(id: string, listener: (event: MessageEvent<any>) => void, errorListener?: (event: MessageEvent) => void, options?: TokenOption): Promise<string>;
|
|
33
39
|
}
|
|
@@ -63,6 +63,15 @@ class FlowDeploymentService extends BaseService {
|
|
|
63
63
|
addOne(dto, options = {}) {
|
|
64
64
|
return super.addOne(dto, options);
|
|
65
65
|
}
|
|
66
|
+
triggerFlow(dto, options = {}) {
|
|
67
|
+
return this.httpClient.post(`${this.basePath}/trigger`, dto, options);
|
|
68
|
+
}
|
|
69
|
+
sendWebhookCallback(correlationId, dto, options = {}) {
|
|
70
|
+
return this.httpClient.post(`${this.basePath}/webhook/${correlationId}/callback`, dto, options);
|
|
71
|
+
}
|
|
72
|
+
subscribeToNatsFlowWebhookState(correlationId, listener, errorListener, options = {}) {
|
|
73
|
+
return this.httpClient.addEventSource(`${this.basePath}/webhook/${correlationId}/subscribe`, listener, errorListener, options);
|
|
74
|
+
}
|
|
66
75
|
subscribeToStatus(id, listener, errorListener, options = {}) {
|
|
67
76
|
return this.httpClient.addEventSource(`${this.basePath}/${id}/status`, listener, errorListener, options);
|
|
68
77
|
}
|
|
@@ -2,7 +2,7 @@ import { APIBase } from '../api-base';
|
|
|
2
2
|
import { CreateOrganizationDto, KeycloakProfile, Organization, OrganizationData, OrganizationDataKind, OrganizationName, OrganizationRolesAdjustment, OrganizationSearchQuery } from '../interfaces';
|
|
3
3
|
import { HttpClientService } from './';
|
|
4
4
|
export declare class OrganizationsService extends APIBase {
|
|
5
|
-
constructor(
|
|
5
|
+
constructor(httpClient: HttpClientService);
|
|
6
6
|
searchForOrganizationNames(query: OrganizationSearchQuery): Promise<OrganizationName[]>;
|
|
7
7
|
/**
|
|
8
8
|
* Create an organization.
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.OrganizationsService = void 0;
|
|
4
4
|
const api_base_1 = require("../api-base");
|
|
5
5
|
class OrganizationsService extends api_base_1.APIBase {
|
|
6
|
-
constructor(
|
|
7
|
-
super(
|
|
6
|
+
constructor(httpClient) {
|
|
7
|
+
super(httpClient, '/organizations');
|
|
8
8
|
}
|
|
9
9
|
searchForOrganizationNames(query) {
|
|
10
10
|
const params = {};
|