@ai-appforge/core 1.0.0

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/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # @ai-appforge/core
2
+
3
+ Core types and shared utilities for the AI App Forge SDK.
4
+
5
+ This package is generally used internally by `@ai-appforge/nodejs` and `@ai-appforge/react-native`, but can be used directly if you need access to the raw types or workflow logic.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @ai-appforge/core
11
+ ```
12
+
13
+ ## Exports
14
+
15
+ - **`WorkflowsModule`**: Handles workflow execution and status checks.
16
+ - **`APIError`**: Custom error class for API responses.
17
+ - **Types**: Various TypeScript definitions for workflow payloads and responses.
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './workflows';
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types"), exports);
18
+ __exportStar(require("./workflows"), exports);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ describe('Core SDK', () => {
4
+ it('should export types', () => {
5
+ expect(true).toBe(true);
6
+ // Basic smoke test to ensure types are resolvable
7
+ const workflow = {
8
+ id: 'test-id',
9
+ name: 'Test Workflow'
10
+ };
11
+ expect(workflow.id).toBe('test-id');
12
+ });
13
+ });
@@ -0,0 +1,114 @@
1
+ import { Headers as FetchHeaders } from 'node-fetch';
2
+ export interface Workflow {
3
+ id: string;
4
+ name: string;
5
+ description?: string;
6
+ userId: string;
7
+ isReusable?: boolean;
8
+ icon?: any;
9
+ workflow_data?: {
10
+ nodes: any[];
11
+ edges: any[];
12
+ viewport?: any;
13
+ isReusable?: boolean;
14
+ icon?: any;
15
+ description?: string;
16
+ };
17
+ created_at?: string;
18
+ updated_at?: string;
19
+ }
20
+ export interface ListWorkflowsResponse {
21
+ success: boolean;
22
+ data: Workflow[];
23
+ }
24
+ export interface RunWorkflowInput {
25
+ workflow?: {
26
+ nodes: any[];
27
+ edges: any[];
28
+ [key: string]: any;
29
+ };
30
+ workflowId?: string;
31
+ userId?: string;
32
+ input?: any;
33
+ [key: string]: any;
34
+ }
35
+ export interface RunWorkflowResponse {
36
+ success: boolean;
37
+ context?: any;
38
+ logs?: any[];
39
+ job?: any;
40
+ scheduled?: boolean;
41
+ error?: string;
42
+ }
43
+ export interface StopWorkflowResponse {
44
+ success: boolean;
45
+ message: string;
46
+ error?: string;
47
+ }
48
+ export interface SaveWorkflowInput {
49
+ nodes: any[];
50
+ edges: any[];
51
+ name?: string;
52
+ userId: string;
53
+ workflowId?: string;
54
+ viewport?: any;
55
+ isReusable?: boolean;
56
+ icon?: any;
57
+ description?: string;
58
+ }
59
+ export interface SaveWorkflowResponse {
60
+ success: boolean;
61
+ data?: any;
62
+ message?: string;
63
+ error?: string;
64
+ }
65
+ export interface ListReusableWorkflowsResponse {
66
+ success: boolean;
67
+ data: any[];
68
+ error?: string;
69
+ }
70
+ export interface ListSchedulesResponse {
71
+ success: boolean;
72
+ data: any[];
73
+ error?: string;
74
+ }
75
+ export interface CancelScheduleResponse {
76
+ success: boolean;
77
+ message?: string;
78
+ error?: string;
79
+ }
80
+ export interface WaitingInput {
81
+ id: string;
82
+ workflow_id: string;
83
+ node_id: string;
84
+ user_id: string;
85
+ status: 'waiting' | 'responded';
86
+ context: any;
87
+ created_at: string;
88
+ [key: string]: any;
89
+ }
90
+ export interface GetWaitingInputsResponse {
91
+ success: boolean;
92
+ data: WaitingInput[];
93
+ error?: string;
94
+ }
95
+ export interface RespondToInputData {
96
+ inputId: string;
97
+ responseData: any;
98
+ }
99
+ export interface RespondToInputResponse {
100
+ success: boolean;
101
+ message?: string;
102
+ error?: string;
103
+ }
104
+ export interface DeleteWorkflowResponse {
105
+ success: boolean;
106
+ message?: string;
107
+ error?: string;
108
+ }
109
+ export declare class APIError extends Error {
110
+ status: number;
111
+ body: any;
112
+ headers: FetchHeaders;
113
+ constructor(status: number, body: any, headers: FetchHeaders);
114
+ }
package/dist/types.js ADDED
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.APIError = void 0;
4
+ class APIError extends Error {
5
+ constructor(status, body, headers) {
6
+ super(body?.error || `API request failed with status ${status}`);
7
+ this.status = status;
8
+ this.body = body;
9
+ this.headers = headers;
10
+ }
11
+ }
12
+ exports.APIError = APIError;
@@ -0,0 +1,63 @@
1
+ import { Workflow, ListWorkflowsResponse, RunWorkflowInput, RunWorkflowResponse, StopWorkflowResponse, SaveWorkflowInput, SaveWorkflowResponse, ListReusableWorkflowsResponse, ListSchedulesResponse, CancelScheduleResponse, GetWaitingInputsResponse, RespondToInputData, RespondToInputResponse, DeleteWorkflowResponse } from './types';
2
+ export declare class WorkflowsModule {
3
+ private request;
4
+ constructor(request: <T>(endpoint: string, options?: any) => Promise<T>);
5
+ /**
6
+ * List all workflows for a user.
7
+ * @param userId The ID of the user.
8
+ */
9
+ list(userId: string): Promise<ListWorkflowsResponse>;
10
+ /**
11
+ * Get a specific workflow by ID.
12
+ * @param id The workflow ID.
13
+ */
14
+ get(id: string): Promise<Workflow>;
15
+ /**
16
+ * Run a workflow.
17
+ * @param data The input data for running the workflow.
18
+ */
19
+ run(data: RunWorkflowInput): Promise<RunWorkflowResponse>;
20
+ /**
21
+ * Stop a running workflow.
22
+ * @param workflowId The ID of the workflow to stop.
23
+ */
24
+ stop(workflowId: string): Promise<StopWorkflowResponse>;
25
+ /**
26
+ * Save (create or update) a workflow.
27
+ * @param data The workflow data to save.
28
+ */
29
+ save(data: SaveWorkflowInput): Promise<SaveWorkflowResponse>;
30
+ /**
31
+ * Delete a workflow by ID.
32
+ * @param id The ID of the workflow to delete.
33
+ */
34
+ delete(id: string): Promise<DeleteWorkflowResponse>;
35
+ /**
36
+ * List reusable workflows for a user.
37
+ * @param userId The ID of the user.
38
+ */
39
+ listReusable(userId: string): Promise<ListReusableWorkflowsResponse>;
40
+ /**
41
+ * List scheduled jobs/workflows.
42
+ * @param userId The ID of the user.
43
+ * @param workflowId Optional workflow ID filter.
44
+ * @param status Optional status filter.
45
+ */
46
+ listSchedules(userId: string, workflowId?: string, status?: string): Promise<ListSchedulesResponse>;
47
+ /**
48
+ * Cancel a scheduled job.
49
+ * @param jobId The ID of the job/schedule to cancel.
50
+ */
51
+ cancelSchedule(jobId: string): Promise<CancelScheduleResponse>;
52
+ /**
53
+ * Get inputs waiting for user response.
54
+ * @param userId The ID of the user.
55
+ * @param status Optional status filter.
56
+ */
57
+ getWaitingInputs(userId: string, status?: string): Promise<GetWaitingInputsResponse>;
58
+ /**
59
+ * Respond to a waiting input.
60
+ * @param data The response data including inputId.
61
+ */
62
+ respondToInput(data: RespondToInputData): Promise<RespondToInputResponse>;
63
+ }
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WorkflowsModule = void 0;
4
+ class WorkflowsModule {
5
+ constructor(request) {
6
+ this.request = request;
7
+ }
8
+ /**
9
+ * List all workflows for a user.
10
+ * @param userId The ID of the user.
11
+ */
12
+ async list(userId) {
13
+ if (!userId)
14
+ throw new Error('userId is required');
15
+ return this.request(`/api/workflows?userId=${encodeURIComponent(userId)}`, { method: 'GET' });
16
+ }
17
+ /**
18
+ * Get a specific workflow by ID.
19
+ * @param id The workflow ID.
20
+ */
21
+ async get(id) {
22
+ if (!id)
23
+ throw new Error('id is required');
24
+ const res = await this.request(`/api/workflows/${id}`, { method: 'GET' });
25
+ return res.data;
26
+ }
27
+ /**
28
+ * Run a workflow.
29
+ * @param data The input data for running the workflow.
30
+ */
31
+ async run(data) {
32
+ return this.request('/api/workflows/run', {
33
+ method: 'POST',
34
+ body: JSON.stringify(data)
35
+ });
36
+ }
37
+ /**
38
+ * Stop a running workflow.
39
+ * @param workflowId The ID of the workflow to stop.
40
+ */
41
+ async stop(workflowId) {
42
+ if (!workflowId)
43
+ throw new Error('workflowId is required');
44
+ return this.request('/api/workflows/stop', {
45
+ method: 'POST',
46
+ body: JSON.stringify({ workflowId })
47
+ });
48
+ }
49
+ /**
50
+ * Save (create or update) a workflow.
51
+ * @param data The workflow data to save.
52
+ */
53
+ async save(data) {
54
+ return this.request('/api/workflows/save', {
55
+ method: 'POST',
56
+ body: JSON.stringify(data)
57
+ });
58
+ }
59
+ /**
60
+ * Delete a workflow by ID.
61
+ * @param id The ID of the workflow to delete.
62
+ */
63
+ async delete(id) {
64
+ if (!id)
65
+ throw new Error('id is required');
66
+ return this.request(`/api/workflows/${id}`, { method: 'DELETE' });
67
+ }
68
+ /**
69
+ * List reusable workflows for a user.
70
+ * @param userId The ID of the user.
71
+ */
72
+ async listReusable(userId) {
73
+ if (!userId)
74
+ throw new Error('userId is required');
75
+ return this.request(`/api/workflows/reusable?userId=${encodeURIComponent(userId)}`, { method: 'GET' });
76
+ }
77
+ /**
78
+ * List scheduled jobs/workflows.
79
+ * @param userId The ID of the user.
80
+ * @param workflowId Optional workflow ID filter.
81
+ * @param status Optional status filter.
82
+ */
83
+ async listSchedules(userId, workflowId, status) {
84
+ if (!userId)
85
+ throw new Error('userId is required');
86
+ let query = `?userId=${encodeURIComponent(userId)}`;
87
+ if (workflowId)
88
+ query += `&workflowId=${encodeURIComponent(workflowId)}`;
89
+ if (status)
90
+ query += `&status=${encodeURIComponent(status)}`;
91
+ return this.request(`/api/schedules${query}`, { method: 'GET' });
92
+ }
93
+ /**
94
+ * Cancel a scheduled job.
95
+ * @param jobId The ID of the job/schedule to cancel.
96
+ */
97
+ async cancelSchedule(jobId) {
98
+ if (!jobId)
99
+ throw new Error('jobId is required');
100
+ return this.request('/api/schedules/cancel', {
101
+ method: 'POST',
102
+ body: JSON.stringify({ jobId })
103
+ });
104
+ }
105
+ /**
106
+ * Get inputs waiting for user response.
107
+ * @param userId The ID of the user.
108
+ * @param status Optional status filter.
109
+ */
110
+ async getWaitingInputs(userId, status) {
111
+ if (!userId)
112
+ throw new Error('userId is required');
113
+ let query = `?userId=${encodeURIComponent(userId)}`;
114
+ if (status)
115
+ query += `&status=${encodeURIComponent(status)}`;
116
+ return this.request(`/api/workflows/inputs${query}`, { method: 'GET' });
117
+ }
118
+ /**
119
+ * Respond to a waiting input.
120
+ * @param data The response data including inputId.
121
+ */
122
+ async respondToInput(data) {
123
+ return this.request('/api/workflows/inputs/respond', {
124
+ method: 'POST',
125
+ body: JSON.stringify(data)
126
+ });
127
+ }
128
+ }
129
+ exports.WorkflowsModule = WorkflowsModule;
package/jest.config.js ADDED
@@ -0,0 +1,6 @@
1
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
2
+ module.exports = {
3
+ preset: 'ts-jest',
4
+ testEnvironment: 'node',
5
+ verbose: true,
6
+ };
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@ai-appforge/core",
3
+ "version": "1.0.0",
4
+ "description": "Core types and utilities for AI App Forge SDK",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "npx tsc",
9
+ "test": "jest"
10
+ },
11
+ "keywords": [],
12
+ "author": "",
13
+ "license": "ISC",
14
+ "devDependencies": {
15
+ "@types/jest": "^30.0.0",
16
+ "@types/node": "^25.0.10",
17
+ "@types/node-fetch": "^2.6.13",
18
+ "jest": "^30.2.0",
19
+ "node-fetch": "^3.3.2",
20
+ "ts-jest": "^29.4.6",
21
+ "typescript": "^5.0.0"
22
+ }
23
+ }
@@ -0,0 +1,13 @@
1
+ import { Workflow } from './index';
2
+
3
+ describe('Core SDK', () => {
4
+ it('should export types', () => {
5
+ expect(true).toBe(true);
6
+ // Basic smoke test to ensure types are resolvable
7
+ const workflow: Partial<Workflow> = {
8
+ id: 'test-id',
9
+ name: 'Test Workflow'
10
+ };
11
+ expect(workflow.id).toBe('test-id');
12
+ });
13
+ });
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './workflows';
package/src/types.ts ADDED
@@ -0,0 +1,136 @@
1
+ import { Headers as FetchHeaders } from 'node-fetch';
2
+
3
+ export interface Workflow {
4
+ id: string;
5
+ name: string;
6
+ description?: string;
7
+ userId: string;
8
+ isReusable?: boolean;
9
+ icon?: any;
10
+ workflow_data?: {
11
+ nodes: any[];
12
+ edges: any[];
13
+ viewport?: any;
14
+ isReusable?: boolean;
15
+ icon?: any;
16
+ description?: string;
17
+ };
18
+ created_at?: string;
19
+ updated_at?: string;
20
+ }
21
+
22
+ export interface ListWorkflowsResponse {
23
+ success: boolean;
24
+ data: Workflow[];
25
+ }
26
+
27
+ export interface RunWorkflowInput {
28
+ workflow?: {
29
+ nodes: any[];
30
+ edges: any[];
31
+ [key: string]: any;
32
+ };
33
+ workflowId?: string;
34
+ userId?: string;
35
+ input?: any;
36
+ [key: string]: any; // Allow other properties if needed
37
+ }
38
+
39
+ export interface RunWorkflowResponse {
40
+ success: boolean;
41
+ context?: any;
42
+ logs?: any[];
43
+ job?: any;
44
+ scheduled?: boolean;
45
+ error?: string;
46
+ }
47
+
48
+ export interface StopWorkflowResponse {
49
+ success: boolean;
50
+ message: string;
51
+ error?: string;
52
+ }
53
+
54
+ export interface SaveWorkflowInput {
55
+ nodes: any[];
56
+ edges: any[];
57
+ name?: string;
58
+ userId: string;
59
+ workflowId?: string;
60
+ viewport?: any;
61
+ isReusable?: boolean;
62
+ icon?: any;
63
+ description?: string;
64
+ }
65
+
66
+ export interface SaveWorkflowResponse {
67
+ success: boolean;
68
+ data?: any;
69
+ message?: string;
70
+ error?: string;
71
+ }
72
+
73
+ export interface ListReusableWorkflowsResponse {
74
+ success: boolean;
75
+ data: any[];
76
+ error?: string;
77
+ }
78
+
79
+ export interface ListSchedulesResponse {
80
+ success: boolean;
81
+ data: any[];
82
+ error?: string;
83
+ }
84
+
85
+ export interface CancelScheduleResponse {
86
+ success: boolean;
87
+ message?: string;
88
+ error?: string;
89
+ }
90
+
91
+ export interface WaitingInput {
92
+ id: string;
93
+ workflow_id: string;
94
+ node_id: string;
95
+ user_id: string;
96
+ status: 'waiting' | 'responded';
97
+ context: any;
98
+ created_at: string;
99
+ [key: string]: any;
100
+ }
101
+
102
+ export interface GetWaitingInputsResponse {
103
+ success: boolean;
104
+ data: WaitingInput[];
105
+ error?: string;
106
+ }
107
+
108
+ export interface RespondToInputData {
109
+ inputId: string;
110
+ responseData: any;
111
+ }
112
+
113
+ export interface RespondToInputResponse {
114
+ success: boolean;
115
+ message?: string;
116
+ error?: string;
117
+ }
118
+
119
+ export interface DeleteWorkflowResponse {
120
+ success: boolean;
121
+ message?: string;
122
+ error?: string;
123
+ }
124
+
125
+ export class APIError extends Error {
126
+ public status: number;
127
+ public body: any;
128
+ public headers: FetchHeaders;
129
+
130
+ constructor(status: number, body: any, headers: FetchHeaders) {
131
+ super(body?.error || `API request failed with status ${status}`);
132
+ this.status = status;
133
+ this.body = body;
134
+ this.headers = headers;
135
+ }
136
+ }
@@ -0,0 +1,175 @@
1
+ import {
2
+ Workflow,
3
+ ListWorkflowsResponse,
4
+ RunWorkflowInput,
5
+ RunWorkflowResponse,
6
+ StopWorkflowResponse,
7
+ SaveWorkflowInput,
8
+ SaveWorkflowResponse,
9
+ ListReusableWorkflowsResponse,
10
+ ListSchedulesResponse,
11
+ CancelScheduleResponse,
12
+ GetWaitingInputsResponse,
13
+ RespondToInputData,
14
+ RespondToInputResponse,
15
+ DeleteWorkflowResponse
16
+ } from './types'; // Removed .js extension for TS resolution
17
+
18
+ export class WorkflowsModule {
19
+ constructor(private request: <T>(endpoint: string, options?: any) => Promise<T>) { }
20
+
21
+ /**
22
+ * List all workflows for a user.
23
+ * @param userId The ID of the user.
24
+ */
25
+ async list(userId: string): Promise<ListWorkflowsResponse> {
26
+ if (!userId) throw new Error('userId is required');
27
+ return this.request<ListWorkflowsResponse>(
28
+ `/api/workflows?userId=${encodeURIComponent(userId)}`,
29
+ { method: 'GET' }
30
+ );
31
+ }
32
+
33
+ /**
34
+ * Get a specific workflow by ID.
35
+ * @param id The workflow ID.
36
+ */
37
+ async get(id: string): Promise<Workflow> {
38
+ if (!id) throw new Error('id is required');
39
+ const res = await this.request<{ success: boolean; data: Workflow }>(
40
+ `/api/workflows/${id}`,
41
+ { method: 'GET' }
42
+ );
43
+ return res.data;
44
+ }
45
+
46
+ /**
47
+ * Run a workflow.
48
+ * @param data The input data for running the workflow.
49
+ */
50
+ async run(data: RunWorkflowInput): Promise<RunWorkflowResponse> {
51
+ return this.request<RunWorkflowResponse>(
52
+ '/api/workflows/run',
53
+ {
54
+ method: 'POST',
55
+ body: JSON.stringify(data)
56
+ }
57
+ );
58
+ }
59
+
60
+ /**
61
+ * Stop a running workflow.
62
+ * @param workflowId The ID of the workflow to stop.
63
+ */
64
+ async stop(workflowId: string): Promise<StopWorkflowResponse> {
65
+ if (!workflowId) throw new Error('workflowId is required');
66
+ return this.request<StopWorkflowResponse>(
67
+ '/api/workflows/stop',
68
+ {
69
+ method: 'POST',
70
+ body: JSON.stringify({ workflowId })
71
+ }
72
+ );
73
+ }
74
+
75
+ /**
76
+ * Save (create or update) a workflow.
77
+ * @param data The workflow data to save.
78
+ */
79
+ async save(data: SaveWorkflowInput): Promise<SaveWorkflowResponse> {
80
+ return this.request<SaveWorkflowResponse>(
81
+ '/api/workflows/save',
82
+ {
83
+ method: 'POST',
84
+ body: JSON.stringify(data)
85
+ }
86
+ );
87
+ }
88
+
89
+ /**
90
+ * Delete a workflow by ID.
91
+ * @param id The ID of the workflow to delete.
92
+ */
93
+ async delete(id: string): Promise<DeleteWorkflowResponse> {
94
+ if (!id) throw new Error('id is required');
95
+ return this.request<DeleteWorkflowResponse>(
96
+ `/api/workflows/${id}`,
97
+ { method: 'DELETE' }
98
+ );
99
+ }
100
+
101
+ /**
102
+ * List reusable workflows for a user.
103
+ * @param userId The ID of the user.
104
+ */
105
+ async listReusable(userId: string): Promise<ListReusableWorkflowsResponse> {
106
+ if (!userId) throw new Error('userId is required');
107
+ return this.request<ListReusableWorkflowsResponse>(
108
+ `/api/workflows/reusable?userId=${encodeURIComponent(userId)}`,
109
+ { method: 'GET' }
110
+ );
111
+ }
112
+
113
+ /**
114
+ * List scheduled jobs/workflows.
115
+ * @param userId The ID of the user.
116
+ * @param workflowId Optional workflow ID filter.
117
+ * @param status Optional status filter.
118
+ */
119
+ async listSchedules(userId: string, workflowId?: string, status?: string): Promise<ListSchedulesResponse> {
120
+ if (!userId) throw new Error('userId is required');
121
+ let query = `?userId=${encodeURIComponent(userId)}`;
122
+ if (workflowId) query += `&workflowId=${encodeURIComponent(workflowId)}`;
123
+ if (status) query += `&status=${encodeURIComponent(status)}`;
124
+
125
+ return this.request<ListSchedulesResponse>(
126
+ `/api/schedules${query}`,
127
+ { method: 'GET' }
128
+ );
129
+ }
130
+
131
+ /**
132
+ * Cancel a scheduled job.
133
+ * @param jobId The ID of the job/schedule to cancel.
134
+ */
135
+ async cancelSchedule(jobId: string): Promise<CancelScheduleResponse> {
136
+ if (!jobId) throw new Error('jobId is required');
137
+ return this.request<CancelScheduleResponse>(
138
+ '/api/schedules/cancel',
139
+ {
140
+ method: 'POST',
141
+ body: JSON.stringify({ jobId })
142
+ }
143
+ );
144
+ }
145
+
146
+ /**
147
+ * Get inputs waiting for user response.
148
+ * @param userId The ID of the user.
149
+ * @param status Optional status filter.
150
+ */
151
+ async getWaitingInputs(userId: string, status?: string): Promise<GetWaitingInputsResponse> {
152
+ if (!userId) throw new Error('userId is required');
153
+ let query = `?userId=${encodeURIComponent(userId)}`;
154
+ if (status) query += `&status=${encodeURIComponent(status)}`;
155
+
156
+ return this.request<GetWaitingInputsResponse>(
157
+ `/api/workflows/inputs${query}`,
158
+ { method: 'GET' }
159
+ );
160
+ }
161
+
162
+ /**
163
+ * Respond to a waiting input.
164
+ * @param data The response data including inputId.
165
+ */
166
+ async respondToInput(data: RespondToInputData): Promise<RespondToInputResponse> {
167
+ return this.request<RespondToInputResponse>(
168
+ '/api/workflows/inputs/respond',
169
+ {
170
+ method: 'POST',
171
+ body: JSON.stringify(data)
172
+ }
173
+ );
174
+ }
175
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "CommonJS",
5
+ "moduleResolution": "node",
6
+ "declaration": true,
7
+ "outDir": "./dist",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true
12
+ },
13
+ "include": ["src"]
14
+ }