@machhub-dev/sdk-ts 1.0.16 → 1.0.17

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.
@@ -1,4 +1,8 @@
1
1
  import { HTTPService } from "../services/http.service.js";
2
+ import { Process, ProcessTrigger } from "../types/processes.models.js";
3
+ import { RecordID } from "../types/recordID.models.js";
4
+ export { Process, ProcessTrigger } from "../types/processes.models.js";
5
+ export type { ProcessLanguage, TriggerType, TriggerConfig, InputType, InputConfig, ProcessInput, OutputType, OutputConfig, ProcessOutput, ProcessKey, ProcessValue } from "../types/processes.models.js";
2
6
  export declare class Processes {
3
7
  private httpService;
4
8
  constructor(httpService: HTTPService);
@@ -9,4 +13,16 @@ export declare class Processes {
9
13
  * @returns The result of the process execution
10
14
  */
11
15
  execute(name: string, input?: Record<string, any>): Promise<any>;
16
+ /**
17
+ * Retrieves all processes for the current domain
18
+ * @returns A list of domain processes
19
+ */
20
+ getProcesses(): Promise<Process[]>;
21
+ /**
22
+ * Updates the triggers for a specific process
23
+ * @param id - The ID of the process to update
24
+ * @param triggers - The list of triggers to set on the process
25
+ * @returns The updated process
26
+ */
27
+ changeTriggers(id: RecordID, triggers: ProcessTrigger[]): Promise<Process>;
12
28
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Processes = void 0;
4
+ const recordID_models_js_1 = require("../types/recordID.models.js");
4
5
  class Processes {
5
6
  constructor(httpService) {
6
7
  this.httpService = httpService;
@@ -18,5 +19,22 @@ class Processes {
18
19
  };
19
20
  return await this.httpService.request.withJSON(payload).post("processes/execute");
20
21
  }
22
+ /**
23
+ * Retrieves all processes for the current domain
24
+ * @returns A list of domain processes
25
+ */
26
+ async getProcesses() {
27
+ return await this.httpService.request.get("processes/domain");
28
+ }
29
+ /**
30
+ * Updates the triggers for a specific process
31
+ * @param id - The ID of the process to update
32
+ * @param triggers - The list of triggers to set on the process
33
+ * @returns The updated process
34
+ */
35
+ async changeTriggers(id, triggers) {
36
+ let stringID = (0, recordID_models_js_1.RecordIDToString)(id);
37
+ return await this.httpService.request.withJSON({ triggers }).put(`processes/triggers/${stringID}`);
38
+ }
21
39
  }
22
40
  exports.Processes = Processes;
@@ -5,3 +5,4 @@ export type { BaseResponse } from './types/response.models.js';
5
5
  export type { RecordID } from './types/recordID.models.js';
6
6
  export { StringToRecordID, RecordIDToString, emptyRecordID } from './types/recordID.models.js';
7
7
  export type { HistorizedData } from './types/tag.models.js';
8
+ export type { Process, ProcessLanguage, ProcessTrigger, TriggerType, TriggerConfig, ProcessInput, InputType, InputConfig, ProcessOutput, OutputType, OutputConfig, ProcessKey, ProcessValue } from './types/processes.models.js';
@@ -0,0 +1,58 @@
1
+ import { RecordID } from "./recordID.models.js";
2
+ export type ProcessLanguage = "python" | "typescript";
3
+ export type TriggerType = "tag_change" | "interval" | "cron" | "http" | "manual";
4
+ export interface TriggerConfig {
5
+ cron_expression?: string;
6
+ interval_value?: number;
7
+ interval_unit?: string;
8
+ tag?: string;
9
+ endpoint?: string;
10
+ }
11
+ export interface ProcessTrigger {
12
+ type: TriggerType;
13
+ config: TriggerConfig;
14
+ }
15
+ export type InputType = "tag" | "sql";
16
+ export interface InputConfig {
17
+ tag?: string;
18
+ query?: string;
19
+ }
20
+ export interface ProcessInput {
21
+ name: string;
22
+ type: InputType;
23
+ config: InputConfig;
24
+ }
25
+ export type OutputType = "sql" | "tag_write";
26
+ export interface OutputConfig {
27
+ query?: string;
28
+ tag?: string;
29
+ field?: string;
30
+ }
31
+ export interface ProcessOutput {
32
+ type: OutputType;
33
+ config: OutputConfig;
34
+ }
35
+ export interface ProcessKey {
36
+ key: string;
37
+ }
38
+ export interface ProcessValue {
39
+ value: string;
40
+ }
41
+ export interface Process {
42
+ id?: RecordID;
43
+ domain_id?: RecordID;
44
+ name: string;
45
+ enabled: boolean;
46
+ log_enabled: boolean;
47
+ language: ProcessLanguage;
48
+ code: string;
49
+ version: number;
50
+ triggers: ProcessTrigger[];
51
+ inputs: ProcessInput[];
52
+ outputs: ProcessOutput[];
53
+ keys?: ProcessKey[];
54
+ values?: ProcessValue[];
55
+ createdBy?: RecordID;
56
+ createdDt?: string;
57
+ updated_dt?: string;
58
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,8 @@
1
1
  import { HTTPService } from "../services/http.service.js";
2
+ import { Process, ProcessTrigger } from "../types/processes.models.js";
3
+ import { RecordID } from "../types/recordID.models.js";
4
+ export { Process, ProcessTrigger } from "../types/processes.models.js";
5
+ export type { ProcessLanguage, TriggerType, TriggerConfig, InputType, InputConfig, ProcessInput, OutputType, OutputConfig, ProcessOutput, ProcessKey, ProcessValue } from "../types/processes.models.js";
2
6
  export declare class Processes {
3
7
  private httpService;
4
8
  constructor(httpService: HTTPService);
@@ -9,4 +13,16 @@ export declare class Processes {
9
13
  * @returns The result of the process execution
10
14
  */
11
15
  execute(name: string, input?: Record<string, any>): Promise<any>;
16
+ /**
17
+ * Retrieves all processes for the current domain
18
+ * @returns A list of domain processes
19
+ */
20
+ getProcesses(): Promise<Process[]>;
21
+ /**
22
+ * Updates the triggers for a specific process
23
+ * @param id - The ID of the process to update
24
+ * @param triggers - The list of triggers to set on the process
25
+ * @returns The updated process
26
+ */
27
+ changeTriggers(id: RecordID, triggers: ProcessTrigger[]): Promise<Process>;
12
28
  }
@@ -1,3 +1,4 @@
1
+ import { RecordIDToString } from "../types/recordID.models.js";
1
2
  export class Processes {
2
3
  constructor(httpService) {
3
4
  this.httpService = httpService;
@@ -15,4 +16,21 @@ export class Processes {
15
16
  };
16
17
  return await this.httpService.request.withJSON(payload).post("processes/execute");
17
18
  }
19
+ /**
20
+ * Retrieves all processes for the current domain
21
+ * @returns A list of domain processes
22
+ */
23
+ async getProcesses() {
24
+ return await this.httpService.request.get("processes/domain");
25
+ }
26
+ /**
27
+ * Updates the triggers for a specific process
28
+ * @param id - The ID of the process to update
29
+ * @param triggers - The list of triggers to set on the process
30
+ * @returns The updated process
31
+ */
32
+ async changeTriggers(id, triggers) {
33
+ let stringID = RecordIDToString(id);
34
+ return await this.httpService.request.withJSON({ triggers }).put(`processes/triggers/${stringID}`);
35
+ }
18
36
  }
package/dist/index.d.ts CHANGED
@@ -5,3 +5,4 @@ export type { BaseResponse } from './types/response.models.js';
5
5
  export type { RecordID } from './types/recordID.models.js';
6
6
  export { StringToRecordID, RecordIDToString, emptyRecordID } from './types/recordID.models.js';
7
7
  export type { HistorizedData } from './types/tag.models.js';
8
+ export type { Process, ProcessLanguage, ProcessTrigger, TriggerType, TriggerConfig, ProcessInput, InputType, InputConfig, ProcessOutput, OutputType, OutputConfig, ProcessKey, ProcessValue } from './types/processes.models.js';
@@ -0,0 +1,58 @@
1
+ import { RecordID } from "./recordID.models.js";
2
+ export type ProcessLanguage = "python" | "typescript";
3
+ export type TriggerType = "tag_change" | "interval" | "cron" | "http" | "manual";
4
+ export interface TriggerConfig {
5
+ cron_expression?: string;
6
+ interval_value?: number;
7
+ interval_unit?: string;
8
+ tag?: string;
9
+ endpoint?: string;
10
+ }
11
+ export interface ProcessTrigger {
12
+ type: TriggerType;
13
+ config: TriggerConfig;
14
+ }
15
+ export type InputType = "tag" | "sql";
16
+ export interface InputConfig {
17
+ tag?: string;
18
+ query?: string;
19
+ }
20
+ export interface ProcessInput {
21
+ name: string;
22
+ type: InputType;
23
+ config: InputConfig;
24
+ }
25
+ export type OutputType = "sql" | "tag_write";
26
+ export interface OutputConfig {
27
+ query?: string;
28
+ tag?: string;
29
+ field?: string;
30
+ }
31
+ export interface ProcessOutput {
32
+ type: OutputType;
33
+ config: OutputConfig;
34
+ }
35
+ export interface ProcessKey {
36
+ key: string;
37
+ }
38
+ export interface ProcessValue {
39
+ value: string;
40
+ }
41
+ export interface Process {
42
+ id?: RecordID;
43
+ domain_id?: RecordID;
44
+ name: string;
45
+ enabled: boolean;
46
+ log_enabled: boolean;
47
+ language: ProcessLanguage;
48
+ code: string;
49
+ version: number;
50
+ triggers: ProcessTrigger[];
51
+ inputs: ProcessInput[];
52
+ outputs: ProcessOutput[];
53
+ keys?: ProcessKey[];
54
+ values?: ProcessValue[];
55
+ createdBy?: RecordID;
56
+ createdDt?: string;
57
+ updated_dt?: string;
58
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@machhub-dev/sdk-ts",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "MACHHUB TYPESCRIPT SDK",
5
5
  "keywords": [
6
6
  "machhub",
@@ -1,4 +1,9 @@
1
1
  import { HTTPService } from "../services/http.service.js";
2
+ import { Process, ProcessTrigger } from "../types/processes.models.js";
3
+ import { RecordID, RecordIDToString } from "../types/recordID.models.js";
4
+
5
+ export { Process, ProcessTrigger } from "../types/processes.models.js";
6
+ export type { ProcessLanguage, TriggerType, TriggerConfig, InputType, InputConfig, ProcessInput, OutputType, OutputConfig, ProcessOutput, ProcessKey, ProcessValue } from "../types/processes.models.js";
2
7
 
3
8
  export class Processes {
4
9
  private httpService: HTTPService;
@@ -20,4 +25,24 @@ export class Processes {
20
25
  };
21
26
  return await this.httpService.request.withJSON(payload).post("processes/execute");
22
27
  }
28
+
29
+ /**
30
+ * Retrieves all processes for the current domain
31
+ * @returns A list of domain processes
32
+ */
33
+ public async getProcesses(): Promise<Process[]> {
34
+ return await this.httpService.request.get("processes/domain");
35
+ }
36
+
37
+ /**
38
+ * Updates the triggers for a specific process
39
+ * @param id - The ID of the process to update
40
+ * @param triggers - The list of triggers to set on the process
41
+ * @returns The updated process
42
+ */
43
+ public async changeTriggers(id: RecordID, triggers: ProcessTrigger[]): Promise<Process> {
44
+ let stringID = RecordIDToString(id);
45
+ return await this.httpService.request.withJSON({ triggers } as unknown as Record<string, unknown>).put(`processes/triggers/${stringID}`);
46
+ }
23
47
  }
48
+
package/src/index.ts CHANGED
@@ -6,4 +6,5 @@ export type { Operator } from './types/operator.models.js';
6
6
  export type { BaseResponse } from './types/response.models.js';
7
7
  export type { RecordID } from './types/recordID.models.js';
8
8
  export { StringToRecordID, RecordIDToString, emptyRecordID } from './types/recordID.models.js';
9
- export type { HistorizedData } from './types/tag.models.js';
9
+ export type { HistorizedData } from './types/tag.models.js';
10
+ export type { Process, ProcessLanguage, ProcessTrigger, TriggerType, TriggerConfig, ProcessInput, InputType, InputConfig, ProcessOutput, OutputType, OutputConfig, ProcessKey, ProcessValue } from './types/processes.models.js';
@@ -0,0 +1,71 @@
1
+ import { RecordID } from "./recordID.models.js";
2
+
3
+ export type ProcessLanguage = "python" | "typescript";
4
+
5
+ export type TriggerType = "tag_change" | "interval" | "cron" | "http" | "manual";
6
+
7
+ export interface TriggerConfig {
8
+ cron_expression?: string;
9
+ interval_value?: number;
10
+ interval_unit?: string;
11
+ tag?: string;
12
+ endpoint?: string;
13
+ }
14
+
15
+ export interface ProcessTrigger {
16
+ type: TriggerType;
17
+ config: TriggerConfig;
18
+ }
19
+
20
+ export type InputType = "tag" | "sql";
21
+
22
+ export interface InputConfig {
23
+ tag?: string;
24
+ query?: string;
25
+ }
26
+
27
+ export interface ProcessInput {
28
+ name: string;
29
+ type: InputType;
30
+ config: InputConfig;
31
+ }
32
+
33
+ export type OutputType = "sql" | "tag_write";
34
+
35
+ export interface OutputConfig {
36
+ query?: string;
37
+ tag?: string;
38
+ field?: string;
39
+ }
40
+
41
+ export interface ProcessOutput {
42
+ type: OutputType;
43
+ config: OutputConfig;
44
+ }
45
+
46
+ export interface ProcessKey {
47
+ key: string;
48
+ }
49
+
50
+ export interface ProcessValue {
51
+ value: string;
52
+ }
53
+
54
+ export interface Process {
55
+ id?: RecordID;
56
+ domain_id?: RecordID;
57
+ name: string;
58
+ enabled: boolean;
59
+ log_enabled: boolean;
60
+ language: ProcessLanguage;
61
+ code: string;
62
+ version: number;
63
+ triggers: ProcessTrigger[];
64
+ inputs: ProcessInput[];
65
+ outputs: ProcessOutput[];
66
+ keys?: ProcessKey[];
67
+ values?: ProcessValue[];
68
+ createdBy?: RecordID;
69
+ createdDt?: string;
70
+ updated_dt?: string;
71
+ }