@unmeshed/sdk 1.1.4 → 1.1.6
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 +171 -1
- package/dist/index.d.ts +171 -1
- package/dist/index.js +113 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +113 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -232,6 +232,170 @@ type ProcessSearchRequest = {
|
|
|
232
232
|
offset?: number;
|
|
233
233
|
tags?: TagValue[];
|
|
234
234
|
};
|
|
235
|
+
type ProcessDefinitionDeleteRequest = {
|
|
236
|
+
namespace: string;
|
|
237
|
+
name: string;
|
|
238
|
+
type: string;
|
|
239
|
+
version: number;
|
|
240
|
+
steps?: Step[];
|
|
241
|
+
};
|
|
242
|
+
interface ProcessRequest {
|
|
243
|
+
name?: string;
|
|
244
|
+
namespace?: string;
|
|
245
|
+
version?: number | null;
|
|
246
|
+
id?: string | null;
|
|
247
|
+
correlationId?: string | null;
|
|
248
|
+
input?: Record<string, any> | null;
|
|
249
|
+
testRun?: boolean | null;
|
|
250
|
+
}
|
|
251
|
+
interface ProcessConfiguration {
|
|
252
|
+
completionTimeout?: number;
|
|
253
|
+
onTimeoutProcess?: ProcessRequest;
|
|
254
|
+
onFailProcess?: ProcessRequest | null;
|
|
255
|
+
onCompleteProcess?: ProcessRequest | null;
|
|
256
|
+
onCancelProcess?: ProcessRequest;
|
|
257
|
+
}
|
|
258
|
+
interface ProcessDefinitionData {
|
|
259
|
+
namespace: string;
|
|
260
|
+
name: string;
|
|
261
|
+
version?: number;
|
|
262
|
+
type: ProcessType | string;
|
|
263
|
+
description?: string;
|
|
264
|
+
configuration?: ProcessConfiguration;
|
|
265
|
+
steps: Step[];
|
|
266
|
+
defaultInput?: Record<string, any>;
|
|
267
|
+
defaultOutput?: Record<string, any>;
|
|
268
|
+
outputMapping?: Record<string, any>;
|
|
269
|
+
tags?: TagValue[];
|
|
270
|
+
}
|
|
271
|
+
interface ProcessDefinitionsDetail {
|
|
272
|
+
name: string;
|
|
273
|
+
namespace: string;
|
|
274
|
+
}
|
|
275
|
+
interface ProcessDefinitionDetails {
|
|
276
|
+
name: string;
|
|
277
|
+
namespace: string;
|
|
278
|
+
version?: number;
|
|
279
|
+
}
|
|
280
|
+
interface ExecutionWait {
|
|
281
|
+
result: {
|
|
282
|
+
waitUntil: number;
|
|
283
|
+
};
|
|
284
|
+
logs: [];
|
|
285
|
+
}
|
|
286
|
+
interface ExecutionWait {
|
|
287
|
+
result: {
|
|
288
|
+
waitUntil: number;
|
|
289
|
+
};
|
|
290
|
+
logs: [];
|
|
291
|
+
}
|
|
292
|
+
interface ExecutionTimelineType {
|
|
293
|
+
id: number;
|
|
294
|
+
executor: string;
|
|
295
|
+
output: ExecutionWait | null;
|
|
296
|
+
polled: number;
|
|
297
|
+
scheduled: number;
|
|
298
|
+
start: number;
|
|
299
|
+
updated: number;
|
|
300
|
+
ref?: string | null;
|
|
301
|
+
}
|
|
302
|
+
interface ExecutionTimelineType {
|
|
303
|
+
id: number;
|
|
304
|
+
executor: string;
|
|
305
|
+
output: ExecutionWait | null;
|
|
306
|
+
polled: number;
|
|
307
|
+
scheduled: number;
|
|
308
|
+
start: number;
|
|
309
|
+
updated: number;
|
|
310
|
+
ref?: string | null;
|
|
311
|
+
}
|
|
312
|
+
interface ExecutionDetails extends ExecutionTimelineType {
|
|
313
|
+
stepRef: string;
|
|
314
|
+
}
|
|
315
|
+
interface ExecutionDetails extends ExecutionTimelineType {
|
|
316
|
+
stepRef: string;
|
|
317
|
+
}
|
|
318
|
+
interface AuditInfo {
|
|
319
|
+
createdBy: string;
|
|
320
|
+
updatedBy: string;
|
|
321
|
+
created: number;
|
|
322
|
+
updated: number;
|
|
323
|
+
}
|
|
324
|
+
interface AuditInfo {
|
|
325
|
+
createdBy: string;
|
|
326
|
+
updatedBy: string;
|
|
327
|
+
created: number;
|
|
328
|
+
updated: number;
|
|
329
|
+
}
|
|
330
|
+
interface Step extends NewStepData, AuditInfo, Object {
|
|
331
|
+
executionList?: ExecutionDetails[];
|
|
332
|
+
parentRef?: string;
|
|
333
|
+
status?: string;
|
|
334
|
+
completed?: number;
|
|
335
|
+
children: Step[];
|
|
336
|
+
executionCount?: number;
|
|
337
|
+
triggerType?: string;
|
|
338
|
+
}
|
|
339
|
+
interface Step extends NewStepData, AuditInfo, Object {
|
|
340
|
+
executionList?: ExecutionDetails[];
|
|
341
|
+
parentRef?: string;
|
|
342
|
+
status?: string;
|
|
343
|
+
completed?: number;
|
|
344
|
+
children: Step[];
|
|
345
|
+
executionCount?: number;
|
|
346
|
+
triggerType?: string;
|
|
347
|
+
}
|
|
348
|
+
interface StepConfiguration {
|
|
349
|
+
errorPolicyName?: string;
|
|
350
|
+
useCache?: boolean;
|
|
351
|
+
stream?: boolean;
|
|
352
|
+
cacheKey?: string;
|
|
353
|
+
cacheTimeoutSeconds?: number;
|
|
354
|
+
jqTransformer?: string;
|
|
355
|
+
rateLimitWindowSeconds?: number | null;
|
|
356
|
+
rateLimitMaxRequests?: number | null;
|
|
357
|
+
preExecutionScript?: string;
|
|
358
|
+
scriptLanguage?: 'JAVASCRIPT' | 'PYTHON';
|
|
359
|
+
constructInputFromScript?: boolean;
|
|
360
|
+
additionalRefs?: string[];
|
|
361
|
+
}
|
|
362
|
+
interface StepConfiguration {
|
|
363
|
+
errorPolicyName?: string;
|
|
364
|
+
useCache?: boolean;
|
|
365
|
+
stream?: boolean;
|
|
366
|
+
cacheKey?: string;
|
|
367
|
+
cacheTimeoutSeconds?: number;
|
|
368
|
+
jqTransformer?: string;
|
|
369
|
+
rateLimitWindowSeconds?: number | null;
|
|
370
|
+
rateLimitMaxRequests?: number | null;
|
|
371
|
+
preExecutionScript?: string;
|
|
372
|
+
scriptLanguage?: 'JAVASCRIPT' | 'PYTHON';
|
|
373
|
+
constructInputFromScript?: boolean;
|
|
374
|
+
additionalRefs?: string[];
|
|
375
|
+
streamAllStatuses?: boolean;
|
|
376
|
+
}
|
|
377
|
+
interface NewStepData {
|
|
378
|
+
type: StepType;
|
|
379
|
+
name: string;
|
|
380
|
+
namespace: string;
|
|
381
|
+
ref: string;
|
|
382
|
+
optional?: boolean;
|
|
383
|
+
configuration?: StepConfiguration;
|
|
384
|
+
children?: Step[];
|
|
385
|
+
input?: Record<string, any>;
|
|
386
|
+
output?: Record<string, any>;
|
|
387
|
+
}
|
|
388
|
+
interface NewStepData {
|
|
389
|
+
type: StepType;
|
|
390
|
+
name: string;
|
|
391
|
+
namespace: string;
|
|
392
|
+
ref: string;
|
|
393
|
+
optional?: boolean;
|
|
394
|
+
configuration?: StepConfiguration;
|
|
395
|
+
children?: Step[];
|
|
396
|
+
input?: Record<string, any>;
|
|
397
|
+
output?: Record<string, any>;
|
|
398
|
+
}
|
|
235
399
|
type StepSize = {
|
|
236
400
|
stepQueueNameData: StepQueueNameData;
|
|
237
401
|
size: number | null;
|
|
@@ -379,6 +543,12 @@ declare class UnmeshedClient {
|
|
|
379
543
|
invokeApiMappingGet(apiClient: UnmeshedApiClient, endpoint: string, id: string, correlationId: string, apiCallType: ApiCallType): Promise<any>;
|
|
380
544
|
invokeApiMappingPost(endpoint: string, input: Record<string, any>, id: string, correlationId: string, apiCallType: ApiCallType): Promise<any>;
|
|
381
545
|
reNewRegistration(params: RenewRegistrationParams): Promise<string>;
|
|
546
|
+
createProcessDefinition(body: ProcessDefinitionData): Promise<any>;
|
|
547
|
+
updateProcessDefinition(body: ProcessDefinitionData): Promise<any>;
|
|
548
|
+
deleteProcessDefinition(body: ProcessDefinitionDeleteRequest): Promise<any>;
|
|
549
|
+
getProcessDefinitions(namespace?: string): Promise<any>;
|
|
550
|
+
getProcessDefinitionVersions(body: ProcessDefinitionsDetail): Promise<any>;
|
|
551
|
+
getProcessDefinitionByVersion(body: ProcessDefinitionDetails): Promise<any>;
|
|
382
552
|
}
|
|
383
553
|
|
|
384
|
-
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, type TagValue, UnmeshedClient, type UnmeshedClientConfig, type UnmeshedWorkerConfig, WebhookSource, type WorkRequest, type WorkResponse, type WorkResult };
|
|
554
|
+
export { ApiCallType, type ApiError, type ApiMappingData, type ApiMappingWebhookData, type ApiResponse, type AuditInfo, type ClientProfileData, type ClientRequestConfig, type ClientSubmitResult, type ExecutionDetails, type ExecutionTimelineType, type ExecutionWait, type FinalUnmeshedClientConfig, type FullClientProfileData, type HandleRequestConfig, type NewStepData, type PollRequestData, type ProcessActionResponseData, type ProcessActionResponseDetailData, type ProcessConfiguration, type ProcessData, type ProcessDefinitionData, type ProcessDefinitionDeleteRequest, type ProcessDefinitionDetails, type ProcessDefinitionsDetail, type ProcessRequest, type ProcessRequestData, type ProcessSearchRequest, ProcessStatus, ProcessTriggerType, ProcessType, type QueryParams, type RenewRegistrationParams, type RequestConfig, SQAuthUserType, type Step, type StepConfiguration, type StepData, type StepExecutionData, type StepId, type StepQueueNameData, type StepSize, StepStatus, StepType, type TagValue, UnmeshedClient, type UnmeshedClientConfig, type UnmeshedWorkerConfig, WebhookSource, type WorkRequest, type WorkResponse, type WorkResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -232,6 +232,170 @@ type ProcessSearchRequest = {
|
|
|
232
232
|
offset?: number;
|
|
233
233
|
tags?: TagValue[];
|
|
234
234
|
};
|
|
235
|
+
type ProcessDefinitionDeleteRequest = {
|
|
236
|
+
namespace: string;
|
|
237
|
+
name: string;
|
|
238
|
+
type: string;
|
|
239
|
+
version: number;
|
|
240
|
+
steps?: Step[];
|
|
241
|
+
};
|
|
242
|
+
interface ProcessRequest {
|
|
243
|
+
name?: string;
|
|
244
|
+
namespace?: string;
|
|
245
|
+
version?: number | null;
|
|
246
|
+
id?: string | null;
|
|
247
|
+
correlationId?: string | null;
|
|
248
|
+
input?: Record<string, any> | null;
|
|
249
|
+
testRun?: boolean | null;
|
|
250
|
+
}
|
|
251
|
+
interface ProcessConfiguration {
|
|
252
|
+
completionTimeout?: number;
|
|
253
|
+
onTimeoutProcess?: ProcessRequest;
|
|
254
|
+
onFailProcess?: ProcessRequest | null;
|
|
255
|
+
onCompleteProcess?: ProcessRequest | null;
|
|
256
|
+
onCancelProcess?: ProcessRequest;
|
|
257
|
+
}
|
|
258
|
+
interface ProcessDefinitionData {
|
|
259
|
+
namespace: string;
|
|
260
|
+
name: string;
|
|
261
|
+
version?: number;
|
|
262
|
+
type: ProcessType | string;
|
|
263
|
+
description?: string;
|
|
264
|
+
configuration?: ProcessConfiguration;
|
|
265
|
+
steps: Step[];
|
|
266
|
+
defaultInput?: Record<string, any>;
|
|
267
|
+
defaultOutput?: Record<string, any>;
|
|
268
|
+
outputMapping?: Record<string, any>;
|
|
269
|
+
tags?: TagValue[];
|
|
270
|
+
}
|
|
271
|
+
interface ProcessDefinitionsDetail {
|
|
272
|
+
name: string;
|
|
273
|
+
namespace: string;
|
|
274
|
+
}
|
|
275
|
+
interface ProcessDefinitionDetails {
|
|
276
|
+
name: string;
|
|
277
|
+
namespace: string;
|
|
278
|
+
version?: number;
|
|
279
|
+
}
|
|
280
|
+
interface ExecutionWait {
|
|
281
|
+
result: {
|
|
282
|
+
waitUntil: number;
|
|
283
|
+
};
|
|
284
|
+
logs: [];
|
|
285
|
+
}
|
|
286
|
+
interface ExecutionWait {
|
|
287
|
+
result: {
|
|
288
|
+
waitUntil: number;
|
|
289
|
+
};
|
|
290
|
+
logs: [];
|
|
291
|
+
}
|
|
292
|
+
interface ExecutionTimelineType {
|
|
293
|
+
id: number;
|
|
294
|
+
executor: string;
|
|
295
|
+
output: ExecutionWait | null;
|
|
296
|
+
polled: number;
|
|
297
|
+
scheduled: number;
|
|
298
|
+
start: number;
|
|
299
|
+
updated: number;
|
|
300
|
+
ref?: string | null;
|
|
301
|
+
}
|
|
302
|
+
interface ExecutionTimelineType {
|
|
303
|
+
id: number;
|
|
304
|
+
executor: string;
|
|
305
|
+
output: ExecutionWait | null;
|
|
306
|
+
polled: number;
|
|
307
|
+
scheduled: number;
|
|
308
|
+
start: number;
|
|
309
|
+
updated: number;
|
|
310
|
+
ref?: string | null;
|
|
311
|
+
}
|
|
312
|
+
interface ExecutionDetails extends ExecutionTimelineType {
|
|
313
|
+
stepRef: string;
|
|
314
|
+
}
|
|
315
|
+
interface ExecutionDetails extends ExecutionTimelineType {
|
|
316
|
+
stepRef: string;
|
|
317
|
+
}
|
|
318
|
+
interface AuditInfo {
|
|
319
|
+
createdBy: string;
|
|
320
|
+
updatedBy: string;
|
|
321
|
+
created: number;
|
|
322
|
+
updated: number;
|
|
323
|
+
}
|
|
324
|
+
interface AuditInfo {
|
|
325
|
+
createdBy: string;
|
|
326
|
+
updatedBy: string;
|
|
327
|
+
created: number;
|
|
328
|
+
updated: number;
|
|
329
|
+
}
|
|
330
|
+
interface Step extends NewStepData, AuditInfo, Object {
|
|
331
|
+
executionList?: ExecutionDetails[];
|
|
332
|
+
parentRef?: string;
|
|
333
|
+
status?: string;
|
|
334
|
+
completed?: number;
|
|
335
|
+
children: Step[];
|
|
336
|
+
executionCount?: number;
|
|
337
|
+
triggerType?: string;
|
|
338
|
+
}
|
|
339
|
+
interface Step extends NewStepData, AuditInfo, Object {
|
|
340
|
+
executionList?: ExecutionDetails[];
|
|
341
|
+
parentRef?: string;
|
|
342
|
+
status?: string;
|
|
343
|
+
completed?: number;
|
|
344
|
+
children: Step[];
|
|
345
|
+
executionCount?: number;
|
|
346
|
+
triggerType?: string;
|
|
347
|
+
}
|
|
348
|
+
interface StepConfiguration {
|
|
349
|
+
errorPolicyName?: string;
|
|
350
|
+
useCache?: boolean;
|
|
351
|
+
stream?: boolean;
|
|
352
|
+
cacheKey?: string;
|
|
353
|
+
cacheTimeoutSeconds?: number;
|
|
354
|
+
jqTransformer?: string;
|
|
355
|
+
rateLimitWindowSeconds?: number | null;
|
|
356
|
+
rateLimitMaxRequests?: number | null;
|
|
357
|
+
preExecutionScript?: string;
|
|
358
|
+
scriptLanguage?: 'JAVASCRIPT' | 'PYTHON';
|
|
359
|
+
constructInputFromScript?: boolean;
|
|
360
|
+
additionalRefs?: string[];
|
|
361
|
+
}
|
|
362
|
+
interface StepConfiguration {
|
|
363
|
+
errorPolicyName?: string;
|
|
364
|
+
useCache?: boolean;
|
|
365
|
+
stream?: boolean;
|
|
366
|
+
cacheKey?: string;
|
|
367
|
+
cacheTimeoutSeconds?: number;
|
|
368
|
+
jqTransformer?: string;
|
|
369
|
+
rateLimitWindowSeconds?: number | null;
|
|
370
|
+
rateLimitMaxRequests?: number | null;
|
|
371
|
+
preExecutionScript?: string;
|
|
372
|
+
scriptLanguage?: 'JAVASCRIPT' | 'PYTHON';
|
|
373
|
+
constructInputFromScript?: boolean;
|
|
374
|
+
additionalRefs?: string[];
|
|
375
|
+
streamAllStatuses?: boolean;
|
|
376
|
+
}
|
|
377
|
+
interface NewStepData {
|
|
378
|
+
type: StepType;
|
|
379
|
+
name: string;
|
|
380
|
+
namespace: string;
|
|
381
|
+
ref: string;
|
|
382
|
+
optional?: boolean;
|
|
383
|
+
configuration?: StepConfiguration;
|
|
384
|
+
children?: Step[];
|
|
385
|
+
input?: Record<string, any>;
|
|
386
|
+
output?: Record<string, any>;
|
|
387
|
+
}
|
|
388
|
+
interface NewStepData {
|
|
389
|
+
type: StepType;
|
|
390
|
+
name: string;
|
|
391
|
+
namespace: string;
|
|
392
|
+
ref: string;
|
|
393
|
+
optional?: boolean;
|
|
394
|
+
configuration?: StepConfiguration;
|
|
395
|
+
children?: Step[];
|
|
396
|
+
input?: Record<string, any>;
|
|
397
|
+
output?: Record<string, any>;
|
|
398
|
+
}
|
|
235
399
|
type StepSize = {
|
|
236
400
|
stepQueueNameData: StepQueueNameData;
|
|
237
401
|
size: number | null;
|
|
@@ -379,6 +543,12 @@ declare class UnmeshedClient {
|
|
|
379
543
|
invokeApiMappingGet(apiClient: UnmeshedApiClient, endpoint: string, id: string, correlationId: string, apiCallType: ApiCallType): Promise<any>;
|
|
380
544
|
invokeApiMappingPost(endpoint: string, input: Record<string, any>, id: string, correlationId: string, apiCallType: ApiCallType): Promise<any>;
|
|
381
545
|
reNewRegistration(params: RenewRegistrationParams): Promise<string>;
|
|
546
|
+
createProcessDefinition(body: ProcessDefinitionData): Promise<any>;
|
|
547
|
+
updateProcessDefinition(body: ProcessDefinitionData): Promise<any>;
|
|
548
|
+
deleteProcessDefinition(body: ProcessDefinitionDeleteRequest): Promise<any>;
|
|
549
|
+
getProcessDefinitions(namespace?: string): Promise<any>;
|
|
550
|
+
getProcessDefinitionVersions(body: ProcessDefinitionsDetail): Promise<any>;
|
|
551
|
+
getProcessDefinitionByVersion(body: ProcessDefinitionDetails): Promise<any>;
|
|
382
552
|
}
|
|
383
553
|
|
|
384
|
-
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, type TagValue, UnmeshedClient, type UnmeshedClientConfig, type UnmeshedWorkerConfig, WebhookSource, type WorkRequest, type WorkResponse, type WorkResult };
|
|
554
|
+
export { ApiCallType, type ApiError, type ApiMappingData, type ApiMappingWebhookData, type ApiResponse, type AuditInfo, type ClientProfileData, type ClientRequestConfig, type ClientSubmitResult, type ExecutionDetails, type ExecutionTimelineType, type ExecutionWait, type FinalUnmeshedClientConfig, type FullClientProfileData, type HandleRequestConfig, type NewStepData, type PollRequestData, type ProcessActionResponseData, type ProcessActionResponseDetailData, type ProcessConfiguration, type ProcessData, type ProcessDefinitionData, type ProcessDefinitionDeleteRequest, type ProcessDefinitionDetails, type ProcessDefinitionsDetail, type ProcessRequest, type ProcessRequestData, type ProcessSearchRequest, ProcessStatus, ProcessTriggerType, ProcessType, type QueryParams, type RenewRegistrationParams, type RequestConfig, SQAuthUserType, type Step, type StepConfiguration, type StepData, type StepExecutionData, type StepId, type StepQueueNameData, type StepSize, StepStatus, StepType, type TagValue, UnmeshedClient, type UnmeshedClientConfig, type UnmeshedWorkerConfig, WebhookSource, type WorkRequest, type WorkResponse, type WorkResult };
|
package/dist/index.js
CHANGED
|
@@ -351,6 +351,7 @@ var BlockingQueue = class {
|
|
|
351
351
|
};
|
|
352
352
|
|
|
353
353
|
// src/apis/pollerClientImpl.ts
|
|
354
|
+
var import_os = __toESM(require("os"));
|
|
354
355
|
async function registerPolling(apiClient, data) {
|
|
355
356
|
const attempt = async () => {
|
|
356
357
|
try {
|
|
@@ -369,7 +370,10 @@ async function registerPolling(apiClient, data) {
|
|
|
369
370
|
}
|
|
370
371
|
async function pollWorker(apiClient, data) {
|
|
371
372
|
try {
|
|
372
|
-
const response = await apiClient.post(`/api/clients/poll`, {
|
|
373
|
+
const response = await apiClient.post(`/api/clients/poll`, {
|
|
374
|
+
data,
|
|
375
|
+
config: { headers: { UNMESHED_HOST_NAME: getHostName() } }
|
|
376
|
+
});
|
|
373
377
|
if (response.data && response.data.length > 0) {
|
|
374
378
|
console.log(`Received ${response.data.length} work requests`);
|
|
375
379
|
}
|
|
@@ -559,6 +563,28 @@ async function startPollingWorkers(apiClient, workers, intervalMs = 5e3) {
|
|
|
559
563
|
}
|
|
560
564
|
await pollCycle();
|
|
561
565
|
}
|
|
566
|
+
function getHostName() {
|
|
567
|
+
const unmeshedHostName = process.env.UNMESHED_HOST_NAME;
|
|
568
|
+
if (unmeshedHostName && unmeshedHostName.trim() !== "") {
|
|
569
|
+
return unmeshedHostName.trim();
|
|
570
|
+
}
|
|
571
|
+
const hostNameEnv = process.env.HOSTNAME;
|
|
572
|
+
if (hostNameEnv && hostNameEnv.trim() !== "") {
|
|
573
|
+
return hostNameEnv.trim();
|
|
574
|
+
}
|
|
575
|
+
const computerNameEnv = process.env.COMPUTERNAME;
|
|
576
|
+
if (computerNameEnv && computerNameEnv.trim() !== "") {
|
|
577
|
+
return computerNameEnv.trim();
|
|
578
|
+
}
|
|
579
|
+
try {
|
|
580
|
+
const host = import_os.default.hostname();
|
|
581
|
+
if (host && host.trim() !== "") {
|
|
582
|
+
return host.trim();
|
|
583
|
+
}
|
|
584
|
+
} catch {
|
|
585
|
+
}
|
|
586
|
+
return "-";
|
|
587
|
+
}
|
|
562
588
|
|
|
563
589
|
// src/apis/processClientImpl.ts
|
|
564
590
|
var import_axios2 = require("axios");
|
|
@@ -688,9 +714,7 @@ var searchProcessExecutions = async (apiClient, params) => {
|
|
|
688
714
|
try {
|
|
689
715
|
const response = await apiClient.post(`api/stats/process/search`, {
|
|
690
716
|
data: body,
|
|
691
|
-
// ✅ everything sent inside body
|
|
692
717
|
params: {}
|
|
693
|
-
// ✅ now empty
|
|
694
718
|
});
|
|
695
719
|
return response.data;
|
|
696
720
|
} catch (error) {
|
|
@@ -728,6 +752,74 @@ var invokeApiMappingPost = async (apiClient, endpoint, input, id, correlationId,
|
|
|
728
752
|
throw error;
|
|
729
753
|
}
|
|
730
754
|
};
|
|
755
|
+
var createProcessDefinition = async (apiClient, requestData) => {
|
|
756
|
+
try {
|
|
757
|
+
const response = await apiClient.post(`/api/processDefinitions`, {
|
|
758
|
+
data: requestData,
|
|
759
|
+
params: {}
|
|
760
|
+
});
|
|
761
|
+
return response.data;
|
|
762
|
+
} catch (error) {
|
|
763
|
+
console.error("Error occurred while creating process definition:", error);
|
|
764
|
+
throw error;
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
var deleteProcessDefinition = async (apiClient, requestData) => {
|
|
768
|
+
try {
|
|
769
|
+
const response = await apiClient.delete(`/api/processDefinitions`, {
|
|
770
|
+
data: [requestData],
|
|
771
|
+
params: {}
|
|
772
|
+
});
|
|
773
|
+
return response.data;
|
|
774
|
+
} catch (error) {
|
|
775
|
+
console.error("Error occurred while deleting process definition:", error);
|
|
776
|
+
throw error;
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
var updateProcessDefinition = async (apiClient, requestData) => {
|
|
780
|
+
try {
|
|
781
|
+
const response = await apiClient.put(`/api/processDefinitions`, {
|
|
782
|
+
data: requestData,
|
|
783
|
+
params: {}
|
|
784
|
+
});
|
|
785
|
+
return response.data;
|
|
786
|
+
} catch (error) {
|
|
787
|
+
console.error("Error occurred while creating process definition:", error);
|
|
788
|
+
throw error;
|
|
789
|
+
}
|
|
790
|
+
};
|
|
791
|
+
var getProcessDefinitions = async (apiClient, namespace) => {
|
|
792
|
+
try {
|
|
793
|
+
const params = namespace ? { namespace } : {};
|
|
794
|
+
const response = await apiClient.get("/api/processDefinitions", params);
|
|
795
|
+
return response.data;
|
|
796
|
+
} catch (error) {
|
|
797
|
+
console.error("Error occurred while fetching process definitions:", error);
|
|
798
|
+
throw error;
|
|
799
|
+
}
|
|
800
|
+
};
|
|
801
|
+
var getProcessDefinitionVersions = async (apiClient, body) => {
|
|
802
|
+
try {
|
|
803
|
+
const response = await apiClient.get(`/api/processDefinitions/${body.namespace}/${body.name}/versions`);
|
|
804
|
+
return response.data;
|
|
805
|
+
} catch (error) {
|
|
806
|
+
console.error("Error occurred while fetching process definition: ", error);
|
|
807
|
+
throw error;
|
|
808
|
+
}
|
|
809
|
+
};
|
|
810
|
+
var getProcessDefinitionByVersion = async (apiClient, body) => {
|
|
811
|
+
if (!body.namespace || !body.name || !body.version) {
|
|
812
|
+
throw new Error("namespace, name, and version are required");
|
|
813
|
+
}
|
|
814
|
+
try {
|
|
815
|
+
const params = body.version ? { version: body.version } : {};
|
|
816
|
+
const response = await apiClient.get(`/api/processDefinitions/${body.namespace}/${body.name}`, params);
|
|
817
|
+
return response.data;
|
|
818
|
+
} catch (error) {
|
|
819
|
+
console.error("Error occurred while fetching process definition:", error);
|
|
820
|
+
throw error;
|
|
821
|
+
}
|
|
822
|
+
};
|
|
731
823
|
|
|
732
824
|
// src/apis/registrationClientImpl.ts
|
|
733
825
|
var renewRegistration = async (apiClient, params) => {
|
|
@@ -788,6 +880,24 @@ var UnmeshedClient = class {
|
|
|
788
880
|
reNewRegistration(params) {
|
|
789
881
|
return renewRegistration(this.client, params);
|
|
790
882
|
}
|
|
883
|
+
createProcessDefinition(body) {
|
|
884
|
+
return createProcessDefinition(this.client, body);
|
|
885
|
+
}
|
|
886
|
+
updateProcessDefinition(body) {
|
|
887
|
+
return updateProcessDefinition(this.client, body);
|
|
888
|
+
}
|
|
889
|
+
deleteProcessDefinition(body) {
|
|
890
|
+
return deleteProcessDefinition(this.client, body);
|
|
891
|
+
}
|
|
892
|
+
getProcessDefinitions(namespace) {
|
|
893
|
+
return getProcessDefinitions(this.client, namespace);
|
|
894
|
+
}
|
|
895
|
+
getProcessDefinitionVersions(body) {
|
|
896
|
+
return getProcessDefinitionVersions(this.client, body);
|
|
897
|
+
}
|
|
898
|
+
getProcessDefinitionByVersion(body) {
|
|
899
|
+
return getProcessDefinitionByVersion(this.client, body);
|
|
900
|
+
}
|
|
791
901
|
};
|
|
792
902
|
// Annotate the CommonJS export names for ESM import in node:
|
|
793
903
|
0 && (module.exports = {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/apis/unmeshedApiClient.ts","../src/utils/unmeshedCommonUtils.ts","../src/types/index.ts","../src/apis/queuedWorker.ts","../src/apis/pollerClientImpl.ts","../src/apis/processClientImpl.ts","../src/apis/registrationClientImpl.ts"],"sourcesContent":["import {\n ApiCallType,\n ProcessRequestData,\n ProcessSearchRequest,\n RenewRegistrationParams,\n UnmeshedClientConfig,\n UnmeshedWorkerConfig,\n} from './types';\nimport { UnmeshedApiClient } from './apis/unmeshedApiClient';\nimport { startPollingWorkers } from './apis/pollerClientImpl';\nimport {\n bulkResume,\n bulkReviewed,\n bulkTerminate,\n getProcessData,\n getStepData,\n invokeApiMappingGet,\n invokeApiMappingPost,\n rerun,\n runProcessAsync,\n runProcessSync,\n searchProcessExecutions,\n} from './apis/processClientImpl';\nimport { renewRegistration } from './apis/registrationClientImpl';\n\n// noinspection JSUnusedGlobalSymbols\nexport class UnmeshedClient {\n private client: UnmeshedApiClient;\n\n constructor(config: UnmeshedClientConfig) {\n this.client = new UnmeshedApiClient(config);\n }\n\n startPolling(workers: UnmeshedWorkerConfig[]) {\n startPollingWorkers(this.client, workers);\n }\n\n runProcessSync(ProcessRequestData: ProcessRequestData) {\n return runProcessSync(this.client, ProcessRequestData);\n }\n\n runProcessAsync(ProcessRequestData: ProcessRequestData) {\n return runProcessAsync(this.client, ProcessRequestData);\n }\n\n getProcessData(processId: number, includeSteps: boolean) {\n return getProcessData(this.client, processId, includeSteps);\n }\n\n getStepData(stepId: number) {\n return getStepData(this.client, stepId);\n }\n\n bulkTerminate(processIds: number[], reason?: string) {\n return bulkTerminate(this.client, processIds, reason);\n }\n\n bulkResume(processIds: number[]) {\n return bulkResume(this.client, processIds);\n }\n\n bulkReviewed(processIds: number[], reason?: string) {\n return bulkReviewed(this.client, processIds, reason);\n }\n\n reRun(processId: number, version?: number) {\n return rerun(this.client, processId, version);\n }\n\n searchProcessExecution(params: ProcessSearchRequest) {\n return searchProcessExecutions(this.client, params);\n }\n\n invokeApiMappingGet(\n apiClient: UnmeshedApiClient,\n endpoint: string,\n id: string,\n correlationId: string,\n apiCallType: ApiCallType\n ) {\n return invokeApiMappingGet(apiClient, endpoint, id, correlationId, apiCallType);\n }\n\n invokeApiMappingPost(\n endpoint: string,\n input: Record<string, any>,\n id: string,\n correlationId: string,\n apiCallType: ApiCallType\n ) {\n return invokeApiMappingPost(this.client, endpoint, input, id, correlationId, apiCallType);\n }\n\n reNewRegistration(params: RenewRegistrationParams) {\n return renewRegistration(this.client, params);\n }\n}\n\nexport * from './types';\n","import axios, { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, RawAxiosRequestHeaders } from 'axios';\nimport {\n ApiResponse,\n ClientRequestConfig,\n FinalUnmeshedClientConfig,\n HandleRequestConfig,\n QueryParams,\n RequestConfig,\n UnmeshedClientConfig,\n} from '../types';\nimport { UnmeshedCommonUtils } from '../utils/unmeshedCommonUtils';\n\nexport class UnmeshedApiClient {\n private axiosInstance: AxiosInstance | null = null;\n private clientId: string | undefined = undefined;\n private _config: FinalUnmeshedClientConfig;\n\n constructor(unmeshedClientConfig: UnmeshedClientConfig) {\n console.log('Initializing Unmeshed ApiClient');\n\n this._config = createUnmeshedClientConfig(unmeshedClientConfig);\n\n console.log(this._config);\n\n this.clientId = this._config.clientId;\n\n if (!this._config.baseUrl) {\n throw new Error('baseUrl is required');\n }\n\n const baseURL = this._config.port ? `${this._config.baseUrl}:${this._config.port}` : this._config.baseUrl;\n\n this.axiosInstance = axios.create({\n baseURL,\n timeout: this._config.timeout,\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer client.sdk.${this._config.clientId}.${UnmeshedCommonUtils.createSecureHash(\n this._config.authToken\n )}`,\n } as RawAxiosRequestHeaders,\n });\n }\n\n private async handleRequest<T>({\n method,\n endpoint,\n params,\n data,\n config,\n }: HandleRequestConfig): Promise<ApiResponse<T>> {\n if (!this.axiosInstance) {\n throw new Error('ApiClient must be initialized before making requests');\n }\n\n try {\n const response: AxiosResponse<T> = await this.axiosInstance.request<T>({\n method,\n url: endpoint,\n params,\n data,\n ...config,\n } as AxiosRequestConfig);\n\n return {\n data: response.data,\n status: response.status,\n headers: response.headers as Record<string, string>,\n };\n } catch (error) {\n if (axios.isAxiosError(error)) {\n console.error('Request failed:', error.message);\n throw this.handleError(error);\n }\n console.error('Unexpected error:', (error as Error).message);\n throw error;\n }\n }\n\n private handleError(error: AxiosError): Error {\n console.error('Error details:', {\n message: error.message,\n status: error.response?.status,\n data: error.response?.data,\n });\n\n let response = error?.response?.data as ErrorResponse;\n if (response?.errorMessage) {\n return new Error(`${response.errorMessage} [Status code: ${error.response?.status || ''}]`);\n }\n\n return new Error(error.message, { cause: error.response?.data || {} });\n }\n\n public async get<T = any>(endpoint: string, params?: QueryParams, config?: RequestConfig): Promise<ApiResponse<T>> {\n return this.handleRequest<T>({\n method: 'get',\n endpoint: endpoint,\n params: params,\n config: config,\n });\n }\n\n public async post<T = any>(endpoint: string, clientRequestConfig: ClientRequestConfig): Promise<ApiResponse<T>> {\n return this.handleRequest<T>({\n method: 'post',\n endpoint: endpoint,\n ...clientRequestConfig,\n });\n }\n\n public async put<T = any>(endpoint: string, clientRequestConfig: ClientRequestConfig): Promise<ApiResponse<T>> {\n return this.handleRequest<T>({\n method: 'put',\n endpoint: endpoint,\n ...clientRequestConfig,\n });\n }\n\n public async delete<T = any>(endpoint: string, clientRequestConfig: ClientRequestConfig): Promise<ApiResponse<T>> {\n return this.handleRequest<T>({\n method: 'delete',\n endpoint: endpoint,\n ...clientRequestConfig,\n });\n }\n\n public getClientId(): string | undefined {\n return this.clientId;\n }\n\n get config(): FinalUnmeshedClientConfig {\n return this._config;\n }\n}\n\ninterface ErrorResponse {\n errorMessage?: string;\n [key: string]: any; // To allow other unexpected properties\n}\n\nexport function createUnmeshedClientConfig(config: UnmeshedClientConfig): Required<FinalUnmeshedClientConfig> {\n return {\n baseUrl: config.baseUrl,\n clientId: config.clientId,\n authToken: config.authToken,\n port: config.port ?? 443,\n timeout: config.timeout ?? 5000,\n pollInterval: config.pollInterval ?? 100,\n apiWorkerTimeout: config.apiWorkerTimeout ?? 10000,\n pollTimeout: config.pollTimeout ?? 10000,\n responsePollInterval: config.responsePollInterval ?? 100,\n responsePollTimeout: config.responsePollTimeout ?? 10000,\n responseBatchSize: config.responseBatchSize ?? 50,\n };\n}\n","import { createHash } from 'crypto';\n\nexport class UnmeshedCommonUtils {\n static createSecureHash(input: string): string {\n try {\n const hash = createHash('sha256');\n hash.update(input, 'utf8');\n return hash.digest('hex');\n } catch (e) {\n throw new Error('Error creating hash');\n }\n }\n}\n","import { AxiosRequestConfig } from 'axios';\n\nexport enum ApiCallType {\n SYNC = 'SYNC',\n ASYNC = 'ASYNC',\n STREAM = 'STREAM',\n}\n\nexport interface ApiMappingData {\n endpoint: string;\n processDefNamespace: string;\n processDefName: string;\n processDefVersion: number;\n authType: string;\n authClaims: string;\n createdBy: string;\n updatedBy: string;\n created: Date;\n updated: Date;\n}\n\nexport type ApiMappingWebhookData = {\n endpoint: string;\n name: string;\n uniqueId: string;\n urlSecret: string;\n description: string;\n userIdentifier: string;\n webhookSource: WebhookSource;\n webhookSourceConfig: Record<string, string>;\n expiryDate: Date;\n userType: SQAuthUserType;\n createdBy: string;\n updatedBy: string;\n created: Date;\n updated: Date;\n};\n\nexport enum WebhookSource {\n MS_TEAMS = 'MS_TEAMS',\n NOT_DEFINED = 'NOT_DEFINED',\n}\n\nexport enum SQAuthUserType {\n USER = 'USER',\n API = 'API',\n INTERNAL = 'INTERNAL',\n}\n\nexport enum StepType {\n LIST = 'LIST',\n HTTP = 'HTTP',\n WORKER = 'WORKER',\n SWITCH = 'SWITCH',\n PARALLEL = 'PARALLEL',\n FAIL = 'FAIL',\n PYTHON = 'PYTHON',\n JAVASCRIPT = 'JAVASCRIPT',\n JQ = 'JQ',\n SLACK = 'SLACK',\n GRAPHQL = 'GRAPHQL',\n WAIT = 'WAIT',\n BUILTIN = 'BUILTIN',\n NOOP = 'NOOP',\n AI_AGENT = 'AI_AGENT',\n EXIT = 'EXIT',\n DEPENDSON = 'DEPENDSON',\n PERSISTED_STATE = 'PERSISTED_STATE',\n UPDATE_STEP = 'UPDATE_STEP',\n INTEGRATION = 'INTEGRATION',\n FOREACH = 'FOREACH',\n WHILE = 'WHILE',\n SUB_PROCESS = 'SUB_PROCESS',\n FLOW_GATEWAY = 'FLOW_GATEWAY',\n DECISION_ENGINE = 'DECISION_ENGINE',\n SQLITE = 'SQLITE',\n MANAGED = 'MANAGED',\n}\n\nexport enum StepStatus {\n PENDING = 'PENDING',\n SCHEDULED = 'SCHEDULED',\n RUNNING = 'RUNNING',\n PAUSED = 'PAUSED',\n COMPLETED = 'COMPLETED',\n FAILED = 'FAILED',\n TIMED_OUT = 'TIMED_OUT',\n SKIPPED = 'SKIPPED',\n CANCELLED = 'CANCELLED',\n}\n\nexport enum ProcessStatus {\n RUNNING = 'RUNNING',\n COMPLETED = 'COMPLETED',\n FAILED = 'FAILED',\n TIMED_OUT = 'TIMED_OUT',\n CANCELLED = 'CANCELLED',\n TERMINATED = 'TERMINATED',\n REVIEWED = 'REVIEWED',\n}\n\nexport enum ProcessTriggerType {\n MANUAL = 'MANUAL',\n SCHEDULED = 'SCHEDULED',\n API_MAPPING = 'API_MAPPING',\n WEBHOOK = 'WEBHOOK',\n API = 'API',\n SUB_PROCESS = 'SUB_PROCESS',\n}\n\nexport enum ProcessType {\n STANDARD = 'STANDARD',\n DYNAMIC = 'DYNAMIC',\n API_ORCHESTRATION = 'API_ORCHESTRATION',\n INTERNAL = 'INTERNAL',\n}\n\nexport type ClientProfileData = {\n clientId: string;\n ipAddress: string;\n friendlyName: string;\n userIdentifier: string;\n stepQueueNames: StepQueueNameData[];\n createdBy: string;\n updatedBy: string;\n created: Date;\n updated: Date;\n expiryDate: Date;\n};\n\nexport type FullClientProfileData = {\n clientId: string;\n ipAddress: string;\n friendlyName: string;\n userIdentifier: string;\n stepQueueNames: StepQueueNameData[];\n createdBy: string;\n updatedBy: string;\n created: Date;\n updated: Date;\n expiryDate: Date;\n tokenValue: string;\n};\n\nexport type StepQueueNameData = {\n orgId: number;\n namespace: string;\n stepType: StepType;\n name: string;\n};\n\nexport type ProcessActionResponseData = {\n count: number;\n details: ProcessActionResponseDetailData[];\n};\n\nexport type ProcessActionResponseDetailData = {\n id: string;\n message: string;\n error: string;\n};\n\nexport type ProcessData = {\n processId: number;\n processType: ProcessType;\n triggerType: ProcessTriggerType;\n namespace: string;\n name: string;\n version: number | null;\n historyId: number | null;\n requestId: string;\n correlationId: string;\n status: ProcessStatus;\n input: Record<string, unknown>;\n output: Record<string, unknown>;\n authClaims: Record<string, unknown>;\n stepIdCount: number | null;\n shardName: string;\n shardInstanceId: number | null;\n steps: StepId[];\n stepRecords: StepData[];\n created: number;\n updated: number;\n createdBy: string;\n};\n\nexport type StepData = {\n id: number;\n processId: number;\n ref: string;\n parentId: number | null;\n parentRef: string | null;\n namespace: string;\n name: string;\n type: StepType;\n stepDefinitionHistoryId: number | null;\n status: StepStatus;\n input: Record<string, unknown>;\n output: Record<string, unknown>;\n workerId: string;\n start: number;\n schedule: number;\n priority: number;\n updated: number;\n optional: boolean;\n executionList: StepExecutionData[];\n};\n\nexport type StepExecutionData = {\n id: number;\n scheduled: number;\n polled: number;\n start: number;\n updated: number;\n executor: string;\n ref: string;\n runs: number;\n output: Record<string, unknown>;\n};\n\nexport type StepId = {\n id: number;\n processId: number;\n ref: string;\n};\n\nexport type TagValue = {\n name: string;\n value: string;\n};\n\nexport type ProcessRequestData = {\n name: string;\n namespace: string;\n version: number | null;\n requestId?: string;\n correlationId?: string;\n input?: Record<string, unknown>;\n};\n\nexport type ProcessSearchRequest = {\n startTimeEpoch: number;\n endTimeEpoch?: number | null;\n namespace?: string;\n processTypes?: ProcessType[];\n triggerTypes?: ProcessTriggerType[];\n names?: string[];\n processIds?: number[];\n correlationIds?: string[];\n requestIds?: string[];\n statuses?: ProcessStatus[];\n limit?: number;\n offset?: number;\n tags?: TagValue[];\n};\nexport type StepSize = {\n stepQueueNameData: StepQueueNameData;\n size: number | null;\n};\n\nexport type ClientSubmitResult = {\n processId: number;\n stepId: number;\n errorMessage: string | null;\n httpStatusCode: number | null;\n};\n\nexport type WorkRequest = {\n processId: number;\n stepId: number;\n stepExecutionId: number;\n runCount: number;\n stepName: string;\n stepNamespace: string;\n stepRef: string;\n inputParam: Record<string, unknown>;\n isOptional: boolean;\n polled: number;\n scheduled: number;\n updated: number;\n priority: number;\n};\n\nexport type WorkResponse = {\n processId: number;\n stepId: number;\n stepExecutionId: number;\n runCount: number;\n output: Record<string, unknown>;\n status: StepStatus;\n rescheduleAfterSeconds: number | null;\n startedAt: number;\n};\n\nexport type WorkResult = {\n output: unknown;\n taskExecutionId: string;\n startTime: number;\n endTime: number;\n workRequest: WorkRequest;\n};\n\nexport interface FinalUnmeshedClientConfig {\n baseUrl: string;\n clientId: string;\n authToken: string;\n port: string | number;\n timeout: number;\n apiWorkerTimeout: number;\n pollTimeout: number;\n pollInterval: number;\n responsePollInterval: number;\n responsePollTimeout: number;\n responseBatchSize: number;\n}\n\nexport interface UnmeshedClientConfig {\n baseUrl: string;\n clientId: string;\n authToken: string;\n port: string | number;\n timeout?: number;\n apiWorkerTimeout?: number;\n pollTimeout?: number;\n pollInterval?: number;\n responsePollInterval?: number;\n responsePollTimeout?: number;\n responseBatchSize?: number;\n}\n\nexport interface ApiResponse<T = any> {\n data: T;\n status: number;\n headers: Record<string, string>;\n}\n\nexport interface ApiError extends Error {\n status?: number;\n response?: {\n data?: any;\n status: number;\n headers: Record<string, string>;\n };\n}\n\nexport interface QueryParams {\n [key: string]: string | number | boolean | undefined;\n}\n\nexport interface RequestConfig extends Omit<AxiosRequestConfig, 'baseURL' | 'url' | 'method'> {\n headers?: Record<string, string>;\n}\n\nexport interface HandleRequestConfig {\n method: 'get' | 'post' | 'put' | 'delete';\n endpoint: string;\n params?: QueryParams;\n data?: Record<string, unknown>;\n config?: RequestConfig;\n}\n\nexport interface ClientRequestConfig {\n params?: QueryParams;\n data?: any;\n config?: RequestConfig;\n}\n\ninterface UnmeshedWorker {\n (input: Record<string, any>): Promise<any>;\n}\n\nexport interface UnmeshedWorkerConfig {\n worker: UnmeshedWorker;\n namespace: string;\n name: string;\n maxInProgress: number;\n}\n\nexport interface PollRequestData {\n stepQueueNameData: StepQueueNameData;\n size: number;\n}\nexport interface RenewRegistrationParams {\n friendlyName: string;\n}\n","export type WorkerFunction<T> = (items: T[]) => Promise<void>;\n\nexport class QueuedWorker<T> {\n private readonly queue: BlockingQueue<T>;\n private readonly pollIntervalMs: number;\n private readonly batchSize: number;\n private readonly workerFn: WorkerFunction<T>;\n private readonly timeoutMs: number;\n\n constructor(\n capacity: number,\n pollIntervalMs: number,\n batchSize: number,\n workerFn: WorkerFunction<T>,\n timeoutMs: number\n ) {\n this.queue = new BlockingQueue<T>(capacity);\n this.pollIntervalMs = pollIntervalMs;\n this.batchSize = batchSize;\n this.workerFn = workerFn;\n this.timeoutMs = timeoutMs;\n\n console.log(\n `Configured queued worker with ${pollIntervalMs} ms interval and batch size of ${batchSize} and a timeout of ${timeoutMs} ms`\n );\n // noinspection JSIgnoredPromiseFromCall\n this.start();\n }\n\n async start(): Promise<void> {\n let errorCount = 0;\n // noinspection InfiniteLoopJS\n while (true) {\n try {\n const batch = await this.queue.takeBatch(this.batchSize);\n if (batch.length > 0) {\n console.log(`Batch work ${batch.length} received`);\n await this.runWithTimeout(this.workerFn(batch), this.timeoutMs);\n }\n } catch (error) {\n errorCount++;\n console.error(`Error processing batch - error count : ${errorCount} - `, error);\n await new Promise((resolve) => setTimeout(resolve, 1000));\n }\n await new Promise((resolve) => setTimeout(resolve, this.pollIntervalMs));\n }\n }\n\n private async runWithTimeout(task: Promise<void>, timeoutMs: number): Promise<void> {\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => reject(new Error('Task timed out')), timeoutMs);\n task\n .then(() => {\n clearTimeout(timeout);\n resolve();\n })\n .catch((error) => {\n clearTimeout(timeout);\n reject(error);\n });\n });\n }\n\n async put(item: T): Promise<void> {\n await this.queue.put(item);\n }\n}\n\nclass BlockingQueue<T> {\n private queue: T[] = [];\n private readonly capacity: number;\n\n constructor(capacity: number) {\n if (capacity <= 0) {\n throw new Error('Capacity must be greater than 0');\n }\n this.capacity = capacity;\n }\n\n async put(item: T): Promise<void> {\n while (this.queue.length >= this.capacity) {\n await new Promise((resolve) => setTimeout(resolve, 10));\n }\n this.queue.push(item);\n }\n\n async takeBatch(batchSize: number): Promise<T[]> {\n while (this.queue.length === 0) {\n await new Promise((resolve) => setTimeout(resolve, 10));\n }\n return this.queue.splice(0, batchSize);\n }\n\n size(): number {\n return this.queue.length;\n }\n\n isEmpty(): boolean {\n return this.queue.length === 0;\n }\n\n peek(): T | undefined {\n return this.queue[0];\n }\n}\n","import {\n ApiResponse,\n PollRequestData,\n StepQueueNameData,\n StepStatus,\n UnmeshedWorkerConfig,\n WorkRequest,\n WorkResponse,\n} from '../types';\nimport { UnmeshedApiClient } from './unmeshedApiClient';\nimport { QueuedWorker } from './queuedWorker';\n\nasync function registerPolling(apiClient: UnmeshedApiClient, data: StepQueueNameData[]) {\n const attempt = async (): Promise<any> => {\n try {\n const response = await apiClient.put(`/api/clients/register`, {\n data: data,\n });\n console.log('Successfully renewed registration for workers', data);\n return response.data;\n } catch {\n console.error('An error occurred during polling registration. Retrying in 3 seconds...');\n await new Promise((resolve) => setTimeout(resolve, 3000));\n return attempt();\n }\n };\n\n return attempt();\n}\n\nasync function pollWorker(apiClient: UnmeshedApiClient, data: PollRequestData[]): Promise<WorkRequest[]> {\n try {\n const response: ApiResponse<WorkRequest[]> = await apiClient.post(`/api/clients/poll`, { data: data });\n if (response.data && response.data.length > 0) {\n console.log(`Received ${response.data.length} work requests`);\n }\n return response.data;\n } catch (error) {\n console.error('Error occurred during worker polling', error);\n return [];\n }\n}\n\nasync function postWorkerResponse(apiClient: UnmeshedApiClient, workResponses: WorkResponse[]) {\n try {\n if (workResponses.length > 0) {\n const grouped: Record<StepStatus, number[]> = workResponses.reduce(\n (acc, response) => {\n if (!acc[response.status]) {\n acc[response.status] = [];\n }\n acc[response.status].push(response.stepId);\n return acc;\n },\n {} as Record<StepStatus, number[]>\n );\n const resultString = Object.entries(grouped)\n .map(([status, stepIds]) => `${status}: [${stepIds.join(', ')}]`)\n .join(', ');\n console.log(`Posting response of size: ${workResponses.length} including ids: ${resultString}`);\n const response = await apiClient.post(`/api/clients/bulkResults`, {\n data: workResponses,\n });\n return response.data;\n }\n return {};\n } catch (error) {\n console.log('Error:', error);\n }\n}\n\nasync function runPollWithTimeout(task: Promise<WorkRequest[]>, timeoutMs: number): Promise<WorkRequest[]> {\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => reject(new Error('Task timed out')), timeoutMs);\n task\n .then((workRequests) => {\n clearTimeout(timeout);\n resolve(workRequests);\n })\n .catch((error) => {\n clearTimeout(timeout);\n reject(error);\n });\n });\n}\n\nexport const continuePolling: { value: boolean } = {\n value: true,\n};\n\nexport async function pollForWorkers(apiClient: UnmeshedApiClient, workers: UnmeshedWorkerConfig[]) {\n const queuedWorker: QueuedWorker<WorkResponse> = new QueuedWorker<WorkResponse>(\n 100000,\n apiClient.config.responsePollInterval,\n apiClient.config.responseBatchSize,\n async (batchWork: WorkResponse[]) => {\n await postWorkerResponse(apiClient, batchWork);\n },\n apiClient.config.responsePollTimeout\n );\n\n const registerPollingData = workers.map((worker) => {\n return {\n orgId: 0,\n namespace: worker.namespace,\n stepType: 'WORKER',\n name: worker.name,\n } as StepQueueNameData;\n });\n\n await registerPolling(apiClient, registerPollingData);\n\n const pollWorkerData = workers.map((worker) => {\n return {\n stepQueueNameData: {\n orgId: 0,\n namespace: worker.namespace,\n stepType: 'WORKER',\n name: worker.name,\n },\n size: worker.maxInProgress,\n } as PollRequestData;\n });\n\n let errorCount = 0;\n // noinspection InfiniteLoopJS\n while (continuePolling.value) {\n try {\n const workRequests: WorkRequest[] = await runPollWithTimeout(\n pollWorker(apiClient, pollWorkerData),\n apiClient.config.pollTimeout\n );\n for (const polledWorker of workRequests) {\n const associatedWorker: UnmeshedWorkerConfig | undefined = workers.find(\n (worker) => worker.name === polledWorker.stepName && worker.namespace === polledWorker.stepNamespace\n );\n\n let workerResponse: WorkResponse = {\n processId: polledWorker.processId,\n stepId: polledWorker.stepId,\n stepExecutionId: polledWorker.stepExecutionId,\n runCount: polledWorker.runCount,\n output: {},\n status: StepStatus.RUNNING,\n rescheduleAfterSeconds: null,\n startedAt: new Date().getTime(),\n };\n\n if (!associatedWorker) {\n workerResponse = {\n ...workerResponse,\n output: {\n error: `No worker found for ${polledWorker.stepName} ${polledWorker.stepNamespace}`,\n },\n status: StepStatus.TIMED_OUT,\n };\n await queuedWorker.put(workerResponse);\n continue;\n }\n\n const TIMEOUT = apiClient.config.apiWorkerTimeout;\n\n const timeoutPromise = new Promise((_, reject) => {\n setTimeout(() => reject(new Error('Timed out')), TIMEOUT);\n });\n\n try {\n console.log(\n `Starting work ${polledWorker.processId} : ${polledWorker.stepId} : ${polledWorker.stepName} : ${polledWorker.stepRef}`\n );\n const result = await Promise.race([associatedWorker.worker(polledWorker.inputParam), timeoutPromise]);\n\n workerResponse = {\n ...workerResponse,\n output: {\n ...result,\n __workCompletedAt: new Date().getTime(),\n },\n status: StepStatus.COMPLETED,\n };\n } catch (error: unknown) {\n const err = error as Error;\n if (err.message && err.message === 'Timed out') {\n workerResponse = {\n ...workerResponse,\n output: {\n error: `${err.message} based on work timeout settings in worker - ${apiClient.config.apiWorkerTimeout} ms`,\n },\n status: StepStatus.TIMED_OUT,\n };\n } else {\n workerResponse = {\n ...workerResponse,\n output: {\n error: safeStringifyError(err),\n },\n status: StepStatus.FAILED,\n };\n console.error('Error:', err.message);\n }\n }\n await queuedWorker.put(workerResponse);\n }\n await new Promise((resolve) => setTimeout(resolve, apiClient.config.pollInterval));\n } catch (error) {\n errorCount++;\n console.error(`Error processing batch - error count : ${errorCount} - `, error);\n await new Promise((resolve) => setTimeout(resolve, 1000));\n }\n }\n}\n\nfunction safeStringifyError(error: Error) {\n try {\n if (error instanceof Error) {\n const plainError = {\n ...error,\n name: error.name,\n message: error.message,\n stack: error.stack,\n };\n return JSON.stringify(plainError);\n }\n return JSON.stringify(error);\n } catch (stringifyError: unknown) {\n if (stringifyError instanceof Error) {\n return `Error stringification failed: ${stringifyError.message}`;\n }\n return 'Error stringification failed: An unknown error occurred during stringification.';\n }\n}\n\nexport async function startPollingWorkers(\n apiClient: UnmeshedApiClient,\n workers: UnmeshedWorkerConfig[],\n intervalMs: number = 5000\n) {\n async function pollCycle() {\n try {\n await pollForWorkers(apiClient, workers);\n } catch (error) {\n console.error('Error during worker polling:', error);\n }\n\n setTimeout(pollCycle, intervalMs);\n }\n\n await pollCycle();\n}\n","import {\n ApiCallType,\n ProcessActionResponseData,\n ProcessData,\n ProcessRequestData,\n ProcessSearchRequest,\n StepData,\n} from '../types';\nimport { isAxiosError } from 'axios';\nimport { UnmeshedApiClient } from './unmeshedApiClient';\n\nconst PROCESS_PREFIX = 'api/process';\n\nexport const runProcessSync = async (\n apiClient: UnmeshedApiClient,\n ProcessRequestData: ProcessRequestData\n): Promise<ProcessData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/runSync`, {\n data: ProcessRequestData,\n params: {\n clientId: apiClient.getClientId(),\n },\n });\n console.log('Response:', response);\n return response.data;\n } catch (error) {\n console.error('Some error occurred running process request : ', error);\n throw error;\n }\n};\n\nexport const runProcessAsync = async (\n apiClient: UnmeshedApiClient,\n ProcessRequestData: ProcessRequestData\n): Promise<ProcessData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/runAsync`, {\n data: ProcessRequestData,\n params: {\n clientId: apiClient.getClientId(),\n },\n });\n console.log('Response:', response);\n return response.data;\n } catch (error) {\n console.error('Some error occurred running process request : ', error);\n throw error;\n }\n};\n\nexport const getProcessData = async (\n apiClient: UnmeshedApiClient,\n processId: number,\n includeSteps: boolean = false\n): Promise<ProcessData> => {\n if (!processId) {\n throw new Error('Process ID cannot be null');\n }\n try {\n const response = await apiClient.get<ProcessData>(`${PROCESS_PREFIX}/context/${processId}`, { includeSteps });\n return response.data;\n } catch (error) {\n console.error('Error occurred while fetching process record: ', error);\n throw error;\n }\n};\n\nexport const getStepData = async (apiClient: UnmeshedApiClient, stepId: number): Promise<StepData> => {\n if (!stepId) {\n throw new Error('Step ID cannot be null or undefined');\n }\n try {\n const response = await apiClient.get<StepData>(`${PROCESS_PREFIX}/stepContext/${stepId}`);\n return response.data;\n } catch (error) {\n console.log('Error occurred while getStepData: ', error);\n throw error;\n }\n};\n\nexport const bulkTerminate = async (\n apiClient: UnmeshedApiClient,\n processIds: number[],\n reason?: string\n): Promise<ProcessActionResponseData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/bulkTerminate`, {\n params: { reason },\n data: processIds,\n });\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(`Error occurred while terminating processes: ${err.message || error}`);\n }\n};\n\nexport const bulkResume = async (\n apiClient: UnmeshedApiClient,\n processIds: number[]\n): Promise<ProcessActionResponseData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/bulkResume`, {\n data: processIds,\n });\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(`Error occurred while resuming processes: ${err.message || error}`);\n }\n};\n\nexport const bulkReviewed = async (\n apiClient: UnmeshedApiClient,\n processIds: number[],\n reason?: string\n): Promise<ProcessActionResponseData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/bulkReviewed`, {\n data: processIds,\n params: { reason },\n });\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(`Error occurred while marking processes as reviewed: ${err.message || error}`);\n }\n};\n\nexport const rerun = async (\n apiClient: UnmeshedApiClient,\n processId: number,\n version?: number\n): Promise<ProcessData> => {\n const params: Record<string, any> = {\n processId,\n };\n\n if (version !== undefined) {\n params['version'] = version;\n }\n\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/rerun`, {\n params,\n });\n\n return response.data as ProcessData;\n } catch (error) {\n if (isAxiosError(error)) {\n throw new Error(`HTTP request error during rerun process: ${error.response?.status} - ${error.response?.data}`);\n } else {\n const err = error as Error;\n throw new Error(`Unexpected error during rerun process: ${err.message || err}`);\n }\n }\n};\n\n// export const searchProcessExecutions = async (apiClient: UnmeshedApiClient, params: ProcessSearchRequest) => {\n// const queryParams = new URLSearchParams();\n\n// if (params.startTimeEpoch !== undefined && params.startTimeEpoch !== 0)\n// queryParams.set('startTimeEpoch', params.startTimeEpoch.toString());\n// if (params.endTimeEpoch !== undefined && params.endTimeEpoch !== 0)\n// queryParams.set('endTimeEpoch', (params.endTimeEpoch || 0).toString());\n// if (params.namespace) queryParams.set('namespace', params.namespace);\n// if (params.names && params.names.length) queryParams.set('names', params.names.join(','));\n// if (params.processIds && params.processIds.length) queryParams.set('processIds', params.processIds.join(','));\n// if (params.correlationIds && params.correlationIds.length)\n// queryParams.set('correlationIds', params.correlationIds.join(','));\n// if (params.requestIds && params.requestIds.length) queryParams.set('requestIds', params.requestIds.join(','));\n// if (params.statuses && params.statuses.length) queryParams.set('statuses', params.statuses.join(','));\n// if (params.triggerTypes && params.triggerTypes.length) queryParams.set('triggerTypes', params.triggerTypes.join(','));\n\n// const updatedParams = Object.fromEntries(new URLSearchParams(queryParams));\n\n// try {\n// const response = await apiClient.post(`api/stats/process/search`, updatedParams);\n// console.log('Response:', response);\n// return response.data;\n// } catch (error) {\n// console.error('Error occurred while searching process executions: ', error);\n// throw error;\n// }\n// };\n\nexport const searchProcessExecutions = async (apiClient: UnmeshedApiClient, params: ProcessSearchRequest) => {\n // everything in body now\n const body: Record<string, any> = {};\n\n if (params.startTimeEpoch) body.startTimeEpoch = params.startTimeEpoch;\n if (params.endTimeEpoch) body.endTimeEpoch = params.endTimeEpoch;\n\n if (params.namespace) body.namespace = params.namespace;\n if (params.names?.length) body.names = params.names;\n if (params.processIds?.length) body.processIds = params.processIds;\n if (params.correlationIds?.length) body.correlationIds = params.correlationIds;\n if (params.requestIds?.length) body.requestIds = params.requestIds;\n if (params.statuses?.length) body.statuses = params.statuses;\n if (params.triggerTypes?.length) body.triggerTypes = params.triggerTypes;\n\n if (params.tags?.length) body.tags = params.tags;\n\n try {\n const response = await apiClient.post(`api/stats/process/search`, {\n data: body, // ✅ everything sent inside body\n params: {}, // ✅ now empty\n });\n\n return response.data;\n } catch (error) {\n console.error('Error occurred while searching process executions:', error);\n throw error;\n }\n};\n\nexport const invokeApiMappingGet = async (\n apiClient: UnmeshedApiClient,\n endpoint: string,\n id: string,\n correlationId: string,\n apiCallType: ApiCallType\n) => {\n try {\n const response = await apiClient.get(`${PROCESS_PREFIX}/api/call/${endpoint}`, {\n id: id,\n correlationId: correlationId,\n apiCallType,\n });\n console.log('Response:', response);\n return response.data;\n } catch (error) {\n console.error('Error occurred while invoking API Mapping GET: ', error);\n throw error;\n }\n};\n\nexport const invokeApiMappingPost = async (\n apiClient: UnmeshedApiClient,\n endpoint: string,\n input: Record<string, any>,\n id: string,\n correlationId: string,\n apiCallType: ApiCallType = ApiCallType.ASYNC\n): Promise<any> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/api/call/${endpoint}`, {\n data: input,\n params: {\n id: id,\n correlationId: correlationId,\n apiCallType,\n },\n });\n\n return response.data;\n } catch (error) {\n console.error('Error occurred while invoking API Mapping POST: ', error);\n throw error;\n }\n};\n","import { RenewRegistrationParams } from '../types';\nimport { UnmeshedApiClient } from './unmeshedApiClient';\n\nexport const renewRegistration = async (\n apiClient: UnmeshedApiClient,\n params: RenewRegistrationParams\n): Promise<string> => {\n try {\n const response = await apiClient.put('/api/clients/register', {\n params: { ...params },\n });\n console.debug('Response from server:', response);\n return response.data;\n } catch (error) {\n console.error('Error occurred during registration renewal:', error);\n throw error;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA4G;;;ACA5G,oBAA2B;AAEpB,IAAM,sBAAN,MAA0B;AAAA,EAC/B,OAAO,iBAAiB,OA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,MAAM;AAAA,EACrD;AAAA,EAEA,MAAM,WAAmB,SAAkB;AACzC,WAAO,MAAM,KAAK,QAAQ,WAAW,OAAO;AAAA,EAC9C;AAAA,EAEA,uBAAuB,QAA8B;AACnD,WAAO,wBAAwB,KAAK,QAAQ,MAAM;AAAA,EACpD;AAAA,EAEA,oBACE,WACA,UACA,IACA,eACA,aACA;AACA,WAAO,oBAAoB,WAAW,UAAU,IAAI,eAAe,WAAW;AAAA,EAChF;AAAA,EAEA,qBACE,UACA,OACA,IACA,eACA,aACA;AACA,WAAO,qBAAqB,KAAK,QAAQ,UAAU,OAAO,IAAI,eAAe,WAAW;AAAA,EAC1F;AAAA,EAEA,kBAAkB,QAAiC;AACjD,WAAO,kBAAkB,KAAK,QAAQ,MAAM;AAAA,EAC9C;AACF;","names":["axios","ApiCallType","WebhookSource","SQAuthUserType","StepType","StepStatus","ProcessStatus","ProcessTriggerType","ProcessType","response","import_axios","ProcessRequestData","ProcessRequestData"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/apis/unmeshedApiClient.ts","../src/utils/unmeshedCommonUtils.ts","../src/types/index.ts","../src/apis/queuedWorker.ts","../src/apis/pollerClientImpl.ts","../src/apis/processClientImpl.ts","../src/apis/registrationClientImpl.ts"],"sourcesContent":["import {\n ApiCallType,\n ProcessDefinitionData,\n ProcessDefinitionDeleteRequest,\n ProcessDefinitionDetails,\n ProcessDefinitionsDetail,\n ProcessRequestData,\n ProcessSearchRequest,\n RenewRegistrationParams,\n UnmeshedClientConfig,\n UnmeshedWorkerConfig,\n} from './types';\nimport { UnmeshedApiClient } from './apis/unmeshedApiClient';\nimport { startPollingWorkers } from './apis/pollerClientImpl';\nimport {\n bulkResume,\n bulkReviewed,\n bulkTerminate,\n getProcessData,\n getStepData,\n invokeApiMappingGet,\n invokeApiMappingPost,\n rerun,\n runProcessAsync,\n runProcessSync,\n searchProcessExecutions,\n createProcessDefinition,\n updateProcessDefinition,\n deleteProcessDefinition,\n getProcessDefinitions,\n getProcessDefinitionVersions,\n getProcessDefinitionByVersion,\n} from './apis/processClientImpl';\nimport { renewRegistration } from './apis/registrationClientImpl';\n\n// noinspection JSUnusedGlobalSymbols\nexport class UnmeshedClient {\n private client: UnmeshedApiClient;\n\n constructor(config: UnmeshedClientConfig) {\n this.client = new UnmeshedApiClient(config);\n }\n\n startPolling(workers: UnmeshedWorkerConfig[]) {\n startPollingWorkers(this.client, workers);\n }\n\n runProcessSync(ProcessRequestData: ProcessRequestData) {\n return runProcessSync(this.client, ProcessRequestData);\n }\n\n runProcessAsync(ProcessRequestData: ProcessRequestData) {\n return runProcessAsync(this.client, ProcessRequestData);\n }\n\n getProcessData(processId: number, includeSteps: boolean) {\n return getProcessData(this.client, processId, includeSteps);\n }\n\n getStepData(stepId: number) {\n return getStepData(this.client, stepId);\n }\n\n bulkTerminate(processIds: number[], reason?: string) {\n return bulkTerminate(this.client, processIds, reason);\n }\n\n bulkResume(processIds: number[]) {\n return bulkResume(this.client, processIds);\n }\n\n bulkReviewed(processIds: number[], reason?: string) {\n return bulkReviewed(this.client, processIds, reason);\n }\n\n reRun(processId: number, version?: number) {\n return rerun(this.client, processId, version);\n }\n\n searchProcessExecution(params: ProcessSearchRequest) {\n return searchProcessExecutions(this.client, params);\n }\n\n invokeApiMappingGet(\n apiClient: UnmeshedApiClient,\n endpoint: string,\n id: string,\n correlationId: string,\n apiCallType: ApiCallType\n ) {\n return invokeApiMappingGet(apiClient, endpoint, id, correlationId, apiCallType);\n }\n\n invokeApiMappingPost(\n endpoint: string,\n input: Record<string, any>,\n id: string,\n correlationId: string,\n apiCallType: ApiCallType\n ) {\n return invokeApiMappingPost(this.client, endpoint, input, id, correlationId, apiCallType);\n }\n\n reNewRegistration(params: RenewRegistrationParams) {\n return renewRegistration(this.client, params);\n }\n\n createProcessDefinition(body: ProcessDefinitionData) {\n return createProcessDefinition(this.client, body);\n }\n updateProcessDefinition(body: ProcessDefinitionData) {\n return updateProcessDefinition(this.client, body);\n }\n deleteProcessDefinition(body: ProcessDefinitionDeleteRequest) {\n return deleteProcessDefinition(this.client, body);\n }\n getProcessDefinitions(namespace?: string) {\n return getProcessDefinitions(this.client, namespace);\n }\n getProcessDefinitionVersions(body: ProcessDefinitionsDetail) {\n return getProcessDefinitionVersions(this.client, body);\n }\n getProcessDefinitionByVersion(body: ProcessDefinitionDetails) {\n return getProcessDefinitionByVersion(this.client, body);\n }\n}\n\nexport * from './types';\n","import axios, { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, RawAxiosRequestHeaders } from 'axios';\nimport {\n ApiResponse,\n ClientRequestConfig,\n FinalUnmeshedClientConfig,\n HandleRequestConfig,\n QueryParams,\n RequestConfig,\n UnmeshedClientConfig,\n} from '../types';\nimport { UnmeshedCommonUtils } from '../utils/unmeshedCommonUtils';\n\nexport class UnmeshedApiClient {\n private axiosInstance: AxiosInstance | null = null;\n private clientId: string | undefined = undefined;\n private _config: FinalUnmeshedClientConfig;\n\n constructor(unmeshedClientConfig: UnmeshedClientConfig) {\n console.log('Initializing Unmeshed ApiClient');\n\n this._config = createUnmeshedClientConfig(unmeshedClientConfig);\n\n console.log(this._config);\n\n this.clientId = this._config.clientId;\n\n if (!this._config.baseUrl) {\n throw new Error('baseUrl is required');\n }\n\n const baseURL = this._config.port ? `${this._config.baseUrl}:${this._config.port}` : this._config.baseUrl;\n\n this.axiosInstance = axios.create({\n baseURL,\n timeout: this._config.timeout,\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer client.sdk.${this._config.clientId}.${UnmeshedCommonUtils.createSecureHash(\n this._config.authToken\n )}`,\n } as RawAxiosRequestHeaders,\n });\n }\n\n private async handleRequest<T>({\n method,\n endpoint,\n params,\n data,\n config,\n }: HandleRequestConfig): Promise<ApiResponse<T>> {\n if (!this.axiosInstance) {\n throw new Error('ApiClient must be initialized before making requests');\n }\n\n try {\n const response: AxiosResponse<T> = await this.axiosInstance.request<T>({\n method,\n url: endpoint,\n params,\n data,\n ...config,\n } as AxiosRequestConfig);\n\n return {\n data: response.data,\n status: response.status,\n headers: response.headers as Record<string, string>,\n };\n } catch (error) {\n if (axios.isAxiosError(error)) {\n console.error('Request failed:', error.message);\n throw this.handleError(error);\n }\n console.error('Unexpected error:', (error as Error).message);\n throw error;\n }\n }\n\n private handleError(error: AxiosError): Error {\n console.error('Error details:', {\n message: error.message,\n status: error.response?.status,\n data: error.response?.data,\n });\n\n let response = error?.response?.data as ErrorResponse;\n if (response?.errorMessage) {\n return new Error(`${response.errorMessage} [Status code: ${error.response?.status || ''}]`);\n }\n\n return new Error(error.message, { cause: error.response?.data || {} });\n }\n\n public async get<T = any>(endpoint: string, params?: QueryParams, config?: RequestConfig): Promise<ApiResponse<T>> {\n return this.handleRequest<T>({\n method: 'get',\n endpoint: endpoint,\n params: params,\n config: config,\n });\n }\n\n public async post<T = any>(endpoint: string, clientRequestConfig: ClientRequestConfig): Promise<ApiResponse<T>> {\n return this.handleRequest<T>({\n method: 'post',\n endpoint: endpoint,\n ...clientRequestConfig,\n });\n }\n\n public async put<T = any>(endpoint: string, clientRequestConfig: ClientRequestConfig): Promise<ApiResponse<T>> {\n return this.handleRequest<T>({\n method: 'put',\n endpoint: endpoint,\n ...clientRequestConfig,\n });\n }\n\n public async delete<T = any>(endpoint: string, clientRequestConfig: ClientRequestConfig): Promise<ApiResponse<T>> {\n return this.handleRequest<T>({\n method: 'delete',\n endpoint: endpoint,\n ...clientRequestConfig,\n });\n }\n\n public getClientId(): string | undefined {\n return this.clientId;\n }\n\n get config(): FinalUnmeshedClientConfig {\n return this._config;\n }\n}\n\ninterface ErrorResponse {\n errorMessage?: string;\n [key: string]: any; // To allow other unexpected properties\n}\n\nexport function createUnmeshedClientConfig(config: UnmeshedClientConfig): Required<FinalUnmeshedClientConfig> {\n return {\n baseUrl: config.baseUrl,\n clientId: config.clientId,\n authToken: config.authToken,\n port: config.port ?? 443,\n timeout: config.timeout ?? 5000,\n pollInterval: config.pollInterval ?? 100,\n apiWorkerTimeout: config.apiWorkerTimeout ?? 10000,\n pollTimeout: config.pollTimeout ?? 10000,\n responsePollInterval: config.responsePollInterval ?? 100,\n responsePollTimeout: config.responsePollTimeout ?? 10000,\n responseBatchSize: config.responseBatchSize ?? 50,\n };\n}\n","import { createHash } from 'crypto';\n\nexport class UnmeshedCommonUtils {\n static createSecureHash(input: string): string {\n try {\n const hash = createHash('sha256');\n hash.update(input, 'utf8');\n return hash.digest('hex');\n } catch (e) {\n throw new Error('Error creating hash');\n }\n }\n}\n","import { AxiosRequestConfig } from 'axios';\n\nexport enum ApiCallType {\n SYNC = 'SYNC',\n ASYNC = 'ASYNC',\n STREAM = 'STREAM',\n}\n\nexport interface ApiMappingData {\n endpoint: string;\n processDefNamespace: string;\n processDefName: string;\n processDefVersion: number;\n authType: string;\n authClaims: string;\n createdBy: string;\n updatedBy: string;\n created: Date;\n updated: Date;\n}\n\nexport type ApiMappingWebhookData = {\n endpoint: string;\n name: string;\n uniqueId: string;\n urlSecret: string;\n description: string;\n userIdentifier: string;\n webhookSource: WebhookSource;\n webhookSourceConfig: Record<string, string>;\n expiryDate: Date;\n userType: SQAuthUserType;\n createdBy: string;\n updatedBy: string;\n created: Date;\n updated: Date;\n};\n\nexport enum WebhookSource {\n MS_TEAMS = 'MS_TEAMS',\n NOT_DEFINED = 'NOT_DEFINED',\n}\n\nexport enum SQAuthUserType {\n USER = 'USER',\n API = 'API',\n INTERNAL = 'INTERNAL',\n}\n\nexport enum StepType {\n LIST = 'LIST',\n HTTP = 'HTTP',\n WORKER = 'WORKER',\n SWITCH = 'SWITCH',\n PARALLEL = 'PARALLEL',\n FAIL = 'FAIL',\n PYTHON = 'PYTHON',\n JAVASCRIPT = 'JAVASCRIPT',\n JQ = 'JQ',\n SLACK = 'SLACK',\n GRAPHQL = 'GRAPHQL',\n WAIT = 'WAIT',\n BUILTIN = 'BUILTIN',\n NOOP = 'NOOP',\n AI_AGENT = 'AI_AGENT',\n EXIT = 'EXIT',\n DEPENDSON = 'DEPENDSON',\n PERSISTED_STATE = 'PERSISTED_STATE',\n UPDATE_STEP = 'UPDATE_STEP',\n INTEGRATION = 'INTEGRATION',\n FOREACH = 'FOREACH',\n WHILE = 'WHILE',\n SUB_PROCESS = 'SUB_PROCESS',\n FLOW_GATEWAY = 'FLOW_GATEWAY',\n DECISION_ENGINE = 'DECISION_ENGINE',\n SQLITE = 'SQLITE',\n MANAGED = 'MANAGED',\n}\n\nexport enum StepStatus {\n PENDING = 'PENDING',\n SCHEDULED = 'SCHEDULED',\n RUNNING = 'RUNNING',\n PAUSED = 'PAUSED',\n COMPLETED = 'COMPLETED',\n FAILED = 'FAILED',\n TIMED_OUT = 'TIMED_OUT',\n SKIPPED = 'SKIPPED',\n CANCELLED = 'CANCELLED',\n}\n\nexport enum ProcessStatus {\n RUNNING = 'RUNNING',\n COMPLETED = 'COMPLETED',\n FAILED = 'FAILED',\n TIMED_OUT = 'TIMED_OUT',\n CANCELLED = 'CANCELLED',\n TERMINATED = 'TERMINATED',\n REVIEWED = 'REVIEWED',\n}\n\nexport enum ProcessTriggerType {\n MANUAL = 'MANUAL',\n SCHEDULED = 'SCHEDULED',\n API_MAPPING = 'API_MAPPING',\n WEBHOOK = 'WEBHOOK',\n API = 'API',\n SUB_PROCESS = 'SUB_PROCESS',\n}\n\nexport enum ProcessType {\n STANDARD = 'STANDARD',\n DYNAMIC = 'DYNAMIC',\n API_ORCHESTRATION = 'API_ORCHESTRATION',\n INTERNAL = 'INTERNAL',\n}\n\nexport type ClientProfileData = {\n clientId: string;\n ipAddress: string;\n friendlyName: string;\n userIdentifier: string;\n stepQueueNames: StepQueueNameData[];\n createdBy: string;\n updatedBy: string;\n created: Date;\n updated: Date;\n expiryDate: Date;\n};\n\nexport type FullClientProfileData = {\n clientId: string;\n ipAddress: string;\n friendlyName: string;\n userIdentifier: string;\n stepQueueNames: StepQueueNameData[];\n createdBy: string;\n updatedBy: string;\n created: Date;\n updated: Date;\n expiryDate: Date;\n tokenValue: string;\n};\n\nexport type StepQueueNameData = {\n orgId: number;\n namespace: string;\n stepType: StepType;\n name: string;\n};\n\nexport type ProcessActionResponseData = {\n count: number;\n details: ProcessActionResponseDetailData[];\n};\n\nexport type ProcessActionResponseDetailData = {\n id: string;\n message: string;\n error: string;\n};\n\nexport type ProcessData = {\n processId: number;\n processType: ProcessType;\n triggerType: ProcessTriggerType;\n namespace: string;\n name: string;\n version: number | null;\n historyId: number | null;\n requestId: string;\n correlationId: string;\n status: ProcessStatus;\n input: Record<string, unknown>;\n output: Record<string, unknown>;\n authClaims: Record<string, unknown>;\n stepIdCount: number | null;\n shardName: string;\n shardInstanceId: number | null;\n steps: StepId[];\n stepRecords: StepData[];\n created: number;\n updated: number;\n createdBy: string;\n};\n\nexport type StepData = {\n id: number;\n processId: number;\n ref: string;\n parentId: number | null;\n parentRef: string | null;\n namespace: string;\n name: string;\n type: StepType;\n stepDefinitionHistoryId: number | null;\n status: StepStatus;\n input: Record<string, unknown>;\n output: Record<string, unknown>;\n workerId: string;\n start: number;\n schedule: number;\n priority: number;\n updated: number;\n optional: boolean;\n executionList: StepExecutionData[];\n};\n\nexport type StepExecutionData = {\n id: number;\n scheduled: number;\n polled: number;\n start: number;\n updated: number;\n executor: string;\n ref: string;\n runs: number;\n output: Record<string, unknown>;\n};\n\nexport type StepId = {\n id: number;\n processId: number;\n ref: string;\n};\n\nexport type TagValue = {\n name: string;\n value: string;\n};\n\nexport type ProcessRequestData = {\n name: string;\n namespace: string;\n version: number | null;\n requestId?: string;\n correlationId?: string;\n input?: Record<string, unknown>;\n};\n\nexport type ProcessSearchRequest = {\n startTimeEpoch: number;\n endTimeEpoch?: number | null;\n namespace?: string;\n processTypes?: ProcessType[];\n triggerTypes?: ProcessTriggerType[];\n names?: string[];\n processIds?: number[];\n correlationIds?: string[];\n requestIds?: string[];\n statuses?: ProcessStatus[];\n limit?: number;\n offset?: number;\n tags?: TagValue[];\n};\n\nexport interface ExecutionWait {\n result: { waitUntil: number };\n logs: [];\n}\n\nexport interface ExecutionTimelineType {\n id: number;\n executor: string;\n output: ExecutionWait | null;\n polled: number;\n scheduled: number;\n start: number;\n updated: number;\n ref?: string | null;\n}\n\nexport interface ExecutionDetails extends ExecutionTimelineType {\n stepRef: string;\n}\n\nexport interface AuditInfo {\n createdBy: string;\n updatedBy: string;\n created: number;\n updated: number;\n}\n\nexport interface Step extends NewStepData, AuditInfo, Object {\n executionList?: ExecutionDetails[];\n parentRef?: string;\n status?: string;\n completed?: number;\n children: Step[];\n executionCount?: number;\n triggerType?: string;\n}\nexport interface StepConfiguration {\n errorPolicyName?: string;\n useCache?: boolean;\n stream?: boolean;\n cacheKey?: string;\n cacheTimeoutSeconds?: number;\n jqTransformer?: string;\n rateLimitWindowSeconds?: number | null;\n rateLimitMaxRequests?: number | null;\n preExecutionScript?: string;\n scriptLanguage?: 'JAVASCRIPT' | 'PYTHON';\n constructInputFromScript?: boolean;\n additionalRefs?: string[];\n}\n\nexport interface NewStepData {\n type: StepType;\n name: string;\n namespace: string;\n ref: string;\n optional?: boolean;\n configuration?: StepConfiguration;\n children?: Step[];\n input?: Record<string, any>;\n output?: Record<string, any>;\n}\n\nexport type ProcessDefinitionDeleteRequest = {\n namespace: string;\n name: string;\n type: string;\n version: number;\n steps?: Step[];\n};\n\nexport interface ProcessRequest {\n name?: string;\n namespace?: string;\n version?: number | null;\n id?: string | null;\n correlationId?: string | null;\n input?: Record<string, any> | null;\n testRun?: boolean | null;\n}\nexport interface ProcessConfiguration {\n completionTimeout?: number;\n onTimeoutProcess?: ProcessRequest;\n onFailProcess?: ProcessRequest | null;\n onCompleteProcess?: ProcessRequest | null;\n onCancelProcess?: ProcessRequest;\n}\n\nexport interface ProcessDefinitionData {\n namespace: string;\n name: string;\n version?: number;\n type: ProcessType | string;\n description?: string;\n configuration?: ProcessConfiguration;\n steps: Step[];\n defaultInput?: Record<string, any>;\n defaultOutput?: Record<string, any>;\n outputMapping?: Record<string, any>;\n tags?: TagValue[];\n}\nexport interface ProcessDefinitionsDetail {\n name: string;\n namespace: string;\n}\n\nexport interface ProcessDefinitionDetails {\n name: string;\n namespace: string;\n version?: number;\n}\n\nexport interface ExecutionWait {\n result: { waitUntil: number };\n logs: [];\n}\n\nexport interface ExecutionTimelineType {\n id: number;\n executor: string;\n output: ExecutionWait | null;\n polled: number;\n scheduled: number;\n start: number;\n updated: number;\n ref?: string | null;\n}\n\nexport interface ExecutionDetails extends ExecutionTimelineType {\n stepRef: string;\n}\n\nexport interface AuditInfo {\n createdBy: string;\n updatedBy: string;\n created: number;\n updated: number;\n}\n\nexport interface Step extends NewStepData, AuditInfo, Object {\n executionList?: ExecutionDetails[];\n parentRef?: string;\n status?: string;\n completed?: number;\n children: Step[];\n executionCount?: number;\n triggerType?: string;\n}\nexport interface StepConfiguration {\n errorPolicyName?: string;\n useCache?: boolean;\n stream?: boolean;\n cacheKey?: string;\n cacheTimeoutSeconds?: number;\n jqTransformer?: string;\n rateLimitWindowSeconds?: number | null;\n rateLimitMaxRequests?: number | null;\n preExecutionScript?: string;\n scriptLanguage?: 'JAVASCRIPT' | 'PYTHON';\n constructInputFromScript?: boolean;\n additionalRefs?: string[];\n streamAllStatuses?: boolean;\n}\n\nexport interface NewStepData {\n type: StepType;\n name: string;\n namespace: string;\n ref: string;\n optional?: boolean;\n configuration?: StepConfiguration;\n children?: Step[];\n input?: Record<string, any>;\n output?: Record<string, any>;\n}\n\nexport type StepSize = {\n stepQueueNameData: StepQueueNameData;\n size: number | null;\n};\n\nexport type ClientSubmitResult = {\n processId: number;\n stepId: number;\n errorMessage: string | null;\n httpStatusCode: number | null;\n};\n\nexport type WorkRequest = {\n processId: number;\n stepId: number;\n stepExecutionId: number;\n runCount: number;\n stepName: string;\n stepNamespace: string;\n stepRef: string;\n inputParam: Record<string, unknown>;\n isOptional: boolean;\n polled: number;\n scheduled: number;\n updated: number;\n priority: number;\n};\n\nexport type WorkResponse = {\n processId: number;\n stepId: number;\n stepExecutionId: number;\n runCount: number;\n output: Record<string, unknown>;\n status: StepStatus;\n rescheduleAfterSeconds: number | null;\n startedAt: number;\n};\n\nexport type WorkResult = {\n output: unknown;\n taskExecutionId: string;\n startTime: number;\n endTime: number;\n workRequest: WorkRequest;\n};\n\nexport interface FinalUnmeshedClientConfig {\n baseUrl: string;\n clientId: string;\n authToken: string;\n port: string | number;\n timeout: number;\n apiWorkerTimeout: number;\n pollTimeout: number;\n pollInterval: number;\n responsePollInterval: number;\n responsePollTimeout: number;\n responseBatchSize: number;\n}\n\nexport interface UnmeshedClientConfig {\n baseUrl: string;\n clientId: string;\n authToken: string;\n port: string | number;\n timeout?: number;\n apiWorkerTimeout?: number;\n pollTimeout?: number;\n pollInterval?: number;\n responsePollInterval?: number;\n responsePollTimeout?: number;\n responseBatchSize?: number;\n}\n\nexport interface ApiResponse<T = any> {\n data: T;\n status: number;\n headers: Record<string, string>;\n}\n\nexport interface ApiError extends Error {\n status?: number;\n response?: {\n data?: any;\n status: number;\n headers: Record<string, string>;\n };\n}\n\nexport interface QueryParams {\n [key: string]: string | number | boolean | undefined;\n}\n\nexport interface RequestConfig extends Omit<AxiosRequestConfig, 'baseURL' | 'url' | 'method'> {\n headers?: Record<string, string>;\n}\n\nexport interface HandleRequestConfig {\n method: 'get' | 'post' | 'put' | 'delete';\n endpoint: string;\n params?: QueryParams;\n data?: Record<string, unknown>;\n config?: RequestConfig;\n}\n\nexport interface ClientRequestConfig {\n params?: QueryParams;\n data?: any;\n config?: RequestConfig;\n}\n\ninterface UnmeshedWorker {\n (input: Record<string, any>): Promise<any>;\n}\n\nexport interface UnmeshedWorkerConfig {\n worker: UnmeshedWorker;\n namespace: string;\n name: string;\n maxInProgress: number;\n}\n\nexport interface PollRequestData {\n stepQueueNameData: StepQueueNameData;\n size: number;\n}\nexport interface RenewRegistrationParams {\n friendlyName: string;\n}\n","export type WorkerFunction<T> = (items: T[]) => Promise<void>;\n\nexport class QueuedWorker<T> {\n private readonly queue: BlockingQueue<T>;\n private readonly pollIntervalMs: number;\n private readonly batchSize: number;\n private readonly workerFn: WorkerFunction<T>;\n private readonly timeoutMs: number;\n\n constructor(\n capacity: number,\n pollIntervalMs: number,\n batchSize: number,\n workerFn: WorkerFunction<T>,\n timeoutMs: number\n ) {\n this.queue = new BlockingQueue<T>(capacity);\n this.pollIntervalMs = pollIntervalMs;\n this.batchSize = batchSize;\n this.workerFn = workerFn;\n this.timeoutMs = timeoutMs;\n\n console.log(\n `Configured queued worker with ${pollIntervalMs} ms interval and batch size of ${batchSize} and a timeout of ${timeoutMs} ms`\n );\n // noinspection JSIgnoredPromiseFromCall\n this.start();\n }\n\n async start(): Promise<void> {\n let errorCount = 0;\n // noinspection InfiniteLoopJS\n while (true) {\n try {\n const batch = await this.queue.takeBatch(this.batchSize);\n if (batch.length > 0) {\n console.log(`Batch work ${batch.length} received`);\n await this.runWithTimeout(this.workerFn(batch), this.timeoutMs);\n }\n } catch (error) {\n errorCount++;\n console.error(`Error processing batch - error count : ${errorCount} - `, error);\n await new Promise((resolve) => setTimeout(resolve, 1000));\n }\n await new Promise((resolve) => setTimeout(resolve, this.pollIntervalMs));\n }\n }\n\n private async runWithTimeout(task: Promise<void>, timeoutMs: number): Promise<void> {\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => reject(new Error('Task timed out')), timeoutMs);\n task\n .then(() => {\n clearTimeout(timeout);\n resolve();\n })\n .catch((error) => {\n clearTimeout(timeout);\n reject(error);\n });\n });\n }\n\n async put(item: T): Promise<void> {\n await this.queue.put(item);\n }\n}\n\nclass BlockingQueue<T> {\n private queue: T[] = [];\n private readonly capacity: number;\n\n constructor(capacity: number) {\n if (capacity <= 0) {\n throw new Error('Capacity must be greater than 0');\n }\n this.capacity = capacity;\n }\n\n async put(item: T): Promise<void> {\n while (this.queue.length >= this.capacity) {\n await new Promise((resolve) => setTimeout(resolve, 10));\n }\n this.queue.push(item);\n }\n\n async takeBatch(batchSize: number): Promise<T[]> {\n while (this.queue.length === 0) {\n await new Promise((resolve) => setTimeout(resolve, 10));\n }\n return this.queue.splice(0, batchSize);\n }\n\n size(): number {\n return this.queue.length;\n }\n\n isEmpty(): boolean {\n return this.queue.length === 0;\n }\n\n peek(): T | undefined {\n return this.queue[0];\n }\n}\n","import {\n ApiResponse,\n PollRequestData,\n StepQueueNameData,\n StepStatus,\n UnmeshedWorkerConfig,\n WorkRequest,\n WorkResponse,\n} from '../types';\nimport { UnmeshedApiClient } from './unmeshedApiClient';\nimport { QueuedWorker } from './queuedWorker';\nimport os from 'os';\n\nasync function registerPolling(apiClient: UnmeshedApiClient, data: StepQueueNameData[]) {\n const attempt = async (): Promise<any> => {\n try {\n const response = await apiClient.put(`/api/clients/register`, {\n data: data,\n });\n console.log('Successfully renewed registration for workers', data);\n return response.data;\n } catch {\n console.error('An error occurred during polling registration. Retrying in 3 seconds...');\n await new Promise((resolve) => setTimeout(resolve, 3000));\n return attempt();\n }\n };\n\n return attempt();\n}\n\nasync function pollWorker(apiClient: UnmeshedApiClient, data: PollRequestData[]): Promise<WorkRequest[]> {\n try {\n const response: ApiResponse<WorkRequest[]> = await apiClient.post(`/api/clients/poll`, {\n data: data,\n config: { headers: { UNMESHED_HOST_NAME: getHostName() } },\n });\n if (response.data && response.data.length > 0) {\n console.log(`Received ${response.data.length} work requests`);\n }\n return response.data;\n } catch (error) {\n console.error('Error occurred during worker polling', error);\n return [];\n }\n}\n\nasync function postWorkerResponse(apiClient: UnmeshedApiClient, workResponses: WorkResponse[]) {\n try {\n if (workResponses.length > 0) {\n const grouped: Record<StepStatus, number[]> = workResponses.reduce(\n (acc, response) => {\n if (!acc[response.status]) {\n acc[response.status] = [];\n }\n acc[response.status].push(response.stepId);\n return acc;\n },\n {} as Record<StepStatus, number[]>\n );\n const resultString = Object.entries(grouped)\n .map(([status, stepIds]) => `${status}: [${stepIds.join(', ')}]`)\n .join(', ');\n console.log(`Posting response of size: ${workResponses.length} including ids: ${resultString}`);\n const response = await apiClient.post(`/api/clients/bulkResults`, {\n data: workResponses,\n });\n return response.data;\n }\n return {};\n } catch (error) {\n console.log('Error:', error);\n }\n}\n\nasync function runPollWithTimeout(task: Promise<WorkRequest[]>, timeoutMs: number): Promise<WorkRequest[]> {\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => reject(new Error('Task timed out')), timeoutMs);\n task\n .then((workRequests) => {\n clearTimeout(timeout);\n resolve(workRequests);\n })\n .catch((error) => {\n clearTimeout(timeout);\n reject(error);\n });\n });\n}\n\nexport const continuePolling: { value: boolean } = {\n value: true,\n};\n\nexport async function pollForWorkers(apiClient: UnmeshedApiClient, workers: UnmeshedWorkerConfig[]) {\n const queuedWorker: QueuedWorker<WorkResponse> = new QueuedWorker<WorkResponse>(\n 100000,\n apiClient.config.responsePollInterval,\n apiClient.config.responseBatchSize,\n async (batchWork: WorkResponse[]) => {\n await postWorkerResponse(apiClient, batchWork);\n },\n apiClient.config.responsePollTimeout\n );\n\n const registerPollingData = workers.map((worker) => {\n return {\n orgId: 0,\n namespace: worker.namespace,\n stepType: 'WORKER',\n name: worker.name,\n } as StepQueueNameData;\n });\n\n await registerPolling(apiClient, registerPollingData);\n\n const pollWorkerData = workers.map((worker) => {\n return {\n stepQueueNameData: {\n orgId: 0,\n namespace: worker.namespace,\n stepType: 'WORKER',\n name: worker.name,\n },\n size: worker.maxInProgress,\n } as PollRequestData;\n });\n\n let errorCount = 0;\n // noinspection InfiniteLoopJS\n while (continuePolling.value) {\n try {\n const workRequests: WorkRequest[] = await runPollWithTimeout(\n pollWorker(apiClient, pollWorkerData),\n apiClient.config.pollTimeout\n );\n for (const polledWorker of workRequests) {\n const associatedWorker: UnmeshedWorkerConfig | undefined = workers.find(\n (worker) => worker.name === polledWorker.stepName && worker.namespace === polledWorker.stepNamespace\n );\n\n let workerResponse: WorkResponse = {\n processId: polledWorker.processId,\n stepId: polledWorker.stepId,\n stepExecutionId: polledWorker.stepExecutionId,\n runCount: polledWorker.runCount,\n output: {},\n status: StepStatus.RUNNING,\n rescheduleAfterSeconds: null,\n startedAt: new Date().getTime(),\n };\n\n if (!associatedWorker) {\n workerResponse = {\n ...workerResponse,\n output: {\n error: `No worker found for ${polledWorker.stepName} ${polledWorker.stepNamespace}`,\n },\n status: StepStatus.TIMED_OUT,\n };\n await queuedWorker.put(workerResponse);\n continue;\n }\n\n const TIMEOUT = apiClient.config.apiWorkerTimeout;\n\n const timeoutPromise = new Promise((_, reject) => {\n setTimeout(() => reject(new Error('Timed out')), TIMEOUT);\n });\n\n try {\n console.log(\n `Starting work ${polledWorker.processId} : ${polledWorker.stepId} : ${polledWorker.stepName} : ${polledWorker.stepRef}`\n );\n const result = await Promise.race([associatedWorker.worker(polledWorker.inputParam), timeoutPromise]);\n\n workerResponse = {\n ...workerResponse,\n output: {\n ...result,\n __workCompletedAt: new Date().getTime(),\n },\n status: StepStatus.COMPLETED,\n };\n } catch (error: unknown) {\n const err = error as Error;\n if (err.message && err.message === 'Timed out') {\n workerResponse = {\n ...workerResponse,\n output: {\n error: `${err.message} based on work timeout settings in worker - ${apiClient.config.apiWorkerTimeout} ms`,\n },\n status: StepStatus.TIMED_OUT,\n };\n } else {\n workerResponse = {\n ...workerResponse,\n output: {\n error: safeStringifyError(err),\n },\n status: StepStatus.FAILED,\n };\n console.error('Error:', err.message);\n }\n }\n await queuedWorker.put(workerResponse);\n }\n await new Promise((resolve) => setTimeout(resolve, apiClient.config.pollInterval));\n } catch (error) {\n errorCount++;\n console.error(`Error processing batch - error count : ${errorCount} - `, error);\n await new Promise((resolve) => setTimeout(resolve, 1000));\n }\n }\n}\n\nfunction safeStringifyError(error: Error) {\n try {\n if (error instanceof Error) {\n const plainError = {\n ...error,\n name: error.name,\n message: error.message,\n stack: error.stack,\n };\n return JSON.stringify(plainError);\n }\n return JSON.stringify(error);\n } catch (stringifyError: unknown) {\n if (stringifyError instanceof Error) {\n return `Error stringification failed: ${stringifyError.message}`;\n }\n return 'Error stringification failed: An unknown error occurred during stringification.';\n }\n}\n\nexport async function startPollingWorkers(\n apiClient: UnmeshedApiClient,\n workers: UnmeshedWorkerConfig[],\n intervalMs: number = 5000\n) {\n async function pollCycle() {\n try {\n await pollForWorkers(apiClient, workers);\n } catch (error) {\n console.error('Error during worker polling:', error);\n }\n\n setTimeout(pollCycle, intervalMs);\n }\n\n await pollCycle();\n}\n\nexport function getHostName(): string {\n const unmeshedHostName = process.env.UNMESHED_HOST_NAME;\n if (unmeshedHostName && unmeshedHostName.trim() !== '') {\n return unmeshedHostName.trim();\n }\n\n const hostNameEnv = process.env.HOSTNAME;\n if (hostNameEnv && hostNameEnv.trim() !== '') {\n return hostNameEnv.trim();\n }\n\n const computerNameEnv = process.env.COMPUTERNAME;\n if (computerNameEnv && computerNameEnv.trim() !== '') {\n return computerNameEnv.trim();\n }\n\n try {\n const host = os.hostname();\n if (host && host.trim() !== '') {\n return host.trim();\n }\n } catch {\n // ignore\n }\n\n return '-';\n}\n","import {\n ApiCallType,\n ProcessActionResponseData,\n ProcessData,\n ProcessDefinitionData,\n ProcessDefinitionDeleteRequest,\n ProcessDefinitionDetails,\n ProcessDefinitionsDetail,\n ProcessRequestData,\n ProcessSearchRequest,\n StepData,\n} from '../types';\nimport { isAxiosError } from 'axios';\nimport { UnmeshedApiClient } from './unmeshedApiClient';\n\nconst PROCESS_PREFIX = 'api/process';\n\nexport const runProcessSync = async (\n apiClient: UnmeshedApiClient,\n ProcessRequestData: ProcessRequestData\n): Promise<ProcessData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/runSync`, {\n data: ProcessRequestData,\n params: {\n clientId: apiClient.getClientId(),\n },\n });\n console.log('Response:', response);\n return response.data;\n } catch (error) {\n console.error('Some error occurred running process request : ', error);\n throw error;\n }\n};\n\nexport const runProcessAsync = async (\n apiClient: UnmeshedApiClient,\n ProcessRequestData: ProcessRequestData\n): Promise<ProcessData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/runAsync`, {\n data: ProcessRequestData,\n params: {\n clientId: apiClient.getClientId(),\n },\n });\n console.log('Response:', response);\n return response.data;\n } catch (error) {\n console.error('Some error occurred running process request : ', error);\n throw error;\n }\n};\n\nexport const getProcessData = async (\n apiClient: UnmeshedApiClient,\n processId: number,\n includeSteps: boolean = false\n): Promise<ProcessData> => {\n if (!processId) {\n throw new Error('Process ID cannot be null');\n }\n try {\n const response = await apiClient.get<ProcessData>(`${PROCESS_PREFIX}/context/${processId}`, { includeSteps });\n return response.data;\n } catch (error) {\n console.error('Error occurred while fetching process record: ', error);\n throw error;\n }\n};\n\nexport const getStepData = async (apiClient: UnmeshedApiClient, stepId: number): Promise<StepData> => {\n if (!stepId) {\n throw new Error('Step ID cannot be null or undefined');\n }\n try {\n const response = await apiClient.get<StepData>(`${PROCESS_PREFIX}/stepContext/${stepId}`);\n return response.data;\n } catch (error) {\n console.log('Error occurred while getStepData: ', error);\n throw error;\n }\n};\n\nexport const bulkTerminate = async (\n apiClient: UnmeshedApiClient,\n processIds: number[],\n reason?: string\n): Promise<ProcessActionResponseData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/bulkTerminate`, {\n params: { reason },\n data: processIds,\n });\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(`Error occurred while terminating processes: ${err.message || error}`);\n }\n};\n\nexport const bulkResume = async (\n apiClient: UnmeshedApiClient,\n processIds: number[]\n): Promise<ProcessActionResponseData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/bulkResume`, {\n data: processIds,\n });\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(`Error occurred while resuming processes: ${err.message || error}`);\n }\n};\n\nexport const bulkReviewed = async (\n apiClient: UnmeshedApiClient,\n processIds: number[],\n reason?: string\n): Promise<ProcessActionResponseData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/bulkReviewed`, {\n data: processIds,\n params: { reason },\n });\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(`Error occurred while marking processes as reviewed: ${err.message || error}`);\n }\n};\n\nexport const rerun = async (\n apiClient: UnmeshedApiClient,\n processId: number,\n version?: number\n): Promise<ProcessData> => {\n const params: Record<string, any> = {\n processId,\n };\n\n if (version !== undefined) {\n params['version'] = version;\n }\n\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/rerun`, {\n params,\n });\n\n return response.data as ProcessData;\n } catch (error) {\n if (isAxiosError(error)) {\n throw new Error(`HTTP request error during rerun process: ${error.response?.status} - ${error.response?.data}`);\n } else {\n const err = error as Error;\n throw new Error(`Unexpected error during rerun process: ${err.message || err}`);\n }\n }\n};\n\nexport const searchProcessExecutions = async (apiClient: UnmeshedApiClient, params: ProcessSearchRequest) => {\n const body: Record<string, any> = {};\n\n if (params.startTimeEpoch) body.startTimeEpoch = params.startTimeEpoch;\n if (params.endTimeEpoch) body.endTimeEpoch = params.endTimeEpoch;\n\n if (params.namespace) body.namespace = params.namespace;\n if (params.names?.length) body.names = params.names;\n if (params.processIds?.length) body.processIds = params.processIds;\n if (params.correlationIds?.length) body.correlationIds = params.correlationIds;\n if (params.requestIds?.length) body.requestIds = params.requestIds;\n if (params.statuses?.length) body.statuses = params.statuses;\n if (params.triggerTypes?.length) body.triggerTypes = params.triggerTypes;\n\n if (params.tags?.length) body.tags = params.tags;\n\n try {\n const response = await apiClient.post(`api/stats/process/search`, {\n data: body,\n params: {},\n });\n\n return response.data;\n } catch (error) {\n console.error('Error occurred while searching process executions:', error);\n throw error;\n }\n};\n\nexport const invokeApiMappingGet = async (\n apiClient: UnmeshedApiClient,\n endpoint: string,\n id: string,\n correlationId: string,\n apiCallType: ApiCallType\n) => {\n try {\n const response = await apiClient.get(`${PROCESS_PREFIX}/api/call/${endpoint}`, {\n id: id,\n correlationId: correlationId,\n apiCallType,\n });\n console.log('Response:', response);\n return response.data;\n } catch (error) {\n console.error('Error occurred while invoking API Mapping GET: ', error);\n throw error;\n }\n};\n\nexport const invokeApiMappingPost = async (\n apiClient: UnmeshedApiClient,\n endpoint: string,\n input: Record<string, any>,\n id: string,\n correlationId: string,\n apiCallType: ApiCallType = ApiCallType.ASYNC\n): Promise<any> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/api/call/${endpoint}`, {\n data: input,\n params: {\n id: id,\n correlationId: correlationId,\n apiCallType,\n },\n });\n\n return response.data;\n } catch (error) {\n console.error('Error occurred while invoking API Mapping POST: ', error);\n throw error;\n }\n};\n\nexport const createProcessDefinition = async (apiClient: UnmeshedApiClient, requestData: ProcessDefinitionData) => {\n try {\n const response = await apiClient.post(`/api/processDefinitions`, {\n data: requestData,\n params: {},\n });\n\n return response.data;\n } catch (error) {\n console.error('Error occurred while creating process definition:', error);\n throw error;\n }\n};\n\nexport const deleteProcessDefinition = async (\n apiClient: UnmeshedApiClient,\n requestData: ProcessDefinitionDeleteRequest\n) => {\n try {\n const response = await apiClient.delete(`/api/processDefinitions`, {\n data: [requestData],\n params: {},\n });\n\n return response.data;\n } catch (error) {\n console.error('Error occurred while deleting process definition:', error);\n throw error;\n }\n};\n\nexport const updateProcessDefinition = async (apiClient: UnmeshedApiClient, requestData: ProcessDefinitionData) => {\n try {\n const response = await apiClient.put(`/api/processDefinitions`, {\n data: requestData,\n params: {},\n });\n\n return response.data;\n } catch (error) {\n console.error('Error occurred while creating process definition:', error);\n throw error;\n }\n};\n\nexport const getProcessDefinitions = async (apiClient: UnmeshedApiClient, namespace?: string) => {\n try {\n const params = namespace ? { namespace } : {};\n const response = await apiClient.get('/api/processDefinitions', params);\n return response.data;\n } catch (error) {\n console.error('Error occurred while fetching process definitions:', error);\n throw error;\n }\n};\n\nexport const getProcessDefinitionVersions = async (apiClient: UnmeshedApiClient, body: ProcessDefinitionsDetail) => {\n try {\n const response = await apiClient.get(`/api/processDefinitions/${body.namespace}/${body.name}/versions`);\n return response.data;\n } catch (error) {\n console.error('Error occurred while fetching process definition: ', error);\n throw error;\n }\n};\n\nexport const getProcessDefinitionByVersion = async (apiClient: UnmeshedApiClient, body: ProcessDefinitionDetails) => {\n if (!body.namespace || !body.name || !body.version) {\n throw new Error('namespace, name, and version are required');\n }\n\n try {\n const params = body.version ? { version: body.version } : {};\n\n const response = await apiClient.get(`/api/processDefinitions/${body.namespace}/${body.name}`, params);\n\n return response.data;\n } catch (error) {\n console.error('Error occurred while fetching process definition:', error);\n throw error;\n }\n};\n","import { RenewRegistrationParams } from '../types';\nimport { UnmeshedApiClient } from './unmeshedApiClient';\n\nexport const renewRegistration = async (\n apiClient: UnmeshedApiClient,\n params: RenewRegistrationParams\n): Promise<string> => {\n try {\n const response = await apiClient.put('/api/clients/register', {\n params: { ...params },\n });\n console.debug('Response from server:', response);\n return response.data;\n } catch (error) {\n console.error('Error occurred during registration renewal:', error);\n throw error;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA4G;;;ACA5G,oBAA2B;AAEpB,IAAM,sBAAN,MAA0B;AAAA,EAC/B,OAAO,iBAAiB,OAAuB;AAC7C,QAAI;AACF,YAAM,WAAO,0BAAW,QAAQ;AAChC,WAAK,OAAO,OAAO,MAAM;AACzB,aAAO,KAAK,OAAO,KAAK;AAAA,IAC1B,SAAS,GAAG;AACV,YAAM,IAAI,MAAM,qBAAqB;AAAA,IACvC;AAAA,EACF;AACF;;;ADAO,IAAM,oBAAN,MAAwB;AAAA,EACrB,gBAAsC;AAAA,EACtC,WAA+B;AAAA,EAC/B;AAAA,EAER,YAAY,sBAA4C;AACtD,YAAQ,IAAI,iCAAiC;AAE7C,SAAK,UAAU,2BAA2B,oBAAoB;AAE9D,YAAQ,IAAI,KAAK,OAAO;AAExB,SAAK,WAAW,KAAK,QAAQ;AAE7B,QAAI,CAAC,KAAK,QAAQ,SAAS;AACzB,YAAM,IAAI,MAAM,qBAAqB;AAAA,IACvC;AAEA,UAAM,UAAU,KAAK,QAAQ,OAAO,GAAG,KAAK,QAAQ,OAAO,IAAI,KAAK,QAAQ,IAAI,KA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AAoB;AACxC,WAAO,sBAAsB,KAAK,QAAQ,SAAS;AAAA,EACrD;AAAA,EACA,6BAA6B,MAAgC;AAC3D,WAAO,6BAA6B,KAAK,QAAQ,IAAI;AAAA,EACvD;AAAA,EACA,8BAA8B,MAAgC;AAC5D,WAAO,8BAA8B,KAAK,QAAQ,IAAI;AAAA,EACxD;AACF;","names":["axios","ApiCallType","WebhookSource","SQAuthUserType","StepType","StepStatus","ProcessStatus","ProcessTriggerType","ProcessType","response","os","import_axios","ProcessRequestData","ProcessRequestData"]}
|
package/dist/index.mjs
CHANGED
|
@@ -307,6 +307,7 @@ var BlockingQueue = class {
|
|
|
307
307
|
};
|
|
308
308
|
|
|
309
309
|
// src/apis/pollerClientImpl.ts
|
|
310
|
+
import os from "os";
|
|
310
311
|
async function registerPolling(apiClient, data) {
|
|
311
312
|
const attempt = async () => {
|
|
312
313
|
try {
|
|
@@ -325,7 +326,10 @@ async function registerPolling(apiClient, data) {
|
|
|
325
326
|
}
|
|
326
327
|
async function pollWorker(apiClient, data) {
|
|
327
328
|
try {
|
|
328
|
-
const response = await apiClient.post(`/api/clients/poll`, {
|
|
329
|
+
const response = await apiClient.post(`/api/clients/poll`, {
|
|
330
|
+
data,
|
|
331
|
+
config: { headers: { UNMESHED_HOST_NAME: getHostName() } }
|
|
332
|
+
});
|
|
329
333
|
if (response.data && response.data.length > 0) {
|
|
330
334
|
console.log(`Received ${response.data.length} work requests`);
|
|
331
335
|
}
|
|
@@ -515,6 +519,28 @@ async function startPollingWorkers(apiClient, workers, intervalMs = 5e3) {
|
|
|
515
519
|
}
|
|
516
520
|
await pollCycle();
|
|
517
521
|
}
|
|
522
|
+
function getHostName() {
|
|
523
|
+
const unmeshedHostName = process.env.UNMESHED_HOST_NAME;
|
|
524
|
+
if (unmeshedHostName && unmeshedHostName.trim() !== "") {
|
|
525
|
+
return unmeshedHostName.trim();
|
|
526
|
+
}
|
|
527
|
+
const hostNameEnv = process.env.HOSTNAME;
|
|
528
|
+
if (hostNameEnv && hostNameEnv.trim() !== "") {
|
|
529
|
+
return hostNameEnv.trim();
|
|
530
|
+
}
|
|
531
|
+
const computerNameEnv = process.env.COMPUTERNAME;
|
|
532
|
+
if (computerNameEnv && computerNameEnv.trim() !== "") {
|
|
533
|
+
return computerNameEnv.trim();
|
|
534
|
+
}
|
|
535
|
+
try {
|
|
536
|
+
const host = os.hostname();
|
|
537
|
+
if (host && host.trim() !== "") {
|
|
538
|
+
return host.trim();
|
|
539
|
+
}
|
|
540
|
+
} catch {
|
|
541
|
+
}
|
|
542
|
+
return "-";
|
|
543
|
+
}
|
|
518
544
|
|
|
519
545
|
// src/apis/processClientImpl.ts
|
|
520
546
|
import { isAxiosError } from "axios";
|
|
@@ -644,9 +670,7 @@ var searchProcessExecutions = async (apiClient, params) => {
|
|
|
644
670
|
try {
|
|
645
671
|
const response = await apiClient.post(`api/stats/process/search`, {
|
|
646
672
|
data: body,
|
|
647
|
-
// ✅ everything sent inside body
|
|
648
673
|
params: {}
|
|
649
|
-
// ✅ now empty
|
|
650
674
|
});
|
|
651
675
|
return response.data;
|
|
652
676
|
} catch (error) {
|
|
@@ -684,6 +708,74 @@ var invokeApiMappingPost = async (apiClient, endpoint, input, id, correlationId,
|
|
|
684
708
|
throw error;
|
|
685
709
|
}
|
|
686
710
|
};
|
|
711
|
+
var createProcessDefinition = async (apiClient, requestData) => {
|
|
712
|
+
try {
|
|
713
|
+
const response = await apiClient.post(`/api/processDefinitions`, {
|
|
714
|
+
data: requestData,
|
|
715
|
+
params: {}
|
|
716
|
+
});
|
|
717
|
+
return response.data;
|
|
718
|
+
} catch (error) {
|
|
719
|
+
console.error("Error occurred while creating process definition:", error);
|
|
720
|
+
throw error;
|
|
721
|
+
}
|
|
722
|
+
};
|
|
723
|
+
var deleteProcessDefinition = async (apiClient, requestData) => {
|
|
724
|
+
try {
|
|
725
|
+
const response = await apiClient.delete(`/api/processDefinitions`, {
|
|
726
|
+
data: [requestData],
|
|
727
|
+
params: {}
|
|
728
|
+
});
|
|
729
|
+
return response.data;
|
|
730
|
+
} catch (error) {
|
|
731
|
+
console.error("Error occurred while deleting process definition:", error);
|
|
732
|
+
throw error;
|
|
733
|
+
}
|
|
734
|
+
};
|
|
735
|
+
var updateProcessDefinition = async (apiClient, requestData) => {
|
|
736
|
+
try {
|
|
737
|
+
const response = await apiClient.put(`/api/processDefinitions`, {
|
|
738
|
+
data: requestData,
|
|
739
|
+
params: {}
|
|
740
|
+
});
|
|
741
|
+
return response.data;
|
|
742
|
+
} catch (error) {
|
|
743
|
+
console.error("Error occurred while creating process definition:", error);
|
|
744
|
+
throw error;
|
|
745
|
+
}
|
|
746
|
+
};
|
|
747
|
+
var getProcessDefinitions = async (apiClient, namespace) => {
|
|
748
|
+
try {
|
|
749
|
+
const params = namespace ? { namespace } : {};
|
|
750
|
+
const response = await apiClient.get("/api/processDefinitions", params);
|
|
751
|
+
return response.data;
|
|
752
|
+
} catch (error) {
|
|
753
|
+
console.error("Error occurred while fetching process definitions:", error);
|
|
754
|
+
throw error;
|
|
755
|
+
}
|
|
756
|
+
};
|
|
757
|
+
var getProcessDefinitionVersions = async (apiClient, body) => {
|
|
758
|
+
try {
|
|
759
|
+
const response = await apiClient.get(`/api/processDefinitions/${body.namespace}/${body.name}/versions`);
|
|
760
|
+
return response.data;
|
|
761
|
+
} catch (error) {
|
|
762
|
+
console.error("Error occurred while fetching process definition: ", error);
|
|
763
|
+
throw error;
|
|
764
|
+
}
|
|
765
|
+
};
|
|
766
|
+
var getProcessDefinitionByVersion = async (apiClient, body) => {
|
|
767
|
+
if (!body.namespace || !body.name || !body.version) {
|
|
768
|
+
throw new Error("namespace, name, and version are required");
|
|
769
|
+
}
|
|
770
|
+
try {
|
|
771
|
+
const params = body.version ? { version: body.version } : {};
|
|
772
|
+
const response = await apiClient.get(`/api/processDefinitions/${body.namespace}/${body.name}`, params);
|
|
773
|
+
return response.data;
|
|
774
|
+
} catch (error) {
|
|
775
|
+
console.error("Error occurred while fetching process definition:", error);
|
|
776
|
+
throw error;
|
|
777
|
+
}
|
|
778
|
+
};
|
|
687
779
|
|
|
688
780
|
// src/apis/registrationClientImpl.ts
|
|
689
781
|
var renewRegistration = async (apiClient, params) => {
|
|
@@ -744,6 +836,24 @@ var UnmeshedClient = class {
|
|
|
744
836
|
reNewRegistration(params) {
|
|
745
837
|
return renewRegistration(this.client, params);
|
|
746
838
|
}
|
|
839
|
+
createProcessDefinition(body) {
|
|
840
|
+
return createProcessDefinition(this.client, body);
|
|
841
|
+
}
|
|
842
|
+
updateProcessDefinition(body) {
|
|
843
|
+
return updateProcessDefinition(this.client, body);
|
|
844
|
+
}
|
|
845
|
+
deleteProcessDefinition(body) {
|
|
846
|
+
return deleteProcessDefinition(this.client, body);
|
|
847
|
+
}
|
|
848
|
+
getProcessDefinitions(namespace) {
|
|
849
|
+
return getProcessDefinitions(this.client, namespace);
|
|
850
|
+
}
|
|
851
|
+
getProcessDefinitionVersions(body) {
|
|
852
|
+
return getProcessDefinitionVersions(this.client, body);
|
|
853
|
+
}
|
|
854
|
+
getProcessDefinitionByVersion(body) {
|
|
855
|
+
return getProcessDefinitionByVersion(this.client, body);
|
|
856
|
+
}
|
|
747
857
|
};
|
|
748
858
|
export {
|
|
749
859
|
ApiCallType,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/apis/unmeshedApiClient.ts","../src/utils/unmeshedCommonUtils.ts","../src/types/index.ts","../src/apis/queuedWorker.ts","../src/apis/pollerClientImpl.ts","../src/apis/processClientImpl.ts","../src/apis/registrationClientImpl.ts","../src/index.ts"],"sourcesContent":["import axios, { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, RawAxiosRequestHeaders } from 'axios';\nimport {\n ApiResponse,\n ClientRequestConfig,\n FinalUnmeshedClientConfig,\n HandleRequestConfig,\n QueryParams,\n RequestConfig,\n UnmeshedClientConfig,\n} from '../types';\nimport { UnmeshedCommonUtils } from '../utils/unmeshedCommonUtils';\n\nexport class UnmeshedApiClient {\n private axiosInstance: AxiosInstance | null = null;\n private clientId: string | undefined = undefined;\n private _config: FinalUnmeshedClientConfig;\n\n constructor(unmeshedClientConfig: UnmeshedClientConfig) {\n console.log('Initializing Unmeshed ApiClient');\n\n this._config = createUnmeshedClientConfig(unmeshedClientConfig);\n\n console.log(this._config);\n\n this.clientId = this._config.clientId;\n\n if (!this._config.baseUrl) {\n throw new Error('baseUrl is required');\n }\n\n const baseURL = this._config.port ? `${this._config.baseUrl}:${this._config.port}` : this._config.baseUrl;\n\n this.axiosInstance = axios.create({\n baseURL,\n timeout: this._config.timeout,\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer client.sdk.${this._config.clientId}.${UnmeshedCommonUtils.createSecureHash(\n this._config.authToken\n )}`,\n } as RawAxiosRequestHeaders,\n });\n }\n\n private async handleRequest<T>({\n method,\n endpoint,\n params,\n data,\n config,\n }: HandleRequestConfig): Promise<ApiResponse<T>> {\n if (!this.axiosInstance) {\n throw new Error('ApiClient must be initialized before making requests');\n }\n\n try {\n const response: AxiosResponse<T> = await this.axiosInstance.request<T>({\n method,\n url: endpoint,\n params,\n data,\n ...config,\n } as AxiosRequestConfig);\n\n return {\n data: response.data,\n status: response.status,\n headers: response.headers as Record<string, string>,\n };\n } catch (error) {\n if (axios.isAxiosError(error)) {\n console.error('Request failed:', error.message);\n throw this.handleError(error);\n }\n console.error('Unexpected error:', (error as Error).message);\n throw error;\n }\n }\n\n private handleError(error: AxiosError): Error {\n console.error('Error details:', {\n message: error.message,\n status: error.response?.status,\n data: error.response?.data,\n });\n\n let response = error?.response?.data as ErrorResponse;\n if (response?.errorMessage) {\n return new Error(`${response.errorMessage} [Status code: ${error.response?.status || ''}]`);\n }\n\n return new Error(error.message, { cause: error.response?.data || {} });\n }\n\n public async get<T = any>(endpoint: string, params?: QueryParams, config?: RequestConfig): Promise<ApiResponse<T>> {\n return this.handleRequest<T>({\n method: 'get',\n endpoint: endpoint,\n params: params,\n config: config,\n });\n }\n\n public async post<T = any>(endpoint: string, clientRequestConfig: ClientRequestConfig): Promise<ApiResponse<T>> {\n return this.handleRequest<T>({\n method: 'post',\n endpoint: endpoint,\n ...clientRequestConfig,\n });\n }\n\n public async put<T = any>(endpoint: string, clientRequestConfig: ClientRequestConfig): Promise<ApiResponse<T>> {\n return this.handleRequest<T>({\n method: 'put',\n endpoint: endpoint,\n ...clientRequestConfig,\n });\n }\n\n public async delete<T = any>(endpoint: string, clientRequestConfig: ClientRequestConfig): Promise<ApiResponse<T>> {\n return this.handleRequest<T>({\n method: 'delete',\n endpoint: endpoint,\n ...clientRequestConfig,\n });\n }\n\n public getClientId(): string | undefined {\n return this.clientId;\n }\n\n get config(): FinalUnmeshedClientConfig {\n return this._config;\n }\n}\n\ninterface ErrorResponse {\n errorMessage?: string;\n [key: string]: any; // To allow other unexpected properties\n}\n\nexport function createUnmeshedClientConfig(config: UnmeshedClientConfig): Required<FinalUnmeshedClientConfig> {\n return {\n baseUrl: config.baseUrl,\n clientId: config.clientId,\n authToken: config.authToken,\n port: config.port ?? 443,\n timeout: config.timeout ?? 5000,\n pollInterval: config.pollInterval ?? 100,\n apiWorkerTimeout: config.apiWorkerTimeout ?? 10000,\n pollTimeout: config.pollTimeout ?? 10000,\n responsePollInterval: config.responsePollInterval ?? 100,\n responsePollTimeout: config.responsePollTimeout ?? 10000,\n responseBatchSize: config.responseBatchSize ?? 50,\n };\n}\n","import { createHash } from 'crypto';\n\nexport class UnmeshedCommonUtils {\n static createSecureHash(input: string): string {\n try {\n const hash = createHash('sha256');\n hash.update(input, 'utf8');\n return hash.digest('hex');\n } catch (e) {\n throw new Error('Error creating hash');\n }\n }\n}\n","import { AxiosRequestConfig } from 'axios';\n\nexport enum ApiCallType {\n SYNC = 'SYNC',\n ASYNC = 'ASYNC',\n STREAM = 'STREAM',\n}\n\nexport interface ApiMappingData {\n endpoint: string;\n processDefNamespace: string;\n processDefName: string;\n processDefVersion: number;\n authType: string;\n authClaims: string;\n createdBy: string;\n updatedBy: string;\n created: Date;\n updated: Date;\n}\n\nexport type ApiMappingWebhookData = {\n endpoint: string;\n name: string;\n uniqueId: string;\n urlSecret: string;\n description: string;\n userIdentifier: string;\n webhookSource: WebhookSource;\n webhookSourceConfig: Record<string, string>;\n expiryDate: Date;\n userType: SQAuthUserType;\n createdBy: string;\n updatedBy: string;\n created: Date;\n updated: Date;\n};\n\nexport enum WebhookSource {\n MS_TEAMS = 'MS_TEAMS',\n NOT_DEFINED = 'NOT_DEFINED',\n}\n\nexport enum SQAuthUserType {\n USER = 'USER',\n API = 'API',\n INTERNAL = 'INTERNAL',\n}\n\nexport enum StepType {\n LIST = 'LIST',\n HTTP = 'HTTP',\n WORKER = 'WORKER',\n SWITCH = 'SWITCH',\n PARALLEL = 'PARALLEL',\n FAIL = 'FAIL',\n PYTHON = 'PYTHON',\n JAVASCRIPT = 'JAVASCRIPT',\n JQ = 'JQ',\n SLACK = 'SLACK',\n GRAPHQL = 'GRAPHQL',\n WAIT = 'WAIT',\n BUILTIN = 'BUILTIN',\n NOOP = 'NOOP',\n AI_AGENT = 'AI_AGENT',\n EXIT = 'EXIT',\n DEPENDSON = 'DEPENDSON',\n PERSISTED_STATE = 'PERSISTED_STATE',\n UPDATE_STEP = 'UPDATE_STEP',\n INTEGRATION = 'INTEGRATION',\n FOREACH = 'FOREACH',\n WHILE = 'WHILE',\n SUB_PROCESS = 'SUB_PROCESS',\n FLOW_GATEWAY = 'FLOW_GATEWAY',\n DECISION_ENGINE = 'DECISION_ENGINE',\n SQLITE = 'SQLITE',\n MANAGED = 'MANAGED',\n}\n\nexport enum StepStatus {\n PENDING = 'PENDING',\n SCHEDULED = 'SCHEDULED',\n RUNNING = 'RUNNING',\n PAUSED = 'PAUSED',\n COMPLETED = 'COMPLETED',\n FAILED = 'FAILED',\n TIMED_OUT = 'TIMED_OUT',\n SKIPPED = 'SKIPPED',\n CANCELLED = 'CANCELLED',\n}\n\nexport enum ProcessStatus {\n RUNNING = 'RUNNING',\n COMPLETED = 'COMPLETED',\n FAILED = 'FAILED',\n TIMED_OUT = 'TIMED_OUT',\n CANCELLED = 'CANCELLED',\n TERMINATED = 'TERMINATED',\n REVIEWED = 'REVIEWED',\n}\n\nexport enum ProcessTriggerType {\n MANUAL = 'MANUAL',\n SCHEDULED = 'SCHEDULED',\n API_MAPPING = 'API_MAPPING',\n WEBHOOK = 'WEBHOOK',\n API = 'API',\n SUB_PROCESS = 'SUB_PROCESS',\n}\n\nexport enum ProcessType {\n STANDARD = 'STANDARD',\n DYNAMIC = 'DYNAMIC',\n API_ORCHESTRATION = 'API_ORCHESTRATION',\n INTERNAL = 'INTERNAL',\n}\n\nexport type ClientProfileData = {\n clientId: string;\n ipAddress: string;\n friendlyName: string;\n userIdentifier: string;\n stepQueueNames: StepQueueNameData[];\n createdBy: string;\n updatedBy: string;\n created: Date;\n updated: Date;\n expiryDate: Date;\n};\n\nexport type FullClientProfileData = {\n clientId: string;\n ipAddress: string;\n friendlyName: string;\n userIdentifier: string;\n stepQueueNames: StepQueueNameData[];\n createdBy: string;\n updatedBy: string;\n created: Date;\n updated: Date;\n expiryDate: Date;\n tokenValue: string;\n};\n\nexport type StepQueueNameData = {\n orgId: number;\n namespace: string;\n stepType: StepType;\n name: string;\n};\n\nexport type ProcessActionResponseData = {\n count: number;\n details: ProcessActionResponseDetailData[];\n};\n\nexport type ProcessActionResponseDetailData = {\n id: string;\n message: string;\n error: string;\n};\n\nexport type ProcessData = {\n processId: number;\n processType: ProcessType;\n triggerType: ProcessTriggerType;\n namespace: string;\n name: string;\n version: number | null;\n historyId: number | null;\n requestId: string;\n correlationId: string;\n status: ProcessStatus;\n input: Record<string, unknown>;\n output: Record<string, unknown>;\n authClaims: Record<string, unknown>;\n stepIdCount: number | null;\n shardName: string;\n shardInstanceId: number | null;\n steps: StepId[];\n stepRecords: StepData[];\n created: number;\n updated: number;\n createdBy: string;\n};\n\nexport type StepData = {\n id: number;\n processId: number;\n ref: string;\n parentId: number | null;\n parentRef: string | null;\n namespace: string;\n name: string;\n type: StepType;\n stepDefinitionHistoryId: number | null;\n status: StepStatus;\n input: Record<string, unknown>;\n output: Record<string, unknown>;\n workerId: string;\n start: number;\n schedule: number;\n priority: number;\n updated: number;\n optional: boolean;\n executionList: StepExecutionData[];\n};\n\nexport type StepExecutionData = {\n id: number;\n scheduled: number;\n polled: number;\n start: number;\n updated: number;\n executor: string;\n ref: string;\n runs: number;\n output: Record<string, unknown>;\n};\n\nexport type StepId = {\n id: number;\n processId: number;\n ref: string;\n};\n\nexport type TagValue = {\n name: string;\n value: string;\n};\n\nexport type ProcessRequestData = {\n name: string;\n namespace: string;\n version: number | null;\n requestId?: string;\n correlationId?: string;\n input?: Record<string, unknown>;\n};\n\nexport type ProcessSearchRequest = {\n startTimeEpoch: number;\n endTimeEpoch?: number | null;\n namespace?: string;\n processTypes?: ProcessType[];\n triggerTypes?: ProcessTriggerType[];\n names?: string[];\n processIds?: number[];\n correlationIds?: string[];\n requestIds?: string[];\n statuses?: ProcessStatus[];\n limit?: number;\n offset?: number;\n tags?: TagValue[];\n};\nexport type StepSize = {\n stepQueueNameData: StepQueueNameData;\n size: number | null;\n};\n\nexport type ClientSubmitResult = {\n processId: number;\n stepId: number;\n errorMessage: string | null;\n httpStatusCode: number | null;\n};\n\nexport type WorkRequest = {\n processId: number;\n stepId: number;\n stepExecutionId: number;\n runCount: number;\n stepName: string;\n stepNamespace: string;\n stepRef: string;\n inputParam: Record<string, unknown>;\n isOptional: boolean;\n polled: number;\n scheduled: number;\n updated: number;\n priority: number;\n};\n\nexport type WorkResponse = {\n processId: number;\n stepId: number;\n stepExecutionId: number;\n runCount: number;\n output: Record<string, unknown>;\n status: StepStatus;\n rescheduleAfterSeconds: number | null;\n startedAt: number;\n};\n\nexport type WorkResult = {\n output: unknown;\n taskExecutionId: string;\n startTime: number;\n endTime: number;\n workRequest: WorkRequest;\n};\n\nexport interface FinalUnmeshedClientConfig {\n baseUrl: string;\n clientId: string;\n authToken: string;\n port: string | number;\n timeout: number;\n apiWorkerTimeout: number;\n pollTimeout: number;\n pollInterval: number;\n responsePollInterval: number;\n responsePollTimeout: number;\n responseBatchSize: number;\n}\n\nexport interface UnmeshedClientConfig {\n baseUrl: string;\n clientId: string;\n authToken: string;\n port: string | number;\n timeout?: number;\n apiWorkerTimeout?: number;\n pollTimeout?: number;\n pollInterval?: number;\n responsePollInterval?: number;\n responsePollTimeout?: number;\n responseBatchSize?: number;\n}\n\nexport interface ApiResponse<T = any> {\n data: T;\n status: number;\n headers: Record<string, string>;\n}\n\nexport interface ApiError extends Error {\n status?: number;\n response?: {\n data?: any;\n status: number;\n headers: Record<string, string>;\n };\n}\n\nexport interface QueryParams {\n [key: string]: string | number | boolean | undefined;\n}\n\nexport interface RequestConfig extends Omit<AxiosRequestConfig, 'baseURL' | 'url' | 'method'> {\n headers?: Record<string, string>;\n}\n\nexport interface HandleRequestConfig {\n method: 'get' | 'post' | 'put' | 'delete';\n endpoint: string;\n params?: QueryParams;\n data?: Record<string, unknown>;\n config?: RequestConfig;\n}\n\nexport interface ClientRequestConfig {\n params?: QueryParams;\n data?: any;\n config?: RequestConfig;\n}\n\ninterface UnmeshedWorker {\n (input: Record<string, any>): Promise<any>;\n}\n\nexport interface UnmeshedWorkerConfig {\n worker: UnmeshedWorker;\n namespace: string;\n name: string;\n maxInProgress: number;\n}\n\nexport interface PollRequestData {\n stepQueueNameData: StepQueueNameData;\n size: number;\n}\nexport interface RenewRegistrationParams {\n friendlyName: string;\n}\n","export type WorkerFunction<T> = (items: T[]) => Promise<void>;\n\nexport class QueuedWorker<T> {\n private readonly queue: BlockingQueue<T>;\n private readonly pollIntervalMs: number;\n private readonly batchSize: number;\n private readonly workerFn: WorkerFunction<T>;\n private readonly timeoutMs: number;\n\n constructor(\n capacity: number,\n pollIntervalMs: number,\n batchSize: number,\n workerFn: WorkerFunction<T>,\n timeoutMs: number\n ) {\n this.queue = new BlockingQueue<T>(capacity);\n this.pollIntervalMs = pollIntervalMs;\n this.batchSize = batchSize;\n this.workerFn = workerFn;\n this.timeoutMs = timeoutMs;\n\n console.log(\n `Configured queued worker with ${pollIntervalMs} ms interval and batch size of ${batchSize} and a timeout of ${timeoutMs} ms`\n );\n // noinspection JSIgnoredPromiseFromCall\n this.start();\n }\n\n async start(): Promise<void> {\n let errorCount = 0;\n // noinspection InfiniteLoopJS\n while (true) {\n try {\n const batch = await this.queue.takeBatch(this.batchSize);\n if (batch.length > 0) {\n console.log(`Batch work ${batch.length} received`);\n await this.runWithTimeout(this.workerFn(batch), this.timeoutMs);\n }\n } catch (error) {\n errorCount++;\n console.error(`Error processing batch - error count : ${errorCount} - `, error);\n await new Promise((resolve) => setTimeout(resolve, 1000));\n }\n await new Promise((resolve) => setTimeout(resolve, this.pollIntervalMs));\n }\n }\n\n private async runWithTimeout(task: Promise<void>, timeoutMs: number): Promise<void> {\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => reject(new Error('Task timed out')), timeoutMs);\n task\n .then(() => {\n clearTimeout(timeout);\n resolve();\n })\n .catch((error) => {\n clearTimeout(timeout);\n reject(error);\n });\n });\n }\n\n async put(item: T): Promise<void> {\n await this.queue.put(item);\n }\n}\n\nclass BlockingQueue<T> {\n private queue: T[] = [];\n private readonly capacity: number;\n\n constructor(capacity: number) {\n if (capacity <= 0) {\n throw new Error('Capacity must be greater than 0');\n }\n this.capacity = capacity;\n }\n\n async put(item: T): Promise<void> {\n while (this.queue.length >= this.capacity) {\n await new Promise((resolve) => setTimeout(resolve, 10));\n }\n this.queue.push(item);\n }\n\n async takeBatch(batchSize: number): Promise<T[]> {\n while (this.queue.length === 0) {\n await new Promise((resolve) => setTimeout(resolve, 10));\n }\n return this.queue.splice(0, batchSize);\n }\n\n size(): number {\n return this.queue.length;\n }\n\n isEmpty(): boolean {\n return this.queue.length === 0;\n }\n\n peek(): T | undefined {\n return this.queue[0];\n }\n}\n","import {\n ApiResponse,\n PollRequestData,\n StepQueueNameData,\n StepStatus,\n UnmeshedWorkerConfig,\n WorkRequest,\n WorkResponse,\n} from '../types';\nimport { UnmeshedApiClient } from './unmeshedApiClient';\nimport { QueuedWorker } from './queuedWorker';\n\nasync function registerPolling(apiClient: UnmeshedApiClient, data: StepQueueNameData[]) {\n const attempt = async (): Promise<any> => {\n try {\n const response = await apiClient.put(`/api/clients/register`, {\n data: data,\n });\n console.log('Successfully renewed registration for workers', data);\n return response.data;\n } catch {\n console.error('An error occurred during polling registration. Retrying in 3 seconds...');\n await new Promise((resolve) => setTimeout(resolve, 3000));\n return attempt();\n }\n };\n\n return attempt();\n}\n\nasync function pollWorker(apiClient: UnmeshedApiClient, data: PollRequestData[]): Promise<WorkRequest[]> {\n try {\n const response: ApiResponse<WorkRequest[]> = await apiClient.post(`/api/clients/poll`, { data: data });\n if (response.data && response.data.length > 0) {\n console.log(`Received ${response.data.length} work requests`);\n }\n return response.data;\n } catch (error) {\n console.error('Error occurred during worker polling', error);\n return [];\n }\n}\n\nasync function postWorkerResponse(apiClient: UnmeshedApiClient, workResponses: WorkResponse[]) {\n try {\n if (workResponses.length > 0) {\n const grouped: Record<StepStatus, number[]> = workResponses.reduce(\n (acc, response) => {\n if (!acc[response.status]) {\n acc[response.status] = [];\n }\n acc[response.status].push(response.stepId);\n return acc;\n },\n {} as Record<StepStatus, number[]>\n );\n const resultString = Object.entries(grouped)\n .map(([status, stepIds]) => `${status}: [${stepIds.join(', ')}]`)\n .join(', ');\n console.log(`Posting response of size: ${workResponses.length} including ids: ${resultString}`);\n const response = await apiClient.post(`/api/clients/bulkResults`, {\n data: workResponses,\n });\n return response.data;\n }\n return {};\n } catch (error) {\n console.log('Error:', error);\n }\n}\n\nasync function runPollWithTimeout(task: Promise<WorkRequest[]>, timeoutMs: number): Promise<WorkRequest[]> {\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => reject(new Error('Task timed out')), timeoutMs);\n task\n .then((workRequests) => {\n clearTimeout(timeout);\n resolve(workRequests);\n })\n .catch((error) => {\n clearTimeout(timeout);\n reject(error);\n });\n });\n}\n\nexport const continuePolling: { value: boolean } = {\n value: true,\n};\n\nexport async function pollForWorkers(apiClient: UnmeshedApiClient, workers: UnmeshedWorkerConfig[]) {\n const queuedWorker: QueuedWorker<WorkResponse> = new QueuedWorker<WorkResponse>(\n 100000,\n apiClient.config.responsePollInterval,\n apiClient.config.responseBatchSize,\n async (batchWork: WorkResponse[]) => {\n await postWorkerResponse(apiClient, batchWork);\n },\n apiClient.config.responsePollTimeout\n );\n\n const registerPollingData = workers.map((worker) => {\n return {\n orgId: 0,\n namespace: worker.namespace,\n stepType: 'WORKER',\n name: worker.name,\n } as StepQueueNameData;\n });\n\n await registerPolling(apiClient, registerPollingData);\n\n const pollWorkerData = workers.map((worker) => {\n return {\n stepQueueNameData: {\n orgId: 0,\n namespace: worker.namespace,\n stepType: 'WORKER',\n name: worker.name,\n },\n size: worker.maxInProgress,\n } as PollRequestData;\n });\n\n let errorCount = 0;\n // noinspection InfiniteLoopJS\n while (continuePolling.value) {\n try {\n const workRequests: WorkRequest[] = await runPollWithTimeout(\n pollWorker(apiClient, pollWorkerData),\n apiClient.config.pollTimeout\n );\n for (const polledWorker of workRequests) {\n const associatedWorker: UnmeshedWorkerConfig | undefined = workers.find(\n (worker) => worker.name === polledWorker.stepName && worker.namespace === polledWorker.stepNamespace\n );\n\n let workerResponse: WorkResponse = {\n processId: polledWorker.processId,\n stepId: polledWorker.stepId,\n stepExecutionId: polledWorker.stepExecutionId,\n runCount: polledWorker.runCount,\n output: {},\n status: StepStatus.RUNNING,\n rescheduleAfterSeconds: null,\n startedAt: new Date().getTime(),\n };\n\n if (!associatedWorker) {\n workerResponse = {\n ...workerResponse,\n output: {\n error: `No worker found for ${polledWorker.stepName} ${polledWorker.stepNamespace}`,\n },\n status: StepStatus.TIMED_OUT,\n };\n await queuedWorker.put(workerResponse);\n continue;\n }\n\n const TIMEOUT = apiClient.config.apiWorkerTimeout;\n\n const timeoutPromise = new Promise((_, reject) => {\n setTimeout(() => reject(new Error('Timed out')), TIMEOUT);\n });\n\n try {\n console.log(\n `Starting work ${polledWorker.processId} : ${polledWorker.stepId} : ${polledWorker.stepName} : ${polledWorker.stepRef}`\n );\n const result = await Promise.race([associatedWorker.worker(polledWorker.inputParam), timeoutPromise]);\n\n workerResponse = {\n ...workerResponse,\n output: {\n ...result,\n __workCompletedAt: new Date().getTime(),\n },\n status: StepStatus.COMPLETED,\n };\n } catch (error: unknown) {\n const err = error as Error;\n if (err.message && err.message === 'Timed out') {\n workerResponse = {\n ...workerResponse,\n output: {\n error: `${err.message} based on work timeout settings in worker - ${apiClient.config.apiWorkerTimeout} ms`,\n },\n status: StepStatus.TIMED_OUT,\n };\n } else {\n workerResponse = {\n ...workerResponse,\n output: {\n error: safeStringifyError(err),\n },\n status: StepStatus.FAILED,\n };\n console.error('Error:', err.message);\n }\n }\n await queuedWorker.put(workerResponse);\n }\n await new Promise((resolve) => setTimeout(resolve, apiClient.config.pollInterval));\n } catch (error) {\n errorCount++;\n console.error(`Error processing batch - error count : ${errorCount} - `, error);\n await new Promise((resolve) => setTimeout(resolve, 1000));\n }\n }\n}\n\nfunction safeStringifyError(error: Error) {\n try {\n if (error instanceof Error) {\n const plainError = {\n ...error,\n name: error.name,\n message: error.message,\n stack: error.stack,\n };\n return JSON.stringify(plainError);\n }\n return JSON.stringify(error);\n } catch (stringifyError: unknown) {\n if (stringifyError instanceof Error) {\n return `Error stringification failed: ${stringifyError.message}`;\n }\n return 'Error stringification failed: An unknown error occurred during stringification.';\n }\n}\n\nexport async function startPollingWorkers(\n apiClient: UnmeshedApiClient,\n workers: UnmeshedWorkerConfig[],\n intervalMs: number = 5000\n) {\n async function pollCycle() {\n try {\n await pollForWorkers(apiClient, workers);\n } catch (error) {\n console.error('Error during worker polling:', error);\n }\n\n setTimeout(pollCycle, intervalMs);\n }\n\n await pollCycle();\n}\n","import {\n ApiCallType,\n ProcessActionResponseData,\n ProcessData,\n ProcessRequestData,\n ProcessSearchRequest,\n StepData,\n} from '../types';\nimport { isAxiosError } from 'axios';\nimport { UnmeshedApiClient } from './unmeshedApiClient';\n\nconst PROCESS_PREFIX = 'api/process';\n\nexport const runProcessSync = async (\n apiClient: UnmeshedApiClient,\n ProcessRequestData: ProcessRequestData\n): Promise<ProcessData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/runSync`, {\n data: ProcessRequestData,\n params: {\n clientId: apiClient.getClientId(),\n },\n });\n console.log('Response:', response);\n return response.data;\n } catch (error) {\n console.error('Some error occurred running process request : ', error);\n throw error;\n }\n};\n\nexport const runProcessAsync = async (\n apiClient: UnmeshedApiClient,\n ProcessRequestData: ProcessRequestData\n): Promise<ProcessData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/runAsync`, {\n data: ProcessRequestData,\n params: {\n clientId: apiClient.getClientId(),\n },\n });\n console.log('Response:', response);\n return response.data;\n } catch (error) {\n console.error('Some error occurred running process request : ', error);\n throw error;\n }\n};\n\nexport const getProcessData = async (\n apiClient: UnmeshedApiClient,\n processId: number,\n includeSteps: boolean = false\n): Promise<ProcessData> => {\n if (!processId) {\n throw new Error('Process ID cannot be null');\n }\n try {\n const response = await apiClient.get<ProcessData>(`${PROCESS_PREFIX}/context/${processId}`, { includeSteps });\n return response.data;\n } catch (error) {\n console.error('Error occurred while fetching process record: ', error);\n throw error;\n }\n};\n\nexport const getStepData = async (apiClient: UnmeshedApiClient, stepId: number): Promise<StepData> => {\n if (!stepId) {\n throw new Error('Step ID cannot be null or undefined');\n }\n try {\n const response = await apiClient.get<StepData>(`${PROCESS_PREFIX}/stepContext/${stepId}`);\n return response.data;\n } catch (error) {\n console.log('Error occurred while getStepData: ', error);\n throw error;\n }\n};\n\nexport const bulkTerminate = async (\n apiClient: UnmeshedApiClient,\n processIds: number[],\n reason?: string\n): Promise<ProcessActionResponseData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/bulkTerminate`, {\n params: { reason },\n data: processIds,\n });\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(`Error occurred while terminating processes: ${err.message || error}`);\n }\n};\n\nexport const bulkResume = async (\n apiClient: UnmeshedApiClient,\n processIds: number[]\n): Promise<ProcessActionResponseData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/bulkResume`, {\n data: processIds,\n });\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(`Error occurred while resuming processes: ${err.message || error}`);\n }\n};\n\nexport const bulkReviewed = async (\n apiClient: UnmeshedApiClient,\n processIds: number[],\n reason?: string\n): Promise<ProcessActionResponseData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/bulkReviewed`, {\n data: processIds,\n params: { reason },\n });\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(`Error occurred while marking processes as reviewed: ${err.message || error}`);\n }\n};\n\nexport const rerun = async (\n apiClient: UnmeshedApiClient,\n processId: number,\n version?: number\n): Promise<ProcessData> => {\n const params: Record<string, any> = {\n processId,\n };\n\n if (version !== undefined) {\n params['version'] = version;\n }\n\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/rerun`, {\n params,\n });\n\n return response.data as ProcessData;\n } catch (error) {\n if (isAxiosError(error)) {\n throw new Error(`HTTP request error during rerun process: ${error.response?.status} - ${error.response?.data}`);\n } else {\n const err = error as Error;\n throw new Error(`Unexpected error during rerun process: ${err.message || err}`);\n }\n }\n};\n\n// export const searchProcessExecutions = async (apiClient: UnmeshedApiClient, params: ProcessSearchRequest) => {\n// const queryParams = new URLSearchParams();\n\n// if (params.startTimeEpoch !== undefined && params.startTimeEpoch !== 0)\n// queryParams.set('startTimeEpoch', params.startTimeEpoch.toString());\n// if (params.endTimeEpoch !== undefined && params.endTimeEpoch !== 0)\n// queryParams.set('endTimeEpoch', (params.endTimeEpoch || 0).toString());\n// if (params.namespace) queryParams.set('namespace', params.namespace);\n// if (params.names && params.names.length) queryParams.set('names', params.names.join(','));\n// if (params.processIds && params.processIds.length) queryParams.set('processIds', params.processIds.join(','));\n// if (params.correlationIds && params.correlationIds.length)\n// queryParams.set('correlationIds', params.correlationIds.join(','));\n// if (params.requestIds && params.requestIds.length) queryParams.set('requestIds', params.requestIds.join(','));\n// if (params.statuses && params.statuses.length) queryParams.set('statuses', params.statuses.join(','));\n// if (params.triggerTypes && params.triggerTypes.length) queryParams.set('triggerTypes', params.triggerTypes.join(','));\n\n// const updatedParams = Object.fromEntries(new URLSearchParams(queryParams));\n\n// try {\n// const response = await apiClient.post(`api/stats/process/search`, updatedParams);\n// console.log('Response:', response);\n// return response.data;\n// } catch (error) {\n// console.error('Error occurred while searching process executions: ', error);\n// throw error;\n// }\n// };\n\nexport const searchProcessExecutions = async (apiClient: UnmeshedApiClient, params: ProcessSearchRequest) => {\n // everything in body now\n const body: Record<string, any> = {};\n\n if (params.startTimeEpoch) body.startTimeEpoch = params.startTimeEpoch;\n if (params.endTimeEpoch) body.endTimeEpoch = params.endTimeEpoch;\n\n if (params.namespace) body.namespace = params.namespace;\n if (params.names?.length) body.names = params.names;\n if (params.processIds?.length) body.processIds = params.processIds;\n if (params.correlationIds?.length) body.correlationIds = params.correlationIds;\n if (params.requestIds?.length) body.requestIds = params.requestIds;\n if (params.statuses?.length) body.statuses = params.statuses;\n if (params.triggerTypes?.length) body.triggerTypes = params.triggerTypes;\n\n if (params.tags?.length) body.tags = params.tags;\n\n try {\n const response = await apiClient.post(`api/stats/process/search`, {\n data: body, // ✅ everything sent inside body\n params: {}, // ✅ now empty\n });\n\n return response.data;\n } catch (error) {\n console.error('Error occurred while searching process executions:', error);\n throw error;\n }\n};\n\nexport const invokeApiMappingGet = async (\n apiClient: UnmeshedApiClient,\n endpoint: string,\n id: string,\n correlationId: string,\n apiCallType: ApiCallType\n) => {\n try {\n const response = await apiClient.get(`${PROCESS_PREFIX}/api/call/${endpoint}`, {\n id: id,\n correlationId: correlationId,\n apiCallType,\n });\n console.log('Response:', response);\n return response.data;\n } catch (error) {\n console.error('Error occurred while invoking API Mapping GET: ', error);\n throw error;\n }\n};\n\nexport const invokeApiMappingPost = async (\n apiClient: UnmeshedApiClient,\n endpoint: string,\n input: Record<string, any>,\n id: string,\n correlationId: string,\n apiCallType: ApiCallType = ApiCallType.ASYNC\n): Promise<any> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/api/call/${endpoint}`, {\n data: input,\n params: {\n id: id,\n correlationId: correlationId,\n apiCallType,\n },\n });\n\n return response.data;\n } catch (error) {\n console.error('Error occurred while invoking API Mapping POST: ', error);\n throw error;\n }\n};\n","import { RenewRegistrationParams } from '../types';\nimport { UnmeshedApiClient } from './unmeshedApiClient';\n\nexport const renewRegistration = async (\n apiClient: UnmeshedApiClient,\n params: RenewRegistrationParams\n): Promise<string> => {\n try {\n const response = await apiClient.put('/api/clients/register', {\n params: { ...params },\n });\n console.debug('Response from server:', response);\n return response.data;\n } catch (error) {\n console.error('Error occurred during registration renewal:', error);\n throw error;\n }\n};\n","import {\n ApiCallType,\n ProcessRequestData,\n ProcessSearchRequest,\n RenewRegistrationParams,\n UnmeshedClientConfig,\n UnmeshedWorkerConfig,\n} from './types';\nimport { UnmeshedApiClient } from './apis/unmeshedApiClient';\nimport { startPollingWorkers } from './apis/pollerClientImpl';\nimport {\n bulkResume,\n bulkReviewed,\n bulkTerminate,\n getProcessData,\n getStepData,\n invokeApiMappingGet,\n invokeApiMappingPost,\n rerun,\n runProcessAsync,\n runProcessSync,\n searchProcessExecutions,\n} from './apis/processClientImpl';\nimport { renewRegistration } from './apis/registrationClientImpl';\n\n// noinspection JSUnusedGlobalSymbols\nexport class UnmeshedClient {\n private client: UnmeshedApiClient;\n\n constructor(config: UnmeshedClientConfig) {\n this.client = new UnmeshedApiClient(config);\n }\n\n startPolling(workers: UnmeshedWorkerConfig[]) {\n startPollingWorkers(this.client, workers);\n }\n\n runProcessSync(ProcessRequestData: ProcessRequestData) {\n return runProcessSync(this.client, ProcessRequestData);\n }\n\n runProcessAsync(ProcessRequestData: ProcessRequestData) {\n return runProcessAsync(this.client, ProcessRequestData);\n }\n\n getProcessData(processId: number, includeSteps: boolean) {\n return getProcessData(this.client, processId, includeSteps);\n }\n\n getStepData(stepId: number) {\n return getStepData(this.client, stepId);\n }\n\n bulkTerminate(processIds: number[], reason?: string) {\n return bulkTerminate(this.client, processIds, reason);\n }\n\n bulkResume(processIds: number[]) {\n return bulkResume(this.client, processIds);\n }\n\n bulkReviewed(processIds: number[], reason?: string) {\n return bulkReviewed(this.client, processIds, reason);\n }\n\n reRun(processId: number, version?: number) {\n return rerun(this.client, processId, version);\n }\n\n searchProcessExecution(params: ProcessSearchRequest) {\n return searchProcessExecutions(this.client, params);\n }\n\n invokeApiMappingGet(\n apiClient: UnmeshedApiClient,\n endpoint: string,\n id: string,\n correlationId: string,\n apiCallType: ApiCallType\n ) {\n return invokeApiMappingGet(apiClient, endpoint, id, correlationId, apiCallType);\n }\n\n invokeApiMappingPost(\n endpoint: string,\n input: Record<string, any>,\n id: string,\n correlationId: string,\n apiCallType: ApiCallType\n ) {\n return invokeApiMappingPost(this.client, endpoint, input, id, correlationId, apiCallType);\n }\n\n reNewRegistration(params: RenewRegistrationParams) {\n return renewRegistration(this.client, params);\n }\n}\n\nexport * from './types';\n"],"mappings":";AAAA,OAAO,WAAqG;;;ACA5G,SAAS,kBAAkB;AAEpB,IAAM,sBAAN,MAA0B;AAAA,EAC/B,OAAO,iBAAiB,OAAuB;AAC7C,QAAI;AACF,YAAM,OAAO,WAAW,QAAQ;AAChC,WAAK,OAAO,OAAO,MAAM;AACzB,aAAO,KAAK,OAAO,KAAK;AAAA,IAC1B,SAAS,GAAG;AACV,YAAM,IAAI,MAAM,qBAAqB;AAAA,IACvC;AAAA,EACF;AACF;;;ADAO,IAAM,oBAAN,MAAwB;AAAA,EACrB,gBAAsC;AAAA,EACtC,WAA+B;AAAA,EAC/B;AAAA,EAER,YAAY,sBAA4C;AACtD,YAAQ,IAAI,iCAAiC;AAE7C,SAAK,UAAU,2BAA2B,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OAAO,IAAI,eAAe,WAAW;AAAA,EAC1F;AAAA,EAEA,kBAAkB,QAAiC;AACjD,WAAO,kBAAkB,KAAK,QAAQ,MAAM;AAAA,EAC9C;AACF;","names":["ApiCallType","WebhookSource","SQAuthUserType","StepType","StepStatus","ProcessStatus","ProcessTriggerType","ProcessType","response","ProcessRequestData","ProcessRequestData"]}
|
|
1
|
+
{"version":3,"sources":["../src/apis/unmeshedApiClient.ts","../src/utils/unmeshedCommonUtils.ts","../src/types/index.ts","../src/apis/queuedWorker.ts","../src/apis/pollerClientImpl.ts","../src/apis/processClientImpl.ts","../src/apis/registrationClientImpl.ts","../src/index.ts"],"sourcesContent":["import axios, { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, RawAxiosRequestHeaders } from 'axios';\nimport {\n ApiResponse,\n ClientRequestConfig,\n FinalUnmeshedClientConfig,\n HandleRequestConfig,\n QueryParams,\n RequestConfig,\n UnmeshedClientConfig,\n} from '../types';\nimport { UnmeshedCommonUtils } from '../utils/unmeshedCommonUtils';\n\nexport class UnmeshedApiClient {\n private axiosInstance: AxiosInstance | null = null;\n private clientId: string | undefined = undefined;\n private _config: FinalUnmeshedClientConfig;\n\n constructor(unmeshedClientConfig: UnmeshedClientConfig) {\n console.log('Initializing Unmeshed ApiClient');\n\n this._config = createUnmeshedClientConfig(unmeshedClientConfig);\n\n console.log(this._config);\n\n this.clientId = this._config.clientId;\n\n if (!this._config.baseUrl) {\n throw new Error('baseUrl is required');\n }\n\n const baseURL = this._config.port ? `${this._config.baseUrl}:${this._config.port}` : this._config.baseUrl;\n\n this.axiosInstance = axios.create({\n baseURL,\n timeout: this._config.timeout,\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer client.sdk.${this._config.clientId}.${UnmeshedCommonUtils.createSecureHash(\n this._config.authToken\n )}`,\n } as RawAxiosRequestHeaders,\n });\n }\n\n private async handleRequest<T>({\n method,\n endpoint,\n params,\n data,\n config,\n }: HandleRequestConfig): Promise<ApiResponse<T>> {\n if (!this.axiosInstance) {\n throw new Error('ApiClient must be initialized before making requests');\n }\n\n try {\n const response: AxiosResponse<T> = await this.axiosInstance.request<T>({\n method,\n url: endpoint,\n params,\n data,\n ...config,\n } as AxiosRequestConfig);\n\n return {\n data: response.data,\n status: response.status,\n headers: response.headers as Record<string, string>,\n };\n } catch (error) {\n if (axios.isAxiosError(error)) {\n console.error('Request failed:', error.message);\n throw this.handleError(error);\n }\n console.error('Unexpected error:', (error as Error).message);\n throw error;\n }\n }\n\n private handleError(error: AxiosError): Error {\n console.error('Error details:', {\n message: error.message,\n status: error.response?.status,\n data: error.response?.data,\n });\n\n let response = error?.response?.data as ErrorResponse;\n if (response?.errorMessage) {\n return new Error(`${response.errorMessage} [Status code: ${error.response?.status || ''}]`);\n }\n\n return new Error(error.message, { cause: error.response?.data || {} });\n }\n\n public async get<T = any>(endpoint: string, params?: QueryParams, config?: RequestConfig): Promise<ApiResponse<T>> {\n return this.handleRequest<T>({\n method: 'get',\n endpoint: endpoint,\n params: params,\n config: config,\n });\n }\n\n public async post<T = any>(endpoint: string, clientRequestConfig: ClientRequestConfig): Promise<ApiResponse<T>> {\n return this.handleRequest<T>({\n method: 'post',\n endpoint: endpoint,\n ...clientRequestConfig,\n });\n }\n\n public async put<T = any>(endpoint: string, clientRequestConfig: ClientRequestConfig): Promise<ApiResponse<T>> {\n return this.handleRequest<T>({\n method: 'put',\n endpoint: endpoint,\n ...clientRequestConfig,\n });\n }\n\n public async delete<T = any>(endpoint: string, clientRequestConfig: ClientRequestConfig): Promise<ApiResponse<T>> {\n return this.handleRequest<T>({\n method: 'delete',\n endpoint: endpoint,\n ...clientRequestConfig,\n });\n }\n\n public getClientId(): string | undefined {\n return this.clientId;\n }\n\n get config(): FinalUnmeshedClientConfig {\n return this._config;\n }\n}\n\ninterface ErrorResponse {\n errorMessage?: string;\n [key: string]: any; // To allow other unexpected properties\n}\n\nexport function createUnmeshedClientConfig(config: UnmeshedClientConfig): Required<FinalUnmeshedClientConfig> {\n return {\n baseUrl: config.baseUrl,\n clientId: config.clientId,\n authToken: config.authToken,\n port: config.port ?? 443,\n timeout: config.timeout ?? 5000,\n pollInterval: config.pollInterval ?? 100,\n apiWorkerTimeout: config.apiWorkerTimeout ?? 10000,\n pollTimeout: config.pollTimeout ?? 10000,\n responsePollInterval: config.responsePollInterval ?? 100,\n responsePollTimeout: config.responsePollTimeout ?? 10000,\n responseBatchSize: config.responseBatchSize ?? 50,\n };\n}\n","import { createHash } from 'crypto';\n\nexport class UnmeshedCommonUtils {\n static createSecureHash(input: string): string {\n try {\n const hash = createHash('sha256');\n hash.update(input, 'utf8');\n return hash.digest('hex');\n } catch (e) {\n throw new Error('Error creating hash');\n }\n }\n}\n","import { AxiosRequestConfig } from 'axios';\n\nexport enum ApiCallType {\n SYNC = 'SYNC',\n ASYNC = 'ASYNC',\n STREAM = 'STREAM',\n}\n\nexport interface ApiMappingData {\n endpoint: string;\n processDefNamespace: string;\n processDefName: string;\n processDefVersion: number;\n authType: string;\n authClaims: string;\n createdBy: string;\n updatedBy: string;\n created: Date;\n updated: Date;\n}\n\nexport type ApiMappingWebhookData = {\n endpoint: string;\n name: string;\n uniqueId: string;\n urlSecret: string;\n description: string;\n userIdentifier: string;\n webhookSource: WebhookSource;\n webhookSourceConfig: Record<string, string>;\n expiryDate: Date;\n userType: SQAuthUserType;\n createdBy: string;\n updatedBy: string;\n created: Date;\n updated: Date;\n};\n\nexport enum WebhookSource {\n MS_TEAMS = 'MS_TEAMS',\n NOT_DEFINED = 'NOT_DEFINED',\n}\n\nexport enum SQAuthUserType {\n USER = 'USER',\n API = 'API',\n INTERNAL = 'INTERNAL',\n}\n\nexport enum StepType {\n LIST = 'LIST',\n HTTP = 'HTTP',\n WORKER = 'WORKER',\n SWITCH = 'SWITCH',\n PARALLEL = 'PARALLEL',\n FAIL = 'FAIL',\n PYTHON = 'PYTHON',\n JAVASCRIPT = 'JAVASCRIPT',\n JQ = 'JQ',\n SLACK = 'SLACK',\n GRAPHQL = 'GRAPHQL',\n WAIT = 'WAIT',\n BUILTIN = 'BUILTIN',\n NOOP = 'NOOP',\n AI_AGENT = 'AI_AGENT',\n EXIT = 'EXIT',\n DEPENDSON = 'DEPENDSON',\n PERSISTED_STATE = 'PERSISTED_STATE',\n UPDATE_STEP = 'UPDATE_STEP',\n INTEGRATION = 'INTEGRATION',\n FOREACH = 'FOREACH',\n WHILE = 'WHILE',\n SUB_PROCESS = 'SUB_PROCESS',\n FLOW_GATEWAY = 'FLOW_GATEWAY',\n DECISION_ENGINE = 'DECISION_ENGINE',\n SQLITE = 'SQLITE',\n MANAGED = 'MANAGED',\n}\n\nexport enum StepStatus {\n PENDING = 'PENDING',\n SCHEDULED = 'SCHEDULED',\n RUNNING = 'RUNNING',\n PAUSED = 'PAUSED',\n COMPLETED = 'COMPLETED',\n FAILED = 'FAILED',\n TIMED_OUT = 'TIMED_OUT',\n SKIPPED = 'SKIPPED',\n CANCELLED = 'CANCELLED',\n}\n\nexport enum ProcessStatus {\n RUNNING = 'RUNNING',\n COMPLETED = 'COMPLETED',\n FAILED = 'FAILED',\n TIMED_OUT = 'TIMED_OUT',\n CANCELLED = 'CANCELLED',\n TERMINATED = 'TERMINATED',\n REVIEWED = 'REVIEWED',\n}\n\nexport enum ProcessTriggerType {\n MANUAL = 'MANUAL',\n SCHEDULED = 'SCHEDULED',\n API_MAPPING = 'API_MAPPING',\n WEBHOOK = 'WEBHOOK',\n API = 'API',\n SUB_PROCESS = 'SUB_PROCESS',\n}\n\nexport enum ProcessType {\n STANDARD = 'STANDARD',\n DYNAMIC = 'DYNAMIC',\n API_ORCHESTRATION = 'API_ORCHESTRATION',\n INTERNAL = 'INTERNAL',\n}\n\nexport type ClientProfileData = {\n clientId: string;\n ipAddress: string;\n friendlyName: string;\n userIdentifier: string;\n stepQueueNames: StepQueueNameData[];\n createdBy: string;\n updatedBy: string;\n created: Date;\n updated: Date;\n expiryDate: Date;\n};\n\nexport type FullClientProfileData = {\n clientId: string;\n ipAddress: string;\n friendlyName: string;\n userIdentifier: string;\n stepQueueNames: StepQueueNameData[];\n createdBy: string;\n updatedBy: string;\n created: Date;\n updated: Date;\n expiryDate: Date;\n tokenValue: string;\n};\n\nexport type StepQueueNameData = {\n orgId: number;\n namespace: string;\n stepType: StepType;\n name: string;\n};\n\nexport type ProcessActionResponseData = {\n count: number;\n details: ProcessActionResponseDetailData[];\n};\n\nexport type ProcessActionResponseDetailData = {\n id: string;\n message: string;\n error: string;\n};\n\nexport type ProcessData = {\n processId: number;\n processType: ProcessType;\n triggerType: ProcessTriggerType;\n namespace: string;\n name: string;\n version: number | null;\n historyId: number | null;\n requestId: string;\n correlationId: string;\n status: ProcessStatus;\n input: Record<string, unknown>;\n output: Record<string, unknown>;\n authClaims: Record<string, unknown>;\n stepIdCount: number | null;\n shardName: string;\n shardInstanceId: number | null;\n steps: StepId[];\n stepRecords: StepData[];\n created: number;\n updated: number;\n createdBy: string;\n};\n\nexport type StepData = {\n id: number;\n processId: number;\n ref: string;\n parentId: number | null;\n parentRef: string | null;\n namespace: string;\n name: string;\n type: StepType;\n stepDefinitionHistoryId: number | null;\n status: StepStatus;\n input: Record<string, unknown>;\n output: Record<string, unknown>;\n workerId: string;\n start: number;\n schedule: number;\n priority: number;\n updated: number;\n optional: boolean;\n executionList: StepExecutionData[];\n};\n\nexport type StepExecutionData = {\n id: number;\n scheduled: number;\n polled: number;\n start: number;\n updated: number;\n executor: string;\n ref: string;\n runs: number;\n output: Record<string, unknown>;\n};\n\nexport type StepId = {\n id: number;\n processId: number;\n ref: string;\n};\n\nexport type TagValue = {\n name: string;\n value: string;\n};\n\nexport type ProcessRequestData = {\n name: string;\n namespace: string;\n version: number | null;\n requestId?: string;\n correlationId?: string;\n input?: Record<string, unknown>;\n};\n\nexport type ProcessSearchRequest = {\n startTimeEpoch: number;\n endTimeEpoch?: number | null;\n namespace?: string;\n processTypes?: ProcessType[];\n triggerTypes?: ProcessTriggerType[];\n names?: string[];\n processIds?: number[];\n correlationIds?: string[];\n requestIds?: string[];\n statuses?: ProcessStatus[];\n limit?: number;\n offset?: number;\n tags?: TagValue[];\n};\n\nexport interface ExecutionWait {\n result: { waitUntil: number };\n logs: [];\n}\n\nexport interface ExecutionTimelineType {\n id: number;\n executor: string;\n output: ExecutionWait | null;\n polled: number;\n scheduled: number;\n start: number;\n updated: number;\n ref?: string | null;\n}\n\nexport interface ExecutionDetails extends ExecutionTimelineType {\n stepRef: string;\n}\n\nexport interface AuditInfo {\n createdBy: string;\n updatedBy: string;\n created: number;\n updated: number;\n}\n\nexport interface Step extends NewStepData, AuditInfo, Object {\n executionList?: ExecutionDetails[];\n parentRef?: string;\n status?: string;\n completed?: number;\n children: Step[];\n executionCount?: number;\n triggerType?: string;\n}\nexport interface StepConfiguration {\n errorPolicyName?: string;\n useCache?: boolean;\n stream?: boolean;\n cacheKey?: string;\n cacheTimeoutSeconds?: number;\n jqTransformer?: string;\n rateLimitWindowSeconds?: number | null;\n rateLimitMaxRequests?: number | null;\n preExecutionScript?: string;\n scriptLanguage?: 'JAVASCRIPT' | 'PYTHON';\n constructInputFromScript?: boolean;\n additionalRefs?: string[];\n}\n\nexport interface NewStepData {\n type: StepType;\n name: string;\n namespace: string;\n ref: string;\n optional?: boolean;\n configuration?: StepConfiguration;\n children?: Step[];\n input?: Record<string, any>;\n output?: Record<string, any>;\n}\n\nexport type ProcessDefinitionDeleteRequest = {\n namespace: string;\n name: string;\n type: string;\n version: number;\n steps?: Step[];\n};\n\nexport interface ProcessRequest {\n name?: string;\n namespace?: string;\n version?: number | null;\n id?: string | null;\n correlationId?: string | null;\n input?: Record<string, any> | null;\n testRun?: boolean | null;\n}\nexport interface ProcessConfiguration {\n completionTimeout?: number;\n onTimeoutProcess?: ProcessRequest;\n onFailProcess?: ProcessRequest | null;\n onCompleteProcess?: ProcessRequest | null;\n onCancelProcess?: ProcessRequest;\n}\n\nexport interface ProcessDefinitionData {\n namespace: string;\n name: string;\n version?: number;\n type: ProcessType | string;\n description?: string;\n configuration?: ProcessConfiguration;\n steps: Step[];\n defaultInput?: Record<string, any>;\n defaultOutput?: Record<string, any>;\n outputMapping?: Record<string, any>;\n tags?: TagValue[];\n}\nexport interface ProcessDefinitionsDetail {\n name: string;\n namespace: string;\n}\n\nexport interface ProcessDefinitionDetails {\n name: string;\n namespace: string;\n version?: number;\n}\n\nexport interface ExecutionWait {\n result: { waitUntil: number };\n logs: [];\n}\n\nexport interface ExecutionTimelineType {\n id: number;\n executor: string;\n output: ExecutionWait | null;\n polled: number;\n scheduled: number;\n start: number;\n updated: number;\n ref?: string | null;\n}\n\nexport interface ExecutionDetails extends ExecutionTimelineType {\n stepRef: string;\n}\n\nexport interface AuditInfo {\n createdBy: string;\n updatedBy: string;\n created: number;\n updated: number;\n}\n\nexport interface Step extends NewStepData, AuditInfo, Object {\n executionList?: ExecutionDetails[];\n parentRef?: string;\n status?: string;\n completed?: number;\n children: Step[];\n executionCount?: number;\n triggerType?: string;\n}\nexport interface StepConfiguration {\n errorPolicyName?: string;\n useCache?: boolean;\n stream?: boolean;\n cacheKey?: string;\n cacheTimeoutSeconds?: number;\n jqTransformer?: string;\n rateLimitWindowSeconds?: number | null;\n rateLimitMaxRequests?: number | null;\n preExecutionScript?: string;\n scriptLanguage?: 'JAVASCRIPT' | 'PYTHON';\n constructInputFromScript?: boolean;\n additionalRefs?: string[];\n streamAllStatuses?: boolean;\n}\n\nexport interface NewStepData {\n type: StepType;\n name: string;\n namespace: string;\n ref: string;\n optional?: boolean;\n configuration?: StepConfiguration;\n children?: Step[];\n input?: Record<string, any>;\n output?: Record<string, any>;\n}\n\nexport type StepSize = {\n stepQueueNameData: StepQueueNameData;\n size: number | null;\n};\n\nexport type ClientSubmitResult = {\n processId: number;\n stepId: number;\n errorMessage: string | null;\n httpStatusCode: number | null;\n};\n\nexport type WorkRequest = {\n processId: number;\n stepId: number;\n stepExecutionId: number;\n runCount: number;\n stepName: string;\n stepNamespace: string;\n stepRef: string;\n inputParam: Record<string, unknown>;\n isOptional: boolean;\n polled: number;\n scheduled: number;\n updated: number;\n priority: number;\n};\n\nexport type WorkResponse = {\n processId: number;\n stepId: number;\n stepExecutionId: number;\n runCount: number;\n output: Record<string, unknown>;\n status: StepStatus;\n rescheduleAfterSeconds: number | null;\n startedAt: number;\n};\n\nexport type WorkResult = {\n output: unknown;\n taskExecutionId: string;\n startTime: number;\n endTime: number;\n workRequest: WorkRequest;\n};\n\nexport interface FinalUnmeshedClientConfig {\n baseUrl: string;\n clientId: string;\n authToken: string;\n port: string | number;\n timeout: number;\n apiWorkerTimeout: number;\n pollTimeout: number;\n pollInterval: number;\n responsePollInterval: number;\n responsePollTimeout: number;\n responseBatchSize: number;\n}\n\nexport interface UnmeshedClientConfig {\n baseUrl: string;\n clientId: string;\n authToken: string;\n port: string | number;\n timeout?: number;\n apiWorkerTimeout?: number;\n pollTimeout?: number;\n pollInterval?: number;\n responsePollInterval?: number;\n responsePollTimeout?: number;\n responseBatchSize?: number;\n}\n\nexport interface ApiResponse<T = any> {\n data: T;\n status: number;\n headers: Record<string, string>;\n}\n\nexport interface ApiError extends Error {\n status?: number;\n response?: {\n data?: any;\n status: number;\n headers: Record<string, string>;\n };\n}\n\nexport interface QueryParams {\n [key: string]: string | number | boolean | undefined;\n}\n\nexport interface RequestConfig extends Omit<AxiosRequestConfig, 'baseURL' | 'url' | 'method'> {\n headers?: Record<string, string>;\n}\n\nexport interface HandleRequestConfig {\n method: 'get' | 'post' | 'put' | 'delete';\n endpoint: string;\n params?: QueryParams;\n data?: Record<string, unknown>;\n config?: RequestConfig;\n}\n\nexport interface ClientRequestConfig {\n params?: QueryParams;\n data?: any;\n config?: RequestConfig;\n}\n\ninterface UnmeshedWorker {\n (input: Record<string, any>): Promise<any>;\n}\n\nexport interface UnmeshedWorkerConfig {\n worker: UnmeshedWorker;\n namespace: string;\n name: string;\n maxInProgress: number;\n}\n\nexport interface PollRequestData {\n stepQueueNameData: StepQueueNameData;\n size: number;\n}\nexport interface RenewRegistrationParams {\n friendlyName: string;\n}\n","export type WorkerFunction<T> = (items: T[]) => Promise<void>;\n\nexport class QueuedWorker<T> {\n private readonly queue: BlockingQueue<T>;\n private readonly pollIntervalMs: number;\n private readonly batchSize: number;\n private readonly workerFn: WorkerFunction<T>;\n private readonly timeoutMs: number;\n\n constructor(\n capacity: number,\n pollIntervalMs: number,\n batchSize: number,\n workerFn: WorkerFunction<T>,\n timeoutMs: number\n ) {\n this.queue = new BlockingQueue<T>(capacity);\n this.pollIntervalMs = pollIntervalMs;\n this.batchSize = batchSize;\n this.workerFn = workerFn;\n this.timeoutMs = timeoutMs;\n\n console.log(\n `Configured queued worker with ${pollIntervalMs} ms interval and batch size of ${batchSize} and a timeout of ${timeoutMs} ms`\n );\n // noinspection JSIgnoredPromiseFromCall\n this.start();\n }\n\n async start(): Promise<void> {\n let errorCount = 0;\n // noinspection InfiniteLoopJS\n while (true) {\n try {\n const batch = await this.queue.takeBatch(this.batchSize);\n if (batch.length > 0) {\n console.log(`Batch work ${batch.length} received`);\n await this.runWithTimeout(this.workerFn(batch), this.timeoutMs);\n }\n } catch (error) {\n errorCount++;\n console.error(`Error processing batch - error count : ${errorCount} - `, error);\n await new Promise((resolve) => setTimeout(resolve, 1000));\n }\n await new Promise((resolve) => setTimeout(resolve, this.pollIntervalMs));\n }\n }\n\n private async runWithTimeout(task: Promise<void>, timeoutMs: number): Promise<void> {\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => reject(new Error('Task timed out')), timeoutMs);\n task\n .then(() => {\n clearTimeout(timeout);\n resolve();\n })\n .catch((error) => {\n clearTimeout(timeout);\n reject(error);\n });\n });\n }\n\n async put(item: T): Promise<void> {\n await this.queue.put(item);\n }\n}\n\nclass BlockingQueue<T> {\n private queue: T[] = [];\n private readonly capacity: number;\n\n constructor(capacity: number) {\n if (capacity <= 0) {\n throw new Error('Capacity must be greater than 0');\n }\n this.capacity = capacity;\n }\n\n async put(item: T): Promise<void> {\n while (this.queue.length >= this.capacity) {\n await new Promise((resolve) => setTimeout(resolve, 10));\n }\n this.queue.push(item);\n }\n\n async takeBatch(batchSize: number): Promise<T[]> {\n while (this.queue.length === 0) {\n await new Promise((resolve) => setTimeout(resolve, 10));\n }\n return this.queue.splice(0, batchSize);\n }\n\n size(): number {\n return this.queue.length;\n }\n\n isEmpty(): boolean {\n return this.queue.length === 0;\n }\n\n peek(): T | undefined {\n return this.queue[0];\n }\n}\n","import {\n ApiResponse,\n PollRequestData,\n StepQueueNameData,\n StepStatus,\n UnmeshedWorkerConfig,\n WorkRequest,\n WorkResponse,\n} from '../types';\nimport { UnmeshedApiClient } from './unmeshedApiClient';\nimport { QueuedWorker } from './queuedWorker';\nimport os from 'os';\n\nasync function registerPolling(apiClient: UnmeshedApiClient, data: StepQueueNameData[]) {\n const attempt = async (): Promise<any> => {\n try {\n const response = await apiClient.put(`/api/clients/register`, {\n data: data,\n });\n console.log('Successfully renewed registration for workers', data);\n return response.data;\n } catch {\n console.error('An error occurred during polling registration. Retrying in 3 seconds...');\n await new Promise((resolve) => setTimeout(resolve, 3000));\n return attempt();\n }\n };\n\n return attempt();\n}\n\nasync function pollWorker(apiClient: UnmeshedApiClient, data: PollRequestData[]): Promise<WorkRequest[]> {\n try {\n const response: ApiResponse<WorkRequest[]> = await apiClient.post(`/api/clients/poll`, {\n data: data,\n config: { headers: { UNMESHED_HOST_NAME: getHostName() } },\n });\n if (response.data && response.data.length > 0) {\n console.log(`Received ${response.data.length} work requests`);\n }\n return response.data;\n } catch (error) {\n console.error('Error occurred during worker polling', error);\n return [];\n }\n}\n\nasync function postWorkerResponse(apiClient: UnmeshedApiClient, workResponses: WorkResponse[]) {\n try {\n if (workResponses.length > 0) {\n const grouped: Record<StepStatus, number[]> = workResponses.reduce(\n (acc, response) => {\n if (!acc[response.status]) {\n acc[response.status] = [];\n }\n acc[response.status].push(response.stepId);\n return acc;\n },\n {} as Record<StepStatus, number[]>\n );\n const resultString = Object.entries(grouped)\n .map(([status, stepIds]) => `${status}: [${stepIds.join(', ')}]`)\n .join(', ');\n console.log(`Posting response of size: ${workResponses.length} including ids: ${resultString}`);\n const response = await apiClient.post(`/api/clients/bulkResults`, {\n data: workResponses,\n });\n return response.data;\n }\n return {};\n } catch (error) {\n console.log('Error:', error);\n }\n}\n\nasync function runPollWithTimeout(task: Promise<WorkRequest[]>, timeoutMs: number): Promise<WorkRequest[]> {\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => reject(new Error('Task timed out')), timeoutMs);\n task\n .then((workRequests) => {\n clearTimeout(timeout);\n resolve(workRequests);\n })\n .catch((error) => {\n clearTimeout(timeout);\n reject(error);\n });\n });\n}\n\nexport const continuePolling: { value: boolean } = {\n value: true,\n};\n\nexport async function pollForWorkers(apiClient: UnmeshedApiClient, workers: UnmeshedWorkerConfig[]) {\n const queuedWorker: QueuedWorker<WorkResponse> = new QueuedWorker<WorkResponse>(\n 100000,\n apiClient.config.responsePollInterval,\n apiClient.config.responseBatchSize,\n async (batchWork: WorkResponse[]) => {\n await postWorkerResponse(apiClient, batchWork);\n },\n apiClient.config.responsePollTimeout\n );\n\n const registerPollingData = workers.map((worker) => {\n return {\n orgId: 0,\n namespace: worker.namespace,\n stepType: 'WORKER',\n name: worker.name,\n } as StepQueueNameData;\n });\n\n await registerPolling(apiClient, registerPollingData);\n\n const pollWorkerData = workers.map((worker) => {\n return {\n stepQueueNameData: {\n orgId: 0,\n namespace: worker.namespace,\n stepType: 'WORKER',\n name: worker.name,\n },\n size: worker.maxInProgress,\n } as PollRequestData;\n });\n\n let errorCount = 0;\n // noinspection InfiniteLoopJS\n while (continuePolling.value) {\n try {\n const workRequests: WorkRequest[] = await runPollWithTimeout(\n pollWorker(apiClient, pollWorkerData),\n apiClient.config.pollTimeout\n );\n for (const polledWorker of workRequests) {\n const associatedWorker: UnmeshedWorkerConfig | undefined = workers.find(\n (worker) => worker.name === polledWorker.stepName && worker.namespace === polledWorker.stepNamespace\n );\n\n let workerResponse: WorkResponse = {\n processId: polledWorker.processId,\n stepId: polledWorker.stepId,\n stepExecutionId: polledWorker.stepExecutionId,\n runCount: polledWorker.runCount,\n output: {},\n status: StepStatus.RUNNING,\n rescheduleAfterSeconds: null,\n startedAt: new Date().getTime(),\n };\n\n if (!associatedWorker) {\n workerResponse = {\n ...workerResponse,\n output: {\n error: `No worker found for ${polledWorker.stepName} ${polledWorker.stepNamespace}`,\n },\n status: StepStatus.TIMED_OUT,\n };\n await queuedWorker.put(workerResponse);\n continue;\n }\n\n const TIMEOUT = apiClient.config.apiWorkerTimeout;\n\n const timeoutPromise = new Promise((_, reject) => {\n setTimeout(() => reject(new Error('Timed out')), TIMEOUT);\n });\n\n try {\n console.log(\n `Starting work ${polledWorker.processId} : ${polledWorker.stepId} : ${polledWorker.stepName} : ${polledWorker.stepRef}`\n );\n const result = await Promise.race([associatedWorker.worker(polledWorker.inputParam), timeoutPromise]);\n\n workerResponse = {\n ...workerResponse,\n output: {\n ...result,\n __workCompletedAt: new Date().getTime(),\n },\n status: StepStatus.COMPLETED,\n };\n } catch (error: unknown) {\n const err = error as Error;\n if (err.message && err.message === 'Timed out') {\n workerResponse = {\n ...workerResponse,\n output: {\n error: `${err.message} based on work timeout settings in worker - ${apiClient.config.apiWorkerTimeout} ms`,\n },\n status: StepStatus.TIMED_OUT,\n };\n } else {\n workerResponse = {\n ...workerResponse,\n output: {\n error: safeStringifyError(err),\n },\n status: StepStatus.FAILED,\n };\n console.error('Error:', err.message);\n }\n }\n await queuedWorker.put(workerResponse);\n }\n await new Promise((resolve) => setTimeout(resolve, apiClient.config.pollInterval));\n } catch (error) {\n errorCount++;\n console.error(`Error processing batch - error count : ${errorCount} - `, error);\n await new Promise((resolve) => setTimeout(resolve, 1000));\n }\n }\n}\n\nfunction safeStringifyError(error: Error) {\n try {\n if (error instanceof Error) {\n const plainError = {\n ...error,\n name: error.name,\n message: error.message,\n stack: error.stack,\n };\n return JSON.stringify(plainError);\n }\n return JSON.stringify(error);\n } catch (stringifyError: unknown) {\n if (stringifyError instanceof Error) {\n return `Error stringification failed: ${stringifyError.message}`;\n }\n return 'Error stringification failed: An unknown error occurred during stringification.';\n }\n}\n\nexport async function startPollingWorkers(\n apiClient: UnmeshedApiClient,\n workers: UnmeshedWorkerConfig[],\n intervalMs: number = 5000\n) {\n async function pollCycle() {\n try {\n await pollForWorkers(apiClient, workers);\n } catch (error) {\n console.error('Error during worker polling:', error);\n }\n\n setTimeout(pollCycle, intervalMs);\n }\n\n await pollCycle();\n}\n\nexport function getHostName(): string {\n const unmeshedHostName = process.env.UNMESHED_HOST_NAME;\n if (unmeshedHostName && unmeshedHostName.trim() !== '') {\n return unmeshedHostName.trim();\n }\n\n const hostNameEnv = process.env.HOSTNAME;\n if (hostNameEnv && hostNameEnv.trim() !== '') {\n return hostNameEnv.trim();\n }\n\n const computerNameEnv = process.env.COMPUTERNAME;\n if (computerNameEnv && computerNameEnv.trim() !== '') {\n return computerNameEnv.trim();\n }\n\n try {\n const host = os.hostname();\n if (host && host.trim() !== '') {\n return host.trim();\n }\n } catch {\n // ignore\n }\n\n return '-';\n}\n","import {\n ApiCallType,\n ProcessActionResponseData,\n ProcessData,\n ProcessDefinitionData,\n ProcessDefinitionDeleteRequest,\n ProcessDefinitionDetails,\n ProcessDefinitionsDetail,\n ProcessRequestData,\n ProcessSearchRequest,\n StepData,\n} from '../types';\nimport { isAxiosError } from 'axios';\nimport { UnmeshedApiClient } from './unmeshedApiClient';\n\nconst PROCESS_PREFIX = 'api/process';\n\nexport const runProcessSync = async (\n apiClient: UnmeshedApiClient,\n ProcessRequestData: ProcessRequestData\n): Promise<ProcessData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/runSync`, {\n data: ProcessRequestData,\n params: {\n clientId: apiClient.getClientId(),\n },\n });\n console.log('Response:', response);\n return response.data;\n } catch (error) {\n console.error('Some error occurred running process request : ', error);\n throw error;\n }\n};\n\nexport const runProcessAsync = async (\n apiClient: UnmeshedApiClient,\n ProcessRequestData: ProcessRequestData\n): Promise<ProcessData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/runAsync`, {\n data: ProcessRequestData,\n params: {\n clientId: apiClient.getClientId(),\n },\n });\n console.log('Response:', response);\n return response.data;\n } catch (error) {\n console.error('Some error occurred running process request : ', error);\n throw error;\n }\n};\n\nexport const getProcessData = async (\n apiClient: UnmeshedApiClient,\n processId: number,\n includeSteps: boolean = false\n): Promise<ProcessData> => {\n if (!processId) {\n throw new Error('Process ID cannot be null');\n }\n try {\n const response = await apiClient.get<ProcessData>(`${PROCESS_PREFIX}/context/${processId}`, { includeSteps });\n return response.data;\n } catch (error) {\n console.error('Error occurred while fetching process record: ', error);\n throw error;\n }\n};\n\nexport const getStepData = async (apiClient: UnmeshedApiClient, stepId: number): Promise<StepData> => {\n if (!stepId) {\n throw new Error('Step ID cannot be null or undefined');\n }\n try {\n const response = await apiClient.get<StepData>(`${PROCESS_PREFIX}/stepContext/${stepId}`);\n return response.data;\n } catch (error) {\n console.log('Error occurred while getStepData: ', error);\n throw error;\n }\n};\n\nexport const bulkTerminate = async (\n apiClient: UnmeshedApiClient,\n processIds: number[],\n reason?: string\n): Promise<ProcessActionResponseData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/bulkTerminate`, {\n params: { reason },\n data: processIds,\n });\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(`Error occurred while terminating processes: ${err.message || error}`);\n }\n};\n\nexport const bulkResume = async (\n apiClient: UnmeshedApiClient,\n processIds: number[]\n): Promise<ProcessActionResponseData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/bulkResume`, {\n data: processIds,\n });\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(`Error occurred while resuming processes: ${err.message || error}`);\n }\n};\n\nexport const bulkReviewed = async (\n apiClient: UnmeshedApiClient,\n processIds: number[],\n reason?: string\n): Promise<ProcessActionResponseData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/bulkReviewed`, {\n data: processIds,\n params: { reason },\n });\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(`Error occurred while marking processes as reviewed: ${err.message || error}`);\n }\n};\n\nexport const rerun = async (\n apiClient: UnmeshedApiClient,\n processId: number,\n version?: number\n): Promise<ProcessData> => {\n const params: Record<string, any> = {\n processId,\n };\n\n if (version !== undefined) {\n params['version'] = version;\n }\n\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/rerun`, {\n params,\n });\n\n return response.data as ProcessData;\n } catch (error) {\n if (isAxiosError(error)) {\n throw new Error(`HTTP request error during rerun process: ${error.response?.status} - ${error.response?.data}`);\n } else {\n const err = error as Error;\n throw new Error(`Unexpected error during rerun process: ${err.message || err}`);\n }\n }\n};\n\nexport const searchProcessExecutions = async (apiClient: UnmeshedApiClient, params: ProcessSearchRequest) => {\n const body: Record<string, any> = {};\n\n if (params.startTimeEpoch) body.startTimeEpoch = params.startTimeEpoch;\n if (params.endTimeEpoch) body.endTimeEpoch = params.endTimeEpoch;\n\n if (params.namespace) body.namespace = params.namespace;\n if (params.names?.length) body.names = params.names;\n if (params.processIds?.length) body.processIds = params.processIds;\n if (params.correlationIds?.length) body.correlationIds = params.correlationIds;\n if (params.requestIds?.length) body.requestIds = params.requestIds;\n if (params.statuses?.length) body.statuses = params.statuses;\n if (params.triggerTypes?.length) body.triggerTypes = params.triggerTypes;\n\n if (params.tags?.length) body.tags = params.tags;\n\n try {\n const response = await apiClient.post(`api/stats/process/search`, {\n data: body,\n params: {},\n });\n\n return response.data;\n } catch (error) {\n console.error('Error occurred while searching process executions:', error);\n throw error;\n }\n};\n\nexport const invokeApiMappingGet = async (\n apiClient: UnmeshedApiClient,\n endpoint: string,\n id: string,\n correlationId: string,\n apiCallType: ApiCallType\n) => {\n try {\n const response = await apiClient.get(`${PROCESS_PREFIX}/api/call/${endpoint}`, {\n id: id,\n correlationId: correlationId,\n apiCallType,\n });\n console.log('Response:', response);\n return response.data;\n } catch (error) {\n console.error('Error occurred while invoking API Mapping GET: ', error);\n throw error;\n }\n};\n\nexport const invokeApiMappingPost = async (\n apiClient: UnmeshedApiClient,\n endpoint: string,\n input: Record<string, any>,\n id: string,\n correlationId: string,\n apiCallType: ApiCallType = ApiCallType.ASYNC\n): Promise<any> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/api/call/${endpoint}`, {\n data: input,\n params: {\n id: id,\n correlationId: correlationId,\n apiCallType,\n },\n });\n\n return response.data;\n } catch (error) {\n console.error('Error occurred while invoking API Mapping POST: ', error);\n throw error;\n }\n};\n\nexport const createProcessDefinition = async (apiClient: UnmeshedApiClient, requestData: ProcessDefinitionData) => {\n try {\n const response = await apiClient.post(`/api/processDefinitions`, {\n data: requestData,\n params: {},\n });\n\n return response.data;\n } catch (error) {\n console.error('Error occurred while creating process definition:', error);\n throw error;\n }\n};\n\nexport const deleteProcessDefinition = async (\n apiClient: UnmeshedApiClient,\n requestData: ProcessDefinitionDeleteRequest\n) => {\n try {\n const response = await apiClient.delete(`/api/processDefinitions`, {\n data: [requestData],\n params: {},\n });\n\n return response.data;\n } catch (error) {\n console.error('Error occurred while deleting process definition:', error);\n throw error;\n }\n};\n\nexport const updateProcessDefinition = async (apiClient: UnmeshedApiClient, requestData: ProcessDefinitionData) => {\n try {\n const response = await apiClient.put(`/api/processDefinitions`, {\n data: requestData,\n params: {},\n });\n\n return response.data;\n } catch (error) {\n console.error('Error occurred while creating process definition:', error);\n throw error;\n }\n};\n\nexport const getProcessDefinitions = async (apiClient: UnmeshedApiClient, namespace?: string) => {\n try {\n const params = namespace ? { namespace } : {};\n const response = await apiClient.get('/api/processDefinitions', params);\n return response.data;\n } catch (error) {\n console.error('Error occurred while fetching process definitions:', error);\n throw error;\n }\n};\n\nexport const getProcessDefinitionVersions = async (apiClient: UnmeshedApiClient, body: ProcessDefinitionsDetail) => {\n try {\n const response = await apiClient.get(`/api/processDefinitions/${body.namespace}/${body.name}/versions`);\n return response.data;\n } catch (error) {\n console.error('Error occurred while fetching process definition: ', error);\n throw error;\n }\n};\n\nexport const getProcessDefinitionByVersion = async (apiClient: UnmeshedApiClient, body: ProcessDefinitionDetails) => {\n if (!body.namespace || !body.name || !body.version) {\n throw new Error('namespace, name, and version are required');\n }\n\n try {\n const params = body.version ? { version: body.version } : {};\n\n const response = await apiClient.get(`/api/processDefinitions/${body.namespace}/${body.name}`, params);\n\n return response.data;\n } catch (error) {\n console.error('Error occurred while fetching process definition:', error);\n throw error;\n }\n};\n","import { RenewRegistrationParams } from '../types';\nimport { UnmeshedApiClient } from './unmeshedApiClient';\n\nexport const renewRegistration = async (\n apiClient: UnmeshedApiClient,\n params: RenewRegistrationParams\n): Promise<string> => {\n try {\n const response = await apiClient.put('/api/clients/register', {\n params: { ...params },\n });\n console.debug('Response from server:', response);\n return response.data;\n } catch (error) {\n console.error('Error occurred during registration renewal:', error);\n throw error;\n }\n};\n","import {\n ApiCallType,\n ProcessDefinitionData,\n ProcessDefinitionDeleteRequest,\n ProcessDefinitionDetails,\n ProcessDefinitionsDetail,\n ProcessRequestData,\n ProcessSearchRequest,\n RenewRegistrationParams,\n UnmeshedClientConfig,\n UnmeshedWorkerConfig,\n} from './types';\nimport { UnmeshedApiClient } from './apis/unmeshedApiClient';\nimport { startPollingWorkers } from './apis/pollerClientImpl';\nimport {\n bulkResume,\n bulkReviewed,\n bulkTerminate,\n getProcessData,\n getStepData,\n invokeApiMappingGet,\n invokeApiMappingPost,\n rerun,\n runProcessAsync,\n runProcessSync,\n searchProcessExecutions,\n createProcessDefinition,\n updateProcessDefinition,\n deleteProcessDefinition,\n getProcessDefinitions,\n getProcessDefinitionVersions,\n getProcessDefinitionByVersion,\n} from './apis/processClientImpl';\nimport { renewRegistration } from './apis/registrationClientImpl';\n\n// noinspection JSUnusedGlobalSymbols\nexport class UnmeshedClient {\n private client: UnmeshedApiClient;\n\n constructor(config: UnmeshedClientConfig) {\n this.client = new UnmeshedApiClient(config);\n }\n\n startPolling(workers: UnmeshedWorkerConfig[]) {\n startPollingWorkers(this.client, workers);\n }\n\n runProcessSync(ProcessRequestData: ProcessRequestData) {\n return runProcessSync(this.client, ProcessRequestData);\n }\n\n runProcessAsync(ProcessRequestData: ProcessRequestData) {\n return runProcessAsync(this.client, ProcessRequestData);\n }\n\n getProcessData(processId: number, includeSteps: boolean) {\n return getProcessData(this.client, processId, includeSteps);\n }\n\n getStepData(stepId: number) {\n return getStepData(this.client, stepId);\n }\n\n bulkTerminate(processIds: number[], reason?: string) {\n return bulkTerminate(this.client, processIds, reason);\n }\n\n bulkResume(processIds: number[]) {\n return bulkResume(this.client, processIds);\n }\n\n bulkReviewed(processIds: number[], reason?: string) {\n return bulkReviewed(this.client, processIds, reason);\n }\n\n reRun(processId: number, version?: number) {\n return rerun(this.client, processId, version);\n }\n\n searchProcessExecution(params: ProcessSearchRequest) {\n return searchProcessExecutions(this.client, params);\n }\n\n invokeApiMappingGet(\n apiClient: UnmeshedApiClient,\n endpoint: string,\n id: string,\n correlationId: string,\n apiCallType: ApiCallType\n ) {\n return invokeApiMappingGet(apiClient, endpoint, id, correlationId, apiCallType);\n }\n\n invokeApiMappingPost(\n endpoint: string,\n input: Record<string, any>,\n id: string,\n correlationId: string,\n apiCallType: ApiCallType\n ) {\n return invokeApiMappingPost(this.client, endpoint, input, id, correlationId, apiCallType);\n }\n\n reNewRegistration(params: RenewRegistrationParams) {\n return renewRegistration(this.client, params);\n }\n\n createProcessDefinition(body: ProcessDefinitionData) {\n return createProcessDefinition(this.client, body);\n }\n updateProcessDefinition(body: ProcessDefinitionData) {\n return updateProcessDefinition(this.client, body);\n }\n deleteProcessDefinition(body: ProcessDefinitionDeleteRequest) {\n return deleteProcessDefinition(this.client, body);\n }\n getProcessDefinitions(namespace?: string) {\n return getProcessDefinitions(this.client, namespace);\n }\n getProcessDefinitionVersions(body: ProcessDefinitionsDetail) {\n return getProcessDefinitionVersions(this.client, body);\n }\n getProcessDefinitionByVersion(body: ProcessDefinitionDetails) {\n return getProcessDefinitionByV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AAAA,EAEA,MAAM,WAAmB,SAAkB;AACzC,WAAO,MAAM,KAAK,QAAQ,WAAW,OAAO;AAAA,EAC9C;AAAA,EAEA,uBAAuB,QAA8B;AACnD,WAAO,wBAAwB,KAAK,QAAQ,MAAM;AAAA,EACpD;AAAA,EAEA,oBACE,WACA,UACA,IACA,eACA,aACA;AACA,WAAO,oBAAoB,WAAW,UAAU,IAAI,eAAe,WAAW;AAAA,EAChF;AAAA,EAEA,qBACE,UACA,OACA,IACA,eACA,aACA;AACA,WAAO,qBAAqB,KAAK,QAAQ,UAAU,OAAO,IAAI,eAAe,WAAW;AAAA,EAC1F;AAAA,EAEA,kBAAkB,QAAiC;AACjD,WAAO,kBAAkB,KAAK,QAAQ,MAAM;AAAA,EAC9C;AAAA,EAEA,wBAAwB,MAA6B;AACnD,WAAO,wBAAwB,KAAK,QAAQ,IAAI;AAAA,EAClD;AAAA,EACA,wBAAwB,MAA6B;AACnD,WAAO,wBAAwB,KAAK,QAAQ,IAAI;AAAA,EAClD;AAAA,EACA,wBAAwB,MAAsC;AAC5D,WAAO,wBAAwB,KAAK,QAAQ,IAAI;AAAA,EAClD;AAAA,EACA,sBAAsB,WAAoB;AACxC,WAAO,sBAAsB,KAAK,QAAQ,SAAS;AAAA,EACrD;AAAA,EACA,6BAA6B,MAAgC;AAC3D,WAAO,6BAA6B,KAAK,QAAQ,IAAI;AAAA,EACvD;AAAA,EACA,8BAA8B,MAAgC;AAC5D,WAAO,8BAA8B,KAAK,QAAQ,IAAI;AAAA,EACxD;AACF;","names":["ApiCallType","WebhookSource","SQAuthUserType","StepType","StepStatus","ProcessStatus","ProcessTriggerType","ProcessType","response","ProcessRequestData","ProcessRequestData"]}
|