@unmeshed/sdk 1.1.5 → 1.1.7

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.js CHANGED
@@ -351,6 +351,22 @@ var BlockingQueue = class {
351
351
  };
352
352
 
353
353
  // src/apis/pollerClientImpl.ts
354
+ var import_os = __toESM(require("os"));
355
+
356
+ // src/utils/retryDelay.ts
357
+ function getRandomDelayMs(maxSeconds, minSeconds = 1) {
358
+ const minimumSeconds = Math.max(1, Math.floor(minSeconds));
359
+ const maximumSeconds = Math.max(minimumSeconds, Math.floor(maxSeconds));
360
+ const delaySeconds = Math.floor(Math.random() * (maximumSeconds - minimumSeconds + 1)) + minimumSeconds;
361
+ return delaySeconds * 1e3;
362
+ }
363
+ async function wait(delayMs) {
364
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
365
+ }
366
+
367
+ // src/apis/pollerClientImpl.ts
368
+ var REGISTRATION_RETRY_DELAY_MAX_SECONDS = 10;
369
+ var POLL_RETRY_DELAY_MAX_SECONDS = 30;
354
370
  async function registerPolling(apiClient, data) {
355
371
  const attempt = async () => {
356
372
  try {
@@ -360,8 +376,9 @@ async function registerPolling(apiClient, data) {
360
376
  console.log("Successfully renewed registration for workers", data);
361
377
  return response.data;
362
378
  } catch {
363
- console.error("An error occurred during polling registration. Retrying in 3 seconds...");
364
- await new Promise((resolve) => setTimeout(resolve, 3e3));
379
+ const delayMs = getRandomDelayMs(REGISTRATION_RETRY_DELAY_MAX_SECONDS);
380
+ console.error(`An error occurred during polling registration. Retrying in ${delayMs / 1e3} seconds...`);
381
+ await wait(delayMs);
365
382
  return attempt();
366
383
  }
367
384
  };
@@ -369,13 +386,19 @@ async function registerPolling(apiClient, data) {
369
386
  }
370
387
  async function pollWorker(apiClient, data) {
371
388
  try {
372
- const response = await apiClient.post(`/api/clients/poll`, { data });
389
+ const response = await apiClient.post(`/api/clients/poll`, {
390
+ data,
391
+ config: { headers: { UNMESHED_HOST_NAME: getHostName() } }
392
+ });
373
393
  if (response.data && response.data.length > 0) {
374
394
  console.log(`Received ${response.data.length} work requests`);
375
395
  }
376
396
  return response.data;
377
397
  } catch (error) {
378
398
  console.error("Error occurred during worker polling", error);
399
+ const delayMs = getRandomDelayMs(POLL_RETRY_DELAY_MAX_SECONDS);
400
+ console.error(`Retrying worker polling in ${delayMs / 1e3} seconds...`);
401
+ await wait(delayMs);
379
402
  return [];
380
403
  }
381
404
  }
@@ -525,7 +548,9 @@ async function pollForWorkers(apiClient, workers) {
525
548
  } catch (error) {
526
549
  errorCount++;
527
550
  console.error(`Error processing batch - error count : ${errorCount} - `, error);
528
- await new Promise((resolve) => setTimeout(resolve, 1e3));
551
+ const delayMs = getRandomDelayMs(POLL_RETRY_DELAY_MAX_SECONDS);
552
+ console.error(`Retrying worker polling in ${delayMs / 1e3} seconds...`);
553
+ await wait(delayMs);
529
554
  }
530
555
  }
531
556
  }
@@ -559,6 +584,28 @@ async function startPollingWorkers(apiClient, workers, intervalMs = 5e3) {
559
584
  }
560
585
  await pollCycle();
561
586
  }
587
+ function getHostName() {
588
+ const unmeshedHostName = process.env.UNMESHED_HOST_NAME;
589
+ if (unmeshedHostName && unmeshedHostName.trim() !== "") {
590
+ return unmeshedHostName.trim();
591
+ }
592
+ const hostNameEnv = process.env.HOSTNAME;
593
+ if (hostNameEnv && hostNameEnv.trim() !== "") {
594
+ return hostNameEnv.trim();
595
+ }
596
+ const computerNameEnv = process.env.COMPUTERNAME;
597
+ if (computerNameEnv && computerNameEnv.trim() !== "") {
598
+ return computerNameEnv.trim();
599
+ }
600
+ try {
601
+ const host = import_os.default.hostname();
602
+ if (host && host.trim() !== "") {
603
+ return host.trim();
604
+ }
605
+ } catch {
606
+ }
607
+ return "-";
608
+ }
562
609
 
563
610
  // src/apis/processClientImpl.ts
564
611
  var import_axios2 = require("axios");
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 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';\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 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,Q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AAM;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;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":["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/utils/retryDelay.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';\nimport { getRandomDelayMs, wait } from '../utils/retryDelay';\n\nconst REGISTRATION_RETRY_DELAY_MAX_SECONDS = 10;\nconst POLL_RETRY_DELAY_MAX_SECONDS = 30;\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 const delayMs = getRandomDelayMs(REGISTRATION_RETRY_DELAY_MAX_SECONDS);\n console.error(`An error occurred during polling registration. Retrying in ${delayMs / 1000} seconds...`);\n await wait(delayMs);\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 const delayMs = getRandomDelayMs(POLL_RETRY_DELAY_MAX_SECONDS);\n console.error(`Retrying worker polling in ${delayMs / 1000} seconds...`);\n await wait(delayMs);\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 const delayMs = getRandomDelayMs(POLL_RETRY_DELAY_MAX_SECONDS);\n console.error(`Retrying worker polling in ${delayMs / 1000} seconds...`);\n await wait(delayMs);\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","export function getRandomDelayMs(maxSeconds: number, minSeconds: number = 1): number {\n const minimumSeconds = Math.max(1, Math.floor(minSeconds));\n const maximumSeconds = Math.max(minimumSeconds, Math.floor(maxSeconds));\n const delaySeconds = Math.floor(Math.random() * (maximumSeconds - minimumSeconds + 1)) + minimumSeconds;\n\n return delaySeconds * 1000;\n}\n\nexport async function wait(delayMs: number): Promise<void> {\n await new Promise((resolve) => setTimeout(resolve, delayMs));\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,KAAK,KAAK,QAAQ;AAElG,SAAK,gBAAgB,aAAAA,QAAM,OAAO;AAAA,MAChC;AAAA,MACA,SAAS,KAAK,QAAQ;AAAA,MACtB,SAAS;AAAA,QACP,gBA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EA,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":["axios","ApiCallType","WebhookSource","SQAuthUserType","StepType","StepStatus","ProcessStatus","ProcessTriggerType","ProcessType","response","os","import_axios","ProcessRequestData","ProcessRequestData"]}
package/dist/index.mjs CHANGED
@@ -307,6 +307,22 @@ var BlockingQueue = class {
307
307
  };
308
308
 
309
309
  // src/apis/pollerClientImpl.ts
310
+ import os from "os";
311
+
312
+ // src/utils/retryDelay.ts
313
+ function getRandomDelayMs(maxSeconds, minSeconds = 1) {
314
+ const minimumSeconds = Math.max(1, Math.floor(minSeconds));
315
+ const maximumSeconds = Math.max(minimumSeconds, Math.floor(maxSeconds));
316
+ const delaySeconds = Math.floor(Math.random() * (maximumSeconds - minimumSeconds + 1)) + minimumSeconds;
317
+ return delaySeconds * 1e3;
318
+ }
319
+ async function wait(delayMs) {
320
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
321
+ }
322
+
323
+ // src/apis/pollerClientImpl.ts
324
+ var REGISTRATION_RETRY_DELAY_MAX_SECONDS = 10;
325
+ var POLL_RETRY_DELAY_MAX_SECONDS = 30;
310
326
  async function registerPolling(apiClient, data) {
311
327
  const attempt = async () => {
312
328
  try {
@@ -316,8 +332,9 @@ async function registerPolling(apiClient, data) {
316
332
  console.log("Successfully renewed registration for workers", data);
317
333
  return response.data;
318
334
  } catch {
319
- console.error("An error occurred during polling registration. Retrying in 3 seconds...");
320
- await new Promise((resolve) => setTimeout(resolve, 3e3));
335
+ const delayMs = getRandomDelayMs(REGISTRATION_RETRY_DELAY_MAX_SECONDS);
336
+ console.error(`An error occurred during polling registration. Retrying in ${delayMs / 1e3} seconds...`);
337
+ await wait(delayMs);
321
338
  return attempt();
322
339
  }
323
340
  };
@@ -325,13 +342,19 @@ async function registerPolling(apiClient, data) {
325
342
  }
326
343
  async function pollWorker(apiClient, data) {
327
344
  try {
328
- const response = await apiClient.post(`/api/clients/poll`, { data });
345
+ const response = await apiClient.post(`/api/clients/poll`, {
346
+ data,
347
+ config: { headers: { UNMESHED_HOST_NAME: getHostName() } }
348
+ });
329
349
  if (response.data && response.data.length > 0) {
330
350
  console.log(`Received ${response.data.length} work requests`);
331
351
  }
332
352
  return response.data;
333
353
  } catch (error) {
334
354
  console.error("Error occurred during worker polling", error);
355
+ const delayMs = getRandomDelayMs(POLL_RETRY_DELAY_MAX_SECONDS);
356
+ console.error(`Retrying worker polling in ${delayMs / 1e3} seconds...`);
357
+ await wait(delayMs);
335
358
  return [];
336
359
  }
337
360
  }
@@ -481,7 +504,9 @@ async function pollForWorkers(apiClient, workers) {
481
504
  } catch (error) {
482
505
  errorCount++;
483
506
  console.error(`Error processing batch - error count : ${errorCount} - `, error);
484
- await new Promise((resolve) => setTimeout(resolve, 1e3));
507
+ const delayMs = getRandomDelayMs(POLL_RETRY_DELAY_MAX_SECONDS);
508
+ console.error(`Retrying worker polling in ${delayMs / 1e3} seconds...`);
509
+ await wait(delayMs);
485
510
  }
486
511
  }
487
512
  }
@@ -515,6 +540,28 @@ async function startPollingWorkers(apiClient, workers, intervalMs = 5e3) {
515
540
  }
516
541
  await pollCycle();
517
542
  }
543
+ function getHostName() {
544
+ const unmeshedHostName = process.env.UNMESHED_HOST_NAME;
545
+ if (unmeshedHostName && unmeshedHostName.trim() !== "") {
546
+ return unmeshedHostName.trim();
547
+ }
548
+ const hostNameEnv = process.env.HOSTNAME;
549
+ if (hostNameEnv && hostNameEnv.trim() !== "") {
550
+ return hostNameEnv.trim();
551
+ }
552
+ const computerNameEnv = process.env.COMPUTERNAME;
553
+ if (computerNameEnv && computerNameEnv.trim() !== "") {
554
+ return computerNameEnv.trim();
555
+ }
556
+ try {
557
+ const host = os.hostname();
558
+ if (host && host.trim() !== "") {
559
+ return host.trim();
560
+ }
561
+ } catch {
562
+ }
563
+ return "-";
564
+ }
518
565
 
519
566
  // src/apis/processClientImpl.ts
520
567
  import { isAxiosError } from "axios";
@@ -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};\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';\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 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 getProcessDefinitionByVersion(this.client, body);\n }\n}\n\nexport * from './types';\n"],"mappings":";AAAA,OAAO,WAAqG;;;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A,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"]}
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/utils/retryDelay.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';\nimport { getRandomDelayMs, wait } from '../utils/retryDelay';\n\nconst REGISTRATION_RETRY_DELAY_MAX_SECONDS = 10;\nconst POLL_RETRY_DELAY_MAX_SECONDS = 30;\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 const delayMs = getRandomDelayMs(REGISTRATION_RETRY_DELAY_MAX_SECONDS);\n console.error(`An error occurred during polling registration. Retrying in ${delayMs / 1000} seconds...`);\n await wait(delayMs);\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 const delayMs = getRandomDelayMs(POLL_RETRY_DELAY_MAX_SECONDS);\n console.error(`Retrying worker polling in ${delayMs / 1000} seconds...`);\n await wait(delayMs);\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 const delayMs = getRandomDelayMs(POLL_RETRY_DELAY_MAX_SECONDS);\n console.error(`Retrying worker polling in ${delayMs / 1000} seconds...`);\n await wait(delayMs);\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","export function getRandomDelayMs(maxSeconds: number, minSeconds: number = 1): number {\n const minimumSeconds = Math.max(1, Math.floor(minSeconds));\n const maximumSeconds = Math.max(minimumSeconds, Math.floor(maxSeconds));\n const delaySeconds = Math.floor(Math.random() * (maximumSeconds - minimumSeconds + 1)) + minimumSeconds;\n\n return delaySeconds * 1000;\n}\n\nexport async function wait(delayMs: number): Promise<void> {\n await new Promise((resolve) => setTimeout(resolve, delayMs));\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 getProcessDefinitionByVersion(this.client, body);\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;AAE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;AAAA,EAC3C;AAAA,EAEA,aAAa,YAAsB,QAAiB;AAClD,WAAO,aAAa,KAAK,QAAQ,YAAY,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;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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unmeshed/sdk",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "Unmeshed TS/JS SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -37,7 +37,7 @@
37
37
  "license": "MIT",
38
38
  "homepage": "https://unmeshed.io/",
39
39
  "dependencies": {
40
- "axios": "^1.7.9"
40
+ "axios": "^1.15.2"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "^22.10.7",