pha-hermes 1.22.0 → 1.24.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.
@@ -525,7 +525,7 @@ var SFTimesheetClient = /*#__PURE__*/function () {
525
525
  while (1) switch (_context.prev = _context.next) {
526
526
  case 0:
527
527
  _context.prev = 0;
528
- url = "/services/data/" + SF_API_VERSION + "/sobjects/TimeSheetHour__c/" + timesheetHourId;
528
+ url = "/services/data/" + SF_API_VERSION$1 + "/sobjects/TimeSheetHour__c/" + timesheetHourId;
529
529
  _context.next = 4;
530
530
  return this.axiosInstance.patch(url, {
531
531
  Date__c: timesheet.date,
@@ -577,7 +577,7 @@ var SFTimesheetClient = /*#__PURE__*/function () {
577
577
  while (1) switch (_context2.prev = _context2.next) {
578
578
  case 0:
579
579
  // Find all timesheet Ids that belong to this WO
580
- url = "/services/data/" + SF_API_VERSION + "/query";
580
+ url = "/services/data/" + SF_API_VERSION$1 + "/query";
581
581
  query = "SELECT Id\n FROM Timesheet__c\n WHERE WorkOrder__c = '" + workorderId + "'";
582
582
  try {
583
583
  if (periodStartDate && periodEndDate) {
@@ -615,7 +615,7 @@ var SFTimesheetClient = /*#__PURE__*/function () {
615
615
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
616
616
  while (1) switch (_context3.prev = _context3.next) {
617
617
  case 0:
618
- url = "/services/data/" + SF_API_VERSION + "/query";
618
+ url = "/services/data/" + SF_API_VERSION$1 + "/query";
619
619
  query = "SELECT FIELDS(STANDARD), WorkOrder__c\n FROM TimeSheet__c\n WHERE WorkOrder__c IN (SELECT Id\n FROM WorkOrder__c\n WHERE Personnel__c = '" + personnelID + "')";
620
620
  _context3.next = 4;
621
621
  return this.axiosInstance.get(url, {
@@ -657,7 +657,7 @@ var SFTimesheetClient = /*#__PURE__*/function () {
657
657
  case 2:
658
658
  timesheetIds = _context4.sent;
659
659
  allHours = [];
660
- url = "/services/data/" + SF_API_VERSION + "/query";
660
+ url = "/services/data/" + SF_API_VERSION$1 + "/query";
661
661
  _iterator2 = _createForOfIteratorHelperLoose(timesheetIds);
662
662
  case 6:
663
663
  if ((_step2 = _iterator2()).done) {
@@ -667,7 +667,7 @@ var SFTimesheetClient = /*#__PURE__*/function () {
667
667
  timesheetId = _step2.value;
668
668
  query = "\n SELECT " + ((fields == null ? void 0 : fields.join(',')) || 'FIELDS(STANDARD)') + "\n FROM TimesheetHour__c\n WHERE Timesheet__c = '" + timesheetId + "'";
669
669
  _context4.prev = 9;
670
- if (fields != null && fields.length) {
670
+ if (fields != null && fields.length && periodStartDate && periodEndDate) {
671
671
  query += "\n AND Date__c >= " + new Date(periodStartDate).toISOString().substring(0, 10) + "\n AND Date__c <= " + new Date(periodEndDate).toISOString().substring(0, 10);
672
672
  }
673
673
  _context4.next = 13;
@@ -708,7 +708,7 @@ var SFTimesheetClient = /*#__PURE__*/function () {
708
708
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
709
709
  while (1) switch (_context5.prev = _context5.next) {
710
710
  case 0:
711
- url = "/services/data/" + SF_API_VERSION + "/query";
711
+ url = "/services/data/" + SF_API_VERSION$1 + "/query";
712
712
  query = "SELECT Name,\n StartDate__c,\n EndDate__c\n FROM PayPeriod__c";
713
713
  _context5.next = 4;
714
714
  return this.axiosInstance.get(url, {
@@ -758,14 +758,14 @@ var SFTimesheetClient = /*#__PURE__*/function () {
758
758
  contentType: 'application/octet-stream'
759
759
  });
760
760
  _context6.next = 6;
761
- return this.axiosInstance.post("/services/data/" + SF_API_VERSION + "/sobjects/ContentVersion", form, {
761
+ return this.axiosInstance.post("/services/data/" + SF_API_VERSION$1 + "/sobjects/ContentVersion", form, {
762
762
  headers: form.getHeaders()
763
763
  });
764
764
  case 6:
765
765
  uploadRes = _context6.sent;
766
766
  versionId = uploadRes.data.id; //get ContentDocumentId
767
767
  _context6.next = 10;
768
- return this.axiosInstance.get("/services/data/" + SF_API_VERSION + "/query", {
768
+ return this.axiosInstance.get("/services/data/" + SF_API_VERSION$1 + "/query", {
769
769
  params: {
770
770
  q: "SELECT ContentDocumentId FROM ContentVersion WHERE Id = '" + versionId + "'"
771
771
  }
@@ -775,7 +775,7 @@ var SFTimesheetClient = /*#__PURE__*/function () {
775
775
  data = _yield$this$axiosInst3.data;
776
776
  contentDocumentId = data.records[0].ContentDocumentId;
777
777
  _context6.next = 15;
778
- return this.axiosInstance.post("/services/data/" + SF_API_VERSION + "/sobjects/ContentDocumentLink", {
778
+ return this.axiosInstance.post("/services/data/" + SF_API_VERSION$1 + "/sobjects/ContentDocumentLink", {
779
779
  ContentDocumentId: contentDocumentId,
780
780
  LinkedEntityId: timesheetId,
781
781
  ShareType: 'V',
@@ -843,7 +843,7 @@ var SFPractitionerClient = /*#__PURE__*/function () {
843
843
  }
844
844
  whereClause = conditions.length ? "WHERE " + conditions.join(' AND ') : '';
845
845
  limitClause = typeof (options == null ? void 0 : options.limit) === 'number' && options.limit > 0 ? "LIMIT " + Math.floor(options.limit) : '';
846
- url = "/services/data/" + SF_API_VERSION + "/query";
846
+ url = "/services/data/" + SF_API_VERSION$1 + "/query";
847
847
  query = "\n SELECT Id, FirstName__c, LastName__c, Email__c, StaffID__c, CreatedDate\n FROM Personnel__c\n " + whereClause + "\n ORDER BY CreatedDate ASC, StaffID__c ASC\n " + limitClause + "\n ";
848
848
  _context.next = 9;
849
849
  return this.axiosInstance.get(url, {
@@ -878,7 +878,7 @@ var SFPractitionerClient = /*#__PURE__*/function () {
878
878
  while (1) switch (_context2.prev = _context2.next) {
879
879
  case 0:
880
880
  _context2.prev = 0;
881
- url = "/services/data/" + SF_API_VERSION + "/query";
881
+ url = "/services/data/" + SF_API_VERSION$1 + "/query";
882
882
  query = "\n SELECT Id, FirstName__c, LastName__c, Email__c, StaffID__c, CreatedDate\n FROM Personnel__c\n WHERE Status__c = 'Active' AND Email__c = '" + email + "'\n ";
883
883
  _context2.next = 5;
884
884
  return this.axiosInstance.get(url, {
@@ -912,6 +912,47 @@ var SFPractitionerClient = /*#__PURE__*/function () {
912
912
  }
913
913
  return fetchPractitionerByEmail;
914
914
  }();
915
+ _proto.fetchRoles = /*#__PURE__*/function () {
916
+ var _fetchRoles = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
917
+ var url, query;
918
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
919
+ while (1) switch (_context3.prev = _context3.next) {
920
+ case 0:
921
+ _context3.prev = 0;
922
+ url = "/services/data/" + SF_API_VERSION$1 + "/query";
923
+ query = "SELECT Label, Value FROM PicklistValueInfo WHERE EntityParticle.EntityDefinition.QualifiedApiName = 'WorkOrder__c' AND EntityParticle.QualifiedApiName = 'ProfessionalDesignation__c' AND isActive = true";
924
+ return _context3.abrupt("return", this.axiosInstance.get(url, {
925
+ params: {
926
+ q: query
927
+ }
928
+ }).then(function (_ref) {
929
+ var records = _ref.data.records;
930
+ return records.map(function (record) {
931
+ return {
932
+ label: record.Label,
933
+ value: record.Value
934
+ };
935
+ });
936
+ })["catch"](function (error) {
937
+ console.error('Error fetching roles: ', error.message);
938
+ throw error;
939
+ }));
940
+ case 6:
941
+ _context3.prev = 6;
942
+ _context3.t0 = _context3["catch"](0);
943
+ console.error('Error fetching roles: ', _context3.t0.message);
944
+ throw _context3.t0;
945
+ case 10:
946
+ case "end":
947
+ return _context3.stop();
948
+ }
949
+ }, _callee3, this, [[0, 6]]);
950
+ }));
951
+ function fetchRoles() {
952
+ return _fetchRoles.apply(this, arguments);
953
+ }
954
+ return fetchRoles;
955
+ }();
915
956
  return SFPractitionerClient;
916
957
  }();
917
958
  function toPractitioner(raw) {
@@ -921,7 +962,7 @@ function toPractitioner(raw) {
921
962
  lastName: raw.LastName__c,
922
963
  email: raw.Email__c,
923
964
  staffId: raw.StaffID__c,
924
- createdAt: raw.CreatedDate.replace(/\+0000$/, 'Z')
965
+ createdAt: raw.CreatedDate ? raw.CreatedDate.replace(/\+0000$/, 'Z') : undefined
925
966
  };
926
967
  }
927
968
 
@@ -956,8 +997,8 @@ var SFWorkorderClient = /*#__PURE__*/function () {
956
997
  filters.push("Region__c IN (" + provincesList + ")");
957
998
  }
958
999
  whereClause = filters.length ? "WHERE " + filters.join(' AND ') : '';
959
- url = "/services/data/" + SF_API_VERSION + "/query";
960
- 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;
1000
+ url = "/services/data/" + SF_API_VERSION$1 + "/query";
1001
+ 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;
961
1002
  _context.next = 11;
962
1003
  return this.axiosInstance.get(url, {
963
1004
  params: {
@@ -982,7 +1023,9 @@ var SFWorkorderClient = /*#__PURE__*/function () {
982
1023
  externalUnitId: formatId(record.Unit__c),
983
1024
  healthAuthority: formatString(record.HealthAuthority__c),
984
1025
  externalHealthAuthorityId: formatId(record.HealthAuthority__c),
985
- price: record.UnitPrice__r.Price__c
1026
+ price: record.UnitPrice__r.Price__c,
1027
+ travelInTime: new Date(record.TravelDate__c),
1028
+ travelOutTime: new Date(record.ReturnDate__c)
986
1029
  };
987
1030
  });
988
1031
  });
@@ -1026,7 +1069,7 @@ var SFPayPeriodClient = /*#__PURE__*/function () {
1026
1069
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1027
1070
  while (1) switch (_context.prev = _context.next) {
1028
1071
  case 0:
1029
- url = "/services/data/" + SF_API_VERSION + "/query";
1072
+ url = "/services/data/" + SF_API_VERSION$1 + "/query";
1030
1073
  query = "SELECT PayPeriod__c, ID\n FROM Timesheet__c\n WHERE WorkOrder__c = '" + workorderID + "'";
1031
1074
  _context.next = 4;
1032
1075
  return this.axiosInstance.get(url, {
@@ -1062,7 +1105,7 @@ var SFPayPeriodClient = /*#__PURE__*/function () {
1062
1105
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1063
1106
  while (1) switch (_context2.prev = _context2.next) {
1064
1107
  case 0:
1065
- url = "/services/data/" + SF_API_VERSION + "/query";
1108
+ url = "/services/data/" + SF_API_VERSION$1 + "/query";
1066
1109
  query = "SELECT ID, StartDate__c, EndDate__c\n FROM PayPeriod__c\n WHERE id IN " + listOfIdsForQuery(payPeriodIDs);
1067
1110
  _context2.next = 4;
1068
1111
  return this.axiosInstance.get(url, {
@@ -1096,7 +1139,7 @@ var SFPayPeriodClient = /*#__PURE__*/function () {
1096
1139
  return SFPayPeriodClient;
1097
1140
  }();
1098
1141
  var listOfIdsForQuery = function listOfIdsForQuery(payPeriodIDs) {
1099
- return "('" + payPeriodIDs.join('\', \'') + "')";
1142
+ return "('" + payPeriodIDs.join("', '") + "')";
1100
1143
  };
1101
1144
 
1102
1145
  var EXPENSE_FIELD_MAP = {
@@ -1117,7 +1160,7 @@ var SFExpenseClient = /*#__PURE__*/function () {
1117
1160
  while (1) switch (_context.prev = _context.next) {
1118
1161
  case 0:
1119
1162
  _context.prev = 0;
1120
- url = "/services/data/" + SF_API_VERSION + "/sobjects/Timesheet__c/" + timesheetId;
1163
+ url = "/services/data/" + SF_API_VERSION$1 + "/sobjects/Timesheet__c/" + timesheetId;
1121
1164
  _context.next = 4;
1122
1165
  return this.axiosInstance.get(url, {
1123
1166
  params: {
@@ -1156,7 +1199,7 @@ var SFExpenseClient = /*#__PURE__*/function () {
1156
1199
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1157
1200
  while (1) switch (_context2.prev = _context2.next) {
1158
1201
  case 0:
1159
- url = "/services/data/" + SF_API_VERSION + "/sobjects/Timesheet__c/" + timesheetId;
1202
+ url = "/services/data/" + SF_API_VERSION$1 + "/sobjects/Timesheet__c/" + timesheetId;
1160
1203
  _context2.next = 3;
1161
1204
  return this.axiosInstance.patch(url, body);
1162
1205
  case 3:
@@ -1180,12 +1223,12 @@ var SFExpenseClient = /*#__PURE__*/function () {
1180
1223
  _proto.updateExpense = /*#__PURE__*/function () {
1181
1224
  var _updateExpense = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(expense) {
1182
1225
  var _this$patchTimesheet;
1183
- var timesheetId, amount, field;
1226
+ var timesheetId, submittedValue, field;
1184
1227
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1185
1228
  while (1) switch (_context3.prev = _context3.next) {
1186
1229
  case 0:
1187
1230
  timesheetId = expense.workorderPeriodId;
1188
- amount = Number(expense.amount);
1231
+ submittedValue = Number(expense.submittedValue);
1189
1232
  field = EXPENSE_FIELD_MAP[expense.type];
1190
1233
  if (field) {
1191
1234
  _context3.next = 5;
@@ -1194,7 +1237,7 @@ var SFExpenseClient = /*#__PURE__*/function () {
1194
1237
  throw new Error("Unsupported expense type: " + expense.type);
1195
1238
  case 5:
1196
1239
  _context3.next = 7;
1197
- return this.patchTimesheet(timesheetId, (_this$patchTimesheet = {}, _this$patchTimesheet[field] = amount, _this$patchTimesheet));
1240
+ return this.patchTimesheet(timesheetId, (_this$patchTimesheet = {}, _this$patchTimesheet[field] = submittedValue, _this$patchTimesheet));
1198
1241
  case 7:
1199
1242
  case "end":
1200
1243
  return _context3.stop();
@@ -1230,7 +1273,7 @@ var SFPriceClient = /*#__PURE__*/function () {
1230
1273
  while (1) switch (_context.prev = _context.next) {
1231
1274
  case 0:
1232
1275
  _context.prev = 0;
1233
- url = "/services/data/" + SF_API_VERSION + "/query";
1276
+ url = "/services/data/" + SF_API_VERSION$1 + "/query";
1234
1277
  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 + "' ";
1235
1278
  _context.next = 5;
1236
1279
  return this.axiosInstance.get(url, {
@@ -1834,5 +1877,7 @@ var Agency;
1834
1877
  Agency["SSI"] = "99";
1835
1878
  })(Agency || (Agency = {}));
1836
1879
 
1837
- export { Agency, LipheApiClient, LipheAuthenticator, LiphePractitionerClient, SFApiClient, SFAuthenticator, SFExpenseClient, SFPractitionerClient, SFPriceClient, SFTimesheetClient };
1880
+ var SF_API_VERSION$1 = 'v57.0';
1881
+
1882
+ export { Agency, LipheApiClient, LipheAuthenticator, LiphePractitionerClient, SFApiClient, SFAuthenticator, SFExpenseClient, SFPractitionerClient, SFPriceClient, SFTimesheetClient, SF_API_VERSION$1 as SF_API_VERSION };
1838
1883
  //# sourceMappingURL=pha-hermes.esm.js.map