pha-hermes 1.20.0 → 1.22.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.
@@ -3,7 +3,8 @@ import { SFPractitionerClient } from './practitioner/practitionerClient';
3
3
  import { Role } from '../../models';
4
4
  import { SFWorkorderClient } from './workorder/workorderClient';
5
5
  import { SFPayPeriodClient } from './payperiod/payperiodClient';
6
- import { SFExpenseClient } from '../expenses/expenseClient';
6
+ import { SFExpenseClient } from './expenses/expenseClient';
7
+ import { SFPriceClient } from './prices/priceClient';
7
8
  export declare const SF_API_VERSION: string;
8
9
  export declare class SFApiClient {
9
10
  private instance;
@@ -15,6 +16,7 @@ export declare class SFApiClient {
15
16
  practitionerClient: SFPractitionerClient;
16
17
  payPeriodClient: SFPayPeriodClient;
17
18
  expenseClient: SFExpenseClient;
19
+ priceClient: SFPriceClient;
18
20
  init(baseUrl: string, sfClientId: string, sfClientSecret: string, onTokenRefresh?: () => Promise<{
19
21
  clientId: string;
20
22
  clientSecret: string;
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { Expense } from '../../models/expense';
2
+ import { Expense } from '../../../models/expense';
3
3
  declare type FrontendExpense = {
4
4
  workorderPeriodId: string;
5
5
  amount: string;
@@ -0,0 +1,7 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { Price } from '../../../models/price';
3
+ export declare class SFPriceClient {
4
+ private axiosInstance;
5
+ constructor(axiosInstance: AxiosInstance);
6
+ getPriceListByWorkorderId(workorderId?: string): Promise<Price>;
7
+ }
package/dist/index.d.ts CHANGED
@@ -2,8 +2,9 @@ export { SFApiClient } from './api/salesforce/apiClient';
2
2
  export { SFPractitionerClient } from './api/salesforce/practitioner/practitionerClient';
3
3
  export { SFTimesheetClient } from './api/salesforce/timesheet/timesheetClient';
4
4
  export { SFAuthenticator } from './api/salesforce/auth/auth';
5
+ export { SFPriceClient } from './api/salesforce/prices/priceClient';
6
+ export { SFExpenseClient } from './api/salesforce/expenses/expenseClient';
5
7
  export { LipheApiClient } from './api/liphe_legacy/lipheApiClient';
6
8
  export { LipheAuthenticator } from './api/liphe_legacy/auth/authClient';
7
9
  export { LiphePractitionerClient } from './api/liphe_legacy/practitioner/practitionerClient';
8
- export { SFExpenseClient } from './api/expenses/expenseClient';
9
10
  export { Practitioner, Role, TimesheetDayEntry, Workorder, Agency, Period } from './models';
@@ -0,0 +1,18 @@
1
+ export interface Price {
2
+ id: string;
3
+ name?: string;
4
+ mileageBillingRate?: number;
5
+ mileageWageRate?: number;
6
+ regularBillingRate?: number;
7
+ regularWageRate?: number;
8
+ overtime1BillingRate?: number;
9
+ overtime2BillingRate?: number;
10
+ overtime1WageRate?: number;
11
+ overtime2WageRate?: number;
12
+ callbackBillingRate?: number;
13
+ callbackWageRate?: number;
14
+ onCallBillingRate?: number;
15
+ onCallWageRate?: number;
16
+ additionalBillingInfo?: string;
17
+ additionalWageInfo?: string;
18
+ }
@@ -18,5 +18,8 @@ export interface Workorder {
18
18
  createdAt?: Date;
19
19
  updatedAt?: Date;
20
20
  unit?: string;
21
+ externalUnitId?: string;
21
22
  healthAuthority?: string;
23
+ externalHealthAuthorityId?: string;
24
+ price?: string;
22
25
  }
@@ -963,7 +963,7 @@ var SFWorkorderClient = /*#__PURE__*/function () {
963
963
  }
964
964
  whereClause = filters.length ? "WHERE " + filters.join(' AND ') : '';
965
965
  url = "/services/data/" + SF_API_VERSION + "/query";
966
- query = "SELECT Id,\n Region__c,\n Name,\n HospitalID__c,\n HospitalName__c,\n ProfessionalDesignation__c,\n Personnel__c,\n startdate__c,\n EndDate__c,\n CreatedDate,\n LastModifiedDate,\n Unit__c,\n HealthAuthority__c\n FROM WorkOrder__c " + whereClause;
966
+ query = "SELECT Id,\n Region__c,\n Name,\n HospitalID__c,\n HospitalName__c,\n ProfessionalDesignation__c,\n Personnel__c,\n startdate__c,\n EndDate__c,\n CreatedDate,\n LastModifiedDate,\n Unit__c,\n HealthAuthority__c,\n UnitPrice__r.Price__c\n FROM WorkOrder__c " + whereClause;
967
967
  _context.next = 11;
968
968
  return this.axiosInstance.get(url, {
969
969
  params: {
@@ -985,7 +985,10 @@ var SFWorkorderClient = /*#__PURE__*/function () {
985
985
  createdAt: new Date(record.CreatedDate),
986
986
  updatedAt: new Date(record.LastModifiedDate),
987
987
  unit: formatString(record.Unit__c),
988
- healthAuthority: formatString(record.HealthAuthority__c)
988
+ externalUnitId: formatId(record.Unit__c),
989
+ healthAuthority: formatString(record.HealthAuthority__c),
990
+ externalHealthAuthorityId: formatId(record.HealthAuthority__c),
991
+ price: record.UnitPrice__r.Price__c
989
992
  };
990
993
  });
991
994
  });
@@ -1012,6 +1015,11 @@ var SFWorkorderClient = /*#__PURE__*/function () {
1012
1015
  var formatString = function formatString(unformattedUnit) {
1013
1016
  return !unformattedUnit ? '' : unformattedUnit.replace(/<[^>]*>/g, '').trim();
1014
1017
  };
1018
+ var formatId = function formatId(htmlString) {
1019
+ if (!htmlString) return '';
1020
+ var hrefMatch = htmlString.match(/href="\/([^"]+)"/i);
1021
+ return hrefMatch ? hrefMatch[1] : '';
1022
+ };
1015
1023
 
1016
1024
  var SFPayPeriodClient = /*#__PURE__*/function () {
1017
1025
  function SFPayPeriodClient(axiosInstance) {
@@ -1216,6 +1224,70 @@ function toExpense(raw) {
1216
1224
  };
1217
1225
  }
1218
1226
 
1227
+ var SFPriceClient = /*#__PURE__*/function () {
1228
+ function SFPriceClient(axiosInstance) {
1229
+ this.axiosInstance = axiosInstance;
1230
+ }
1231
+ var _proto = SFPriceClient.prototype;
1232
+ _proto.getPriceListByWorkorderId = /*#__PURE__*/function () {
1233
+ var _getPriceListByWorkorderId = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(workorderId) {
1234
+ var url, query;
1235
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1236
+ while (1) switch (_context.prev = _context.next) {
1237
+ case 0:
1238
+ _context.prev = 0;
1239
+ url = "/services/data/" + SF_API_VERSION + "/query";
1240
+ query = "SELECT UnitPrice__r.Price__r.Id,\n UnitPrice__r.Price__r.Name,\n UnitPrice__r.Price__r.MileageBillingRate__c,\n UnitPrice__r.Price__r.MileageWageRate__c,\n UnitPrice__r.Price__r.BillingRate__c,\n UnitPrice__r.Price__r.WageRate__c,\n UnitPrice__r.Price__r.Overtime1BillingRate__c,\n UnitPrice__r.Price__r.Overtime1WageRate__c,\n UnitPrice__r.Price__r.Overtime2BillingRate__c,\n UnitPrice__r.Price__r.Overtime2WageRate__c,\n UnitPrice__r.Price__r.CallBackBillingRate__c,\n UnitPrice__r.Price__r.CallBackWageRate__c,\n UnitPrice__r.Price__r.OnCallBillingRate__c,\n UnitPrice__r.Price__r.OnCallWageRate__c,\n UnitPrice__r.Price__r.Additional_Billing_Information__c,\n UnitPrice__r.Price__r.Additional_Wage_Information__c\n FROM WorkOrder__c WHERE Id = '" + workorderId + "' ";
1241
+ _context.next = 5;
1242
+ return this.axiosInstance.get(url, {
1243
+ params: {
1244
+ q: query
1245
+ }
1246
+ }).then(function (_ref) {
1247
+ var records = _ref.data.records;
1248
+ return records.map(function (record) {
1249
+ var _record$UnitPrice__r, _record$UnitPrice__r2, _record$UnitPrice__r3, _record$UnitPrice__r4, _record$UnitPrice__r5, _record$UnitPrice__r6, _record$UnitPrice__r7, _record$UnitPrice__r8, _record$UnitPrice__r9, _record$UnitPrice__r10, _record$UnitPrice__r11, _record$UnitPrice__r12, _record$UnitPrice__r13, _record$UnitPrice__r14, _record$UnitPrice__r15, _record$UnitPrice__r16;
1250
+ return {
1251
+ id: record == null || (_record$UnitPrice__r = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r.Price__r.Id,
1252
+ name: record == null || (_record$UnitPrice__r2 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r2.Price__r.Name,
1253
+ mileageBillingRate: record == null || (_record$UnitPrice__r3 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r3.Price__r.MileageBillingRate__c,
1254
+ mileageWageRate: record == null || (_record$UnitPrice__r4 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r4.Price__r.MileageWageRate__c,
1255
+ regularBillingRate: record == null || (_record$UnitPrice__r5 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r5.Price__r.BillingRate__c,
1256
+ regularWageRate: record == null || (_record$UnitPrice__r6 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r6.Price__r.WageRate__c,
1257
+ overtime1BillingRate: record == null || (_record$UnitPrice__r7 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r7.Price__r.Overtime1BillingRate__c,
1258
+ overtime1WageRate: record == null || (_record$UnitPrice__r8 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r8.Price__r.Overtime1WageRate__c,
1259
+ overtime2BillingRate: record == null || (_record$UnitPrice__r9 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r9.Price__r.Overtime2BillingRate__c,
1260
+ overtime2WageRate: record == null || (_record$UnitPrice__r10 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r10.Price__r.Overtime2WageRate__c,
1261
+ callbackBillingRate: record == null || (_record$UnitPrice__r11 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r11.Price__r.CallBackBillingRate__c,
1262
+ callbackWageRate: record == null || (_record$UnitPrice__r12 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r12.Price__r.CallBackWageRate__c,
1263
+ onCallBillingRate: record == null || (_record$UnitPrice__r13 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r13.Price__r.OnCallBillingRate__c,
1264
+ onCallWageRate: record == null || (_record$UnitPrice__r14 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r14.Price__r.OnCallWageRate__c,
1265
+ additionalBillingInfo: record == null || (_record$UnitPrice__r15 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r15.Price__r.Additional_Billing_Information__c,
1266
+ additionalWageInfo: record == null || (_record$UnitPrice__r16 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r16.Price__r.Additional_Wage_Information__c
1267
+ };
1268
+ });
1269
+ });
1270
+ case 5:
1271
+ return _context.abrupt("return", _context.sent);
1272
+ case 8:
1273
+ _context.prev = 8;
1274
+ _context.t0 = _context["catch"](0);
1275
+ console.error('Error fetching Price list: ', _context.t0.message);
1276
+ throw _context.t0;
1277
+ case 12:
1278
+ case "end":
1279
+ return _context.stop();
1280
+ }
1281
+ }, _callee, this, [[0, 8]]);
1282
+ }));
1283
+ function getPriceListByWorkorderId(_x) {
1284
+ return _getPriceListByWorkorderId.apply(this, arguments);
1285
+ }
1286
+ return getPriceListByWorkorderId;
1287
+ }();
1288
+ return SFPriceClient;
1289
+ }();
1290
+
1219
1291
  var SF_API_VERSION = 'v57.0';
1220
1292
  var SFApiClient = /*#__PURE__*/function () {
1221
1293
  function SFApiClient() {
@@ -1236,10 +1308,11 @@ var SFApiClient = /*#__PURE__*/function () {
1236
1308
  this.practitionerClient = new SFPractitionerClient(this.axiosInstance);
1237
1309
  this.payPeriodClient = new SFPayPeriodClient(this.axiosInstance);
1238
1310
  this.expenseClient = new SFExpenseClient(this.axiosInstance);
1311
+ this.priceClient = new SFPriceClient(this.axiosInstance);
1239
1312
  // creates authenticator and adds token to axios instance
1240
- _context.next = 10;
1313
+ _context.next = 11;
1241
1314
  return this.authenticator.initializeAuth(sfClientId, sfClientSecret, onTokenRefresh);
1242
- case 10:
1315
+ case 11:
1243
1316
  case "end":
1244
1317
  return _context.stop();
1245
1318
  }
@@ -1773,5 +1846,6 @@ exports.SFApiClient = SFApiClient;
1773
1846
  exports.SFAuthenticator = SFAuthenticator;
1774
1847
  exports.SFExpenseClient = SFExpenseClient;
1775
1848
  exports.SFPractitionerClient = SFPractitionerClient;
1849
+ exports.SFPriceClient = SFPriceClient;
1776
1850
  exports.SFTimesheetClient = SFTimesheetClient;
1777
1851
  //# sourceMappingURL=pha-hermes.cjs.development.js.map