@hahnpro/hpc-api 2025.3.5 → 2025.3.7

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hahnpro/hpc-api",
3
- "version": "2025.3.5",
3
+ "version": "2025.3.7",
4
4
  "description": "Module for easy access to the HahnPRO Cloud API",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -8,7 +8,7 @@
8
8
  "url": "https://hahnpro.com"
9
9
  },
10
10
  "dependencies": {
11
- "axios": "1.11.0",
11
+ "axios": "1.12.2",
12
12
  "eventsource": "4.0.0",
13
13
  "form-data": "4.0.4",
14
14
  "jose": "5.10.0",
package/src/index.d.ts CHANGED
@@ -8,7 +8,6 @@ export * from './lib/flow.interface';
8
8
  export * from './lib/flow-deployment.interface';
9
9
  export * from './lib/flow-function.interface';
10
10
  export * from './lib/http.service';
11
- export * from './lib/label.interface';
12
11
  export * from './lib/mock';
13
12
  export * from './lib/notification.interface';
14
13
  export * from './lib/organization.interface';
package/src/index.js CHANGED
@@ -10,7 +10,6 @@ tslib_1.__exportStar(require("./lib/flow.interface"), exports);
10
10
  tslib_1.__exportStar(require("./lib/flow-deployment.interface"), exports);
11
11
  tslib_1.__exportStar(require("./lib/flow-function.interface"), exports);
12
12
  tslib_1.__exportStar(require("./lib/http.service"), exports);
13
- tslib_1.__exportStar(require("./lib/label.interface"), exports);
14
13
  tslib_1.__exportStar(require("./lib/mock"), exports);
15
14
  tslib_1.__exportStar(require("./lib/notification.interface"), exports);
16
15
  tslib_1.__exportStar(require("./lib/organization.interface"), exports);
package/src/lib/api.d.ts CHANGED
@@ -6,13 +6,12 @@ import { FlowFunctionService } from './flow-function.service';
6
6
  import { FlowModuleService } from './flow-module.service';
7
7
  import { FlowService } from './flow.service';
8
8
  import { HttpClient } from './http.service';
9
- import { LabelService } from './label.service';
10
9
  import { NotificationRuleService } from './notification-rule.service';
11
10
  import { NotificationService } from './notification.service';
12
11
  import { OrganizationService } from './organization.service';
13
12
  import { ProxyService } from './proxy.service';
14
13
  import { SecretService } from './secret.service';
15
- import { AiService, AssetService, AssetTypesService, EventService, TimeSeriesService } from './services';
14
+ import { AiService, AssetService, AssetTypesService, EventService, LabelService, TimeSeriesService } from './services';
16
15
  import { TaskService } from './task.service';
17
16
  import { UserService } from './user.service';
18
17
  import { VaultService } from './vault.service';
package/src/lib/api.js CHANGED
@@ -9,7 +9,6 @@ const flow_function_service_1 = require("./flow-function.service");
9
9
  const flow_module_service_1 = require("./flow-module.service");
10
10
  const flow_service_1 = require("./flow.service");
11
11
  const http_service_1 = require("./http.service");
12
- const label_service_1 = require("./label.service");
13
12
  const notification_rule_service_1 = require("./notification-rule.service");
14
13
  const notification_service_1 = require("./notification.service");
15
14
  const organization_service_1 = require("./organization.service");
@@ -53,7 +52,7 @@ class API {
53
52
  this.flowDeployments = new flow_deployment_service_1.FlowDeploymentService(this.httpClient);
54
53
  this.flowFunctions = new flow_function_service_1.FlowFunctionService(this.httpClient);
55
54
  this.flowModules = new flow_module_service_1.FlowModuleService(this.httpClient);
56
- this.labels = new label_service_1.LabelService(this.httpClient);
55
+ this.labels = new services_1.LabelService(this.httpClient);
57
56
  this.organizations = new organization_service_1.OrganizationService(this.httpClient);
58
57
  this.proxy = new proxy_service_1.ProxyService(this.httpClient);
59
58
  this.secrets = new secret_service_1.SecretService(this.httpClient);
@@ -2,4 +2,6 @@ export type { Resource, ResourceReference, Owner, OwnerType, Author } from './re
2
2
  export type { AiAssistant, AssistantMessage, Message, SpeechToken, SystemMessage, Thread, ThreadPopulated, ToolMessage, UserMessage, } from './ai.interface';
3
3
  export type { Action, ActionRevision, Asset, AssetRevision, AssetType, AssetTypeRevision, Attachment, EventCause, EventLevelOverride, Template, } from './asset.interface';
4
4
  export type { Event, EventLevel, CreateEventDto } from './event.interface';
5
+ export type { Label, CreateLabelDto, UpdateLabelDto } from './label.interface';
5
6
  export type { TimeSeries, TimeSeriesBucket, TimeSeriesCondition, TimeSeriesValue, TS_GROUPS } from './timeseries.interface';
7
+ export type { SearchOptions, SearchResult, SearchSortOption, SortableField } from './search.interface';
@@ -0,0 +1,16 @@
1
+ import { Author, Owner } from './resource.interface';
2
+ export interface Label {
3
+ id: string;
4
+ name: string;
5
+ description?: string;
6
+ color?: string;
7
+ readPermissions?: string[];
8
+ readWritePermissions: string[];
9
+ owner: Owner;
10
+ createdBy: Author;
11
+ updatedBy: Author;
12
+ createdAt: string;
13
+ updatedAt: string;
14
+ }
15
+ export type CreateLabelDto = Pick<Label, 'name' | 'description' | 'color' | 'readPermissions' | 'readWritePermissions'>;
16
+ export type UpdateLabelDto = Partial<CreateLabelDto>;
@@ -0,0 +1,24 @@
1
+ export interface SearchOptions<T extends {
2
+ id?: string;
3
+ }, K extends keyof T & string = keyof T & string> {
4
+ query: string;
5
+ sort?: SearchSortOption<T>[];
6
+ limit?: number;
7
+ offset?: number;
8
+ trackTotal?: boolean;
9
+ resultFields?: K[];
10
+ searchFields?: string[];
11
+ }
12
+ export type SortableField<T> = keyof T | `${keyof T & string}.keyword`;
13
+ export interface SearchSortOption<T> {
14
+ field: SortableField<T>;
15
+ order: 'asc' | 'desc';
16
+ }
17
+ export interface SearchResult<T extends {
18
+ id?: string;
19
+ } = any, K extends keyof T & string = keyof T & string> {
20
+ docs: Pick<T, K | 'id'>[];
21
+ limit: number;
22
+ offset: number;
23
+ total: number;
24
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -10,8 +10,7 @@ import { FlowModule } from '../flow-module.interface';
10
10
  import { FlowModuleService } from '../flow-module.service';
11
11
  import { FlowDiagram, FlowDto, FlowRevision } from '../flow.interface';
12
12
  import { FlowService } from '../flow.service';
13
- import { Asset, AssetRevision, AssetType, Event, TimeSeries, TimeSeriesValue } from '../interfaces';
14
- import { Label } from '../label.interface';
13
+ import { Asset, AssetRevision, AssetType, Event, Label, TimeSeries, TimeSeriesValue } from '../interfaces';
15
14
  import { NotificationRuleService } from '../notification-rule.service';
16
15
  import { Notification } from '../notification.interface';
17
16
  import { Organization } from '../organization.interface';
@@ -168,6 +168,11 @@ class MockAPI {
168
168
  description: v.description ?? '',
169
169
  readPermissions: v.readPermissions ?? [],
170
170
  readWritePermissions: v.readWritePermissions ?? [],
171
+ owner: v.owner ?? { id: '123', type: 'org' },
172
+ createdBy: v.createdBy ?? { id: '123', username: 'test-user' },
173
+ updatedBy: v.updatedBy ?? { id: '123', username: 'test-user' },
174
+ createdAt: v.createdAt ?? new Date().toISOString(),
175
+ updatedAt: v.updatedAt ?? new Date().toISOString(),
171
176
  }));
172
177
  const vaultSecrets1 = vault.map((v) => ({
173
178
  ...v,
@@ -1,8 +1,9 @@
1
- import { Label } from '../label.interface';
2
- import { LabelService } from '../label.service';
1
+ import type { Label, SearchOptions, SearchResult } from '../interfaces';
2
+ import { LabelService } from '../services/label.service';
3
3
  import { DataMockService } from './data.mock.service';
4
4
  export declare class LabelMockService extends DataMockService<Label> implements LabelService {
5
5
  constructor(labels: Label[]);
6
6
  count(): Promise<number>;
7
7
  getOneByName(name: string): Promise<Label>;
8
+ search(query: SearchOptions<Label>, _: any): Promise<SearchResult<Label>>;
8
9
  }
@@ -13,5 +13,14 @@ class LabelMockService extends data_mock_service_1.DataMockService {
13
13
  getOneByName(name) {
14
14
  return Promise.resolve(this.data.find((label) => label.name === name));
15
15
  }
16
+ search(query, _) {
17
+ const docs = this.data.filter((label) => label.name.includes(query.query));
18
+ return Promise.resolve({
19
+ docs,
20
+ limit: query.limit,
21
+ offset: query.offset,
22
+ total: docs.length,
23
+ });
24
+ }
16
25
  }
17
26
  exports.LabelMockService = LabelMockService;
@@ -2,4 +2,5 @@ export { AiService } from './ai.service';
2
2
  export { AssetService } from './asset.service';
3
3
  export { AssetTypesService } from './assettypes.service';
4
4
  export { EventService } from './event.service';
5
+ export { LabelService } from './label.service';
5
6
  export { TimeSeriesService } from './timeseries.service';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TimeSeriesService = exports.EventService = exports.AssetTypesService = exports.AssetService = exports.AiService = void 0;
3
+ exports.TimeSeriesService = exports.LabelService = exports.EventService = exports.AssetTypesService = exports.AssetService = exports.AiService = void 0;
4
4
  var ai_service_1 = require("./ai.service");
5
5
  Object.defineProperty(exports, "AiService", { enumerable: true, get: function () { return ai_service_1.AiService; } });
6
6
  var asset_service_1 = require("./asset.service");
@@ -9,5 +9,7 @@ var assettypes_service_1 = require("./assettypes.service");
9
9
  Object.defineProperty(exports, "AssetTypesService", { enumerable: true, get: function () { return assettypes_service_1.AssetTypesService; } });
10
10
  var event_service_1 = require("./event.service");
11
11
  Object.defineProperty(exports, "EventService", { enumerable: true, get: function () { return event_service_1.EventService; } });
12
+ var label_service_1 = require("./label.service");
13
+ Object.defineProperty(exports, "LabelService", { enumerable: true, get: function () { return label_service_1.LabelService; } });
12
14
  var timeseries_service_1 = require("./timeseries.service");
13
15
  Object.defineProperty(exports, "TimeSeriesService", { enumerable: true, get: function () { return timeseries_service_1.TimeSeriesService; } });
@@ -0,0 +1,10 @@
1
+ import { DataService } from '../data.service';
2
+ import { HttpClient, TokenOption } from '../http.service';
3
+ import type { Label, SearchOptions, SearchResult } from '../interfaces';
4
+ export declare class LabelService extends DataService<Label> {
5
+ constructor(httpClient: HttpClient);
6
+ addMany(dtos: Label[], options?: TokenOption): Promise<Label[]>;
7
+ getOneByName(name: string, options?: TokenOption): Promise<Label>;
8
+ count(options?: TokenOption): Promise<number>;
9
+ search<K extends keyof Label>(query: SearchOptions<Label, K>, tokenOption?: TokenOption): Promise<SearchResult<Label, K>>;
10
+ }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LabelService = void 0;
4
- const data_service_1 = require("./data.service");
4
+ const data_service_1 = require("../data.service");
5
5
  class LabelService extends data_service_1.DataService {
6
6
  constructor(httpClient) {
7
7
  super(httpClient, '/labels');
@@ -15,5 +15,8 @@ class LabelService extends data_service_1.DataService {
15
15
  count(options = {}) {
16
16
  return this.httpClient.get(`${this.basePath}/count`, options);
17
17
  }
18
+ search(query, tokenOption = {}) {
19
+ return this.httpClient.post(`${this.basePath}/search`, query, tokenOption);
20
+ }
18
21
  }
19
22
  exports.LabelService = LabelService;
@@ -1,8 +0,0 @@
1
- export interface Label {
2
- id: string;
3
- name: string;
4
- description?: string;
5
- color?: string;
6
- readPermissions?: string[];
7
- readWritePermissions: string[];
8
- }
@@ -1,9 +0,0 @@
1
- import { DataService } from './data.service';
2
- import { HttpClient, TokenOption } from './http.service';
3
- import { Label } from './label.interface';
4
- export declare class LabelService extends DataService<Label> {
5
- constructor(httpClient: HttpClient);
6
- addMany(dtos: Label[], options?: TokenOption): Promise<Label[]>;
7
- getOneByName(name: string, options?: TokenOption): Promise<Label>;
8
- count(options?: TokenOption): Promise<number>;
9
- }