@hahnpro/hpc-api 2025.3.6 → 2025.3.8

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.6",
3
+ "version": "2025.3.8",
4
4
  "description": "Module for easy access to the HahnPRO Cloud API",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -8,9 +8,8 @@
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
- "form-data": "4.0.4",
14
13
  "jose": "5.10.0",
15
14
  "jwt-decode": "4.0.0",
16
15
  "p-queue": "6.6.2",
package/src/index.d.ts CHANGED
@@ -16,3 +16,4 @@ export * from './lib/secret.interface';
16
16
  export * from './lib/task.interface';
17
17
  export * from './lib/vault.interface';
18
18
  export * from './lib/task.service';
19
+ export * from './lib/utils';
package/src/index.js CHANGED
@@ -18,3 +18,4 @@ tslib_1.__exportStar(require("./lib/secret.interface"), exports);
18
18
  tslib_1.__exportStar(require("./lib/task.interface"), exports);
19
19
  tslib_1.__exportStar(require("./lib/vault.interface"), exports);
20
20
  tslib_1.__exportStar(require("./lib/task.service"), exports);
21
+ tslib_1.__exportStar(require("./lib/utils"), exports);
package/src/lib/api.d.ts CHANGED
@@ -11,7 +11,7 @@ import { NotificationService } from './notification.service';
11
11
  import { OrganizationService } from './organization.service';
12
12
  import { ProxyService } from './proxy.service';
13
13
  import { SecretService } from './secret.service';
14
- import { AiService, AssetService, AssetTypesService, EventService, LabelService, TimeSeriesService } from './services';
14
+ import { AiService, AssetService, AssetTypesService, EventService, LabelService, SearchService, TimeSeriesService } from './services';
15
15
  import { TaskService } from './task.service';
16
16
  import { UserService } from './user.service';
17
17
  import { VaultService } from './vault.service';
@@ -31,6 +31,7 @@ export declare class API {
31
31
  labels: LabelService;
32
32
  organizations: OrganizationService;
33
33
  proxy: ProxyService;
34
+ search: SearchService;
34
35
  secrets: SecretService;
35
36
  tasks: TaskService;
36
37
  timeSeries: TimeSeriesService;
package/src/lib/api.js CHANGED
@@ -55,6 +55,7 @@ class API {
55
55
  this.labels = new services_1.LabelService(this.httpClient);
56
56
  this.organizations = new organization_service_1.OrganizationService(this.httpClient);
57
57
  this.proxy = new proxy_service_1.ProxyService(this.httpClient);
58
+ this.search = new services_1.SearchService(this.httpClient);
58
59
  this.secrets = new secret_service_1.SecretService(this.httpClient);
59
60
  this.tasks = new task_service_1.TaskService(this.httpClient);
60
61
  this.timeSeries = new services_1.TimeSeriesService(this.httpClient);
@@ -1,16 +1,16 @@
1
- import FormData from 'form-data';
2
1
  import { APIBase } from './api-base';
3
2
  import { Content, ReturnType } from './content.interface';
4
3
  import { DataService } from './data.service';
5
- import { HttpClient, TokenOption } from './http.service';
4
+ import { Config, HttpClient, TokenOption } from './http.service';
6
5
  import { TrashService } from './trash.service';
6
+ import { CrossPlatformFormData } from './utils';
7
7
  interface BaseService extends DataService<Content>, TrashService<Content> {
8
8
  }
9
9
  declare class BaseService extends APIBase {
10
10
  }
11
11
  export declare class ContentService extends BaseService {
12
12
  constructor(httpClient: HttpClient);
13
- upload: (form: FormData, options?: TokenOption) => Promise<Content>;
13
+ upload: (form: CrossPlatformFormData, options?: Config) => Promise<Content>;
14
14
  download(id: string, raw?: boolean, options?: TokenOption): Promise<Blob | ArrayBuffer>;
15
15
  download(id: string, returnType: ReturnType.TEXT, options?: TokenOption): Promise<string>;
16
16
  download(id: string, returnType: ReturnType.JSON, options?: TokenOption): Promise<Record<string, unknown>>;
@@ -7,6 +7,7 @@ const api_base_1 = require("./api-base");
7
7
  const content_interface_1 = require("./content.interface");
8
8
  const data_service_1 = require("./data.service");
9
9
  const trash_service_1 = require("./trash.service");
10
+ const utils_1 = require("./utils");
10
11
  let BaseService = class BaseService extends api_base_1.APIBase {
11
12
  };
12
13
  BaseService = tslib_1.__decorate([
@@ -16,12 +17,12 @@ class ContentService extends BaseService {
16
17
  constructor(httpClient) {
17
18
  super(httpClient, '/contents');
18
19
  this.upload = (form, options = {}) => {
19
- const headers = { ...form.getHeaders() };
20
+ const headers = { ...(0, utils_1.getFormDataHeaders)(form), ...options.headers };
20
21
  return this.httpClient.post(`${this.basePath}`, form, {
21
- headers,
22
22
  maxBodyLength: Infinity,
23
23
  maxContentLength: Infinity,
24
24
  ...options,
25
+ headers,
25
26
  });
26
27
  };
27
28
  }
@@ -13,6 +13,7 @@ export interface RequestParameter {
13
13
  page?: number;
14
14
  populate?: string;
15
15
  sort?: string;
16
+ lang?: string;
16
17
  }
17
18
  interface TimePeriod {
18
19
  from: Date;
@@ -1,13 +1,15 @@
1
1
  import { APIBase } from './api-base';
2
2
  import { DataInterface, Filter, Paginated, RequestParameter } from './data.interface';
3
- import { TokenOption } from './http.service';
3
+ import { Config, TokenOption } from './http.service';
4
4
  export declare class DataService<T> extends APIBase implements DataInterface<T> {
5
- addOne(dto: any, options?: TokenOption): Promise<T>;
5
+ addOne(dto: any, options?: TokenOption & {
6
+ [key: string]: any;
7
+ }): Promise<T>;
6
8
  addMany(dto: any[], options?: TokenOption): Promise<T[]>;
7
9
  getOne(id: string, options?: TokenOption & {
8
10
  [key: string]: any;
9
11
  }): Promise<T>;
10
- getMany(params?: RequestParameter, options?: TokenOption): Promise<Paginated<T[]>>;
12
+ getMany(params?: RequestParameter, options?: Config): Promise<Paginated<T[]>>;
11
13
  /**
12
14
  * Filters the elements by the passed properties. The object with these properties has to be of the form:
13
15
  * {
@@ -1,11 +1,11 @@
1
- import FormData from 'form-data';
2
1
  import { DataService } from './data.service';
3
2
  import { FlowModule } from './flow-module.interface';
4
3
  import { HttpClient, TokenOption } from './http.service';
4
+ import { CrossPlatformFormData } from './utils';
5
5
  export declare class FlowModuleService extends DataService<FlowModule> {
6
6
  constructor(httpClient: HttpClient);
7
7
  deleteArtifact(name: string, version: string, options?: TokenOption): Promise<FlowModule>;
8
- publish(form: FormData, options?: TokenOption): Promise<unknown>;
8
+ publish(form: CrossPlatformFormData, options?: TokenOption): Promise<unknown>;
9
9
  addOne(_dto: any): Promise<FlowModule>;
10
10
  addMany(_dto: any[]): Promise<FlowModule[]>;
11
11
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FlowModuleService = void 0;
4
4
  const data_service_1 = require("./data.service");
5
+ const utils_1 = require("./utils");
5
6
  class FlowModuleService extends data_service_1.DataService {
6
7
  constructor(httpClient) {
7
8
  super(httpClient, '/flow/modules');
@@ -11,7 +12,7 @@ class FlowModuleService extends data_service_1.DataService {
11
12
  }
12
13
  publish(form, options = {}) {
13
14
  const config = {
14
- headers: { ...form.getHeaders() },
15
+ headers: (0, utils_1.getFormDataHeaders)(form),
15
16
  maxBodyLength: Infinity,
16
17
  maxContentLength: Infinity,
17
18
  ...options,
@@ -12,9 +12,9 @@ export interface AssetType {
12
12
  supertype$name?: string;
13
13
  typeSchema: any;
14
14
  uiSchema: any;
15
- actions?: string[];
16
15
  author?: string;
17
16
  revision?: number;
17
+ templates?: string[] | Template[];
18
18
  owner?: Owner;
19
19
  createdBy?: Author;
20
20
  updatedBy?: Author;
@@ -42,7 +42,8 @@ export interface Asset {
42
42
  image?: string;
43
43
  attachments?: string[];
44
44
  notificationEndpoints?: string[];
45
- actions?: string[];
45
+ aliases?: string[];
46
+ translationId?: string;
46
47
  author?: string;
47
48
  revision?: number;
48
49
  owner?: Owner;
@@ -56,25 +57,6 @@ export type AssetRevision = Asset & {
56
57
  originalId: string;
57
58
  };
58
59
  export type Attachment = Content;
59
- export interface Action {
60
- id?: string;
61
- name?: string;
62
- description?: string;
63
- type?: string;
64
- method?: string;
65
- authToken?: string;
66
- isAuthFromAsset?: boolean;
67
- url?: string;
68
- data?: string;
69
- responseType?: string;
70
- readPermissions: string[];
71
- readWritePermissions: string[];
72
- author?: string;
73
- revision?: number;
74
- }
75
- export type ActionRevision = Action & {
76
- originalId: string;
77
- };
78
60
  export interface EventCause {
79
61
  cause: string;
80
62
  level: string;
@@ -1,6 +1,6 @@
1
1
  export type { Resource, ResourceReference, Owner, OwnerType, Author } from './resource.interface';
2
2
  export type { AiAssistant, AssistantMessage, Message, SpeechToken, SystemMessage, Thread, ThreadPopulated, ToolMessage, UserMessage, } from './ai.interface';
3
- export type { Action, ActionRevision, Asset, AssetRevision, AssetType, AssetTypeRevision, Attachment, EventCause, EventLevelOverride, Template, } from './asset.interface';
3
+ export type { Asset, AssetRevision, AssetType, AssetTypeRevision, Attachment, EventCause, EventLevelOverride, Template, } from './asset.interface';
4
4
  export type { Event, EventLevel, CreateEventDto } from './event.interface';
5
5
  export type { Label, CreateLabelDto, UpdateLabelDto } from './label.interface';
6
6
  export type { TimeSeries, TimeSeriesBucket, TimeSeriesCondition, TimeSeriesValue, TS_GROUPS } from './timeseries.interface';
@@ -29,6 +29,7 @@ import { HttpMockService } from './http.mock.service';
29
29
  import { LabelMockService } from './label.mock.service';
30
30
  import { NotificationMockService } from './notification.mock.service';
31
31
  import { OrganizationMockService } from './organization.mock.service';
32
+ import { SearchMockService } from './search.mock.service';
32
33
  import { SecretMockService } from './secret.mock.service';
33
34
  import { TaskMockService } from './task.mock.service';
34
35
  import { TimeseriesMockService } from './timeseries.mock.service';
@@ -72,6 +73,7 @@ export declare class MockAPI implements API {
72
73
  labels: LabelMockService;
73
74
  notificationRules: NotificationRuleService;
74
75
  proxy: ProxyService;
76
+ search: SearchMockService;
75
77
  secrets: SecretMockService;
76
78
  tasks: TaskMockService;
77
79
  timeSeries: TimeseriesMockService;
@@ -1,8 +1,8 @@
1
- import FormData from 'form-data';
2
1
  import { Filter, Paginated, RequestParameter } from '../data.interface';
3
2
  import { TokenOption } from '../http.service';
4
3
  import { Asset, AssetRevision, Attachment, EventCause, EventLevelOverride } from '../interfaces';
5
4
  import { AssetService } from '../services';
5
+ import { CrossPlatformFormData } from '../utils';
6
6
  import { APIBaseMock } from './api-base.mock';
7
7
  import { MockAPI } from './api.mock';
8
8
  import { DataMockService } from './data.mock.service';
@@ -21,7 +21,7 @@ export declare class AssetMockService extends BaseService implements AssetServic
21
21
  deleteOne(assetId: string, force?: boolean): Promise<Asset>;
22
22
  getMany(params?: RequestParameter): Promise<Paginated<Asset[]>>;
23
23
  updateOne(assetId: string, dto: Asset): Promise<Asset>;
24
- addAttachment(id: string, form: FormData): Promise<Asset>;
24
+ addAttachment(id: string, form: CrossPlatformFormData): Promise<Asset>;
25
25
  getAttachments(assetId: string): Promise<Paginated<Attachment[]>>;
26
26
  getChildren(assetId: string, params?: RequestParameter): Promise<Paginated<Asset[]>>;
27
27
  getEventLevelOverride(ids: string[], causes: string[]): Promise<EventLevelOverride>;
@@ -31,6 +31,9 @@ export declare class AssetMockService extends BaseService implements AssetServic
31
31
  deleteRevision(assetId: string, revisionId: string): Promise<any>;
32
32
  findOneExternal(key: string, options?: TokenOption): Promise<Asset>;
33
33
  updateOneExternal(key: string, dto: any, options?: TokenOption): Promise<Asset>;
34
- findByName(name: string, options?: TokenOption): Promise<Paginated<Asset[]>>;
34
+ findTranslatedNames(lang: string, translationIds: string[], options?: TokenOption): Promise<Record<string, string>>;
35
+ link(id: string, elementId: string, targetProperty: string, options?: TokenOption & {
36
+ [key: string]: any;
37
+ }): Promise<void>;
35
38
  }
36
39
  export {};
@@ -123,13 +123,11 @@ class AssetMockService extends BaseService {
123
123
  this.data[index] = { ...asset, ...dto };
124
124
  return Promise.resolve(this.data[index]);
125
125
  }
126
- findByName(name, options = {}) {
127
- const docs = this.data.filter((asset) => asset.name === name);
128
- return Promise.resolve({
129
- docs,
130
- total: docs.length,
131
- limit: Number.MAX_SAFE_INTEGER,
132
- });
126
+ findTranslatedNames(lang, translationIds, options) {
127
+ throw new Error('Method not implemented.');
128
+ }
129
+ link(id, elementId, targetProperty, options = {}) {
130
+ throw new Error('Method not implemented.');
133
131
  }
134
132
  }
135
133
  exports.AssetMockService = AssetMockService;
@@ -1,7 +1,7 @@
1
- import FormData from 'form-data';
2
1
  import { Content, ReturnType } from '../content.interface';
3
2
  import { ContentService } from '../content.service';
4
3
  import { Paginated, RequestParameter } from '../data.interface';
4
+ import { CrossPlatformFormData } from '../utils';
5
5
  import { APIBaseMock } from './api-base.mock';
6
6
  import { DataMockService } from './data.mock.service';
7
7
  import { TrashMockService } from './trash.mock.service';
@@ -20,6 +20,6 @@ export declare class ContentMockService extends BaseService implements ContentSe
20
20
  download(id: string, returnType: ReturnType.ARRAYBUFFER): Promise<ArrayBuffer>;
21
21
  deleteOne(contentId: string, force?: boolean): Promise<Content>;
22
22
  getMany(params?: RequestParameter): Promise<Paginated<Content[]>>;
23
- upload(form: FormData): Promise<Content>;
23
+ upload(form: CrossPlatformFormData): Promise<Content>;
24
24
  }
25
25
  export {};
@@ -1,7 +1,7 @@
1
- import FormData from 'form-data';
2
1
  import { FlowModule } from '../flow-module.interface';
3
2
  import { FlowModuleService } from '../flow-module.service';
4
3
  import { Artifact } from '../storage.interface';
4
+ import { CrossPlatformFormData } from '../utils';
5
5
  import { Replace } from './api.mock';
6
6
  import { DataMockService } from './data.mock.service';
7
7
  type ExtendedFlowModule = Replace<FlowModule, 'artifacts', Array<Artifact & {
@@ -10,7 +10,7 @@ type ExtendedFlowModule = Replace<FlowModule, 'artifacts', Array<Artifact & {
10
10
  export declare class FlowModulesMockService extends DataMockService<ExtendedFlowModule> implements FlowModuleService {
11
11
  constructor(modules: ExtendedFlowModule[]);
12
12
  deleteArtifact(name: string, version: string): Promise<FlowModule>;
13
- publish(form: FormData): Promise<unknown>;
13
+ publish(form: CrossPlatformFormData): Promise<unknown>;
14
14
  getOne(name: string, options?: any): Promise<ExtendedFlowModule>;
15
15
  }
16
16
  export {};
@@ -0,0 +1,9 @@
1
+ import { TokenOption } from 'lib/hpc-api/src/lib/http.service';
2
+ import { APIBase } from '../api-base';
3
+ import type { SearchOptions, SearchResult } from '../interfaces';
4
+ import { SearchService } from '../services';
5
+ export declare class SearchMockService extends APIBase implements SearchService {
6
+ search<T extends {
7
+ id?: string;
8
+ }, K extends keyof T & string = keyof T & string>(query: SearchOptions<T, K>, tokenOption?: TokenOption): Promise<SearchResult<T, K>>;
9
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SearchMockService = void 0;
4
+ const api_base_1 = require("../api-base");
5
+ class SearchMockService extends api_base_1.APIBase {
6
+ search(query, tokenOption = {}) {
7
+ throw new Error('Method not implemented.');
8
+ }
9
+ }
10
+ exports.SearchMockService = SearchMockService;
@@ -1,10 +1,10 @@
1
- import FormData from 'form-data';
2
1
  import { APIBase } from '../api-base';
3
2
  import { Filter, Paginated, RequestParameter } from '../data.interface';
4
3
  import { DataService } from '../data.service';
5
4
  import { HttpClient, TokenOption } from '../http.service';
6
5
  import { Asset, AssetRevision, Attachment, EventCause, EventLevelOverride } from '../interfaces';
7
6
  import { TrashService } from '../trash.service';
7
+ import { CrossPlatformFormData } from '../utils';
8
8
  interface BaseService extends DataService<Asset>, TrashService<Asset> {
9
9
  }
10
10
  declare class BaseService extends APIBase {
@@ -13,7 +13,7 @@ export declare class AssetService extends BaseService {
13
13
  constructor(httpClient: HttpClient);
14
14
  count(filter: Filter, options?: TokenOption): Promise<number>;
15
15
  deleteOne(id: string, force?: boolean, options?: TokenOption): Promise<any>;
16
- addAttachment: (id: string, form: FormData, options?: TokenOption) => Promise<Asset>;
16
+ addAttachment: (id: string, form: CrossPlatformFormData, options?: TokenOption) => Promise<Asset>;
17
17
  getChildren(assetId: string, params?: RequestParameter, options?: TokenOption): Promise<Paginated<Asset[]>>;
18
18
  getAttachments(assetId: string, options?: TokenOption): Promise<Paginated<Attachment[]>>;
19
19
  getEventLevelOverride(ids: string[], causes: string[], options?: TokenOption): Promise<EventLevelOverride>;
@@ -23,6 +23,9 @@ export declare class AssetService extends BaseService {
23
23
  deleteRevision(assetId: string, revisionId: string, options?: TokenOption): Promise<any>;
24
24
  findOneExternal(key: string, options?: TokenOption): Promise<Asset>;
25
25
  updateOneExternal(key: string, dto: any, options?: TokenOption): Promise<Asset>;
26
- findByName(name: string, options?: TokenOption): Promise<Paginated<Asset[]>>;
26
+ findTranslatedNames(lang: string, translationIds: string[], options?: TokenOption): Promise<Record<string, string>>;
27
+ link(id: string, elementId: string, targetProperty: string, options?: TokenOption & {
28
+ [key: string]: any;
29
+ }): Promise<void>;
27
30
  }
28
31
  export {};
@@ -6,6 +6,7 @@ const ts_mixer_1 = require("ts-mixer");
6
6
  const api_base_1 = require("../api-base");
7
7
  const data_service_1 = require("../data.service");
8
8
  const trash_service_1 = require("../trash.service");
9
+ const utils_1 = require("../utils");
9
10
  let BaseService = class BaseService extends api_base_1.APIBase {
10
11
  };
11
12
  BaseService = tslib_1.__decorate([
@@ -15,9 +16,8 @@ class AssetService extends BaseService {
15
16
  constructor(httpClient) {
16
17
  super(httpClient, '/assets');
17
18
  this.addAttachment = (id, form, options = {}) => {
18
- const headers = { ...form.getHeaders() };
19
19
  return this.httpClient.post(`${this.basePath}/${id}/attachment`, form, {
20
- headers,
20
+ headers: (0, utils_1.getFormDataHeaders)(form),
21
21
  maxBodyLength: Infinity,
22
22
  maxContentLength: Infinity,
23
23
  ...options,
@@ -58,8 +58,14 @@ class AssetService extends BaseService {
58
58
  updateOneExternal(key, dto, options = {}) {
59
59
  return this.httpClient.put(`${this.basePath}/external/${key}`, dto, options);
60
60
  }
61
- findByName(name, options = {}) {
62
- return this.httpClient.get(`${this.basePath}?name=${encodeURIComponent(name)}`, options);
61
+ findTranslatedNames(lang, translationIds, options = {}) {
62
+ return this.httpClient.get(`${this.basePath}/translations/names/${lang}?translationIds=${translationIds.join(',')}`, options);
63
+ }
64
+ link(id, elementId, targetProperty, options = {}) {
65
+ return this.httpClient.post(`${this.basePath}/${id}/link`, {
66
+ elementId,
67
+ targetProperty,
68
+ }, options);
63
69
  }
64
70
  }
65
71
  exports.AssetService = AssetService;
@@ -3,4 +3,5 @@ export { AssetService } from './asset.service';
3
3
  export { AssetTypesService } from './assettypes.service';
4
4
  export { EventService } from './event.service';
5
5
  export { LabelService } from './label.service';
6
+ export { SearchService } from './search.service';
6
7
  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.LabelService = exports.EventService = exports.AssetTypesService = exports.AssetService = exports.AiService = void 0;
3
+ exports.TimeSeriesService = exports.SearchService = 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");
@@ -11,5 +11,7 @@ var event_service_1 = require("./event.service");
11
11
  Object.defineProperty(exports, "EventService", { enumerable: true, get: function () { return event_service_1.EventService; } });
12
12
  var label_service_1 = require("./label.service");
13
13
  Object.defineProperty(exports, "LabelService", { enumerable: true, get: function () { return label_service_1.LabelService; } });
14
+ var search_service_1 = require("./search.service");
15
+ Object.defineProperty(exports, "SearchService", { enumerable: true, get: function () { return search_service_1.SearchService; } });
14
16
  var timeseries_service_1 = require("./timeseries.service");
15
17
  Object.defineProperty(exports, "TimeSeriesService", { enumerable: true, get: function () { return timeseries_service_1.TimeSeriesService; } });
@@ -0,0 +1,9 @@
1
+ import { APIBase } from '../api-base';
2
+ import { HttpClient, TokenOption } from '../http.service';
3
+ import type { SearchOptions, SearchResult } from '../interfaces';
4
+ export declare class SearchService extends APIBase {
5
+ constructor(httpClient: HttpClient);
6
+ search<T extends {
7
+ id?: string;
8
+ }, K extends keyof T & string = keyof T & string>(query: SearchOptions<T, K>, tokenOption?: TokenOption): Promise<SearchResult<T, K>>;
9
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SearchService = void 0;
4
+ const api_base_1 = require("../api-base");
5
+ class SearchService extends api_base_1.APIBase {
6
+ constructor(httpClient) {
7
+ super(httpClient, '/search');
8
+ }
9
+ search(query, tokenOption = {}) {
10
+ return this.httpClient.post(this.basePath, query, tokenOption);
11
+ }
12
+ }
13
+ exports.SearchService = SearchService;
@@ -0,0 +1,11 @@
1
+ export type CrossPlatformFormData = FormData | {
2
+ getHeaders(): Record<string, string>;
3
+ };
4
+ /**
5
+ * Utility function to get headers from FormData in a cross-platform way.
6
+ * Works with both node form-data package and browser native FormData.
7
+ *
8
+ * @param form - FormData object (either node or browser)
9
+ * @returns Headers object for HTTP requests
10
+ */
11
+ export declare function getFormDataHeaders(form: CrossPlatformFormData): Record<string, string>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFormDataHeaders = getFormDataHeaders;
4
+ /**
5
+ * Utility function to get headers from FormData in a cross-platform way.
6
+ * Works with both node form-data package and browser native FormData.
7
+ *
8
+ * @param form - FormData object (either node or browser)
9
+ * @returns Headers object for HTTP requests
10
+ */
11
+ function getFormDataHeaders(form) {
12
+ // check if it's node form-data (has getHeaders method)
13
+ if ('getHeaders' in form && typeof form.getHeaders === 'function') {
14
+ return form.getHeaders();
15
+ }
16
+ // for browser FormData, we don't need to set Content-Type header since it will automatically do so
17
+ return {};
18
+ }