@unmeshed/sdk 1.0.18 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -90,11 +90,10 @@ const worker = {
90
90
  unmeshedClient.startPolling([worker]);
91
91
  ```
92
92
 
93
-
94
93
  You can run as many workers as you want.
95
94
 
96
-
97
- Et voilà — that's it! Now whenever a process definition or worker reaches this step with name test-node-worker, it will run your function
95
+ Et voilà — that's it! Now whenever a process definition or worker reaches this step with name test-node-worker, it will
96
+ run your function
98
97
 
99
98
  > The `startPolling` method starts the worker to listen 👂 for tasks continuously.
100
99
 
@@ -102,6 +101,200 @@ Et voilà — that's it! Now whenever a process definition or worker reaches thi
102
101
 
103
102
  When you run your Node.js app, and the worker will start polling for tasks automatically 🤖.
104
103
 
104
+ ---
105
+
106
+ ## APIs in the SDK
107
+
108
+ ### Fetch a process
109
+
110
+ ```javascript
111
+
112
+ // processId: number, includeSteps: boolean
113
+ const processData = await unmeshedClient.getProcessData(processId, includeSteps);
114
+
115
+ ```
116
+
117
+ ### Fetch a step
118
+
119
+ ```javascript
120
+
121
+ // stepId: number
122
+ const stepData = await unmeshedClient.getStepData(stepId);
123
+
124
+ ```
125
+
126
+ ### Start a Process / Workflow - Synchronously
127
+
128
+ ```javascript
129
+
130
+ const request = {
131
+ name: `your-process-name`,
132
+ version: null, // null = latest, specify a version if required
133
+ namespace: `default`,
134
+ requestId: `my-id-1`, // Your id (Optional)
135
+ correlationId: `my-crid-1`, // Your correlation id (Optional)
136
+ input: { // Inputs to your process
137
+ "mykey": "value",
138
+ "mykeyNumber": 100,
139
+ "mykeyBoolean": true
140
+ }
141
+ }
142
+ const processData = await unmeshedClient.runProcessSync(request);
143
+
144
+ ```
145
+
146
+ ### Start a Process / Workflow - Asynchronously (trigger and check status later)
147
+
148
+ ```javascript
149
+
150
+ const request = {
151
+ name: `your-process-name`,
152
+ version: null, // null = latest, specify a version if required
153
+ namespace: `default`,
154
+ requestId: `my-id-1`, // Your id (Optional)
155
+ correlationId: `my-crid-1`, // Your correlation id (Optional)
156
+ input: { // Inputs to your process
157
+ "mykey": "value",
158
+ "mykeyNumber": 100,
159
+ "mykeyBoolean": true
160
+ }
161
+ }
162
+ const processData = await unmeshedClient.runProcessAsync(request);
163
+
164
+ ```
165
+
166
+ > Difference between sync and async is just the method you call. `runProcessSync` vs `runProcessAsync`
167
+
168
+
169
+ ---
170
+
171
+ ### Bulk Terminate Running Processes
172
+
173
+ Terminates multiple processes in bulk based on the provided process IDs.
174
+
175
+ ```javascript
176
+ const processIds = [1, 2, 3];
177
+ const reason = "Terminating due to policy changes";
178
+ const response = await unmeshedClient.bulkTerminate(processIds, reason);
179
+ console.log(response);
180
+ ```
181
+
182
+ #### Parameters
183
+
184
+ - **processIds** (array of numbers): The IDs of the processes to terminate.
185
+ - **reason** (string, optional): The reason for terminating the processes.
186
+
187
+ #### Returns
188
+
189
+ - **ProcessActionResponseData**: The response containing the status of the termination.
190
+
191
+ ---
192
+
193
+ ### Bulk Resume Failed or Terminated Processes
194
+
195
+ Resumes multiple processes in bulk based on the provided process IDs.
196
+
197
+ ```javascript
198
+ const processIds = [1, 2, 3];
199
+ const response = await unmeshedClient.bulkResume(processIds);
200
+ console.log(response);
201
+ ```
202
+
203
+ #### Parameters
204
+
205
+ - **processIds** (array of numbers): The IDs of the processes to resume.
206
+
207
+ #### Returns
208
+
209
+ - **ProcessActionResponseData**: The response containing the status of the resumption.
210
+
211
+ ---
212
+
213
+ ### Mark Processes as Reviewed in Bulk
214
+
215
+ Marks multiple processes as reviewed based on the provided process IDs.
216
+
217
+ ```javascript
218
+ const processIds = [1, 2, 3];
219
+ const reason = "Reviewed for compliance";
220
+ const response = await unmeshedClient.bulkReviewed(processIds, reason);
221
+ console.log(response);
222
+ ```
223
+
224
+ #### Parameters
225
+
226
+ - **processIds** (array of numbers): The IDs of the processes to mark as reviewed.
227
+ - **reason** (string, optional): The reason for marking the processes as reviewed.
228
+
229
+ #### Returns
230
+
231
+ - **ProcessActionResponseData**: The response containing the status of the review action.
232
+
233
+ ---
234
+
235
+ ### Rerun
236
+
237
+ Reruns a specific process based on its ID, client ID, and optionally a version.
238
+
239
+ ```javascript
240
+ const processId = 123;
241
+ const version = 2; // Optional, empty if you want to run latest
242
+ const response = await unmeshedClient.rerun(processId, version);
243
+ console.log(response);
244
+ ```
245
+
246
+ #### Parameters
247
+
248
+ - **processId** (number): The ID of the process to rerun.
249
+ - **version** (number, optional): The version of the process to rerun.
250
+
251
+ #### Returns
252
+
253
+ - **ProcessData**: The data of the rerun process.
254
+
255
+ ---
256
+
257
+ ### Search Process Executions
258
+
259
+ Searches for process executions based on the provided search criteria.
260
+
261
+ #### Example Usage
262
+
263
+ ```javascript
264
+ const searchParams = {
265
+ startTimeEpoch: 1622505600000,
266
+ endTimeEpoch: 1622505800000,
267
+ namespace: "default",
268
+ names: ["process1", "process2"],
269
+ processIds: [1, 2, 3],
270
+ correlationIds: ["corr1", "corr2"],
271
+ requestIds: ["req1", "req2"],
272
+ statuses: ["RUNNING", "COMPLETED"],
273
+ triggerTypes: ["MANUAL", "API"]
274
+ };
275
+ const response = await unmeshedClient.searchProcessExecutions(searchParams);
276
+ console.log(response);
277
+ ```
278
+
279
+ #### Parameters
280
+
281
+ - **startTimeEpoch** (number, optional): The start time in epoch format.
282
+ - **endTimeEpoch** (number, optional): The end time in epoch format.
283
+ - **namespace** (string, optional): The namespace to filter the processes.
284
+ - **names** (array of strings, optional): The names of the processes.
285
+ - **processIds** (array of numbers, optional): The IDs of the processes.
286
+ - **correlationIds** (array of strings, optional): The correlation IDs of the processes.
287
+ - **requestIds** (array of strings, optional): The request IDs of the processes.
288
+ - **statuses** (array of strings, optional): The statuses of the processes.
289
+ - **triggerTypes** (array of strings, optional): The trigger types of the processes.
290
+
291
+ #### Returns
292
+
293
+ - Response data containing the search results.
294
+
295
+ ---
296
+
297
+
105
298
  ---
106
299
 
107
300
  ## Additional Resources
@@ -123,6 +316,9 @@ When you run your Node.js app, and the worker will start polling for tasks autom
123
316
 
124
317
  ---
125
318
 
319
+
320
+
321
+
126
322
  For more details, visit our [📖 documentation](https://unmeshed.io/docs/concepts/overview). If you encounter issues, feel
127
323
  free to reach out or open an issue in this repository!
128
324
 
package/dist/index.d.mts CHANGED
@@ -144,17 +144,18 @@ type ProcessData = {
144
144
  namespace: string;
145
145
  name: string;
146
146
  version: number | null;
147
- processDefinitionHistoryId: number | null;
147
+ historyId: number | null;
148
148
  requestId: string;
149
149
  correlationId: string;
150
150
  status: ProcessStatus;
151
151
  input: Record<string, unknown>;
152
152
  output: Record<string, unknown>;
153
+ authClaims: Record<string, unknown>;
153
154
  stepIdCount: number | null;
154
155
  shardName: string;
155
156
  shardInstanceId: number | null;
156
- stepIds: StepId[];
157
- stepDataById: Record<number, StepData>;
157
+ steps: StepId[];
158
+ stepRecords: StepData[];
158
159
  created: number;
159
160
  updated: number;
160
161
  createdBy: string;
package/dist/index.d.ts CHANGED
@@ -144,17 +144,18 @@ type ProcessData = {
144
144
  namespace: string;
145
145
  name: string;
146
146
  version: number | null;
147
- processDefinitionHistoryId: number | null;
147
+ historyId: number | null;
148
148
  requestId: string;
149
149
  correlationId: string;
150
150
  status: ProcessStatus;
151
151
  input: Record<string, unknown>;
152
152
  output: Record<string, unknown>;
153
+ authClaims: Record<string, unknown>;
153
154
  stepIdCount: number | null;
154
155
  shardName: string;
155
156
  shardInstanceId: number | null;
156
- stepIds: StepId[];
157
- stepDataById: Record<number, StepData>;
157
+ steps: StepId[];
158
+ stepRecords: StepData[];
158
159
  created: number;
159
160
  updated: number;
160
161
  createdBy: string;
package/dist/index.js CHANGED
@@ -659,9 +659,8 @@ var bulkReviewed = async (apiClient, processIds, reason) => {
659
659
  );
660
660
  }
661
661
  };
662
- var rerun = async (apiClient, processId, clientId, version) => {
662
+ var rerun = async (apiClient, processId, version) => {
663
663
  const params = {
664
- clientId,
665
664
  processId
666
665
  };
667
666
  if (version !== void 0) {
@@ -799,7 +798,7 @@ var UnmeshedClient = class {
799
798
  return bulkReviewed(this.client, processIds, reason);
800
799
  }
801
800
  reRun(processId, clientId, version) {
802
- return rerun(this.client, processId, clientId, version);
801
+ return rerun(this.client, processId, version);
803
802
  }
804
803
  searchProcessExecution(params) {
805
804
  return searchProcessExecutions(this.client, params);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/apis/unmeshedApiClient.ts","../src/utils/unmeshedCommonUtils.ts","../src/types/index.ts","../src/apis/queuedWorker.ts","../src/apis/pollerClientImpl.ts","../src/apis/processClientImpl.ts","../src/apis/registrationClientImpl.ts"],"sourcesContent":["import {\n ApiCallType,\n ProcessRequestData,\n ProcessSearchRequest,\n RenewRegistrationParams,\n UnmeshedClientConfig,\n UnmeshedWorkerConfig,\n} from \"./types\";\nimport {UnmeshedApiClient} from \"./apis/unmeshedApiClient\";\nimport {startPollingWorkers} from \"./apis/pollerClientImpl\";\nimport {\n bulkResume,\n bulkReviewed,\n bulkTerminate,\n getProcessData,\n getStepData,\n invokeApiMappingGet,\n invokeApiMappingPost,\n rerun,\n runProcessAsync,\n runProcessSync,\n searchProcessExecutions,\n} from \"./apis/processClientImpl\";\nimport {renewRegistration} from \"./apis/registrationClientImpl\";\n\n// noinspection JSUnusedGlobalSymbols\nexport class UnmeshedClient {\n private client: UnmeshedApiClient;\n\n constructor(config: UnmeshedClientConfig) {\n this.client = new UnmeshedApiClient(config);\n }\n\n startPolling(workers: UnmeshedWorkerConfig[]) {\n startPollingWorkers(this.client, workers);\n }\n\n runProcessSync(ProcessRequestData: ProcessRequestData) {\n return runProcessSync(this.client, ProcessRequestData);\n }\n\n runProcessAsync(ProcessRequestData: ProcessRequestData) {\n return runProcessAsync(this.client, ProcessRequestData);\n }\n\n getProcessData(processId: number, includeSteps: boolean) {\n return getProcessData(this.client, processId, includeSteps);\n }\n\n getStepData(stepId: number) {\n return getStepData(this.client, stepId);\n }\n\n bulkTerminate(processIds: number[], reason?: string) {\n return bulkTerminate(this.client, processIds, reason);\n }\n\n bulkResume(processIds: number[]) {\n return bulkResume(this.client, processIds);\n }\n\n bulkReviewed(processIds: number[], reason?: string) {\n return bulkReviewed(this.client, processIds, reason);\n }\n\n reRun(processId: number, clientId: string, version?: number) {\n return rerun(this.client, processId, clientId, 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(\n apiClient,\n endpoint,\n id,\n correlationId,\n apiCallType\n );\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(\n this.client,\n endpoint,\n input,\n id,\n correlationId,\n apiCallType\n );\n }\n\n reNewRegistration(params: RenewRegistrationParams) {\n return renewRegistration(this.client, params);\n }\n\n}\n\nexport * from \"./types\";\n","import axios, {AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, RawAxiosRequestHeaders} from \"axios\";\nimport {\n ApiResponse,\n ClientRequestConfig, FinalUnmeshedClientConfig,\n HandleRequestConfig,\n QueryParams,\n RequestConfig,\n UnmeshedClientConfig,\n} from \"../types\";\nimport {UnmeshedCommonUtils} from \"../utils/unmeshedCommonUtils\";\n\nexport class UnmeshedApiClient {\n\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\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>(\n endpoint: string,\n params?: QueryParams,\n config?: RequestConfig\n ): 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>(\n endpoint: string,\n clientRequestConfig: ClientRequestConfig\n ): 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>(\n endpoint: string,\n clientRequestConfig: ClientRequestConfig\n ): 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>(\n endpoint: string,\n clientRequestConfig: ClientRequestConfig\n ): 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\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 WORKER = \"WORKER\",\n HTTP = \"HTTP\",\n WAIT = \"WAIT\",\n FAIL = \"FAIL\",\n PYTHON = \"PYTHON\",\n JAVASCRIPT = \"JAVASCRIPT\",\n JQ = \"JQ\",\n MANAGED = \"MANAGED\",\n BUILTIN = \"BUILTIN\",\n NOOP = \"NOOP\",\n PERSISTED_STATE = \"PERSISTED_STATE\",\n DEPENDSON = \"DEPENDSON\",\n INTEGRATION = \"INTEGRATION\",\n EXIT = \"EXIT\",\n SUB_PROCESS = \"SUB_PROCESS\",\n LIST = \"LIST\",\n PARALLEL = \"PARALLEL\",\n FOREACH = \"FOREACH\",\n SWITCH = \"SWITCH\",\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 processDefinitionHistoryId: number | null;\n requestId: string;\n correlationId: string;\n status: ProcessStatus;\n input: Record<string, unknown>;\n output: Record<string, unknown>;\n stepIdCount: number | null;\n shardName: string;\n shardInstanceId: number | null;\n stepIds: StepId[];\n stepDataById: Record<number, 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 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};\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\n 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\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(`Configured queued worker with ${pollIntervalMs} ms interval and batch size of ${batchSize} and a timeout of ${timeoutMs} ms`);\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.then(() => {\n clearTimeout(timeout);\n resolve();\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}\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(\n apiClient: UnmeshedApiClient,\n data: StepQueueNameData[]\n) {\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(\n \"An error occurred during polling registration. Retrying in 3 seconds...\"\n );\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 }\n}\n\nasync function postWorkerResponse(apiClient: UnmeshedApiClient, workResponses: WorkResponse[]) {\n try {\n if (workResponses.length > 0) {\n const grouped: Record<StepStatus, number[]> = workResponses.reduce((acc, response) => {\n if (!acc[response.status]) {\n acc[response.status] = [];\n }\n acc[response.status].push(response.stepId);\n return acc;\n }, {} as Record<StepStatus, number[]>);\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.then((workRequests) => {\n clearTimeout(timeout);\n resolve(workRequests);\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(\n apiClient: UnmeshedApiClient,\n workers: UnmeshedWorkerConfig[]\n) {\n\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(pollWorker(apiClient, pollWorkerData), apiClient.config.pollTimeout);\n for (const polledWorker of workRequests) {\n const associatedWorker: UnmeshedWorkerConfig | undefined = workers.find(\n (worker) =>\n worker.name === polledWorker.stepName &&\n 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(`Starting work ${polledWorker.processId} : ${polledWorker.stepId} : ${polledWorker.stepName} : ${polledWorker.stepRef}`);\n const result = await Promise.race([\n associatedWorker.worker(polledWorker.inputParam),\n timeoutPromise,\n ]);\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) {\n try {\n if (error instanceof Error) {\n const plainError = {\n name: error.name,\n message: error.message,\n stack: error.stack,\n ...error, // Include enumerable custom properties if they exist\n };\n return JSON.stringify(plainError);\n }\n return JSON.stringify(error);\n } catch (stringifyError) {\n return `Error stringification failed: ${stringifyError.message}`;\n }\n}\n\nexport async function startPollingWorkers(\n apiClient: UnmeshedApiClient,\n workers: UnmeshedWorkerConfig[],\n intervalMs: number = 5000\n) {\n async function pollCycle() {\n try {\n await pollForWorkers(apiClient, workers);\n } catch (error) {\n console.error(\"Error during worker polling:\", error);\n }\n\n setTimeout(pollCycle, intervalMs);\n }\n\n await pollCycle();\n}\n","import {\n ApiCallType,\n ProcessActionResponseData,\n ProcessData,\n ProcessRequestData,\n ProcessSearchRequest,\n StepData,\n} from \"../types\";\nimport {isAxiosError} from \"axios\";\nimport {UnmeshedApiClient} from \"./unmeshedApiClient\";\n\nconst PROCESS_PREFIX = \"api/process\";\n\nexport const runProcessSync = async (\n apiClient: UnmeshedApiClient,\n ProcessRequestData: ProcessRequestData\n): Promise<ProcessData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/runSync`, {\n data: ProcessRequestData,\n params: {\n clientId: apiClient.getClientId(),\n },\n });\n console.log(\"Response:\", response);\n return response.data;\n } catch (error) {\n console.error(\"Some error occurred running process request : \", error);\n throw error;\n }\n};\n\nexport const runProcessAsync = async (\n apiClient: UnmeshedApiClient,\n ProcessRequestData: ProcessRequestData\n): Promise<ProcessData> => {\n try {\n const response = await apiClient.post(\n `${PROCESS_PREFIX}/runAsync`,\n {\n data: ProcessRequestData,\n params: {\n clientId: apiClient.getClientId(),\n },\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>(\n `${PROCESS_PREFIX}/context/${processId}`,\n {includeSteps}\n );\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 (\n apiClient: UnmeshedApiClient,\n stepId: number\n): 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>(\n `${PROCESS_PREFIX}/stepContext/${stepId}`\n );\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(\n `${PROCESS_PREFIX}/bulkTerminate`,\n {\n params: {reason},\n data: processIds,\n }\n );\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(\n `Error occurred while terminating processes: ${err.message || error}`\n );\n }\n};\n\nexport const bulkResume = async (\n apiClient: UnmeshedApiClient,\n processIds: number[]\n): Promise<ProcessActionResponseData> => {\n try {\n const response = await apiClient.post(\n `${PROCESS_PREFIX}/bulkResume`,\n {\n data: processIds,\n }\n );\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(\n `Error occurred while resuming processes: ${err.message || error}`\n );\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(\n `${PROCESS_PREFIX}/bulkReviewed`,\n {\n data: processIds,\n params: {reason},\n }\n );\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(\n `Error occurred while marking processes as reviewed: ${\n err.message || error\n }`\n );\n }\n};\n\nexport const rerun = async (\n apiClient: UnmeshedApiClient,\n processId: number,\n clientId: string,\n version?: number\n): Promise<ProcessData> => {\n const params: Record<string, any> = {\n clientId,\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(\n `HTTP request error during rerun process: ${error.response?.status} - ${error.response?.data}`\n );\n } else {\n const err = error as Error;\n throw new Error(\n `Unexpected error during rerun process: ${err.message || err}`\n );\n }\n }\n};\n\nexport const searchProcessExecutions = async (\n apiClient: UnmeshedApiClient,\n params: ProcessSearchRequest\n) => {\n const queryParams = new URLSearchParams();\n\n if (params.startTimeEpoch !== undefined && params.startTimeEpoch !== 0)\n queryParams.set(\"startTimeEpoch\", params.startTimeEpoch.toString());\n if (params.endTimeEpoch !== undefined && params.endTimeEpoch !== 0)\n queryParams.set(\"endTimeEpoch\", (params.endTimeEpoch || 0).toString());\n if (params.namespace) queryParams.set(\"namespace\", params.namespace);\n if (params.names && params.names.length)\n queryParams.set(\"names\", params.names.join(\",\"));\n if (params.processIds && params.processIds.length)\n queryParams.set(\"processIds\", params.processIds.join(\",\"));\n if (params.correlationIds && params.correlationIds.length)\n queryParams.set(\"correlationIds\", params.correlationIds.join(\",\"));\n if (params.requestIds && params.requestIds.length)\n queryParams.set(\"requestIds\", params.requestIds.join(\",\"));\n if (params.statuses && params.statuses.length)\n queryParams.set(\"statuses\", params.statuses.join(\",\"));\n if (params.triggerTypes && params.triggerTypes.length)\n queryParams.set(\"triggerTypes\", params.triggerTypes.join(\",\"));\n\n const updatedParams = Object.fromEntries(new URLSearchParams(queryParams));\n\n try {\n const response = await apiClient.get(\n `${PROCESS_PREFIX}/api/stats/process/search`,\n updatedParams\n );\n console.log(\"Response:\", response);\n return response.data;\n } catch (error) {\n console.error(\"Error occurred while searching process executions: \", error);\n throw error;\n }\n};\n\nexport const 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(\n `${PROCESS_PREFIX}/api/call/${endpoint}`,\n {\n id: id,\n correlationId: correlationId,\n apiCallType,\n }\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(\n `${PROCESS_PREFIX}/api/call/${endpoint}`,\n {\n data: input,\n params: {\n id: id,\n correlationId: correlationId,\n apiCallType,\n },\n }\n );\n\n return response.data;\n } catch (error) {\n console.error(\"Error occurred while invoking API Mapping POST: \", error);\n throw error;\n }\n};\n","import { RenewRegistrationParams } from \"../types\";\nimport { UnmeshedApiClient } from \"./unmeshedApiClient\";\n\nexport const renewRegistration = async (\n apiClient: UnmeshedApiClient,\n params: RenewRegistrationParams\n): Promise<string> => {\n try {\n const response = await apiClient.put(\"/api/clients/register\", {\n params: { ...params },\n });\n console.debug(\"Response from server:\", response);\n return response.data;\n } catch (error) {\n console.error(\"Error occurred during registration renewal:\", error);\n throw error;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA0G;;;ACA1G,oBAA2B;AAEpB,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BAAkB;AAAA,EAC1D;AAAA,EAEA,eAAe,WAAmB,cAAuB;AACrD,WAAO,eAAe,KAAK,QAAQ,WAAW,YAAY;AAAA,EAC9D;AAAA,EAEA,YAAY,QAAgB;AACxB,WAAO,YAAY,KAAK,QAAQ,MAAM;AAAA,EAC1C;AAAA,EAEA,cAAc,YAAsB,QAAiB;AACjD,WAAO,cAAc,KAAK,QAAQ,YAAY,MAAM;AAAA,EACxD;AAAA,EAEA,WAAW,YAAsB;AAC7B,WAAO,WAAW,KAAK,QAAQ,UAAU;AAAA,EAC7C;AAAA,EAEA,aAAa,YAAsB,QAAiB;AAChD,WAAO,aAAa,KAAK,QAAQ,YAAY,MAAM;AAAA,EACvD;AAAA,EAEA,MAAM,WAAmB,UAAkB,SAAkB;AACzD,WAAO,MAAM,KAAK,QAAQ,WAAW,UAAU,OAAO;AAAA,EAC1D;AAAA,EAEA,uBAAuB,QAA8B;AACjD,WAAO,wBAAwB,KAAK,QAAQ,MAAM;AAAA,EACtD;AAAA,EAEA,oBACI,WACA,UACA,IACA,eACA,aACF;AACE,WAAO;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AAAA,EAEA,qBACI,UACA,OACA,IACA,eACA,aACF;AACE,WAAO;AAAA,MACH,KAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AAAA,EAEA,kBAAkB,QAAiC;AAC/C,WAAO,kBAAkB,KAAK,QAAQ,MAAM;AAAA,EAChD;AAEJ;","names":["axios","ApiCallType","WebhookSource","SQAuthUserType","StepType","StepStatus","ProcessStatus","ProcessTriggerType","ProcessType","response","import_axios","ProcessRequestData","ProcessRequestData"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/apis/unmeshedApiClient.ts","../src/utils/unmeshedCommonUtils.ts","../src/types/index.ts","../src/apis/queuedWorker.ts","../src/apis/pollerClientImpl.ts","../src/apis/processClientImpl.ts","../src/apis/registrationClientImpl.ts"],"sourcesContent":["import {\n ApiCallType,\n ProcessRequestData,\n ProcessSearchRequest,\n RenewRegistrationParams,\n UnmeshedClientConfig,\n UnmeshedWorkerConfig,\n} from \"./types\";\nimport {UnmeshedApiClient} from \"./apis/unmeshedApiClient\";\nimport {startPollingWorkers} from \"./apis/pollerClientImpl\";\nimport {\n bulkResume,\n bulkReviewed,\n bulkTerminate,\n getProcessData,\n getStepData,\n invokeApiMappingGet,\n invokeApiMappingPost,\n rerun,\n runProcessAsync,\n runProcessSync,\n searchProcessExecutions,\n} from \"./apis/processClientImpl\";\nimport {renewRegistration} from \"./apis/registrationClientImpl\";\n\n// noinspection JSUnusedGlobalSymbols\nexport class UnmeshedClient {\n private client: UnmeshedApiClient;\n\n constructor(config: UnmeshedClientConfig) {\n this.client = new UnmeshedApiClient(config);\n }\n\n startPolling(workers: UnmeshedWorkerConfig[]) {\n startPollingWorkers(this.client, workers);\n }\n\n runProcessSync(ProcessRequestData: ProcessRequestData) {\n return runProcessSync(this.client, ProcessRequestData);\n }\n\n runProcessAsync(ProcessRequestData: ProcessRequestData) {\n return runProcessAsync(this.client, ProcessRequestData);\n }\n\n getProcessData(processId: number, includeSteps: boolean) {\n return getProcessData(this.client, processId, includeSteps);\n }\n\n getStepData(stepId: number) {\n return getStepData(this.client, stepId);\n }\n\n bulkTerminate(processIds: number[], reason?: string) {\n return bulkTerminate(this.client, processIds, reason);\n }\n\n bulkResume(processIds: number[]) {\n return bulkResume(this.client, processIds);\n }\n\n bulkReviewed(processIds: number[], reason?: string) {\n return bulkReviewed(this.client, processIds, reason);\n }\n\n reRun(processId: number, clientId: string, 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(\n apiClient,\n endpoint,\n id,\n correlationId,\n apiCallType\n );\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(\n this.client,\n endpoint,\n input,\n id,\n correlationId,\n apiCallType\n );\n }\n\n reNewRegistration(params: RenewRegistrationParams) {\n return renewRegistration(this.client, params);\n }\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\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\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>(\n endpoint: string,\n params?: QueryParams,\n config?: RequestConfig\n ): 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>(\n endpoint: string,\n clientRequestConfig: ClientRequestConfig\n ): 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>(\n endpoint: string,\n clientRequestConfig: ClientRequestConfig\n ): 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>(\n endpoint: string,\n clientRequestConfig: ClientRequestConfig\n ): 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\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 WORKER = \"WORKER\",\n HTTP = \"HTTP\",\n WAIT = \"WAIT\",\n FAIL = \"FAIL\",\n PYTHON = \"PYTHON\",\n JAVASCRIPT = \"JAVASCRIPT\",\n JQ = \"JQ\",\n MANAGED = \"MANAGED\",\n BUILTIN = \"BUILTIN\",\n NOOP = \"NOOP\",\n PERSISTED_STATE = \"PERSISTED_STATE\",\n DEPENDSON = \"DEPENDSON\",\n INTEGRATION = \"INTEGRATION\",\n EXIT = \"EXIT\",\n SUB_PROCESS = \"SUB_PROCESS\",\n LIST = \"LIST\",\n PARALLEL = \"PARALLEL\",\n FOREACH = \"FOREACH\",\n SWITCH = \"SWITCH\",\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\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 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};\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\n 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\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(`Configured queued worker with ${pollIntervalMs} ms interval and batch size of ${batchSize} and a timeout of ${timeoutMs} ms`);\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.then(() => {\n clearTimeout(timeout);\n resolve();\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}\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(\n apiClient: UnmeshedApiClient,\n data: StepQueueNameData[]\n) {\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(\n \"An error occurred during polling registration. Retrying in 3 seconds...\"\n );\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 }\n}\n\nasync function postWorkerResponse(apiClient: UnmeshedApiClient, workResponses: WorkResponse[]) {\n try {\n if (workResponses.length > 0) {\n const grouped: Record<StepStatus, number[]> = workResponses.reduce((acc, response) => {\n if (!acc[response.status]) {\n acc[response.status] = [];\n }\n acc[response.status].push(response.stepId);\n return acc;\n }, {} as Record<StepStatus, number[]>);\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.then((workRequests) => {\n clearTimeout(timeout);\n resolve(workRequests);\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(\n apiClient: UnmeshedApiClient,\n workers: UnmeshedWorkerConfig[]\n) {\n\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(pollWorker(apiClient, pollWorkerData), apiClient.config.pollTimeout);\n for (const polledWorker of workRequests) {\n const associatedWorker: UnmeshedWorkerConfig | undefined = workers.find(\n (worker) =>\n worker.name === polledWorker.stepName &&\n 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(`Starting work ${polledWorker.processId} : ${polledWorker.stepId} : ${polledWorker.stepName} : ${polledWorker.stepRef}`);\n const result = await Promise.race([\n associatedWorker.worker(polledWorker.inputParam),\n timeoutPromise,\n ]);\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) {\n try {\n if (error instanceof Error) {\n const plainError = {\n name: error.name,\n message: error.message,\n stack: error.stack,\n ...error, // Include enumerable custom properties if they exist\n };\n return JSON.stringify(plainError);\n }\n return JSON.stringify(error);\n } catch (stringifyError) {\n return `Error stringification failed: ${stringifyError.message}`;\n }\n}\n\nexport async function startPollingWorkers(\n apiClient: UnmeshedApiClient,\n workers: UnmeshedWorkerConfig[],\n intervalMs: number = 5000\n) {\n async function pollCycle() {\n try {\n await pollForWorkers(apiClient, workers);\n } catch (error) {\n console.error(\"Error during worker polling:\", error);\n }\n\n setTimeout(pollCycle, intervalMs);\n }\n\n await pollCycle();\n}\n","import {\n ApiCallType,\n ProcessActionResponseData,\n ProcessData,\n ProcessRequestData,\n ProcessSearchRequest,\n StepData,\n} from \"../types\";\nimport {isAxiosError} from \"axios\";\nimport {UnmeshedApiClient} from \"./unmeshedApiClient\";\n\nconst PROCESS_PREFIX = \"api/process\";\n\nexport const runProcessSync = async (\n apiClient: UnmeshedApiClient,\n ProcessRequestData: ProcessRequestData\n): Promise<ProcessData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/runSync`, {\n data: ProcessRequestData,\n params: {\n clientId: apiClient.getClientId(),\n },\n });\n console.log(\"Response:\", response);\n return response.data;\n } catch (error) {\n console.error(\"Some error occurred running process request : \", error);\n throw error;\n }\n};\n\nexport const runProcessAsync = async (\n apiClient: UnmeshedApiClient,\n ProcessRequestData: ProcessRequestData\n): Promise<ProcessData> => {\n try {\n const response = await apiClient.post(\n `${PROCESS_PREFIX}/runAsync`,\n {\n data: ProcessRequestData,\n params: {\n clientId: apiClient.getClientId(),\n },\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>(\n `${PROCESS_PREFIX}/context/${processId}`,\n {includeSteps}\n );\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 (\n apiClient: UnmeshedApiClient,\n stepId: number\n): 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>(\n `${PROCESS_PREFIX}/stepContext/${stepId}`\n );\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(\n `${PROCESS_PREFIX}/bulkTerminate`,\n {\n params: {reason},\n data: processIds,\n }\n );\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(\n `Error occurred while terminating processes: ${err.message || error}`\n );\n }\n};\n\nexport const bulkResume = async (\n apiClient: UnmeshedApiClient,\n processIds: number[]\n): Promise<ProcessActionResponseData> => {\n try {\n const response = await apiClient.post(\n `${PROCESS_PREFIX}/bulkResume`,\n {\n data: processIds,\n }\n );\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(\n `Error occurred while resuming processes: ${err.message || error}`\n );\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(\n `${PROCESS_PREFIX}/bulkReviewed`,\n {\n data: processIds,\n params: {reason},\n }\n );\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(\n `Error occurred while marking processes as reviewed: ${\n err.message || error\n }`\n );\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(\n `HTTP request error during rerun process: ${error.response?.status} - ${error.response?.data}`\n );\n } else {\n const err = error as Error;\n throw new Error(\n `Unexpected error during rerun process: ${err.message || err}`\n );\n }\n }\n};\n\nexport const searchProcessExecutions = async (\n apiClient: UnmeshedApiClient,\n params: ProcessSearchRequest\n) => {\n const queryParams = new URLSearchParams();\n\n if (params.startTimeEpoch !== undefined && params.startTimeEpoch !== 0)\n queryParams.set(\"startTimeEpoch\", params.startTimeEpoch.toString());\n if (params.endTimeEpoch !== undefined && params.endTimeEpoch !== 0)\n queryParams.set(\"endTimeEpoch\", (params.endTimeEpoch || 0).toString());\n if (params.namespace) queryParams.set(\"namespace\", params.namespace);\n if (params.names && params.names.length)\n queryParams.set(\"names\", params.names.join(\",\"));\n if (params.processIds && params.processIds.length)\n queryParams.set(\"processIds\", params.processIds.join(\",\"));\n if (params.correlationIds && params.correlationIds.length)\n queryParams.set(\"correlationIds\", params.correlationIds.join(\",\"));\n if (params.requestIds && params.requestIds.length)\n queryParams.set(\"requestIds\", params.requestIds.join(\",\"));\n if (params.statuses && params.statuses.length)\n queryParams.set(\"statuses\", params.statuses.join(\",\"));\n if (params.triggerTypes && params.triggerTypes.length)\n queryParams.set(\"triggerTypes\", params.triggerTypes.join(\",\"));\n\n const updatedParams = Object.fromEntries(new URLSearchParams(queryParams));\n\n try {\n const response = await apiClient.get(\n `${PROCESS_PREFIX}/api/stats/process/search`,\n updatedParams\n );\n console.log(\"Response:\", response);\n return response.data;\n } catch (error) {\n console.error(\"Error occurred while searching process executions: \", error);\n throw error;\n }\n};\n\nexport const 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(\n `${PROCESS_PREFIX}/api/call/${endpoint}`,\n {\n id: id,\n correlationId: correlationId,\n apiCallType,\n }\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(\n `${PROCESS_PREFIX}/api/call/${endpoint}`,\n {\n data: input,\n params: {\n id: id,\n correlationId: correlationId,\n apiCallType,\n },\n }\n );\n\n return response.data;\n } catch (error) {\n console.error(\"Error occurred while invoking API Mapping POST: \", error);\n throw error;\n }\n};\n","import { RenewRegistrationParams } from \"../types\";\nimport { UnmeshedApiClient } from \"./unmeshedApiClient\";\n\nexport const renewRegistration = async (\n apiClient: UnmeshedApiClient,\n params: RenewRegistrationParams\n): Promise<string> => {\n try {\n const response = await apiClient.put(\"/api/clients/register\", {\n params: { ...params },\n });\n console.debug(\"Response from server:\", response);\n return response.data;\n } catch (error) {\n console.error(\"Error occurred during registration renewal:\", error);\n throw error;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA0G;;;ACA1G,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,EAEnB,gBAAsC;AAAA,EACtC,WAA+B;AAAA,EAC/B;AAAA,EAER,YAAY,sBAA4C;AACpD,YAAQ,IAAI,iCAAiC;AA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Aa,KAAK,QAAQ,YAAY,MAAM;AAAA,EACvD;AAAA,EAEA,MAAM,WAAmB,UAAkB,SAAkB;AACzD,WAAO,MAAM,KAAK,QAAQ,WAAW,OAAO;AAAA,EAChD;AAAA,EAEA,uBAAuB,QAA8B;AACjD,WAAO,wBAAwB,KAAK,QAAQ,MAAM;AAAA,EACtD;AAAA,EAEA,oBACI,WACA,UACA,IACA,eACA,aACF;AACE,WAAO;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AAAA,EAEA,qBACI,UACA,OACA,IACA,eACA,aACF;AACE,WAAO;AAAA,MACH,KAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AAAA,EAEA,kBAAkB,QAAiC;AAC/C,WAAO,kBAAkB,KAAK,QAAQ,MAAM;AAAA,EAChD;AAEJ;","names":["axios","ApiCallType","WebhookSource","SQAuthUserType","StepType","StepStatus","ProcessStatus","ProcessTriggerType","ProcessType","response","import_axios","ProcessRequestData","ProcessRequestData"]}
package/dist/index.mjs CHANGED
@@ -615,9 +615,8 @@ var bulkReviewed = async (apiClient, processIds, reason) => {
615
615
  );
616
616
  }
617
617
  };
618
- var rerun = async (apiClient, processId, clientId, version) => {
618
+ var rerun = async (apiClient, processId, version) => {
619
619
  const params = {
620
- clientId,
621
620
  processId
622
621
  };
623
622
  if (version !== void 0) {
@@ -755,7 +754,7 @@ var UnmeshedClient = class {
755
754
  return bulkReviewed(this.client, processIds, reason);
756
755
  }
757
756
  reRun(processId, clientId, version) {
758
- return rerun(this.client, processId, clientId, version);
757
+ return rerun(this.client, processId, version);
759
758
  }
760
759
  searchProcessExecution(params) {
761
760
  return searchProcessExecutions(this.client, params);
@@ -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, FinalUnmeshedClientConfig,\n HandleRequestConfig,\n QueryParams,\n RequestConfig,\n UnmeshedClientConfig,\n} from \"../types\";\nimport {UnmeshedCommonUtils} from \"../utils/unmeshedCommonUtils\";\n\nexport class UnmeshedApiClient {\n\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\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>(\n endpoint: string,\n params?: QueryParams,\n config?: RequestConfig\n ): 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>(\n endpoint: string,\n clientRequestConfig: ClientRequestConfig\n ): 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>(\n endpoint: string,\n clientRequestConfig: ClientRequestConfig\n ): 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>(\n endpoint: string,\n clientRequestConfig: ClientRequestConfig\n ): 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\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 WORKER = \"WORKER\",\n HTTP = \"HTTP\",\n WAIT = \"WAIT\",\n FAIL = \"FAIL\",\n PYTHON = \"PYTHON\",\n JAVASCRIPT = \"JAVASCRIPT\",\n JQ = \"JQ\",\n MANAGED = \"MANAGED\",\n BUILTIN = \"BUILTIN\",\n NOOP = \"NOOP\",\n PERSISTED_STATE = \"PERSISTED_STATE\",\n DEPENDSON = \"DEPENDSON\",\n INTEGRATION = \"INTEGRATION\",\n EXIT = \"EXIT\",\n SUB_PROCESS = \"SUB_PROCESS\",\n LIST = \"LIST\",\n PARALLEL = \"PARALLEL\",\n FOREACH = \"FOREACH\",\n SWITCH = \"SWITCH\",\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 processDefinitionHistoryId: number | null;\n requestId: string;\n correlationId: string;\n status: ProcessStatus;\n input: Record<string, unknown>;\n output: Record<string, unknown>;\n stepIdCount: number | null;\n shardName: string;\n shardInstanceId: number | null;\n stepIds: StepId[];\n stepDataById: Record<number, 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 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};\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\n 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\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(`Configured queued worker with ${pollIntervalMs} ms interval and batch size of ${batchSize} and a timeout of ${timeoutMs} ms`);\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.then(() => {\n clearTimeout(timeout);\n resolve();\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}\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(\n apiClient: UnmeshedApiClient,\n data: StepQueueNameData[]\n) {\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(\n \"An error occurred during polling registration. Retrying in 3 seconds...\"\n );\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 }\n}\n\nasync function postWorkerResponse(apiClient: UnmeshedApiClient, workResponses: WorkResponse[]) {\n try {\n if (workResponses.length > 0) {\n const grouped: Record<StepStatus, number[]> = workResponses.reduce((acc, response) => {\n if (!acc[response.status]) {\n acc[response.status] = [];\n }\n acc[response.status].push(response.stepId);\n return acc;\n }, {} as Record<StepStatus, number[]>);\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.then((workRequests) => {\n clearTimeout(timeout);\n resolve(workRequests);\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(\n apiClient: UnmeshedApiClient,\n workers: UnmeshedWorkerConfig[]\n) {\n\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(pollWorker(apiClient, pollWorkerData), apiClient.config.pollTimeout);\n for (const polledWorker of workRequests) {\n const associatedWorker: UnmeshedWorkerConfig | undefined = workers.find(\n (worker) =>\n worker.name === polledWorker.stepName &&\n 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(`Starting work ${polledWorker.processId} : ${polledWorker.stepId} : ${polledWorker.stepName} : ${polledWorker.stepRef}`);\n const result = await Promise.race([\n associatedWorker.worker(polledWorker.inputParam),\n timeoutPromise,\n ]);\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) {\n try {\n if (error instanceof Error) {\n const plainError = {\n name: error.name,\n message: error.message,\n stack: error.stack,\n ...error, // Include enumerable custom properties if they exist\n };\n return JSON.stringify(plainError);\n }\n return JSON.stringify(error);\n } catch (stringifyError) {\n return `Error stringification failed: ${stringifyError.message}`;\n }\n}\n\nexport async function startPollingWorkers(\n apiClient: UnmeshedApiClient,\n workers: UnmeshedWorkerConfig[],\n intervalMs: number = 5000\n) {\n async function pollCycle() {\n try {\n await pollForWorkers(apiClient, workers);\n } catch (error) {\n console.error(\"Error during worker polling:\", error);\n }\n\n setTimeout(pollCycle, intervalMs);\n }\n\n await pollCycle();\n}\n","import {\n ApiCallType,\n ProcessActionResponseData,\n ProcessData,\n ProcessRequestData,\n ProcessSearchRequest,\n StepData,\n} from \"../types\";\nimport {isAxiosError} from \"axios\";\nimport {UnmeshedApiClient} from \"./unmeshedApiClient\";\n\nconst PROCESS_PREFIX = \"api/process\";\n\nexport const runProcessSync = async (\n apiClient: UnmeshedApiClient,\n ProcessRequestData: ProcessRequestData\n): Promise<ProcessData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/runSync`, {\n data: ProcessRequestData,\n params: {\n clientId: apiClient.getClientId(),\n },\n });\n console.log(\"Response:\", response);\n return response.data;\n } catch (error) {\n console.error(\"Some error occurred running process request : \", error);\n throw error;\n }\n};\n\nexport const runProcessAsync = async (\n apiClient: UnmeshedApiClient,\n ProcessRequestData: ProcessRequestData\n): Promise<ProcessData> => {\n try {\n const response = await apiClient.post(\n `${PROCESS_PREFIX}/runAsync`,\n {\n data: ProcessRequestData,\n params: {\n clientId: apiClient.getClientId(),\n },\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>(\n `${PROCESS_PREFIX}/context/${processId}`,\n {includeSteps}\n );\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 (\n apiClient: UnmeshedApiClient,\n stepId: number\n): 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>(\n `${PROCESS_PREFIX}/stepContext/${stepId}`\n );\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(\n `${PROCESS_PREFIX}/bulkTerminate`,\n {\n params: {reason},\n data: processIds,\n }\n );\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(\n `Error occurred while terminating processes: ${err.message || error}`\n );\n }\n};\n\nexport const bulkResume = async (\n apiClient: UnmeshedApiClient,\n processIds: number[]\n): Promise<ProcessActionResponseData> => {\n try {\n const response = await apiClient.post(\n `${PROCESS_PREFIX}/bulkResume`,\n {\n data: processIds,\n }\n );\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(\n `Error occurred while resuming processes: ${err.message || error}`\n );\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(\n `${PROCESS_PREFIX}/bulkReviewed`,\n {\n data: processIds,\n params: {reason},\n }\n );\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(\n `Error occurred while marking processes as reviewed: ${\n err.message || error\n }`\n );\n }\n};\n\nexport const rerun = async (\n apiClient: UnmeshedApiClient,\n processId: number,\n clientId: string,\n version?: number\n): Promise<ProcessData> => {\n const params: Record<string, any> = {\n clientId,\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(\n `HTTP request error during rerun process: ${error.response?.status} - ${error.response?.data}`\n );\n } else {\n const err = error as Error;\n throw new Error(\n `Unexpected error during rerun process: ${err.message || err}`\n );\n }\n }\n};\n\nexport const searchProcessExecutions = async (\n apiClient: UnmeshedApiClient,\n params: ProcessSearchRequest\n) => {\n const queryParams = new URLSearchParams();\n\n if (params.startTimeEpoch !== undefined && params.startTimeEpoch !== 0)\n queryParams.set(\"startTimeEpoch\", params.startTimeEpoch.toString());\n if (params.endTimeEpoch !== undefined && params.endTimeEpoch !== 0)\n queryParams.set(\"endTimeEpoch\", (params.endTimeEpoch || 0).toString());\n if (params.namespace) queryParams.set(\"namespace\", params.namespace);\n if (params.names && params.names.length)\n queryParams.set(\"names\", params.names.join(\",\"));\n if (params.processIds && params.processIds.length)\n queryParams.set(\"processIds\", params.processIds.join(\",\"));\n if (params.correlationIds && params.correlationIds.length)\n queryParams.set(\"correlationIds\", params.correlationIds.join(\",\"));\n if (params.requestIds && params.requestIds.length)\n queryParams.set(\"requestIds\", params.requestIds.join(\",\"));\n if (params.statuses && params.statuses.length)\n queryParams.set(\"statuses\", params.statuses.join(\",\"));\n if (params.triggerTypes && params.triggerTypes.length)\n queryParams.set(\"triggerTypes\", params.triggerTypes.join(\",\"));\n\n const updatedParams = Object.fromEntries(new URLSearchParams(queryParams));\n\n try {\n const response = await apiClient.get(\n `${PROCESS_PREFIX}/api/stats/process/search`,\n updatedParams\n );\n console.log(\"Response:\", response);\n return response.data;\n } catch (error) {\n console.error(\"Error occurred while searching process executions: \", error);\n throw error;\n }\n};\n\nexport const 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(\n `${PROCESS_PREFIX}/api/call/${endpoint}`,\n {\n id: id,\n correlationId: correlationId,\n apiCallType,\n }\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(\n `${PROCESS_PREFIX}/api/call/${endpoint}`,\n {\n data: input,\n params: {\n id: id,\n correlationId: correlationId,\n apiCallType,\n },\n }\n );\n\n return response.data;\n } catch (error) {\n console.error(\"Error occurred while invoking API Mapping POST: \", error);\n throw error;\n }\n};\n","import { RenewRegistrationParams } from \"../types\";\nimport { UnmeshedApiClient } from \"./unmeshedApiClient\";\n\nexport const renewRegistration = async (\n apiClient: UnmeshedApiClient,\n params: RenewRegistrationParams\n): Promise<string> => {\n try {\n const response = await apiClient.put(\"/api/clients/register\", {\n params: { ...params },\n });\n console.debug(\"Response from server:\", response);\n return response.data;\n } catch (error) {\n console.error(\"Error occurred during registration renewal:\", error);\n throw error;\n }\n};\n","import {\n ApiCallType,\n ProcessRequestData,\n ProcessSearchRequest,\n RenewRegistrationParams,\n UnmeshedClientConfig,\n UnmeshedWorkerConfig,\n} from \"./types\";\nimport {UnmeshedApiClient} from \"./apis/unmeshedApiClient\";\nimport {startPollingWorkers} from \"./apis/pollerClientImpl\";\nimport {\n bulkResume,\n bulkReviewed,\n bulkTerminate,\n getProcessData,\n getStepData,\n invokeApiMappingGet,\n invokeApiMappingPost,\n rerun,\n runProcessAsync,\n runProcessSync,\n searchProcessExecutions,\n} from \"./apis/processClientImpl\";\nimport {renewRegistration} from \"./apis/registrationClientImpl\";\n\n// noinspection JSUnusedGlobalSymbols\nexport class UnmeshedClient {\n private client: UnmeshedApiClient;\n\n constructor(config: UnmeshedClientConfig) {\n this.client = new UnmeshedApiClient(config);\n }\n\n startPolling(workers: UnmeshedWorkerConfig[]) {\n startPollingWorkers(this.client, workers);\n }\n\n runProcessSync(ProcessRequestData: ProcessRequestData) {\n return runProcessSync(this.client, ProcessRequestData);\n }\n\n runProcessAsync(ProcessRequestData: ProcessRequestData) {\n return runProcessAsync(this.client, ProcessRequestData);\n }\n\n getProcessData(processId: number, includeSteps: boolean) {\n return getProcessData(this.client, processId, includeSteps);\n }\n\n getStepData(stepId: number) {\n return getStepData(this.client, stepId);\n }\n\n bulkTerminate(processIds: number[], reason?: string) {\n return bulkTerminate(this.client, processIds, reason);\n }\n\n bulkResume(processIds: number[]) {\n return bulkResume(this.client, processIds);\n }\n\n bulkReviewed(processIds: number[], reason?: string) {\n return bulkReviewed(this.client, processIds, reason);\n }\n\n reRun(processId: number, clientId: string, version?: number) {\n return rerun(this.client, processId, clientId, 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(\n apiClient,\n endpoint,\n id,\n correlationId,\n apiCallType\n );\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(\n this.client,\n endpoint,\n input,\n id,\n correlationId,\n apiCallType\n );\n }\n\n reNewRegistration(params: RenewRegistrationParams) {\n return renewRegistration(this.client, params);\n }\n\n}\n\nexport * from \"./types\";\n"],"mappings":";AAAA,OAAO,WAAmG;;;ACA1G,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;;;ADDO,IAAM,oBAAN,MAAwB;AAAA,EAEnB,gBAAsC;AAAA,EACtC,WAA+B;AAAA,EAC/B;AAAA,EAER,YAAY,sBAA4C;AACpD,YAAQ,IAAI,iCAAiC;AAE7C,SAAK,UAAU,2BAA2B,oBAAoB;AAE9D,YAAQ,IAAI,KAAK,O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AmB,UAAkB,SAAkB;AACzD,WAAO,MAAM,KAAK,QAAQ,WAAW,UAAU,OAAO;AAAA,EAC1D;AAAA,EAEA,uBAAuB,QAA8B;AACjD,WAAO,wBAAwB,KAAK,QAAQ,MAAM;AAAA,EACtD;AAAA,EAEA,oBACI,WACA,UACA,IACA,eACA,aACF;AACE,WAAO;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AAAA,EAEA,qBACI,UACA,OACA,IACA,eACA,aACF;AACE,WAAO;AAAA,MACH,KAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AAAA,EAEA,kBAAkB,QAAiC;AAC/C,WAAO,kBAAkB,KAAK,QAAQ,MAAM;AAAA,EAChD;AAEJ;","names":["ApiCallType","WebhookSource","SQAuthUserType","StepType","StepStatus","ProcessStatus","ProcessTriggerType","ProcessType","response","ProcessRequestData","ProcessRequestData"]}
1
+ {"version":3,"sources":["../src/apis/unmeshedApiClient.ts","../src/utils/unmeshedCommonUtils.ts","../src/types/index.ts","../src/apis/queuedWorker.ts","../src/apis/pollerClientImpl.ts","../src/apis/processClientImpl.ts","../src/apis/registrationClientImpl.ts","../src/index.ts"],"sourcesContent":["import axios, {AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, RawAxiosRequestHeaders} from \"axios\";\nimport {\n ApiResponse,\n ClientRequestConfig,\n FinalUnmeshedClientConfig,\n HandleRequestConfig,\n QueryParams,\n RequestConfig,\n UnmeshedClientConfig,\n} from \"../types\";\nimport {UnmeshedCommonUtils} from \"../utils/unmeshedCommonUtils\";\n\nexport class UnmeshedApiClient {\n\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\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>(\n endpoint: string,\n params?: QueryParams,\n config?: RequestConfig\n ): 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>(\n endpoint: string,\n clientRequestConfig: ClientRequestConfig\n ): 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>(\n endpoint: string,\n clientRequestConfig: ClientRequestConfig\n ): 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>(\n endpoint: string,\n clientRequestConfig: ClientRequestConfig\n ): 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\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 WORKER = \"WORKER\",\n HTTP = \"HTTP\",\n WAIT = \"WAIT\",\n FAIL = \"FAIL\",\n PYTHON = \"PYTHON\",\n JAVASCRIPT = \"JAVASCRIPT\",\n JQ = \"JQ\",\n MANAGED = \"MANAGED\",\n BUILTIN = \"BUILTIN\",\n NOOP = \"NOOP\",\n PERSISTED_STATE = \"PERSISTED_STATE\",\n DEPENDSON = \"DEPENDSON\",\n INTEGRATION = \"INTEGRATION\",\n EXIT = \"EXIT\",\n SUB_PROCESS = \"SUB_PROCESS\",\n LIST = \"LIST\",\n PARALLEL = \"PARALLEL\",\n FOREACH = \"FOREACH\",\n SWITCH = \"SWITCH\",\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\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 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};\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\n 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\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(`Configured queued worker with ${pollIntervalMs} ms interval and batch size of ${batchSize} and a timeout of ${timeoutMs} ms`);\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.then(() => {\n clearTimeout(timeout);\n resolve();\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}\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(\n apiClient: UnmeshedApiClient,\n data: StepQueueNameData[]\n) {\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(\n \"An error occurred during polling registration. Retrying in 3 seconds...\"\n );\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 }\n}\n\nasync function postWorkerResponse(apiClient: UnmeshedApiClient, workResponses: WorkResponse[]) {\n try {\n if (workResponses.length > 0) {\n const grouped: Record<StepStatus, number[]> = workResponses.reduce((acc, response) => {\n if (!acc[response.status]) {\n acc[response.status] = [];\n }\n acc[response.status].push(response.stepId);\n return acc;\n }, {} as Record<StepStatus, number[]>);\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.then((workRequests) => {\n clearTimeout(timeout);\n resolve(workRequests);\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(\n apiClient: UnmeshedApiClient,\n workers: UnmeshedWorkerConfig[]\n) {\n\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(pollWorker(apiClient, pollWorkerData), apiClient.config.pollTimeout);\n for (const polledWorker of workRequests) {\n const associatedWorker: UnmeshedWorkerConfig | undefined = workers.find(\n (worker) =>\n worker.name === polledWorker.stepName &&\n 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(`Starting work ${polledWorker.processId} : ${polledWorker.stepId} : ${polledWorker.stepName} : ${polledWorker.stepRef}`);\n const result = await Promise.race([\n associatedWorker.worker(polledWorker.inputParam),\n timeoutPromise,\n ]);\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) {\n try {\n if (error instanceof Error) {\n const plainError = {\n name: error.name,\n message: error.message,\n stack: error.stack,\n ...error, // Include enumerable custom properties if they exist\n };\n return JSON.stringify(plainError);\n }\n return JSON.stringify(error);\n } catch (stringifyError) {\n return `Error stringification failed: ${stringifyError.message}`;\n }\n}\n\nexport async function startPollingWorkers(\n apiClient: UnmeshedApiClient,\n workers: UnmeshedWorkerConfig[],\n intervalMs: number = 5000\n) {\n async function pollCycle() {\n try {\n await pollForWorkers(apiClient, workers);\n } catch (error) {\n console.error(\"Error during worker polling:\", error);\n }\n\n setTimeout(pollCycle, intervalMs);\n }\n\n await pollCycle();\n}\n","import {\n ApiCallType,\n ProcessActionResponseData,\n ProcessData,\n ProcessRequestData,\n ProcessSearchRequest,\n StepData,\n} from \"../types\";\nimport {isAxiosError} from \"axios\";\nimport {UnmeshedApiClient} from \"./unmeshedApiClient\";\n\nconst PROCESS_PREFIX = \"api/process\";\n\nexport const runProcessSync = async (\n apiClient: UnmeshedApiClient,\n ProcessRequestData: ProcessRequestData\n): Promise<ProcessData> => {\n try {\n const response = await apiClient.post(`${PROCESS_PREFIX}/runSync`, {\n data: ProcessRequestData,\n params: {\n clientId: apiClient.getClientId(),\n },\n });\n console.log(\"Response:\", response);\n return response.data;\n } catch (error) {\n console.error(\"Some error occurred running process request : \", error);\n throw error;\n }\n};\n\nexport const runProcessAsync = async (\n apiClient: UnmeshedApiClient,\n ProcessRequestData: ProcessRequestData\n): Promise<ProcessData> => {\n try {\n const response = await apiClient.post(\n `${PROCESS_PREFIX}/runAsync`,\n {\n data: ProcessRequestData,\n params: {\n clientId: apiClient.getClientId(),\n },\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>(\n `${PROCESS_PREFIX}/context/${processId}`,\n {includeSteps}\n );\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 (\n apiClient: UnmeshedApiClient,\n stepId: number\n): 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>(\n `${PROCESS_PREFIX}/stepContext/${stepId}`\n );\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(\n `${PROCESS_PREFIX}/bulkTerminate`,\n {\n params: {reason},\n data: processIds,\n }\n );\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(\n `Error occurred while terminating processes: ${err.message || error}`\n );\n }\n};\n\nexport const bulkResume = async (\n apiClient: UnmeshedApiClient,\n processIds: number[]\n): Promise<ProcessActionResponseData> => {\n try {\n const response = await apiClient.post(\n `${PROCESS_PREFIX}/bulkResume`,\n {\n data: processIds,\n }\n );\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(\n `Error occurred while resuming processes: ${err.message || error}`\n );\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(\n `${PROCESS_PREFIX}/bulkReviewed`,\n {\n data: processIds,\n params: {reason},\n }\n );\n return response.data as ProcessActionResponseData;\n } catch (error) {\n const err = error as Error;\n throw new Error(\n `Error occurred while marking processes as reviewed: ${\n err.message || error\n }`\n );\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(\n `HTTP request error during rerun process: ${error.response?.status} - ${error.response?.data}`\n );\n } else {\n const err = error as Error;\n throw new Error(\n `Unexpected error during rerun process: ${err.message || err}`\n );\n }\n }\n};\n\nexport const searchProcessExecutions = async (\n apiClient: UnmeshedApiClient,\n params: ProcessSearchRequest\n) => {\n const queryParams = new URLSearchParams();\n\n if (params.startTimeEpoch !== undefined && params.startTimeEpoch !== 0)\n queryParams.set(\"startTimeEpoch\", params.startTimeEpoch.toString());\n if (params.endTimeEpoch !== undefined && params.endTimeEpoch !== 0)\n queryParams.set(\"endTimeEpoch\", (params.endTimeEpoch || 0).toString());\n if (params.namespace) queryParams.set(\"namespace\", params.namespace);\n if (params.names && params.names.length)\n queryParams.set(\"names\", params.names.join(\",\"));\n if (params.processIds && params.processIds.length)\n queryParams.set(\"processIds\", params.processIds.join(\",\"));\n if (params.correlationIds && params.correlationIds.length)\n queryParams.set(\"correlationIds\", params.correlationIds.join(\",\"));\n if (params.requestIds && params.requestIds.length)\n queryParams.set(\"requestIds\", params.requestIds.join(\",\"));\n if (params.statuses && params.statuses.length)\n queryParams.set(\"statuses\", params.statuses.join(\",\"));\n if (params.triggerTypes && params.triggerTypes.length)\n queryParams.set(\"triggerTypes\", params.triggerTypes.join(\",\"));\n\n const updatedParams = Object.fromEntries(new URLSearchParams(queryParams));\n\n try {\n const response = await apiClient.get(\n `${PROCESS_PREFIX}/api/stats/process/search`,\n updatedParams\n );\n console.log(\"Response:\", response);\n return response.data;\n } catch (error) {\n console.error(\"Error occurred while searching process executions: \", error);\n throw error;\n }\n};\n\nexport const 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(\n `${PROCESS_PREFIX}/api/call/${endpoint}`,\n {\n id: id,\n correlationId: correlationId,\n apiCallType,\n }\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(\n `${PROCESS_PREFIX}/api/call/${endpoint}`,\n {\n data: input,\n params: {\n id: id,\n correlationId: correlationId,\n apiCallType,\n },\n }\n );\n\n return response.data;\n } catch (error) {\n console.error(\"Error occurred while invoking API Mapping POST: \", error);\n throw error;\n }\n};\n","import { RenewRegistrationParams } from \"../types\";\nimport { UnmeshedApiClient } from \"./unmeshedApiClient\";\n\nexport const renewRegistration = async (\n apiClient: UnmeshedApiClient,\n params: RenewRegistrationParams\n): Promise<string> => {\n try {\n const response = await apiClient.put(\"/api/clients/register\", {\n params: { ...params },\n });\n console.debug(\"Response from server:\", response);\n return response.data;\n } catch (error) {\n console.error(\"Error occurred during registration renewal:\", error);\n throw error;\n }\n};\n","import {\n ApiCallType,\n ProcessRequestData,\n ProcessSearchRequest,\n RenewRegistrationParams,\n UnmeshedClientConfig,\n UnmeshedWorkerConfig,\n} from \"./types\";\nimport {UnmeshedApiClient} from \"./apis/unmeshedApiClient\";\nimport {startPollingWorkers} from \"./apis/pollerClientImpl\";\nimport {\n bulkResume,\n bulkReviewed,\n bulkTerminate,\n getProcessData,\n getStepData,\n invokeApiMappingGet,\n invokeApiMappingPost,\n rerun,\n runProcessAsync,\n runProcessSync,\n searchProcessExecutions,\n} from \"./apis/processClientImpl\";\nimport {renewRegistration} from \"./apis/registrationClientImpl\";\n\n// noinspection JSUnusedGlobalSymbols\nexport class UnmeshedClient {\n private client: UnmeshedApiClient;\n\n constructor(config: UnmeshedClientConfig) {\n this.client = new UnmeshedApiClient(config);\n }\n\n startPolling(workers: UnmeshedWorkerConfig[]) {\n startPollingWorkers(this.client, workers);\n }\n\n runProcessSync(ProcessRequestData: ProcessRequestData) {\n return runProcessSync(this.client, ProcessRequestData);\n }\n\n runProcessAsync(ProcessRequestData: ProcessRequestData) {\n return runProcessAsync(this.client, ProcessRequestData);\n }\n\n getProcessData(processId: number, includeSteps: boolean) {\n return getProcessData(this.client, processId, includeSteps);\n }\n\n getStepData(stepId: number) {\n return getStepData(this.client, stepId);\n }\n\n bulkTerminate(processIds: number[], reason?: string) {\n return bulkTerminate(this.client, processIds, reason);\n }\n\n bulkResume(processIds: number[]) {\n return bulkResume(this.client, processIds);\n }\n\n bulkReviewed(processIds: number[], reason?: string) {\n return bulkReviewed(this.client, processIds, reason);\n }\n\n reRun(processId: number, clientId: string, 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(\n apiClient,\n endpoint,\n id,\n correlationId,\n apiCallType\n );\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(\n this.client,\n endpoint,\n input,\n id,\n correlationId,\n apiCallType\n );\n }\n\n reNewRegistration(params: RenewRegistrationParams) {\n return renewRegistration(this.client, params);\n }\n\n}\n\nexport * from \"./types\";\n"],"mappings":";AAAA,OAAO,WAAmG;;;ACA1G,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,EAEnB,gBAAsC;AAAA,EACtC,WAA+B;AAAA,EAC/B;AAAA,EAER,YAAY,sBAA4C;AACpD,YAAQ,IAAI,iCAAiC;AAE7C,SAAK,UAAU,2BAA2B,oBAAoB;AAE9D,YAAQ,IAAI,KAAK,OAAO;AAExB,SAAK,WAAW,KAAK,QAAQ;AAE7B,QAAI,CAAC,KAAK,QAAQ,SAAS;AACvB,YAAM,IAAI,MAAM,qBAAqB;AAAA,IACzC;AAEA,UAAM,UAAU,KAAK,QAAQ,OAAO,GAAG,KAAK,QAAQ,OAAO,IAAI,KAAK,QAAQ,IAAI,KAAK,KAAK,QAAQ;AAElG,SAAK,gBAAgB,MAAM,OAAO;AAAA,MAC9B;AAAA,MACA,SAAS,KAAK,QAAQ;AAAA,MACtB,SAAS;AAAA,QACL,gBAAgB;AAAA,QAChB,eAAe,qBAAqB,KAAK,QAAQ,QAAQ,IAAI,oBAAoB;AAAA,UAC7E,KAAK,QAAQ;AAAA,QACjB,CAAC;AAAA,MACL;AAAA,IACJ,CAAC;AAAA,EACL;AAAA,EAEA,MAAc,cAAiB;AA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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.0.18",
3
+ "version": "1.1.0",
4
4
  "description": "Unmeshed TS/JS SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",