pha-hermes 1.21.0 → 1.23.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 +2 -2
- 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 +76 -7
- 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 +76 -8
- package/dist/pha-hermes.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/api/salesforce/apiClient.ts +4 -1
- package/src/api/{expenses → salesforce/expenses}/expenseClient.ts +5 -5
- package/src/api/salesforce/prices/priceClient.ts +70 -0
- package/src/api/salesforce/workorder/workorderClient.ts +14 -7
- 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;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { Expense } from '
|
|
2
|
+
import { Expense } from '../../../models/expense';
|
|
3
3
|
declare type FrontendExpense = {
|
|
4
4
|
workorderPeriodId: string;
|
|
5
|
-
|
|
5
|
+
submittedValue: string;
|
|
6
6
|
type: 'Other' | 'Lodging' | 'Transportation' | 'Travel (Hours)' | 'Per diem' | 'Meals';
|
|
7
7
|
};
|
|
8
8
|
export declare class SFExpenseClient {
|
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 TravelDate__c,\n ReturnDate__c\n FROM WorkOrder__c " + whereClause;
|
|
967
967
|
_context.next = 11;
|
|
968
968
|
return this.axiosInstance.get(url, {
|
|
969
969
|
params: {
|
|
@@ -987,7 +987,10 @@ var SFWorkorderClient = /*#__PURE__*/function () {
|
|
|
987
987
|
unit: formatString(record.Unit__c),
|
|
988
988
|
externalUnitId: formatId(record.Unit__c),
|
|
989
989
|
healthAuthority: formatString(record.HealthAuthority__c),
|
|
990
|
-
externalHealthAuthorityId: formatId(record.HealthAuthority__c)
|
|
990
|
+
externalHealthAuthorityId: formatId(record.HealthAuthority__c),
|
|
991
|
+
price: record.UnitPrice__r.Price__c,
|
|
992
|
+
travelInTime: new Date(record.TravelDate__c),
|
|
993
|
+
travelOutTime: new Date(record.ReturnDate__c)
|
|
991
994
|
};
|
|
992
995
|
});
|
|
993
996
|
});
|
|
@@ -1185,12 +1188,12 @@ var SFExpenseClient = /*#__PURE__*/function () {
|
|
|
1185
1188
|
_proto.updateExpense = /*#__PURE__*/function () {
|
|
1186
1189
|
var _updateExpense = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(expense) {
|
|
1187
1190
|
var _this$patchTimesheet;
|
|
1188
|
-
var timesheetId,
|
|
1191
|
+
var timesheetId, submittedValue, field;
|
|
1189
1192
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1190
1193
|
while (1) switch (_context3.prev = _context3.next) {
|
|
1191
1194
|
case 0:
|
|
1192
1195
|
timesheetId = expense.workorderPeriodId;
|
|
1193
|
-
|
|
1196
|
+
submittedValue = Number(expense.submittedValue);
|
|
1194
1197
|
field = EXPENSE_FIELD_MAP[expense.type];
|
|
1195
1198
|
if (field) {
|
|
1196
1199
|
_context3.next = 5;
|
|
@@ -1199,7 +1202,7 @@ var SFExpenseClient = /*#__PURE__*/function () {
|
|
|
1199
1202
|
throw new Error("Unsupported expense type: " + expense.type);
|
|
1200
1203
|
case 5:
|
|
1201
1204
|
_context3.next = 7;
|
|
1202
|
-
return this.patchTimesheet(timesheetId, (_this$patchTimesheet = {}, _this$patchTimesheet[field] =
|
|
1205
|
+
return this.patchTimesheet(timesheetId, (_this$patchTimesheet = {}, _this$patchTimesheet[field] = submittedValue, _this$patchTimesheet));
|
|
1203
1206
|
case 7:
|
|
1204
1207
|
case "end":
|
|
1205
1208
|
return _context3.stop();
|
|
@@ -1223,6 +1226,70 @@ function toExpense(raw) {
|
|
|
1223
1226
|
};
|
|
1224
1227
|
}
|
|
1225
1228
|
|
|
1229
|
+
var SFPriceClient = /*#__PURE__*/function () {
|
|
1230
|
+
function SFPriceClient(axiosInstance) {
|
|
1231
|
+
this.axiosInstance = axiosInstance;
|
|
1232
|
+
}
|
|
1233
|
+
var _proto = SFPriceClient.prototype;
|
|
1234
|
+
_proto.getPriceListByWorkorderId = /*#__PURE__*/function () {
|
|
1235
|
+
var _getPriceListByWorkorderId = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(workorderId) {
|
|
1236
|
+
var url, query;
|
|
1237
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1238
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1239
|
+
case 0:
|
|
1240
|
+
_context.prev = 0;
|
|
1241
|
+
url = "/services/data/" + SF_API_VERSION + "/query";
|
|
1242
|
+
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 + "' ";
|
|
1243
|
+
_context.next = 5;
|
|
1244
|
+
return this.axiosInstance.get(url, {
|
|
1245
|
+
params: {
|
|
1246
|
+
q: query
|
|
1247
|
+
}
|
|
1248
|
+
}).then(function (_ref) {
|
|
1249
|
+
var records = _ref.data.records;
|
|
1250
|
+
return records.map(function (record) {
|
|
1251
|
+
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;
|
|
1252
|
+
return {
|
|
1253
|
+
id: record == null || (_record$UnitPrice__r = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r.Price__r.Id,
|
|
1254
|
+
name: record == null || (_record$UnitPrice__r2 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r2.Price__r.Name,
|
|
1255
|
+
mileageBillingRate: record == null || (_record$UnitPrice__r3 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r3.Price__r.MileageBillingRate__c,
|
|
1256
|
+
mileageWageRate: record == null || (_record$UnitPrice__r4 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r4.Price__r.MileageWageRate__c,
|
|
1257
|
+
regularBillingRate: record == null || (_record$UnitPrice__r5 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r5.Price__r.BillingRate__c,
|
|
1258
|
+
regularWageRate: record == null || (_record$UnitPrice__r6 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r6.Price__r.WageRate__c,
|
|
1259
|
+
overtime1BillingRate: record == null || (_record$UnitPrice__r7 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r7.Price__r.Overtime1BillingRate__c,
|
|
1260
|
+
overtime1WageRate: record == null || (_record$UnitPrice__r8 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r8.Price__r.Overtime1WageRate__c,
|
|
1261
|
+
overtime2BillingRate: record == null || (_record$UnitPrice__r9 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r9.Price__r.Overtime2BillingRate__c,
|
|
1262
|
+
overtime2WageRate: record == null || (_record$UnitPrice__r10 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r10.Price__r.Overtime2WageRate__c,
|
|
1263
|
+
callbackBillingRate: record == null || (_record$UnitPrice__r11 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r11.Price__r.CallBackBillingRate__c,
|
|
1264
|
+
callbackWageRate: record == null || (_record$UnitPrice__r12 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r12.Price__r.CallBackWageRate__c,
|
|
1265
|
+
onCallBillingRate: record == null || (_record$UnitPrice__r13 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r13.Price__r.OnCallBillingRate__c,
|
|
1266
|
+
onCallWageRate: record == null || (_record$UnitPrice__r14 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r14.Price__r.OnCallWageRate__c,
|
|
1267
|
+
additionalBillingInfo: record == null || (_record$UnitPrice__r15 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r15.Price__r.Additional_Billing_Information__c,
|
|
1268
|
+
additionalWageInfo: record == null || (_record$UnitPrice__r16 = record.UnitPrice__r) == null ? void 0 : _record$UnitPrice__r16.Price__r.Additional_Wage_Information__c
|
|
1269
|
+
};
|
|
1270
|
+
});
|
|
1271
|
+
});
|
|
1272
|
+
case 5:
|
|
1273
|
+
return _context.abrupt("return", _context.sent);
|
|
1274
|
+
case 8:
|
|
1275
|
+
_context.prev = 8;
|
|
1276
|
+
_context.t0 = _context["catch"](0);
|
|
1277
|
+
console.error('Error fetching Price list: ', _context.t0.message);
|
|
1278
|
+
throw _context.t0;
|
|
1279
|
+
case 12:
|
|
1280
|
+
case "end":
|
|
1281
|
+
return _context.stop();
|
|
1282
|
+
}
|
|
1283
|
+
}, _callee, this, [[0, 8]]);
|
|
1284
|
+
}));
|
|
1285
|
+
function getPriceListByWorkorderId(_x) {
|
|
1286
|
+
return _getPriceListByWorkorderId.apply(this, arguments);
|
|
1287
|
+
}
|
|
1288
|
+
return getPriceListByWorkorderId;
|
|
1289
|
+
}();
|
|
1290
|
+
return SFPriceClient;
|
|
1291
|
+
}();
|
|
1292
|
+
|
|
1226
1293
|
var SF_API_VERSION = 'v57.0';
|
|
1227
1294
|
var SFApiClient = /*#__PURE__*/function () {
|
|
1228
1295
|
function SFApiClient() {
|
|
@@ -1243,10 +1310,11 @@ var SFApiClient = /*#__PURE__*/function () {
|
|
|
1243
1310
|
this.practitionerClient = new SFPractitionerClient(this.axiosInstance);
|
|
1244
1311
|
this.payPeriodClient = new SFPayPeriodClient(this.axiosInstance);
|
|
1245
1312
|
this.expenseClient = new SFExpenseClient(this.axiosInstance);
|
|
1313
|
+
this.priceClient = new SFPriceClient(this.axiosInstance);
|
|
1246
1314
|
// creates authenticator and adds token to axios instance
|
|
1247
|
-
_context.next =
|
|
1315
|
+
_context.next = 11;
|
|
1248
1316
|
return this.authenticator.initializeAuth(sfClientId, sfClientSecret, onTokenRefresh);
|
|
1249
|
-
case
|
|
1317
|
+
case 11:
|
|
1250
1318
|
case "end":
|
|
1251
1319
|
return _context.stop();
|
|
1252
1320
|
}
|
|
@@ -1780,5 +1848,6 @@ exports.SFApiClient = SFApiClient;
|
|
|
1780
1848
|
exports.SFAuthenticator = SFAuthenticator;
|
|
1781
1849
|
exports.SFExpenseClient = SFExpenseClient;
|
|
1782
1850
|
exports.SFPractitionerClient = SFPractitionerClient;
|
|
1851
|
+
exports.SFPriceClient = SFPriceClient;
|
|
1783
1852
|
exports.SFTimesheetClient = SFTimesheetClient;
|
|
1784
1853
|
//# sourceMappingURL=pha-hermes.cjs.development.js.map
|