@unmeshed/sdk 1.0.8 → 1.0.10

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.
Files changed (36) hide show
  1. package/dist/apiClient.js +7 -12
  2. package/dist/index.d.ts +16 -18
  3. package/dist/index.js +20 -23
  4. package/dist/poller/pollerClientImpl.js +10 -13
  5. package/dist/process/processClientImpl.js +27 -42
  6. package/dist/registration/registrationClientImpl.js +3 -7
  7. package/dist/sample/server.d.ts +1 -0
  8. package/dist/sample/server.js +9 -0
  9. package/dist/src/apiClient.d.ts +14 -0
  10. package/dist/src/apiClient.js +99 -0
  11. package/dist/src/index.d.ts +21 -0
  12. package/dist/src/index.js +22 -0
  13. package/dist/src/poller/pollerClientImpl.d.ts +2 -0
  14. package/dist/src/poller/pollerClientImpl.js +126 -0
  15. package/dist/src/process/processClientImpl.d.ts +12 -0
  16. package/dist/src/process/processClientImpl.js +187 -0
  17. package/dist/src/registration/registrationClientImpl.d.ts +1 -0
  18. package/dist/src/registration/registrationClientImpl.js +17 -0
  19. package/dist/src/sample/server.d.ts +1 -0
  20. package/dist/src/sample/server.js +9 -0
  21. package/dist/src/types/index.d.ts +313 -0
  22. package/dist/src/types/index.js +77 -0
  23. package/dist/src/utils/unmeshedCommonUtils.d.ts +3 -0
  24. package/dist/src/utils/unmeshedCommonUtils.js +13 -0
  25. package/dist/tsconfig.tsbuildinfo +1 -0
  26. package/dist/types/index.js +16 -19
  27. package/dist/utils/unmeshedCommonUtils.js +3 -7
  28. package/package.json +3 -1
  29. package/dist/sample/sampleServer.d.ts +0 -1
  30. package/dist/sample/sampleServer.js +0 -76
  31. package/dist/sample/workers/ArithmeticWorker.d.ts +0 -5
  32. package/dist/sample/workers/ArithmeticWorker.js +0 -23
  33. package/dist/sample/workers/DelayedWorker.d.ts +0 -1
  34. package/dist/sample/workers/DelayedWorker.js +0 -11
  35. package/dist/server.d.ts +0 -1
  36. package/dist/server.js +0 -62
@@ -0,0 +1,126 @@
1
+ import { apiClient } from "..";
2
+ import { StepStatus, } from "../types";
3
+ async function registerPolling(data) {
4
+ const attempt = async () => {
5
+ try {
6
+ const response = await apiClient.put("/api/clients/register", {
7
+ data: data,
8
+ });
9
+ console.log("Successfully executed polling registration...");
10
+ return response.data;
11
+ }
12
+ catch {
13
+ console.error("An error occurred during polling registration. Retrying in 3 seconds...");
14
+ await new Promise((resolve) => setTimeout(resolve, 3000));
15
+ return attempt();
16
+ }
17
+ };
18
+ return attempt();
19
+ }
20
+ async function pollWorker(data) {
21
+ try {
22
+ const response = await apiClient.post("/api/clients/poll", {
23
+ data: data,
24
+ });
25
+ console.log("Succesfully executed worker polling...");
26
+ return response.data;
27
+ }
28
+ catch (error) {
29
+ console.error("Error occurred during worker polling", error);
30
+ }
31
+ }
32
+ async function pollWorkerResult(data) {
33
+ try {
34
+ const response = await apiClient.post("/api/clients/bulkResults", {
35
+ data: data,
36
+ });
37
+ console.log("Worker Result returned successfully...");
38
+ return response.data;
39
+ }
40
+ catch (error) {
41
+ console.log("Error:", error);
42
+ }
43
+ }
44
+ export default async function pollForWorkers(workers) {
45
+ const registerPollingData = workers.map((worker) => {
46
+ return {
47
+ orgId: 0,
48
+ namespace: worker.namespace,
49
+ stepType: "WORKER",
50
+ name: worker.name,
51
+ };
52
+ });
53
+ await registerPolling(registerPollingData);
54
+ const pollWorkerData = workers.map((worker) => {
55
+ return {
56
+ stepQueueNameData: {
57
+ orgId: 0,
58
+ namespace: worker.namespace,
59
+ stepType: "WORKER",
60
+ name: worker.name,
61
+ },
62
+ size: worker.maxInProgress,
63
+ };
64
+ });
65
+ const pollResponse = await pollWorker(pollWorkerData);
66
+ const workerResult = await Promise.all(pollResponse.map(async (polledWorker) => {
67
+ const associatedWorker = workers.find((worker) => worker.name === polledWorker.stepName &&
68
+ worker.namespace === polledWorker.stepNamespace);
69
+ if (!associatedWorker) {
70
+ throw Error(`No worker found for ${polledWorker.stepName} ${polledWorker.stepNamespace}`);
71
+ }
72
+ let workerResponse = {
73
+ processId: polledWorker.processId,
74
+ stepId: polledWorker.stepId,
75
+ stepExecutionId: polledWorker.stepExecutionId,
76
+ runCount: polledWorker.runCount,
77
+ output: {},
78
+ status: StepStatus.RUNNING,
79
+ rescheduleAfterSeconds: null,
80
+ startedAt: new Date().getTime(),
81
+ };
82
+ const TIMEOUT = 1000;
83
+ const timeoutPromise = new Promise((_, reject) => {
84
+ setTimeout(() => reject(new Error("Timed out")), TIMEOUT);
85
+ });
86
+ try {
87
+ const result = await Promise.race([
88
+ associatedWorker.worker(polledWorker.inputParam),
89
+ timeoutPromise,
90
+ ]);
91
+ workerResponse = {
92
+ ...workerResponse,
93
+ output: {
94
+ ...result,
95
+ __workCompletedAt: new Date().getTime(),
96
+ },
97
+ status: StepStatus.COMPLETED,
98
+ };
99
+ }
100
+ catch (error) {
101
+ const err = error;
102
+ if (err.message === "Timed out") {
103
+ workerResponse = {
104
+ ...workerResponse,
105
+ output: {
106
+ error: err.message,
107
+ },
108
+ status: StepStatus.TIMED_OUT,
109
+ };
110
+ }
111
+ else {
112
+ workerResponse = {
113
+ ...workerResponse,
114
+ output: {
115
+ error: err.message,
116
+ },
117
+ status: StepStatus.FAILED,
118
+ };
119
+ console.error("Error:", err.message);
120
+ }
121
+ }
122
+ return workerResponse;
123
+ }));
124
+ const workerResultResponse = await pollWorkerResult(workerResult);
125
+ console.log("Worker result : ", workerResultResponse);
126
+ }
@@ -0,0 +1,12 @@
1
+ import { ApiCallType, ProcessActionResponseData, ProcessData, ProcessRequestData, ProcessSearchRequest, StepData } from "../types";
2
+ export declare const runProcessSync: (ProcessRequestData: ProcessRequestData) => Promise<ProcessData>;
3
+ export declare const runProcessAsync: (ProcessRequestData: ProcessRequestData) => Promise<ProcessData>;
4
+ export declare const getProcessData: (processId: number) => Promise<ProcessData>;
5
+ export declare const getStepData: (stepId: number | null) => Promise<StepData>;
6
+ export declare const bulkTerminate: (processIds: number[], reason?: string) => Promise<ProcessActionResponseData>;
7
+ export declare const bulkResume: (processIds: number[]) => Promise<ProcessActionResponseData>;
8
+ export declare const bulkReviewed: (processIds: number[], reason?: string) => Promise<ProcessActionResponseData>;
9
+ export declare const rerun: (processId: number, clientId: string, version?: number) => Promise<ProcessData>;
10
+ export declare const searchProcessExecutions: (params: ProcessSearchRequest) => Promise<any>;
11
+ export declare const invokeApiMappingGet: (endpoint: string, id: string, correlationId: string, apiCallType: ApiCallType) => Promise<any>;
12
+ export declare const invokeApiMappingPost: (endpoint: string, input: Record<string, any>, id: string, correlationId: string, apiCallType?: ApiCallType) => Promise<any>;
@@ -0,0 +1,187 @@
1
+ import { apiClient } from "..";
2
+ import { ApiCallType, } from "../types";
3
+ import { isAxiosError } from "axios";
4
+ const RUN_PROCESS_REQUEST_URL = "api/process/";
5
+ export const runProcessSync = async (ProcessRequestData) => {
6
+ try {
7
+ const response = await apiClient.post(RUN_PROCESS_REQUEST_URL + "runSync", {
8
+ data: ProcessRequestData,
9
+ params: {
10
+ clientId: apiClient.getClientId(),
11
+ },
12
+ });
13
+ console.log("Response:", response);
14
+ return response.data;
15
+ }
16
+ catch (error) {
17
+ console.error("Some error occurred running process request : ", error);
18
+ throw error;
19
+ }
20
+ };
21
+ export const runProcessAsync = async (ProcessRequestData) => {
22
+ try {
23
+ const response = await apiClient.post(RUN_PROCESS_REQUEST_URL + "runAsync", {
24
+ data: ProcessRequestData,
25
+ params: {
26
+ clientId: apiClient.getClientId(),
27
+ },
28
+ });
29
+ console.log("Response:", response);
30
+ return response.data;
31
+ }
32
+ catch (error) {
33
+ console.error("Some error occurred running process request : ", error);
34
+ throw error;
35
+ }
36
+ };
37
+ export const getProcessData = async (processId) => {
38
+ if (processId == null) {
39
+ throw new Error("Process ID cannot be null");
40
+ }
41
+ try {
42
+ const response = await apiClient.get(RUN_PROCESS_REQUEST_URL + "context/" + processId);
43
+ return response.data;
44
+ }
45
+ catch (error) {
46
+ console.error("Error occurred while fetching process record: ", error);
47
+ throw error;
48
+ }
49
+ };
50
+ export const getStepData = async (stepId) => {
51
+ if (stepId === null || stepId === undefined) {
52
+ throw new Error("Step ID cannot be null or undefined");
53
+ }
54
+ try {
55
+ const response = await apiClient.get(RUN_PROCESS_REQUEST_URL + "stepContext/" + stepId);
56
+ return response.data;
57
+ }
58
+ catch (error) {
59
+ const err = error;
60
+ throw new Error(`Error occurred while fetching step record: ${err.message || error}`);
61
+ }
62
+ };
63
+ export const bulkTerminate = async (processIds, reason) => {
64
+ try {
65
+ const response = await apiClient.post(RUN_PROCESS_REQUEST_URL + "bulkTerminate", {
66
+ params: { reason },
67
+ data: processIds,
68
+ });
69
+ return response.data;
70
+ }
71
+ catch (error) {
72
+ const err = error;
73
+ throw new Error(`Error occurred while terminating processes: ${err.message || error}`);
74
+ }
75
+ };
76
+ export const bulkResume = async (processIds) => {
77
+ try {
78
+ const response = await apiClient.post(RUN_PROCESS_REQUEST_URL + "bulkResume", {
79
+ data: processIds,
80
+ });
81
+ return response.data;
82
+ }
83
+ catch (error) {
84
+ const err = error;
85
+ throw new Error(`Error occurred while resuming processes: ${err.message || error}`);
86
+ }
87
+ };
88
+ export const bulkReviewed = async (processIds, reason) => {
89
+ try {
90
+ const response = await apiClient.post(RUN_PROCESS_REQUEST_URL + "bulkReviewed", {
91
+ data: processIds,
92
+ params: { reason },
93
+ });
94
+ return response.data;
95
+ }
96
+ catch (error) {
97
+ const err = error;
98
+ throw new Error(`Error occurred while marking processes as reviewed: ${err.message || error}`);
99
+ }
100
+ };
101
+ export const rerun = async (processId, clientId, version) => {
102
+ const params = {
103
+ clientId,
104
+ processId,
105
+ };
106
+ if (version !== undefined) {
107
+ params["version"] = version;
108
+ }
109
+ try {
110
+ const response = await apiClient.post(RUN_PROCESS_REQUEST_URL + "rerun", {
111
+ params,
112
+ });
113
+ return response.data;
114
+ }
115
+ catch (error) {
116
+ if (isAxiosError(error)) {
117
+ throw new Error(`HTTP request error during rerun process: ${error.response?.status} - ${error.response?.data}`);
118
+ }
119
+ else {
120
+ const err = error;
121
+ throw new Error(`Unexpected error during rerun process: ${err.message || err}`);
122
+ }
123
+ }
124
+ };
125
+ export const searchProcessExecutions = async (params) => {
126
+ const queryParams = new URLSearchParams();
127
+ if (params.startTimeEpoch !== undefined && params.startTimeEpoch !== 0)
128
+ queryParams.set("startTimeEpoch", params.startTimeEpoch.toString());
129
+ if (params.endTimeEpoch !== undefined && params.endTimeEpoch !== 0)
130
+ queryParams.set("endTimeEpoch", (params.endTimeEpoch || 0).toString());
131
+ if (params.namespace)
132
+ queryParams.set("namespace", params.namespace);
133
+ if (params.names && params.names.length)
134
+ queryParams.set("names", params.names.join(","));
135
+ if (params.processIds && params.processIds.length)
136
+ queryParams.set("processIds", params.processIds.join(","));
137
+ if (params.correlationIds && params.correlationIds.length)
138
+ queryParams.set("correlationIds", params.correlationIds.join(","));
139
+ if (params.requestIds && params.requestIds.length)
140
+ queryParams.set("requestIds", params.requestIds.join(","));
141
+ if (params.statuses && params.statuses.length)
142
+ queryParams.set("statuses", params.statuses.join(","));
143
+ if (params.triggerTypes && params.triggerTypes.length)
144
+ queryParams.set("triggerTypes", params.triggerTypes.join(","));
145
+ const updatedParams = Object.fromEntries(new URLSearchParams(queryParams));
146
+ try {
147
+ const response = await apiClient.get(RUN_PROCESS_REQUEST_URL + "api/stats/process/search", updatedParams);
148
+ console.log("Response:", response);
149
+ return response.data;
150
+ }
151
+ catch (error) {
152
+ console.error("Error occurred while searching process executions: ", error);
153
+ throw error;
154
+ }
155
+ };
156
+ export const invokeApiMappingGet = async (endpoint, id, correlationId, apiCallType) => {
157
+ try {
158
+ const response = await apiClient.get(RUN_PROCESS_REQUEST_URL + "api/call/" + endpoint, {
159
+ id: id,
160
+ correlationId: correlationId,
161
+ apiCallType,
162
+ });
163
+ console.log("Response:", response);
164
+ return response.data;
165
+ }
166
+ catch (error) {
167
+ console.error("Error occurred while invoking API Mapping GET: ", error);
168
+ throw error;
169
+ }
170
+ };
171
+ export const invokeApiMappingPost = async (endpoint, input, id, correlationId, apiCallType = ApiCallType.ASYNC) => {
172
+ try {
173
+ const response = await apiClient.post(RUN_PROCESS_REQUEST_URL + "api/call/" + endpoint, {
174
+ data: input,
175
+ params: {
176
+ id: id,
177
+ correlationId: correlationId,
178
+ apiCallType,
179
+ },
180
+ });
181
+ return response.data;
182
+ }
183
+ catch (error) {
184
+ console.error("Error occurred while invoking API Mapping POST: ", error);
185
+ throw error;
186
+ }
187
+ };
@@ -0,0 +1 @@
1
+ export declare const renewRegistration: () => Promise<string>;
@@ -0,0 +1,17 @@
1
+ import { apiClient } from "..";
2
+ export const renewRegistration = async () => {
3
+ try {
4
+ const response = await apiClient.put("/api/clients/register", {
5
+ params: {
6
+ friendlyName: "Unmeshed",
7
+ tokenExpiryDate: "",
8
+ },
9
+ });
10
+ console.debug("Response from server:", response);
11
+ return response.data;
12
+ }
13
+ catch (error) {
14
+ console.error("Error occurred during registration renewal:", error);
15
+ throw error;
16
+ }
17
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import { initialize } from "../index";
2
+ import { getProcessData } from "../process/processClientImpl";
3
+ initialize({
4
+ baseUrl: "https://perfdemo.unmeshed.com",
5
+ clientId: "e1208b04-e308-4976-b236-074a82b0ecbb",
6
+ authToken: "8R06KsNUqBN4b67jcN0W",
7
+ port: "443",
8
+ });
9
+ getProcessData(27100448).then(result => console.log(JSON.stringify(result, null, 2)));
@@ -0,0 +1,313 @@
1
+ import { AxiosRequestConfig } from "axios";
2
+ export declare enum ApiCallType {
3
+ SYNC = "SYNC",
4
+ ASYNC = "ASYNC",
5
+ STREAM = "STREAM"
6
+ }
7
+ export interface ApiMappingData {
8
+ endpoint: string;
9
+ processDefNamespace: string;
10
+ processDefName: string;
11
+ processDefVersion: number;
12
+ authType: string;
13
+ authClaims: string;
14
+ createdBy: string;
15
+ updatedBy: string;
16
+ created: Date;
17
+ updated: Date;
18
+ }
19
+ export type ApiMappingWebhookData = {
20
+ endpoint: string;
21
+ name: string;
22
+ uniqueId: string;
23
+ urlSecret: string;
24
+ description: string;
25
+ userIdentifier: string;
26
+ webhookSource: WebhookSource;
27
+ webhookSourceConfig: Record<string, string>;
28
+ expiryDate: Date;
29
+ userType: SQAuthUserType;
30
+ createdBy: string;
31
+ updatedBy: string;
32
+ created: Date;
33
+ updated: Date;
34
+ };
35
+ export declare enum WebhookSource {
36
+ MS_TEAMS = "MS_TEAMS",
37
+ NOT_DEFINED = "NOT_DEFINED"
38
+ }
39
+ export declare enum SQAuthUserType {
40
+ USER = "USER",
41
+ API = "API",
42
+ INTERNAL = "INTERNAL"
43
+ }
44
+ export declare enum StepType {
45
+ WORKER = "WORKER",
46
+ HTTP = "HTTP",
47
+ WAIT = "WAIT",
48
+ FAIL = "FAIL",
49
+ PYTHON = "PYTHON",
50
+ JAVASCRIPT = "JAVASCRIPT",
51
+ JQ = "JQ",
52
+ MANAGED = "MANAGED",
53
+ BUILTIN = "BUILTIN",
54
+ NOOP = "NOOP",
55
+ PERSISTED_STATE = "PERSISTED_STATE",
56
+ DEPENDSON = "DEPENDSON",
57
+ INTEGRATION = "INTEGRATION",
58
+ EXIT = "EXIT",
59
+ SUB_PROCESS = "SUB_PROCESS",
60
+ LIST = "LIST",
61
+ PARALLEL = "PARALLEL",
62
+ FOREACH = "FOREACH",
63
+ SWITCH = "SWITCH"
64
+ }
65
+ export declare enum StepStatus {
66
+ PENDING = "PENDING",
67
+ SCHEDULED = "SCHEDULED",
68
+ RUNNING = "RUNNING",
69
+ PAUSED = "PAUSED",
70
+ COMPLETED = "COMPLETED",
71
+ FAILED = "FAILED",
72
+ TIMED_OUT = "TIMED_OUT",
73
+ SKIPPED = "SKIPPED",
74
+ CANCELLED = "CANCELLED"
75
+ }
76
+ export declare enum ProcessStatus {
77
+ RUNNING = "RUNNING",
78
+ COMPLETED = "COMPLETED",
79
+ FAILED = "FAILED",
80
+ TIMED_OUT = "TIMED_OUT",
81
+ CANCELLED = "CANCELLED",
82
+ TERMINATED = "TERMINATED",
83
+ REVIEWED = "REVIEWED"
84
+ }
85
+ export declare enum ProcessTriggerType {
86
+ MANUAL = "MANUAL",
87
+ SCHEDULED = "SCHEDULED",
88
+ API_MAPPING = "API_MAPPING",
89
+ WEBHOOK = "WEBHOOK",
90
+ API = "API",
91
+ SUB_PROCESS = "SUB_PROCESS"
92
+ }
93
+ export declare enum ProcessType {
94
+ STANDARD = "STANDARD",
95
+ DYNAMIC = "DYNAMIC",
96
+ API_ORCHESTRATION = "API_ORCHESTRATION",
97
+ INTERNAL = "INTERNAL"
98
+ }
99
+ export type ClientProfileData = {
100
+ clientId: string;
101
+ ipAddress: string;
102
+ friendlyName: string;
103
+ userIdentifier: string;
104
+ stepQueueNames: StepQueueNameData[];
105
+ createdBy: string;
106
+ updatedBy: string;
107
+ created: Date;
108
+ updated: Date;
109
+ expiryDate: Date;
110
+ };
111
+ export type FullClientProfileData = {
112
+ clientId: string;
113
+ ipAddress: string;
114
+ friendlyName: string;
115
+ userIdentifier: string;
116
+ stepQueueNames: StepQueueNameData[];
117
+ createdBy: string;
118
+ updatedBy: string;
119
+ created: Date;
120
+ updated: Date;
121
+ expiryDate: Date;
122
+ tokenValue: string;
123
+ };
124
+ export type StepQueueNameData = {
125
+ orgId: number;
126
+ namespace: string;
127
+ stepType: StepType;
128
+ name: string;
129
+ };
130
+ export type ProcessActionResponseData = {
131
+ count: number;
132
+ details: ProcessActionResponseDetailData[];
133
+ };
134
+ export type ProcessActionResponseDetailData = {
135
+ id: string;
136
+ message: string;
137
+ error: string;
138
+ };
139
+ export type ProcessData = {
140
+ processId: number;
141
+ processType: ProcessType;
142
+ triggerType: ProcessTriggerType;
143
+ namespace: string;
144
+ name: string;
145
+ version: number | null;
146
+ processDefinitionHistoryId: number | null;
147
+ requestId: string;
148
+ correlationId: string;
149
+ status: ProcessStatus;
150
+ input: Record<string, unknown>;
151
+ output: Record<string, unknown>;
152
+ stepIdCount: number | null;
153
+ shardName: string;
154
+ shardInstanceId: number | null;
155
+ stepIds: StepId[];
156
+ stepDataById: Record<number, StepData>;
157
+ created: number;
158
+ updated: number;
159
+ createdBy: string;
160
+ };
161
+ export type StepData = {
162
+ id: number;
163
+ processId: number;
164
+ ref: string;
165
+ parentId: number | null;
166
+ parentRef: string | null;
167
+ namespace: string;
168
+ name: string;
169
+ type: StepType;
170
+ stepDefinitionHistoryId: number | null;
171
+ status: StepStatus;
172
+ input: Record<string, unknown>;
173
+ output: Record<string, unknown>;
174
+ workerId: string;
175
+ start: number;
176
+ schedule: number;
177
+ priority: number;
178
+ updated: number;
179
+ optional: boolean;
180
+ executionList: StepExecutionData[];
181
+ };
182
+ export type StepExecutionData = {
183
+ id: number;
184
+ scheduled: number;
185
+ polled: number;
186
+ start: number;
187
+ updated: number;
188
+ executor: string;
189
+ ref: string;
190
+ runs: number;
191
+ output: Record<string, unknown>;
192
+ };
193
+ export type StepId = {
194
+ id: number;
195
+ processId: number;
196
+ ref: string;
197
+ };
198
+ export type ProcessRequestData = {
199
+ name: string;
200
+ namespace: string;
201
+ version: number | null;
202
+ requestId: string;
203
+ correlationId: string;
204
+ input: Record<string, unknown>;
205
+ };
206
+ export type ProcessSearchRequest = {
207
+ startTimeEpoch: number;
208
+ endTimeEpoch?: number | null;
209
+ namespace: string;
210
+ processTypes: ProcessType[];
211
+ triggerTypes: ProcessTriggerType[];
212
+ names: string[];
213
+ processIds: number[];
214
+ correlationIds: string[];
215
+ requestIds: string[];
216
+ statuses: ProcessStatus[];
217
+ limit: number;
218
+ offset: number;
219
+ };
220
+ export type StepSize = {
221
+ stepQueueNameData: StepQueueNameData;
222
+ size: number | null;
223
+ };
224
+ export type ClientSubmitResult = {
225
+ processId: number;
226
+ stepId: number;
227
+ errorMessage: string | null;
228
+ httpStatusCode: number | null;
229
+ };
230
+ export type WorkRequest = {
231
+ processId: number;
232
+ stepId: number;
233
+ stepExecutionId: number;
234
+ runCount: number;
235
+ stepName: string;
236
+ stepNamespace: string;
237
+ stepRef: string;
238
+ inputParam: Record<string, unknown>;
239
+ isOptional: boolean;
240
+ polled: number;
241
+ scheduled: number;
242
+ updated: number;
243
+ priority: number;
244
+ };
245
+ export type WorkResponse = {
246
+ processId: number;
247
+ stepId: number;
248
+ stepExecutionId: number;
249
+ runCount: number;
250
+ output: Record<string, unknown>;
251
+ status: StepStatus;
252
+ rescheduleAfterSeconds: number | null;
253
+ startedAt: number;
254
+ };
255
+ export type WorkResult = {
256
+ output: unknown;
257
+ taskExecutionId: string;
258
+ startTime: number;
259
+ endTime: number;
260
+ workRequest: WorkRequest;
261
+ };
262
+ export interface ApiClientConfig {
263
+ baseUrl: string;
264
+ clientId: string;
265
+ authToken: string;
266
+ port?: string | number;
267
+ timeout?: number;
268
+ }
269
+ export interface ApiResponse<T = any> {
270
+ data: T;
271
+ status: number;
272
+ headers: Record<string, string>;
273
+ }
274
+ export interface ApiError extends Error {
275
+ status?: number;
276
+ response?: {
277
+ data?: any;
278
+ status: number;
279
+ headers: Record<string, string>;
280
+ };
281
+ }
282
+ export interface QueryParams {
283
+ [key: string]: string | number | boolean | undefined;
284
+ }
285
+ export interface RequestConfig extends Omit<AxiosRequestConfig, "baseURL" | "url" | "method"> {
286
+ headers?: Record<string, string>;
287
+ }
288
+ export interface HandleRequestConfig {
289
+ method: "get" | "post" | "put" | "delete";
290
+ endpoint: string;
291
+ params?: QueryParams;
292
+ data?: Record<string, unknown>;
293
+ config?: RequestConfig;
294
+ }
295
+ export interface ClientRequestConfig {
296
+ params?: QueryParams;
297
+ data?: any;
298
+ config?: RequestConfig;
299
+ }
300
+ interface UnmeshedWorker {
301
+ (input: Record<string, any>): Promise<any>;
302
+ }
303
+ export interface UnmeshedWorkerConfig {
304
+ worker: UnmeshedWorker;
305
+ namespace: string;
306
+ name: string;
307
+ maxInProgress: number;
308
+ }
309
+ export interface PollRequestData {
310
+ stepQueueNameData: StepQueueNameData;
311
+ size: number;
312
+ }
313
+ export {};