@unmeshed/sdk 1.0.13 → 1.0.15
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/dist/index.d.mts +370 -0
- package/{types → dist}/index.d.ts +95 -38
- package/dist/index.js +842 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +797 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +31 -14
- package/apiClient.d.ts +0 -14
- package/apiClient.js +0 -106
- package/apiClient.js.map +0 -1
- package/index.d.ts +0 -21
- package/index.js +0 -29
- package/index.js.map +0 -1
- package/poller/pollerClientImpl.d.ts +0 -2
- package/poller/pollerClientImpl.js +0 -130
- package/poller/pollerClientImpl.js.map +0 -1
- package/process/processClientImpl.d.ts +0 -12
- package/process/processClientImpl.js +0 -202
- package/process/processClientImpl.js.map +0 -1
- package/registration/registrationClientImpl.d.ts +0 -1
- package/registration/registrationClientImpl.js +0 -22
- package/registration/registrationClientImpl.js.map +0 -1
- package/sampleTest.d.ts +0 -1
- package/sampleTest.js +0 -82
- package/sampleTest.js.map +0 -1
- package/types/index.js +0 -81
- package/types/index.js.map +0 -1
- package/utils/unmeshedCommonUtils.d.ts +0 -3
- package/utils/unmeshedCommonUtils.js +0 -18
- package/utils/unmeshedCommonUtils.js.map +0 -1
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
|
|
3
|
+
declare enum ApiCallType {
|
|
4
|
+
SYNC = "SYNC",
|
|
5
|
+
ASYNC = "ASYNC",
|
|
6
|
+
STREAM = "STREAM"
|
|
7
|
+
}
|
|
8
|
+
interface ApiMappingData {
|
|
9
|
+
endpoint: string;
|
|
10
|
+
processDefNamespace: string;
|
|
11
|
+
processDefName: string;
|
|
12
|
+
processDefVersion: number;
|
|
13
|
+
authType: string;
|
|
14
|
+
authClaims: string;
|
|
15
|
+
createdBy: string;
|
|
16
|
+
updatedBy: string;
|
|
17
|
+
created: Date;
|
|
18
|
+
updated: Date;
|
|
19
|
+
}
|
|
20
|
+
type ApiMappingWebhookData = {
|
|
21
|
+
endpoint: string;
|
|
22
|
+
name: string;
|
|
23
|
+
uniqueId: string;
|
|
24
|
+
urlSecret: string;
|
|
25
|
+
description: string;
|
|
26
|
+
userIdentifier: string;
|
|
27
|
+
webhookSource: WebhookSource;
|
|
28
|
+
webhookSourceConfig: Record<string, string>;
|
|
29
|
+
expiryDate: Date;
|
|
30
|
+
userType: SQAuthUserType;
|
|
31
|
+
createdBy: string;
|
|
32
|
+
updatedBy: string;
|
|
33
|
+
created: Date;
|
|
34
|
+
updated: Date;
|
|
35
|
+
};
|
|
36
|
+
declare enum WebhookSource {
|
|
37
|
+
MS_TEAMS = "MS_TEAMS",
|
|
38
|
+
NOT_DEFINED = "NOT_DEFINED"
|
|
39
|
+
}
|
|
40
|
+
declare enum SQAuthUserType {
|
|
41
|
+
USER = "USER",
|
|
42
|
+
API = "API",
|
|
43
|
+
INTERNAL = "INTERNAL"
|
|
44
|
+
}
|
|
45
|
+
declare enum StepType {
|
|
46
|
+
WORKER = "WORKER",
|
|
47
|
+
HTTP = "HTTP",
|
|
48
|
+
WAIT = "WAIT",
|
|
49
|
+
FAIL = "FAIL",
|
|
50
|
+
PYTHON = "PYTHON",
|
|
51
|
+
JAVASCRIPT = "JAVASCRIPT",
|
|
52
|
+
JQ = "JQ",
|
|
53
|
+
MANAGED = "MANAGED",
|
|
54
|
+
BUILTIN = "BUILTIN",
|
|
55
|
+
NOOP = "NOOP",
|
|
56
|
+
PERSISTED_STATE = "PERSISTED_STATE",
|
|
57
|
+
DEPENDSON = "DEPENDSON",
|
|
58
|
+
INTEGRATION = "INTEGRATION",
|
|
59
|
+
EXIT = "EXIT",
|
|
60
|
+
SUB_PROCESS = "SUB_PROCESS",
|
|
61
|
+
LIST = "LIST",
|
|
62
|
+
PARALLEL = "PARALLEL",
|
|
63
|
+
FOREACH = "FOREACH",
|
|
64
|
+
SWITCH = "SWITCH"
|
|
65
|
+
}
|
|
66
|
+
declare enum StepStatus {
|
|
67
|
+
PENDING = "PENDING",
|
|
68
|
+
SCHEDULED = "SCHEDULED",
|
|
69
|
+
RUNNING = "RUNNING",
|
|
70
|
+
PAUSED = "PAUSED",
|
|
71
|
+
COMPLETED = "COMPLETED",
|
|
72
|
+
FAILED = "FAILED",
|
|
73
|
+
TIMED_OUT = "TIMED_OUT",
|
|
74
|
+
SKIPPED = "SKIPPED",
|
|
75
|
+
CANCELLED = "CANCELLED"
|
|
76
|
+
}
|
|
77
|
+
declare enum ProcessStatus {
|
|
78
|
+
RUNNING = "RUNNING",
|
|
79
|
+
COMPLETED = "COMPLETED",
|
|
80
|
+
FAILED = "FAILED",
|
|
81
|
+
TIMED_OUT = "TIMED_OUT",
|
|
82
|
+
CANCELLED = "CANCELLED",
|
|
83
|
+
TERMINATED = "TERMINATED",
|
|
84
|
+
REVIEWED = "REVIEWED"
|
|
85
|
+
}
|
|
86
|
+
declare enum ProcessTriggerType {
|
|
87
|
+
MANUAL = "MANUAL",
|
|
88
|
+
SCHEDULED = "SCHEDULED",
|
|
89
|
+
API_MAPPING = "API_MAPPING",
|
|
90
|
+
WEBHOOK = "WEBHOOK",
|
|
91
|
+
API = "API",
|
|
92
|
+
SUB_PROCESS = "SUB_PROCESS"
|
|
93
|
+
}
|
|
94
|
+
declare enum ProcessType {
|
|
95
|
+
STANDARD = "STANDARD",
|
|
96
|
+
DYNAMIC = "DYNAMIC",
|
|
97
|
+
API_ORCHESTRATION = "API_ORCHESTRATION",
|
|
98
|
+
INTERNAL = "INTERNAL"
|
|
99
|
+
}
|
|
100
|
+
type ClientProfileData = {
|
|
101
|
+
clientId: string;
|
|
102
|
+
ipAddress: string;
|
|
103
|
+
friendlyName: string;
|
|
104
|
+
userIdentifier: string;
|
|
105
|
+
stepQueueNames: StepQueueNameData[];
|
|
106
|
+
createdBy: string;
|
|
107
|
+
updatedBy: string;
|
|
108
|
+
created: Date;
|
|
109
|
+
updated: Date;
|
|
110
|
+
expiryDate: Date;
|
|
111
|
+
};
|
|
112
|
+
type FullClientProfileData = {
|
|
113
|
+
clientId: string;
|
|
114
|
+
ipAddress: string;
|
|
115
|
+
friendlyName: string;
|
|
116
|
+
userIdentifier: string;
|
|
117
|
+
stepQueueNames: StepQueueNameData[];
|
|
118
|
+
createdBy: string;
|
|
119
|
+
updatedBy: string;
|
|
120
|
+
created: Date;
|
|
121
|
+
updated: Date;
|
|
122
|
+
expiryDate: Date;
|
|
123
|
+
tokenValue: string;
|
|
124
|
+
};
|
|
125
|
+
type StepQueueNameData = {
|
|
126
|
+
orgId: number;
|
|
127
|
+
namespace: string;
|
|
128
|
+
stepType: StepType;
|
|
129
|
+
name: string;
|
|
130
|
+
};
|
|
131
|
+
type ProcessActionResponseData = {
|
|
132
|
+
count: number;
|
|
133
|
+
details: ProcessActionResponseDetailData[];
|
|
134
|
+
};
|
|
135
|
+
type ProcessActionResponseDetailData = {
|
|
136
|
+
id: string;
|
|
137
|
+
message: string;
|
|
138
|
+
error: string;
|
|
139
|
+
};
|
|
140
|
+
type ProcessData = {
|
|
141
|
+
processId: number;
|
|
142
|
+
processType: ProcessType;
|
|
143
|
+
triggerType: ProcessTriggerType;
|
|
144
|
+
namespace: string;
|
|
145
|
+
name: string;
|
|
146
|
+
version: number | null;
|
|
147
|
+
processDefinitionHistoryId: number | null;
|
|
148
|
+
requestId: string;
|
|
149
|
+
correlationId: string;
|
|
150
|
+
status: ProcessStatus;
|
|
151
|
+
input: Record<string, unknown>;
|
|
152
|
+
output: Record<string, unknown>;
|
|
153
|
+
stepIdCount: number | null;
|
|
154
|
+
shardName: string;
|
|
155
|
+
shardInstanceId: number | null;
|
|
156
|
+
stepIds: StepId[];
|
|
157
|
+
stepDataById: Record<number, StepData>;
|
|
158
|
+
created: number;
|
|
159
|
+
updated: number;
|
|
160
|
+
createdBy: string;
|
|
161
|
+
};
|
|
162
|
+
type StepData = {
|
|
163
|
+
id: number;
|
|
164
|
+
processId: number;
|
|
165
|
+
ref: string;
|
|
166
|
+
parentId: number | null;
|
|
167
|
+
parentRef: string | null;
|
|
168
|
+
namespace: string;
|
|
169
|
+
name: string;
|
|
170
|
+
type: StepType;
|
|
171
|
+
stepDefinitionHistoryId: number | null;
|
|
172
|
+
status: StepStatus;
|
|
173
|
+
input: Record<string, unknown>;
|
|
174
|
+
output: Record<string, unknown>;
|
|
175
|
+
workerId: string;
|
|
176
|
+
start: number;
|
|
177
|
+
schedule: number;
|
|
178
|
+
priority: number;
|
|
179
|
+
updated: number;
|
|
180
|
+
optional: boolean;
|
|
181
|
+
executionList: StepExecutionData[];
|
|
182
|
+
};
|
|
183
|
+
type StepExecutionData = {
|
|
184
|
+
id: number;
|
|
185
|
+
scheduled: number;
|
|
186
|
+
polled: number;
|
|
187
|
+
start: number;
|
|
188
|
+
updated: number;
|
|
189
|
+
executor: string;
|
|
190
|
+
ref: string;
|
|
191
|
+
runs: number;
|
|
192
|
+
output: Record<string, unknown>;
|
|
193
|
+
};
|
|
194
|
+
type StepId = {
|
|
195
|
+
id: number;
|
|
196
|
+
processId: number;
|
|
197
|
+
ref: string;
|
|
198
|
+
};
|
|
199
|
+
type ProcessRequestData = {
|
|
200
|
+
name: string;
|
|
201
|
+
namespace: string;
|
|
202
|
+
version: number | null;
|
|
203
|
+
requestId: string;
|
|
204
|
+
correlationId: string;
|
|
205
|
+
input: Record<string, unknown>;
|
|
206
|
+
};
|
|
207
|
+
type ProcessSearchRequest = {
|
|
208
|
+
startTimeEpoch: number;
|
|
209
|
+
endTimeEpoch?: number | null;
|
|
210
|
+
namespace: string;
|
|
211
|
+
processTypes: ProcessType[];
|
|
212
|
+
triggerTypes: ProcessTriggerType[];
|
|
213
|
+
names: string[];
|
|
214
|
+
processIds: number[];
|
|
215
|
+
correlationIds: string[];
|
|
216
|
+
requestIds: string[];
|
|
217
|
+
statuses: ProcessStatus[];
|
|
218
|
+
limit: number;
|
|
219
|
+
offset: number;
|
|
220
|
+
};
|
|
221
|
+
type StepSize = {
|
|
222
|
+
stepQueueNameData: StepQueueNameData;
|
|
223
|
+
size: number | null;
|
|
224
|
+
};
|
|
225
|
+
type ClientSubmitResult = {
|
|
226
|
+
processId: number;
|
|
227
|
+
stepId: number;
|
|
228
|
+
errorMessage: string | null;
|
|
229
|
+
httpStatusCode: number | null;
|
|
230
|
+
};
|
|
231
|
+
type WorkRequest = {
|
|
232
|
+
processId: number;
|
|
233
|
+
stepId: number;
|
|
234
|
+
stepExecutionId: number;
|
|
235
|
+
runCount: number;
|
|
236
|
+
stepName: string;
|
|
237
|
+
stepNamespace: string;
|
|
238
|
+
stepRef: string;
|
|
239
|
+
inputParam: Record<string, unknown>;
|
|
240
|
+
isOptional: boolean;
|
|
241
|
+
polled: number;
|
|
242
|
+
scheduled: number;
|
|
243
|
+
updated: number;
|
|
244
|
+
priority: number;
|
|
245
|
+
};
|
|
246
|
+
type WorkResponse = {
|
|
247
|
+
processId: number;
|
|
248
|
+
stepId: number;
|
|
249
|
+
stepExecutionId: number;
|
|
250
|
+
runCount: number;
|
|
251
|
+
output: Record<string, unknown>;
|
|
252
|
+
status: StepStatus;
|
|
253
|
+
rescheduleAfterSeconds: number | null;
|
|
254
|
+
startedAt: number;
|
|
255
|
+
};
|
|
256
|
+
type WorkResult = {
|
|
257
|
+
output: unknown;
|
|
258
|
+
taskExecutionId: string;
|
|
259
|
+
startTime: number;
|
|
260
|
+
endTime: number;
|
|
261
|
+
workRequest: WorkRequest;
|
|
262
|
+
};
|
|
263
|
+
interface FinalUnmeshedClientConfig {
|
|
264
|
+
baseUrl: string;
|
|
265
|
+
clientId: string;
|
|
266
|
+
authToken: string;
|
|
267
|
+
port: string | number;
|
|
268
|
+
timeout: number;
|
|
269
|
+
apiWorkerTimeout: number;
|
|
270
|
+
pollTimeout: number;
|
|
271
|
+
pollInterval: number;
|
|
272
|
+
responsePollInterval: number;
|
|
273
|
+
responsePollTimeout: number;
|
|
274
|
+
responseBatchSize: number;
|
|
275
|
+
}
|
|
276
|
+
interface UnmeshedClientConfig {
|
|
277
|
+
baseUrl: string;
|
|
278
|
+
clientId: string;
|
|
279
|
+
authToken: string;
|
|
280
|
+
port: string | number;
|
|
281
|
+
timeout?: number;
|
|
282
|
+
apiWorkerTimeout?: number;
|
|
283
|
+
pollTimeout?: number;
|
|
284
|
+
pollInterval?: number;
|
|
285
|
+
responsePollInterval?: number;
|
|
286
|
+
responsePollTimeout?: number;
|
|
287
|
+
responseBatchSize?: number;
|
|
288
|
+
}
|
|
289
|
+
interface ApiResponse<T = any> {
|
|
290
|
+
data: T;
|
|
291
|
+
status: number;
|
|
292
|
+
headers: Record<string, string>;
|
|
293
|
+
}
|
|
294
|
+
interface ApiError extends Error {
|
|
295
|
+
status?: number;
|
|
296
|
+
response?: {
|
|
297
|
+
data?: any;
|
|
298
|
+
status: number;
|
|
299
|
+
headers: Record<string, string>;
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
interface QueryParams {
|
|
303
|
+
[key: string]: string | number | boolean | undefined;
|
|
304
|
+
}
|
|
305
|
+
interface RequestConfig extends Omit<AxiosRequestConfig, "baseURL" | "url" | "method"> {
|
|
306
|
+
headers?: Record<string, string>;
|
|
307
|
+
}
|
|
308
|
+
interface HandleRequestConfig {
|
|
309
|
+
method: "get" | "post" | "put" | "delete";
|
|
310
|
+
endpoint: string;
|
|
311
|
+
params?: QueryParams;
|
|
312
|
+
data?: Record<string, unknown>;
|
|
313
|
+
config?: RequestConfig;
|
|
314
|
+
}
|
|
315
|
+
interface ClientRequestConfig {
|
|
316
|
+
params?: QueryParams;
|
|
317
|
+
data?: any;
|
|
318
|
+
config?: RequestConfig;
|
|
319
|
+
}
|
|
320
|
+
interface UnmeshedWorker {
|
|
321
|
+
(input: Record<string, any>): Promise<any>;
|
|
322
|
+
}
|
|
323
|
+
interface UnmeshedWorkerConfig {
|
|
324
|
+
worker: UnmeshedWorker;
|
|
325
|
+
namespace: string;
|
|
326
|
+
name: string;
|
|
327
|
+
maxInProgress: number;
|
|
328
|
+
}
|
|
329
|
+
interface PollRequestData {
|
|
330
|
+
stepQueueNameData: StepQueueNameData;
|
|
331
|
+
size: number;
|
|
332
|
+
}
|
|
333
|
+
interface RenewRegistrationParams {
|
|
334
|
+
friendlyName: string;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
declare class UnmeshedApiClient {
|
|
338
|
+
private axiosInstance;
|
|
339
|
+
private clientId;
|
|
340
|
+
private _config;
|
|
341
|
+
constructor(unmeshedClientConfig: UnmeshedClientConfig);
|
|
342
|
+
private handleRequest;
|
|
343
|
+
private handleError;
|
|
344
|
+
get<T = any>(endpoint: string, params?: QueryParams, config?: RequestConfig): Promise<ApiResponse<T>>;
|
|
345
|
+
post<T = any>(endpoint: string, clientRequestConfig: ClientRequestConfig): Promise<ApiResponse<T>>;
|
|
346
|
+
put<T = any>(endpoint: string, clientRequestConfig: ClientRequestConfig): Promise<ApiResponse<T>>;
|
|
347
|
+
delete<T = any>(endpoint: string, clientRequestConfig: ClientRequestConfig): Promise<ApiResponse<T>>;
|
|
348
|
+
getClientId(): string | undefined;
|
|
349
|
+
get config(): FinalUnmeshedClientConfig;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
declare class UnmeshedClient {
|
|
353
|
+
private client;
|
|
354
|
+
constructor(config: UnmeshedClientConfig);
|
|
355
|
+
startPolling(workers: UnmeshedWorkerConfig[]): void;
|
|
356
|
+
runProcessSync(ProcessRequestData: ProcessRequestData): Promise<ProcessData>;
|
|
357
|
+
runProcessAsync(ProcessRequestData: ProcessRequestData): Promise<ProcessData>;
|
|
358
|
+
getProcessData(processId: number): Promise<ProcessData>;
|
|
359
|
+
getStepData(stepId: number): Promise<StepData>;
|
|
360
|
+
bulkTerminate(processIds: number[], reason?: string): Promise<ProcessActionResponseData>;
|
|
361
|
+
bulkResume(processIds: number[]): Promise<ProcessActionResponseData>;
|
|
362
|
+
bulkReviewed(processIds: number[], reason?: string): Promise<ProcessActionResponseData>;
|
|
363
|
+
reRun(processId: number, clientId: string, version?: number): Promise<ProcessData>;
|
|
364
|
+
searchProcessExecution(params: ProcessSearchRequest): Promise<any>;
|
|
365
|
+
invokeApiMappingGet(apiClient: UnmeshedApiClient, endpoint: string, id: string, correlationId: string, apiCallType: ApiCallType): Promise<any>;
|
|
366
|
+
invokeApiMappingPost(endpoint: string, input: Record<string, any>, id: string, correlationId: string, apiCallType: ApiCallType): Promise<any>;
|
|
367
|
+
reNewRegistration(params: RenewRegistrationParams): Promise<string>;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export { ApiCallType, type ApiError, type ApiMappingData, type ApiMappingWebhookData, type ApiResponse, type ClientProfileData, type ClientRequestConfig, type ClientSubmitResult, type FinalUnmeshedClientConfig, type FullClientProfileData, type HandleRequestConfig, type PollRequestData, type ProcessActionResponseData, type ProcessActionResponseDetailData, type ProcessData, type ProcessRequestData, type ProcessSearchRequest, ProcessStatus, ProcessTriggerType, ProcessType, type QueryParams, type RenewRegistrationParams, type RequestConfig, SQAuthUserType, type StepData, type StepExecutionData, type StepId, type StepQueueNameData, type StepSize, StepStatus, StepType, UnmeshedClient, type UnmeshedClientConfig, type UnmeshedWorkerConfig, WebhookSource, type WorkRequest, type WorkResponse, type WorkResult };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from
|
|
2
|
-
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
|
|
3
|
+
declare enum ApiCallType {
|
|
3
4
|
SYNC = "SYNC",
|
|
4
5
|
ASYNC = "ASYNC",
|
|
5
6
|
STREAM = "STREAM"
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
+
interface ApiMappingData {
|
|
8
9
|
endpoint: string;
|
|
9
10
|
processDefNamespace: string;
|
|
10
11
|
processDefName: string;
|
|
@@ -16,7 +17,7 @@ export interface ApiMappingData {
|
|
|
16
17
|
created: Date;
|
|
17
18
|
updated: Date;
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
+
type ApiMappingWebhookData = {
|
|
20
21
|
endpoint: string;
|
|
21
22
|
name: string;
|
|
22
23
|
uniqueId: string;
|
|
@@ -32,16 +33,16 @@ export type ApiMappingWebhookData = {
|
|
|
32
33
|
created: Date;
|
|
33
34
|
updated: Date;
|
|
34
35
|
};
|
|
35
|
-
|
|
36
|
+
declare enum WebhookSource {
|
|
36
37
|
MS_TEAMS = "MS_TEAMS",
|
|
37
38
|
NOT_DEFINED = "NOT_DEFINED"
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
+
declare enum SQAuthUserType {
|
|
40
41
|
USER = "USER",
|
|
41
42
|
API = "API",
|
|
42
43
|
INTERNAL = "INTERNAL"
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
+
declare enum StepType {
|
|
45
46
|
WORKER = "WORKER",
|
|
46
47
|
HTTP = "HTTP",
|
|
47
48
|
WAIT = "WAIT",
|
|
@@ -62,7 +63,7 @@ export declare enum StepType {
|
|
|
62
63
|
FOREACH = "FOREACH",
|
|
63
64
|
SWITCH = "SWITCH"
|
|
64
65
|
}
|
|
65
|
-
|
|
66
|
+
declare enum StepStatus {
|
|
66
67
|
PENDING = "PENDING",
|
|
67
68
|
SCHEDULED = "SCHEDULED",
|
|
68
69
|
RUNNING = "RUNNING",
|
|
@@ -73,7 +74,7 @@ export declare enum StepStatus {
|
|
|
73
74
|
SKIPPED = "SKIPPED",
|
|
74
75
|
CANCELLED = "CANCELLED"
|
|
75
76
|
}
|
|
76
|
-
|
|
77
|
+
declare enum ProcessStatus {
|
|
77
78
|
RUNNING = "RUNNING",
|
|
78
79
|
COMPLETED = "COMPLETED",
|
|
79
80
|
FAILED = "FAILED",
|
|
@@ -82,7 +83,7 @@ export declare enum ProcessStatus {
|
|
|
82
83
|
TERMINATED = "TERMINATED",
|
|
83
84
|
REVIEWED = "REVIEWED"
|
|
84
85
|
}
|
|
85
|
-
|
|
86
|
+
declare enum ProcessTriggerType {
|
|
86
87
|
MANUAL = "MANUAL",
|
|
87
88
|
SCHEDULED = "SCHEDULED",
|
|
88
89
|
API_MAPPING = "API_MAPPING",
|
|
@@ -90,13 +91,13 @@ export declare enum ProcessTriggerType {
|
|
|
90
91
|
API = "API",
|
|
91
92
|
SUB_PROCESS = "SUB_PROCESS"
|
|
92
93
|
}
|
|
93
|
-
|
|
94
|
+
declare enum ProcessType {
|
|
94
95
|
STANDARD = "STANDARD",
|
|
95
96
|
DYNAMIC = "DYNAMIC",
|
|
96
97
|
API_ORCHESTRATION = "API_ORCHESTRATION",
|
|
97
98
|
INTERNAL = "INTERNAL"
|
|
98
99
|
}
|
|
99
|
-
|
|
100
|
+
type ClientProfileData = {
|
|
100
101
|
clientId: string;
|
|
101
102
|
ipAddress: string;
|
|
102
103
|
friendlyName: string;
|
|
@@ -108,7 +109,7 @@ export type ClientProfileData = {
|
|
|
108
109
|
updated: Date;
|
|
109
110
|
expiryDate: Date;
|
|
110
111
|
};
|
|
111
|
-
|
|
112
|
+
type FullClientProfileData = {
|
|
112
113
|
clientId: string;
|
|
113
114
|
ipAddress: string;
|
|
114
115
|
friendlyName: string;
|
|
@@ -121,22 +122,22 @@ export type FullClientProfileData = {
|
|
|
121
122
|
expiryDate: Date;
|
|
122
123
|
tokenValue: string;
|
|
123
124
|
};
|
|
124
|
-
|
|
125
|
+
type StepQueueNameData = {
|
|
125
126
|
orgId: number;
|
|
126
127
|
namespace: string;
|
|
127
128
|
stepType: StepType;
|
|
128
129
|
name: string;
|
|
129
130
|
};
|
|
130
|
-
|
|
131
|
+
type ProcessActionResponseData = {
|
|
131
132
|
count: number;
|
|
132
133
|
details: ProcessActionResponseDetailData[];
|
|
133
134
|
};
|
|
134
|
-
|
|
135
|
+
type ProcessActionResponseDetailData = {
|
|
135
136
|
id: string;
|
|
136
137
|
message: string;
|
|
137
138
|
error: string;
|
|
138
139
|
};
|
|
139
|
-
|
|
140
|
+
type ProcessData = {
|
|
140
141
|
processId: number;
|
|
141
142
|
processType: ProcessType;
|
|
142
143
|
triggerType: ProcessTriggerType;
|
|
@@ -158,7 +159,7 @@ export type ProcessData = {
|
|
|
158
159
|
updated: number;
|
|
159
160
|
createdBy: string;
|
|
160
161
|
};
|
|
161
|
-
|
|
162
|
+
type StepData = {
|
|
162
163
|
id: number;
|
|
163
164
|
processId: number;
|
|
164
165
|
ref: string;
|
|
@@ -179,7 +180,7 @@ export type StepData = {
|
|
|
179
180
|
optional: boolean;
|
|
180
181
|
executionList: StepExecutionData[];
|
|
181
182
|
};
|
|
182
|
-
|
|
183
|
+
type StepExecutionData = {
|
|
183
184
|
id: number;
|
|
184
185
|
scheduled: number;
|
|
185
186
|
polled: number;
|
|
@@ -190,12 +191,12 @@ export type StepExecutionData = {
|
|
|
190
191
|
runs: number;
|
|
191
192
|
output: Record<string, unknown>;
|
|
192
193
|
};
|
|
193
|
-
|
|
194
|
+
type StepId = {
|
|
194
195
|
id: number;
|
|
195
196
|
processId: number;
|
|
196
197
|
ref: string;
|
|
197
198
|
};
|
|
198
|
-
|
|
199
|
+
type ProcessRequestData = {
|
|
199
200
|
name: string;
|
|
200
201
|
namespace: string;
|
|
201
202
|
version: number | null;
|
|
@@ -203,7 +204,7 @@ export type ProcessRequestData = {
|
|
|
203
204
|
correlationId: string;
|
|
204
205
|
input: Record<string, unknown>;
|
|
205
206
|
};
|
|
206
|
-
|
|
207
|
+
type ProcessSearchRequest = {
|
|
207
208
|
startTimeEpoch: number;
|
|
208
209
|
endTimeEpoch?: number | null;
|
|
209
210
|
namespace: string;
|
|
@@ -217,17 +218,17 @@ export type ProcessSearchRequest = {
|
|
|
217
218
|
limit: number;
|
|
218
219
|
offset: number;
|
|
219
220
|
};
|
|
220
|
-
|
|
221
|
+
type StepSize = {
|
|
221
222
|
stepQueueNameData: StepQueueNameData;
|
|
222
223
|
size: number | null;
|
|
223
224
|
};
|
|
224
|
-
|
|
225
|
+
type ClientSubmitResult = {
|
|
225
226
|
processId: number;
|
|
226
227
|
stepId: number;
|
|
227
228
|
errorMessage: string | null;
|
|
228
229
|
httpStatusCode: number | null;
|
|
229
230
|
};
|
|
230
|
-
|
|
231
|
+
type WorkRequest = {
|
|
231
232
|
processId: number;
|
|
232
233
|
stepId: number;
|
|
233
234
|
stepExecutionId: number;
|
|
@@ -242,7 +243,7 @@ export type WorkRequest = {
|
|
|
242
243
|
updated: number;
|
|
243
244
|
priority: number;
|
|
244
245
|
};
|
|
245
|
-
|
|
246
|
+
type WorkResponse = {
|
|
246
247
|
processId: number;
|
|
247
248
|
stepId: number;
|
|
248
249
|
stepExecutionId: number;
|
|
@@ -252,26 +253,45 @@ export type WorkResponse = {
|
|
|
252
253
|
rescheduleAfterSeconds: number | null;
|
|
253
254
|
startedAt: number;
|
|
254
255
|
};
|
|
255
|
-
|
|
256
|
+
type WorkResult = {
|
|
256
257
|
output: unknown;
|
|
257
258
|
taskExecutionId: string;
|
|
258
259
|
startTime: number;
|
|
259
260
|
endTime: number;
|
|
260
261
|
workRequest: WorkRequest;
|
|
261
262
|
};
|
|
262
|
-
|
|
263
|
+
interface FinalUnmeshedClientConfig {
|
|
263
264
|
baseUrl: string;
|
|
264
265
|
clientId: string;
|
|
265
266
|
authToken: string;
|
|
266
|
-
port
|
|
267
|
+
port: string | number;
|
|
268
|
+
timeout: number;
|
|
269
|
+
apiWorkerTimeout: number;
|
|
270
|
+
pollTimeout: number;
|
|
271
|
+
pollInterval: number;
|
|
272
|
+
responsePollInterval: number;
|
|
273
|
+
responsePollTimeout: number;
|
|
274
|
+
responseBatchSize: number;
|
|
275
|
+
}
|
|
276
|
+
interface UnmeshedClientConfig {
|
|
277
|
+
baseUrl: string;
|
|
278
|
+
clientId: string;
|
|
279
|
+
authToken: string;
|
|
280
|
+
port: string | number;
|
|
267
281
|
timeout?: number;
|
|
282
|
+
apiWorkerTimeout?: number;
|
|
283
|
+
pollTimeout?: number;
|
|
284
|
+
pollInterval?: number;
|
|
285
|
+
responsePollInterval?: number;
|
|
286
|
+
responsePollTimeout?: number;
|
|
287
|
+
responseBatchSize?: number;
|
|
268
288
|
}
|
|
269
|
-
|
|
289
|
+
interface ApiResponse<T = any> {
|
|
270
290
|
data: T;
|
|
271
291
|
status: number;
|
|
272
292
|
headers: Record<string, string>;
|
|
273
293
|
}
|
|
274
|
-
|
|
294
|
+
interface ApiError extends Error {
|
|
275
295
|
status?: number;
|
|
276
296
|
response?: {
|
|
277
297
|
data?: any;
|
|
@@ -279,20 +299,20 @@ export interface ApiError extends Error {
|
|
|
279
299
|
headers: Record<string, string>;
|
|
280
300
|
};
|
|
281
301
|
}
|
|
282
|
-
|
|
302
|
+
interface QueryParams {
|
|
283
303
|
[key: string]: string | number | boolean | undefined;
|
|
284
304
|
}
|
|
285
|
-
|
|
305
|
+
interface RequestConfig extends Omit<AxiosRequestConfig, "baseURL" | "url" | "method"> {
|
|
286
306
|
headers?: Record<string, string>;
|
|
287
307
|
}
|
|
288
|
-
|
|
308
|
+
interface HandleRequestConfig {
|
|
289
309
|
method: "get" | "post" | "put" | "delete";
|
|
290
310
|
endpoint: string;
|
|
291
311
|
params?: QueryParams;
|
|
292
312
|
data?: Record<string, unknown>;
|
|
293
313
|
config?: RequestConfig;
|
|
294
314
|
}
|
|
295
|
-
|
|
315
|
+
interface ClientRequestConfig {
|
|
296
316
|
params?: QueryParams;
|
|
297
317
|
data?: any;
|
|
298
318
|
config?: RequestConfig;
|
|
@@ -300,14 +320,51 @@ export interface ClientRequestConfig {
|
|
|
300
320
|
interface UnmeshedWorker {
|
|
301
321
|
(input: Record<string, any>): Promise<any>;
|
|
302
322
|
}
|
|
303
|
-
|
|
323
|
+
interface UnmeshedWorkerConfig {
|
|
304
324
|
worker: UnmeshedWorker;
|
|
305
325
|
namespace: string;
|
|
306
326
|
name: string;
|
|
307
327
|
maxInProgress: number;
|
|
308
328
|
}
|
|
309
|
-
|
|
329
|
+
interface PollRequestData {
|
|
310
330
|
stepQueueNameData: StepQueueNameData;
|
|
311
331
|
size: number;
|
|
312
332
|
}
|
|
313
|
-
|
|
333
|
+
interface RenewRegistrationParams {
|
|
334
|
+
friendlyName: string;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
declare class UnmeshedApiClient {
|
|
338
|
+
private axiosInstance;
|
|
339
|
+
private clientId;
|
|
340
|
+
private _config;
|
|
341
|
+
constructor(unmeshedClientConfig: UnmeshedClientConfig);
|
|
342
|
+
private handleRequest;
|
|
343
|
+
private handleError;
|
|
344
|
+
get<T = any>(endpoint: string, params?: QueryParams, config?: RequestConfig): Promise<ApiResponse<T>>;
|
|
345
|
+
post<T = any>(endpoint: string, clientRequestConfig: ClientRequestConfig): Promise<ApiResponse<T>>;
|
|
346
|
+
put<T = any>(endpoint: string, clientRequestConfig: ClientRequestConfig): Promise<ApiResponse<T>>;
|
|
347
|
+
delete<T = any>(endpoint: string, clientRequestConfig: ClientRequestConfig): Promise<ApiResponse<T>>;
|
|
348
|
+
getClientId(): string | undefined;
|
|
349
|
+
get config(): FinalUnmeshedClientConfig;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
declare class UnmeshedClient {
|
|
353
|
+
private client;
|
|
354
|
+
constructor(config: UnmeshedClientConfig);
|
|
355
|
+
startPolling(workers: UnmeshedWorkerConfig[]): void;
|
|
356
|
+
runProcessSync(ProcessRequestData: ProcessRequestData): Promise<ProcessData>;
|
|
357
|
+
runProcessAsync(ProcessRequestData: ProcessRequestData): Promise<ProcessData>;
|
|
358
|
+
getProcessData(processId: number): Promise<ProcessData>;
|
|
359
|
+
getStepData(stepId: number): Promise<StepData>;
|
|
360
|
+
bulkTerminate(processIds: number[], reason?: string): Promise<ProcessActionResponseData>;
|
|
361
|
+
bulkResume(processIds: number[]): Promise<ProcessActionResponseData>;
|
|
362
|
+
bulkReviewed(processIds: number[], reason?: string): Promise<ProcessActionResponseData>;
|
|
363
|
+
reRun(processId: number, clientId: string, version?: number): Promise<ProcessData>;
|
|
364
|
+
searchProcessExecution(params: ProcessSearchRequest): Promise<any>;
|
|
365
|
+
invokeApiMappingGet(apiClient: UnmeshedApiClient, endpoint: string, id: string, correlationId: string, apiCallType: ApiCallType): Promise<any>;
|
|
366
|
+
invokeApiMappingPost(endpoint: string, input: Record<string, any>, id: string, correlationId: string, apiCallType: ApiCallType): Promise<any>;
|
|
367
|
+
reNewRegistration(params: RenewRegistrationParams): Promise<string>;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export { ApiCallType, type ApiError, type ApiMappingData, type ApiMappingWebhookData, type ApiResponse, type ClientProfileData, type ClientRequestConfig, type ClientSubmitResult, type FinalUnmeshedClientConfig, type FullClientProfileData, type HandleRequestConfig, type PollRequestData, type ProcessActionResponseData, type ProcessActionResponseDetailData, type ProcessData, type ProcessRequestData, type ProcessSearchRequest, ProcessStatus, ProcessTriggerType, ProcessType, type QueryParams, type RenewRegistrationParams, type RequestConfig, SQAuthUserType, type StepData, type StepExecutionData, type StepId, type StepQueueNameData, type StepSize, StepStatus, StepType, UnmeshedClient, type UnmeshedClientConfig, type UnmeshedWorkerConfig, WebhookSource, type WorkRequest, type WorkResponse, type WorkResult };
|