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.
- package/dist/api/salesforce/apiClient.d.ts +3 -1
- package/dist/api/{expenses → salesforce/expenses}/expenseClient.d.ts +1 -1
- package/dist/api/salesforce/prices/priceClient.d.ts +7 -0
- package/dist/index.d.ts +2 -1
- package/dist/models/price.d.ts +18 -0
- package/dist/models/workorder.d.ts +3 -0
- package/dist/pha-hermes.cjs.development.js +78 -4
- package/dist/pha-hermes.cjs.development.js.map +1 -1
- package/dist/pha-hermes.cjs.production.min.js +1 -1
- package/dist/pha-hermes.cjs.production.min.js.map +1 -1
- package/dist/pha-hermes.esm.js +78 -5
- package/dist/pha-hermes.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/api/.env +5 -0
- package/src/api/salesforce/apiClient.ts +4 -1
- package/src/api/{expenses → salesforce/expenses}/expenseClient.ts +2 -2
- package/src/api/salesforce/prices/priceClient.ts +70 -0
- package/src/api/salesforce/workorder/workorderClient.ts +15 -3
- package/src/index.ts +2 -1
- package/src/models/price.ts +18 -0
- package/src/models/workorder.ts +3 -0
|
@@ -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 '
|
|
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;
|
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
|
+
}
|
|
@@ -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
|
-
|
|
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 =
|
|
1313
|
+
_context.next = 11;
|
|
1241
1314
|
return this.authenticator.initializeAuth(sfClientId, sfClientSecret, onTokenRefresh);
|
|
1242
|
-
case
|
|
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
|