@geniehr/utilities 1.0.17 → 1.0.19

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.
@@ -27,7 +27,12 @@ export class ConductorClient {
27
27
  return response.data;
28
28
  }
29
29
  catch (error) {
30
- console.error(`Error starting workflow ${name}:`, error.message);
30
+ if (axios.isAxiosError(error)) {
31
+ console.error(`Error starting workflow ${name}:`, error.response?.status, error.response?.data || error.message);
32
+ }
33
+ else {
34
+ console.error(`Error starting workflow ${name}:`, error);
35
+ }
31
36
  throw error;
32
37
  }
33
38
  }
@@ -161,13 +166,16 @@ export class ConductorClient {
161
166
  return response.data.status;
162
167
  }
163
168
  catch (error) {
164
- // Fallback to full workflow fetch with minimal data if status endpoint doesn't exist
165
- if (error.response?.status === 404 || error.response?.status === 405) {
169
+ // Fallback to full workflow fetch if status endpoint doesn't exist or fails
170
+ // This handles 404, 405, or any other error from the status endpoint
171
+ try {
166
172
  const workflow = await this.getWorkflow(workflowInstanceId, false);
167
173
  return workflow.status;
168
174
  }
169
- console.error(`Error getting workflow status:`, error.message);
170
- throw error;
175
+ catch (fallbackError) {
176
+ console.error(`Error getting workflow status:`, fallbackError.message);
177
+ throw fallbackError;
178
+ }
171
179
  }
172
180
  }
173
181
  }
package/dist/index.d.ts CHANGED
@@ -11,4 +11,3 @@ export { HttpClient, GraphQLClient } from './apiUtils/httpUtils.js';
11
11
  export { sendResponse } from './apiUtils/api.js';
12
12
  export { services } from './shared/services.js';
13
13
  export { ImageCompressor } from './shared/helper/ImageCompressor.js';
14
- export { ConductorClient } from './conductor/ConductorClient.js';
package/dist/index.js CHANGED
@@ -10,4 +10,3 @@ export { HttpClient, GraphQLClient } from './apiUtils/httpUtils.js';
10
10
  export { sendResponse } from './apiUtils/api.js';
11
11
  export { services } from './shared/services.js';
12
12
  export { ImageCompressor } from './shared/helper/ImageCompressor.js';
13
- export { ConductorClient } from './conductor/ConductorClient.js';
@@ -45,8 +45,7 @@ export class LoggerService {
45
45
  }
46
46
  extractErrorPayload(input) {
47
47
  const { ex, correlationId, service, ...rest } = input;
48
- if (!correlationId)
49
- throw new Error('correlationId is mandatory');
48
+ const cid = correlationId || 'UNKNOWN';
50
49
  let message = 'Unknown error';
51
50
  let stack = '';
52
51
  let errorCode = 'UNKNOWN';
@@ -63,7 +62,7 @@ export class LoggerService {
63
62
  }
64
63
  return {
65
64
  message,
66
- correlationId,
65
+ correlationId: cid,
67
66
  errorCode,
68
67
  errorStack: stack,
69
68
  service: service || this.service, // Use provided service or fallback to the class's service
@@ -12,7 +12,8 @@ export const services = {
12
12
  'cache-ms': 'http://localhost:3009',
13
13
  'migration-ms': 'http://localhost:3010',
14
14
  'search-ms': 'http://localhost:3011',
15
- 'notifications-ms': 'http://localhost:3012'
15
+ 'notifications-ms': 'http://localhost:3012',
16
+ 'temporal-ms': 'http://localhost:3013'
16
17
  },
17
18
  'dev': {
18
19
  'bff-ms': 'http://bff-ms-dev:3000',
@@ -27,7 +28,8 @@ export const services = {
27
28
  'cache-ms': 'http://cache-ms-dev:3009',
28
29
  'migration-ms': 'http://migration-ms-dev:3010',
29
30
  'search-ms': 'http://search-ms-dev:3011',
30
- 'notifications-ms': 'http://notifications-ms-dev:3012'
31
+ 'notifications-ms': 'http://notifications-ms-dev:3012',
32
+ 'temporal-ms': 'http://temporal-ms-dev:3013'
31
33
  },
32
34
  'uat': {}
33
35
  };
@@ -1,5 +1,4 @@
1
1
  import type { MQClient } from '../mq/client.js';
2
- import type { ConductorClient } from '../conductor/ConductorClient.js';
3
2
  import Redis from 'ioredis';
4
3
  export type GHRContext<TPrismaClient = any> = {
5
4
  service?: string;
@@ -8,6 +7,5 @@ export type GHRContext<TPrismaClient = any> = {
8
7
  prisma?: TPrismaClient;
9
8
  redis?: Redis;
10
9
  mongo?: any;
11
- conductor?: ConductorClient;
12
10
  extras?: Record<string, any>;
13
11
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geniehr/utilities",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/Genie-HR/ghr-utilities#readme",
6
6
  "bugs": {