pha-hermes 1.14.0 → 1.16.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/expenses/expenseClient.d.ts +15 -0
- package/dist/api/liphe_legacy/assignment/assignmentClient.d.ts +28 -0
- package/dist/api/{liphe1.0 → liphe_legacy}/auth/authClient.d.ts +1 -1
- package/dist/api/liphe_legacy/contract_request/contractRequestClient.d.ts +80 -0
- package/dist/api/liphe_legacy/contract_request_period/contractRequestPeriodClient.d.ts +47 -0
- package/dist/api/{lipheApiClient.d.ts → liphe_legacy/lipheApiClient.d.ts} +4 -2
- package/dist/api/liphe_legacy/practitioner/practitionerClient.d.ts +7 -0
- package/dist/api/{apiClient.d.ts → salesforce/apiClient.d.ts} +3 -1
- package/dist/api/{payperiod → salesforce/payperiod}/payperiodClient.d.ts +1 -7
- package/dist/api/{practitioner → salesforce/practitioner}/practitionerClient.d.ts +1 -1
- package/dist/api/{timesheet → salesforce/timesheet}/timesheetClient.d.ts +1 -1
- package/dist/api/{workorder → salesforce/workorder}/workorderClient.d.ts +1 -1
- package/dist/index.d.ts +9 -8
- package/dist/models/expense.d.ts +6 -0
- package/dist/models/index.d.ts +13 -17
- package/dist/models/{practitioner.d.ts → user.d.ts} +4 -0
- package/dist/models/workorder.d.ts +20 -0
- package/dist/pha-hermes.cjs.development.js +356 -3
- 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 +357 -4
- package/dist/pha-hermes.esm.js.map +1 -1
- package/package.json +2 -1
- package/src/api/expenses/expenseClient.ts +70 -0
- package/src/api/liphe_legacy/assignment/assignmentClient.ts +67 -0
- package/src/api/{liphe1.0 → liphe_legacy}/auth/authClient.ts +11 -2
- package/src/api/liphe_legacy/contract_request/contractRequestClient.ts +128 -0
- package/src/api/liphe_legacy/contract_request_period/contractRequestPeriodClient.ts +233 -0
- package/src/api/{lipheApiClient.ts → liphe_legacy/lipheApiClient.ts} +23 -3
- package/src/api/{liphe1.0 → liphe_legacy}/practitioner/practitionerClient.ts +12 -4
- package/src/api/{apiClient.ts → salesforce/apiClient.ts} +4 -1
- package/src/api/{payperiod → salesforce/payperiod}/payperiodClient.ts +1 -8
- package/src/api/{practitioner → salesforce/practitioner}/practitionerClient.ts +1 -1
- package/src/api/{timesheet → salesforce/timesheet}/timesheetClient.ts +1 -1
- package/src/api/{workorder → salesforce/workorder}/workorderClient.ts +1 -1
- package/src/index.ts +14 -8
- package/src/models/expense.ts +6 -0
- package/src/models/index.ts +13 -18
- package/src/models/{practitioner.ts → user.ts} +5 -0
- package/src/models/workorder.ts +21 -0
- package/dist/api/liphe1.0/practitioner/practitionerClient.d.ts +0 -13
- package/src/api/.env +0 -5
- /package/dist/api/{auth → salesforce/auth}/auth.d.ts +0 -0
- /package/src/api/{auth → salesforce/auth}/auth.ts +0 -0
|
@@ -6,6 +6,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
6
6
|
|
|
7
7
|
var axios = _interopDefault(require('axios'));
|
|
8
8
|
var FormData = _interopDefault(require('form-data'));
|
|
9
|
+
var axiosRetry = _interopDefault(require('axios-retry'));
|
|
9
10
|
|
|
10
11
|
function _arrayLikeToArray(r, a) {
|
|
11
12
|
(null == a || a > r.length) && (a = r.length);
|
|
@@ -1084,6 +1085,125 @@ var listOfIdsForQuery = function listOfIdsForQuery(payPeriodIDs) {
|
|
|
1084
1085
|
return "('" + payPeriodIDs.join('\', \'') + "')";
|
|
1085
1086
|
};
|
|
1086
1087
|
|
|
1088
|
+
var EXPENSE_FIELD_MAP = {
|
|
1089
|
+
Lodging: 'StipendTotalOverride__c',
|
|
1090
|
+
'Per diem': 'Per_Diem_Total__c',
|
|
1091
|
+
Other: 'Reimburseable_Expenses__c',
|
|
1092
|
+
Transportation: 'TaxiAmount__c'
|
|
1093
|
+
};
|
|
1094
|
+
var SFExpenseClient = /*#__PURE__*/function () {
|
|
1095
|
+
function SFExpenseClient(axiosInstance) {
|
|
1096
|
+
this.axiosInstance = axiosInstance;
|
|
1097
|
+
}
|
|
1098
|
+
var _proto = SFExpenseClient.prototype;
|
|
1099
|
+
_proto.fetchExpenseTotals = /*#__PURE__*/function () {
|
|
1100
|
+
var _fetchExpenseTotals = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(timesheetId) {
|
|
1101
|
+
var url, _yield$this$axiosInst, data;
|
|
1102
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1103
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1104
|
+
case 0:
|
|
1105
|
+
_context.prev = 0;
|
|
1106
|
+
url = "/services/data/" + SF_API_VERSION + "/sobjects/Timesheet__c/" + timesheetId;
|
|
1107
|
+
_context.next = 4;
|
|
1108
|
+
return this.axiosInstance.get(url, {
|
|
1109
|
+
params: {
|
|
1110
|
+
fields: 'Reimburseable_Expenses__c,Per_Diem_Total__c,StipendTotalOverride__c,TaxiAmount__c'
|
|
1111
|
+
}
|
|
1112
|
+
});
|
|
1113
|
+
case 4:
|
|
1114
|
+
_yield$this$axiosInst = _context.sent;
|
|
1115
|
+
data = _yield$this$axiosInst.data;
|
|
1116
|
+
if (data) {
|
|
1117
|
+
_context.next = 8;
|
|
1118
|
+
break;
|
|
1119
|
+
}
|
|
1120
|
+
return _context.abrupt("return", null);
|
|
1121
|
+
case 8:
|
|
1122
|
+
return _context.abrupt("return", toExpense(data));
|
|
1123
|
+
case 11:
|
|
1124
|
+
_context.prev = 11;
|
|
1125
|
+
_context.t0 = _context["catch"](0);
|
|
1126
|
+
console.error('Failed to fetch expense totals', _context.t0);
|
|
1127
|
+
throw _context.t0;
|
|
1128
|
+
case 15:
|
|
1129
|
+
case "end":
|
|
1130
|
+
return _context.stop();
|
|
1131
|
+
}
|
|
1132
|
+
}, _callee, this, [[0, 11]]);
|
|
1133
|
+
}));
|
|
1134
|
+
function fetchExpenseTotals(_x) {
|
|
1135
|
+
return _fetchExpenseTotals.apply(this, arguments);
|
|
1136
|
+
}
|
|
1137
|
+
return fetchExpenseTotals;
|
|
1138
|
+
}();
|
|
1139
|
+
_proto.patchTimesheet = /*#__PURE__*/function () {
|
|
1140
|
+
var _patchTimesheet = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(timesheetId, body) {
|
|
1141
|
+
var url, res;
|
|
1142
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1143
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1144
|
+
case 0:
|
|
1145
|
+
url = "/services/data/" + SF_API_VERSION + "/sobjects/Timesheet__c/" + timesheetId;
|
|
1146
|
+
_context2.next = 3;
|
|
1147
|
+
return this.axiosInstance.patch(url, body);
|
|
1148
|
+
case 3:
|
|
1149
|
+
res = _context2.sent;
|
|
1150
|
+
if ([200, 204, 304].includes(res.status)) {
|
|
1151
|
+
_context2.next = 6;
|
|
1152
|
+
break;
|
|
1153
|
+
}
|
|
1154
|
+
throw new Error("Unexpected status " + res.status);
|
|
1155
|
+
case 6:
|
|
1156
|
+
case "end":
|
|
1157
|
+
return _context2.stop();
|
|
1158
|
+
}
|
|
1159
|
+
}, _callee2, this);
|
|
1160
|
+
}));
|
|
1161
|
+
function patchTimesheet(_x2, _x3) {
|
|
1162
|
+
return _patchTimesheet.apply(this, arguments);
|
|
1163
|
+
}
|
|
1164
|
+
return patchTimesheet;
|
|
1165
|
+
}();
|
|
1166
|
+
_proto.updateExpense = /*#__PURE__*/function () {
|
|
1167
|
+
var _updateExpense = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(expense) {
|
|
1168
|
+
var _this$patchTimesheet;
|
|
1169
|
+
var timesheetId, amount, field;
|
|
1170
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1171
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
1172
|
+
case 0:
|
|
1173
|
+
timesheetId = expense.workorderPeriodId;
|
|
1174
|
+
amount = Number(expense.amount);
|
|
1175
|
+
field = EXPENSE_FIELD_MAP[expense.type];
|
|
1176
|
+
if (field) {
|
|
1177
|
+
_context3.next = 5;
|
|
1178
|
+
break;
|
|
1179
|
+
}
|
|
1180
|
+
throw new Error("Unsupported expense type: " + expense.type);
|
|
1181
|
+
case 5:
|
|
1182
|
+
_context3.next = 7;
|
|
1183
|
+
return this.patchTimesheet(timesheetId, (_this$patchTimesheet = {}, _this$patchTimesheet[field] = amount, _this$patchTimesheet));
|
|
1184
|
+
case 7:
|
|
1185
|
+
case "end":
|
|
1186
|
+
return _context3.stop();
|
|
1187
|
+
}
|
|
1188
|
+
}, _callee3, this);
|
|
1189
|
+
}));
|
|
1190
|
+
function updateExpense(_x4) {
|
|
1191
|
+
return _updateExpense.apply(this, arguments);
|
|
1192
|
+
}
|
|
1193
|
+
return updateExpense;
|
|
1194
|
+
}();
|
|
1195
|
+
return SFExpenseClient;
|
|
1196
|
+
}();
|
|
1197
|
+
function toExpense(raw) {
|
|
1198
|
+
var _raw$Reimburseable_Ex, _raw$Per_Diem_Total__, _raw$StipendTotalOver, _raw$TaxiAmount__c;
|
|
1199
|
+
return {
|
|
1200
|
+
reimbursable: Number((_raw$Reimburseable_Ex = raw.Reimburseable_Expenses__c) != null ? _raw$Reimburseable_Ex : 0),
|
|
1201
|
+
perDiem: Number((_raw$Per_Diem_Total__ = raw.Per_Diem_Total__c) != null ? _raw$Per_Diem_Total__ : 0),
|
|
1202
|
+
lodging: Number((_raw$StipendTotalOver = raw.StipendTotalOverride__c) != null ? _raw$StipendTotalOver : 0),
|
|
1203
|
+
transportation: Number((_raw$TaxiAmount__c = raw.TaxiAmount__c) != null ? _raw$TaxiAmount__c : 0)
|
|
1204
|
+
};
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1087
1207
|
var SF_API_VERSION = 'v57.0';
|
|
1088
1208
|
var SFApiClient = /*#__PURE__*/function () {
|
|
1089
1209
|
function SFApiClient(baseUrl) {
|
|
@@ -1096,6 +1216,7 @@ var SFApiClient = /*#__PURE__*/function () {
|
|
|
1096
1216
|
this.workorderClient = new SFWorkorderClient(this.axiosInstance);
|
|
1097
1217
|
this.practitionerClient = new SFPractitionerClient(this.axiosInstance);
|
|
1098
1218
|
this.payPeriodClient = new SFPayPeriodClient(this.axiosInstance);
|
|
1219
|
+
this.expenseClient = new SFExpenseClient(this.axiosInstance);
|
|
1099
1220
|
}
|
|
1100
1221
|
var _proto = SFApiClient.prototype;
|
|
1101
1222
|
_proto.init = /*#__PURE__*/function () {
|
|
@@ -1172,6 +1293,12 @@ var LipheAuthenticator = /*#__PURE__*/function () {
|
|
|
1172
1293
|
this.token = undefined;
|
|
1173
1294
|
this.tokenRefreshPromise = null;
|
|
1174
1295
|
this.authenticatedAxiosInstance = authenticatedAxiosInstance;
|
|
1296
|
+
axiosRetry(this.axiosTokenInstance, {
|
|
1297
|
+
retries: 10,
|
|
1298
|
+
retryDelay: function retryDelay(retryCount) {
|
|
1299
|
+
return Math.min(1000 * Math.pow(2, retryCount - 1), 30000);
|
|
1300
|
+
}
|
|
1301
|
+
});
|
|
1175
1302
|
this.email = email;
|
|
1176
1303
|
this.password = password;
|
|
1177
1304
|
this.type = type;
|
|
@@ -1260,7 +1387,7 @@ var LipheAuthenticator = /*#__PURE__*/function () {
|
|
|
1260
1387
|
form.append('password', this.password);
|
|
1261
1388
|
form.append('type', this.type);
|
|
1262
1389
|
_context3.next = 6;
|
|
1263
|
-
return this.axiosTokenInstance.post('
|
|
1390
|
+
return this.axiosTokenInstance.post('v2/signin', form, {
|
|
1264
1391
|
headers: form.getHeaders()
|
|
1265
1392
|
});
|
|
1266
1393
|
case 6:
|
|
@@ -1311,7 +1438,7 @@ var LiphePractitionerClient = /*#__PURE__*/function () {
|
|
|
1311
1438
|
break;
|
|
1312
1439
|
}
|
|
1313
1440
|
_context.next = 7;
|
|
1314
|
-
return this.axios.get('
|
|
1441
|
+
return this.axios.get('v2/employees', {
|
|
1315
1442
|
params: {
|
|
1316
1443
|
agency_id: agencyId,
|
|
1317
1444
|
page: page
|
|
@@ -1341,7 +1468,15 @@ var LiphePractitionerClient = /*#__PURE__*/function () {
|
|
|
1341
1468
|
_context.next = 4;
|
|
1342
1469
|
break;
|
|
1343
1470
|
case 17:
|
|
1344
|
-
return _context.abrupt("return", practitioners)
|
|
1471
|
+
return _context.abrupt("return", practitioners.map(function (p) {
|
|
1472
|
+
return {
|
|
1473
|
+
id: String(p.id),
|
|
1474
|
+
firstName: p.firstname,
|
|
1475
|
+
lastName: p.lastname,
|
|
1476
|
+
email: p.email,
|
|
1477
|
+
staffId: String(p.id)
|
|
1478
|
+
};
|
|
1479
|
+
}));
|
|
1345
1480
|
case 18:
|
|
1346
1481
|
case "end":
|
|
1347
1482
|
return _context.stop();
|
|
@@ -1356,6 +1491,200 @@ var LiphePractitionerClient = /*#__PURE__*/function () {
|
|
|
1356
1491
|
return LiphePractitionerClient;
|
|
1357
1492
|
}();
|
|
1358
1493
|
|
|
1494
|
+
var ContractRequestPeriodClient = /*#__PURE__*/function () {
|
|
1495
|
+
function ContractRequestPeriodClient(axiosInstance) {
|
|
1496
|
+
this.axiosInstance = axiosInstance;
|
|
1497
|
+
}
|
|
1498
|
+
var _proto = ContractRequestPeriodClient.prototype;
|
|
1499
|
+
_proto.fetchAllContractRequestPeriods = /*#__PURE__*/function () {
|
|
1500
|
+
var _fetchAllContractRequestPeriods = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(agencyId, from, to, page, activeAssignationsOnly, assignedPractitionerId) {
|
|
1501
|
+
var url, params, periods, nextPage, response, _iterator, _step, period;
|
|
1502
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1503
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1504
|
+
case 0:
|
|
1505
|
+
if (page === void 0) {
|
|
1506
|
+
page = 1;
|
|
1507
|
+
}
|
|
1508
|
+
if (activeAssignationsOnly === void 0) {
|
|
1509
|
+
activeAssignationsOnly = true;
|
|
1510
|
+
}
|
|
1511
|
+
url = "v2/contract-request-periods/agency/" + agencyId;
|
|
1512
|
+
params = new URLSearchParams();
|
|
1513
|
+
periods = [];
|
|
1514
|
+
nextPage = true;
|
|
1515
|
+
if (from) {
|
|
1516
|
+
params.append('from', from.toISOString().split('T')[0] + ' 00:00:00');
|
|
1517
|
+
}
|
|
1518
|
+
if (to) {
|
|
1519
|
+
params.append('to', to.toISOString().split('T')[0] + ' 23:59:59');
|
|
1520
|
+
}
|
|
1521
|
+
if (page) {
|
|
1522
|
+
params.append('page', page.toString());
|
|
1523
|
+
}
|
|
1524
|
+
if (activeAssignationsOnly) {
|
|
1525
|
+
params.append('active_assignations_only', activeAssignationsOnly ? '1' : '0');
|
|
1526
|
+
}
|
|
1527
|
+
if (assignedPractitionerId) {
|
|
1528
|
+
params.append('assigned_employee_id', assignedPractitionerId);
|
|
1529
|
+
}
|
|
1530
|
+
case 11:
|
|
1531
|
+
if (!nextPage) {
|
|
1532
|
+
_context.next = 21;
|
|
1533
|
+
break;
|
|
1534
|
+
}
|
|
1535
|
+
params.set('page', page.toString());
|
|
1536
|
+
_context.next = 15;
|
|
1537
|
+
return this.axiosInstance.get(url, {
|
|
1538
|
+
params: params
|
|
1539
|
+
});
|
|
1540
|
+
case 15:
|
|
1541
|
+
response = _context.sent;
|
|
1542
|
+
for (_iterator = _createForOfIteratorHelperLoose(response.data.data); !(_step = _iterator()).done;) {
|
|
1543
|
+
period = _step.value;
|
|
1544
|
+
periods.push({
|
|
1545
|
+
id: period.id.toString(),
|
|
1546
|
+
name: period.id.toString(),
|
|
1547
|
+
establishmentId: period.contract_request.community.id.toString(),
|
|
1548
|
+
region: period.contract_request.community.contact.address_state,
|
|
1549
|
+
establishmentName: period.contract_request.community.name,
|
|
1550
|
+
role: this.getRole(period),
|
|
1551
|
+
practitionerId: period.assignment.selected_client.id,
|
|
1552
|
+
startDate: new Date(period.start_date),
|
|
1553
|
+
endDate: new Date(period.end_date),
|
|
1554
|
+
createdAt: new Date(period.created_at),
|
|
1555
|
+
updatedAt: new Date(period.updated_at)
|
|
1556
|
+
});
|
|
1557
|
+
}
|
|
1558
|
+
nextPage = page < response.data.meta.last_page;
|
|
1559
|
+
page++;
|
|
1560
|
+
_context.next = 11;
|
|
1561
|
+
break;
|
|
1562
|
+
case 21:
|
|
1563
|
+
return _context.abrupt("return", periods);
|
|
1564
|
+
case 22:
|
|
1565
|
+
case "end":
|
|
1566
|
+
return _context.stop();
|
|
1567
|
+
}
|
|
1568
|
+
}, _callee, this);
|
|
1569
|
+
}));
|
|
1570
|
+
function fetchAllContractRequestPeriods(_x, _x2, _x3, _x4, _x5, _x6) {
|
|
1571
|
+
return _fetchAllContractRequestPeriods.apply(this, arguments);
|
|
1572
|
+
}
|
|
1573
|
+
return fetchAllContractRequestPeriods;
|
|
1574
|
+
}();
|
|
1575
|
+
_proto.fetchContractRequestPeriod = /*#__PURE__*/function () {
|
|
1576
|
+
var _fetchContractRequestPeriod = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(workorderId) {
|
|
1577
|
+
var url, params, response;
|
|
1578
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1579
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1580
|
+
case 0:
|
|
1581
|
+
url = "v2/contract-request-periods/" + workorderId;
|
|
1582
|
+
params = new URLSearchParams();
|
|
1583
|
+
_context2.next = 4;
|
|
1584
|
+
return this.axiosInstance.get(url, {
|
|
1585
|
+
params: params
|
|
1586
|
+
});
|
|
1587
|
+
case 4:
|
|
1588
|
+
response = _context2.sent;
|
|
1589
|
+
return _context2.abrupt("return", response.data.data);
|
|
1590
|
+
case 6:
|
|
1591
|
+
case "end":
|
|
1592
|
+
return _context2.stop();
|
|
1593
|
+
}
|
|
1594
|
+
}, _callee2, this);
|
|
1595
|
+
}));
|
|
1596
|
+
function fetchContractRequestPeriod(_x7) {
|
|
1597
|
+
return _fetchContractRequestPeriod.apply(this, arguments);
|
|
1598
|
+
}
|
|
1599
|
+
return fetchContractRequestPeriod;
|
|
1600
|
+
}();
|
|
1601
|
+
_proto.getPayPeriodDatesForPayPeriodId = /*#__PURE__*/function () {
|
|
1602
|
+
var _getPayPeriodDatesForPayPeriodId = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(payPeriodId) {
|
|
1603
|
+
var period, payPeriods, firstPayPeriodDate, lastPayPeriodDate, weeksBetween, i, tempDate, startDate, endDate;
|
|
1604
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1605
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
1606
|
+
case 0:
|
|
1607
|
+
_context3.next = 2;
|
|
1608
|
+
return this.fetchContractRequestPeriod(payPeriodId);
|
|
1609
|
+
case 2:
|
|
1610
|
+
period = _context3.sent;
|
|
1611
|
+
payPeriods = [];
|
|
1612
|
+
firstPayPeriodDate = this.getPayPeriodDayBeforeStartDate(new Date(period.assignment.selected_client.agency.date_first_periode_paie), new Date(period.start_date));
|
|
1613
|
+
lastPayPeriodDate = this.getLastDayOfPayPeriod(new Date(firstPayPeriodDate), new Date(period.end_date)); // Calculate the number of weeks between lastPayPeriodDate and firstPayPeriodDate
|
|
1614
|
+
weeksBetween = this.calculateWeeksBetween(firstPayPeriodDate, lastPayPeriodDate);
|
|
1615
|
+
for (i = 0; i < weeksBetween; i++) {
|
|
1616
|
+
tempDate = new Date(firstPayPeriodDate);
|
|
1617
|
+
startDate = new Date(tempDate.setDate(tempDate.getDate() + 7 * i));
|
|
1618
|
+
endDate = new Date(tempDate.setDate(tempDate.getDate() + 6));
|
|
1619
|
+
payPeriods.push({
|
|
1620
|
+
payPeriodId: '',
|
|
1621
|
+
startDate: startDate.toISOString().split('T')[0],
|
|
1622
|
+
endDate: endDate.toISOString().split('T')[0],
|
|
1623
|
+
workorderId: payPeriodId
|
|
1624
|
+
});
|
|
1625
|
+
}
|
|
1626
|
+
return _context3.abrupt("return", payPeriods);
|
|
1627
|
+
case 9:
|
|
1628
|
+
case "end":
|
|
1629
|
+
return _context3.stop();
|
|
1630
|
+
}
|
|
1631
|
+
}, _callee3, this);
|
|
1632
|
+
}));
|
|
1633
|
+
function getPayPeriodDatesForPayPeriodId(_x8) {
|
|
1634
|
+
return _getPayPeriodDatesForPayPeriodId.apply(this, arguments);
|
|
1635
|
+
}
|
|
1636
|
+
return getPayPeriodDatesForPayPeriodId;
|
|
1637
|
+
}();
|
|
1638
|
+
_proto.getRole = function getRole(period) {
|
|
1639
|
+
if (period.contract_request.job.translations.length === 0) {
|
|
1640
|
+
return '';
|
|
1641
|
+
}
|
|
1642
|
+
if (period.contract_request.job.translations.length > 1) {
|
|
1643
|
+
var roleTranslation = period.contract_request.job.translations.find(function (translation) {
|
|
1644
|
+
return translation.locale === 'en';
|
|
1645
|
+
});
|
|
1646
|
+
return roleTranslation == null ? void 0 : roleTranslation.content;
|
|
1647
|
+
} else {
|
|
1648
|
+
return period.contract_request.job.translations[0].content;
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
/**
|
|
1652
|
+
* Calculates the pay period day of week that comes before the start date
|
|
1653
|
+
* @param firstPayPeriodDate The first pay period date from the agency
|
|
1654
|
+
* @param startDate The start date to find the pay period before
|
|
1655
|
+
* @returns The day of week (0-6, where 0 is Sunday) of the pay period before start_date
|
|
1656
|
+
*/;
|
|
1657
|
+
_proto.getPayPeriodDayBeforeStartDate = function getPayPeriodDayBeforeStartDate(firstPayPeriodDate, startDate) {
|
|
1658
|
+
var payPeriodDayOfWeek = firstPayPeriodDate.getDay();
|
|
1659
|
+
// Calculate the most recent pay period date that falls before start_date
|
|
1660
|
+
var tempDate = new Date(startDate);
|
|
1661
|
+
// Go back one week at a time until we find a date that matches the pay period day of week
|
|
1662
|
+
while (tempDate.getDay() !== payPeriodDayOfWeek) {
|
|
1663
|
+
tempDate.setDate(tempDate.getDate() - 1);
|
|
1664
|
+
}
|
|
1665
|
+
// If the calculated date is not before start_date, go back another week
|
|
1666
|
+
if (tempDate >= startDate) {
|
|
1667
|
+
tempDate.setDate(tempDate.getDate() - 7);
|
|
1668
|
+
}
|
|
1669
|
+
return tempDate;
|
|
1670
|
+
};
|
|
1671
|
+
_proto.getLastDayOfPayPeriod = function getLastDayOfPayPeriod(firstPayPeriodDate, endDate) {
|
|
1672
|
+
var tempDate = new Date(firstPayPeriodDate);
|
|
1673
|
+
// Go back one week at a time until we find a date that matches the pay period day of week
|
|
1674
|
+
while (endDate > tempDate) {
|
|
1675
|
+
tempDate.setDate(tempDate.getDate() + 7);
|
|
1676
|
+
}
|
|
1677
|
+
return tempDate;
|
|
1678
|
+
};
|
|
1679
|
+
_proto.calculateWeeksBetween = function calculateWeeksBetween(startDate, endDate) {
|
|
1680
|
+
var diffTime = Math.abs(endDate.getTime() - startDate.getTime());
|
|
1681
|
+
var diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
|
1682
|
+
var weeks = Math.floor(diffDays / 7);
|
|
1683
|
+
return weeks;
|
|
1684
|
+
};
|
|
1685
|
+
return ContractRequestPeriodClient;
|
|
1686
|
+
}();
|
|
1687
|
+
|
|
1359
1688
|
var LipheApiClient = /*#__PURE__*/function () {
|
|
1360
1689
|
function LipheApiClient(baseUrl, email, password, type) {
|
|
1361
1690
|
if (type === void 0) {
|
|
@@ -1365,7 +1694,17 @@ var LipheApiClient = /*#__PURE__*/function () {
|
|
|
1365
1694
|
this.axiosInstance = axios.create();
|
|
1366
1695
|
this.axiosInstance.defaults.baseURL = baseUrl;
|
|
1367
1696
|
this.authenticator = new LipheAuthenticator(this.axiosInstance, baseUrl, email, password, type);
|
|
1697
|
+
axiosRetry(this.axiosInstance, {
|
|
1698
|
+
retries: 10,
|
|
1699
|
+
retryDelay: function retryDelay(retryCount) {
|
|
1700
|
+
return Math.min(1000 * Math.pow(2, retryCount - 1), 30000);
|
|
1701
|
+
},
|
|
1702
|
+
onRetry: function onRetry(retryCount, error) {
|
|
1703
|
+
console.log("Retry attempt " + retryCount + " failed: " + error.message);
|
|
1704
|
+
}
|
|
1705
|
+
});
|
|
1368
1706
|
this.practitionerClient = new LiphePractitionerClient(this.axiosInstance);
|
|
1707
|
+
this.contractRequestPeriodClient = new ContractRequestPeriodClient(this.axiosInstance);
|
|
1369
1708
|
}
|
|
1370
1709
|
var _proto = LipheApiClient.prototype;
|
|
1371
1710
|
_proto.init = /*#__PURE__*/function () {
|
|
@@ -1398,11 +1737,25 @@ var LipheApiClient = /*#__PURE__*/function () {
|
|
|
1398
1737
|
return LipheApiClient;
|
|
1399
1738
|
}();
|
|
1400
1739
|
|
|
1740
|
+
(function (Agency) {
|
|
1741
|
+
Agency["CHCA"] = "7";
|
|
1742
|
+
Agency["CodeBleu"] = "5";
|
|
1743
|
+
Agency["NordikOntario"] = "6";
|
|
1744
|
+
Agency["PHA"] = "8";
|
|
1745
|
+
Agency["PremierSoin"] = "1";
|
|
1746
|
+
Agency["PremierSoinNordik"] = "3";
|
|
1747
|
+
Agency["SolutionNursing"] = "4";
|
|
1748
|
+
Agency["SolutionsStaffing"] = "9";
|
|
1749
|
+
Agency["Transport"] = "2";
|
|
1750
|
+
Agency["SSI"] = "99";
|
|
1751
|
+
})(exports.Agency || (exports.Agency = {}));
|
|
1752
|
+
|
|
1401
1753
|
exports.LipheApiClient = LipheApiClient;
|
|
1402
1754
|
exports.LipheAuthenticator = LipheAuthenticator;
|
|
1403
1755
|
exports.LiphePractitionerClient = LiphePractitionerClient;
|
|
1404
1756
|
exports.SFApiClient = SFApiClient;
|
|
1405
1757
|
exports.SFAuthenticator = SFAuthenticator;
|
|
1758
|
+
exports.SFExpenseClient = SFExpenseClient;
|
|
1406
1759
|
exports.SFPractitionerClient = SFPractitionerClient;
|
|
1407
1760
|
exports.SFTimesheetClient = SFTimesheetClient;
|
|
1408
1761
|
//# sourceMappingURL=pha-hermes.cjs.development.js.map
|