pha-hermes 1.23.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.
- package/dist/api/salesforce/practitioner/practitionerClient.d.ts +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/pha-hermes.cjs.development.js +63 -19
- 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 +63 -20
- package/dist/pha-hermes.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/api/.env +5 -0
- package/src/api/salesforce/expenses/expenseClient.ts +1 -1
- package/src/api/salesforce/payperiod/payperiodClient.ts +2 -2
- package/src/api/salesforce/practitioner/practitionerClient.ts +32 -3
- package/src/api/salesforce/prices/priceClient.ts +1 -1
- package/src/api/salesforce/timesheet/timesheetClient.ts +14 -6
- package/src/api/salesforce/workorder/workorderClient.ts +1 -1
- package/src/index.ts +2 -0
package/dist/pha-hermes.esm.js
CHANGED
|
@@ -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,7 +997,7 @@ 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";
|
|
1000
|
+
url = "/services/data/" + SF_API_VERSION$1 + "/query";
|
|
960
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, {
|
|
@@ -1028,7 +1069,7 @@ var SFPayPeriodClient = /*#__PURE__*/function () {
|
|
|
1028
1069
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1029
1070
|
while (1) switch (_context.prev = _context.next) {
|
|
1030
1071
|
case 0:
|
|
1031
|
-
url = "/services/data/" + SF_API_VERSION + "/query";
|
|
1072
|
+
url = "/services/data/" + SF_API_VERSION$1 + "/query";
|
|
1032
1073
|
query = "SELECT PayPeriod__c, ID\n FROM Timesheet__c\n WHERE WorkOrder__c = '" + workorderID + "'";
|
|
1033
1074
|
_context.next = 4;
|
|
1034
1075
|
return this.axiosInstance.get(url, {
|
|
@@ -1064,7 +1105,7 @@ var SFPayPeriodClient = /*#__PURE__*/function () {
|
|
|
1064
1105
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1065
1106
|
while (1) switch (_context2.prev = _context2.next) {
|
|
1066
1107
|
case 0:
|
|
1067
|
-
url = "/services/data/" + SF_API_VERSION + "/query";
|
|
1108
|
+
url = "/services/data/" + SF_API_VERSION$1 + "/query";
|
|
1068
1109
|
query = "SELECT ID, StartDate__c, EndDate__c\n FROM PayPeriod__c\n WHERE id IN " + listOfIdsForQuery(payPeriodIDs);
|
|
1069
1110
|
_context2.next = 4;
|
|
1070
1111
|
return this.axiosInstance.get(url, {
|
|
@@ -1098,7 +1139,7 @@ var SFPayPeriodClient = /*#__PURE__*/function () {
|
|
|
1098
1139
|
return SFPayPeriodClient;
|
|
1099
1140
|
}();
|
|
1100
1141
|
var listOfIdsForQuery = function listOfIdsForQuery(payPeriodIDs) {
|
|
1101
|
-
return "('" + payPeriodIDs.join('
|
|
1142
|
+
return "('" + payPeriodIDs.join("', '") + "')";
|
|
1102
1143
|
};
|
|
1103
1144
|
|
|
1104
1145
|
var EXPENSE_FIELD_MAP = {
|
|
@@ -1119,7 +1160,7 @@ var SFExpenseClient = /*#__PURE__*/function () {
|
|
|
1119
1160
|
while (1) switch (_context.prev = _context.next) {
|
|
1120
1161
|
case 0:
|
|
1121
1162
|
_context.prev = 0;
|
|
1122
|
-
url = "/services/data/" + SF_API_VERSION + "/sobjects/Timesheet__c/" + timesheetId;
|
|
1163
|
+
url = "/services/data/" + SF_API_VERSION$1 + "/sobjects/Timesheet__c/" + timesheetId;
|
|
1123
1164
|
_context.next = 4;
|
|
1124
1165
|
return this.axiosInstance.get(url, {
|
|
1125
1166
|
params: {
|
|
@@ -1158,7 +1199,7 @@ var SFExpenseClient = /*#__PURE__*/function () {
|
|
|
1158
1199
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1159
1200
|
while (1) switch (_context2.prev = _context2.next) {
|
|
1160
1201
|
case 0:
|
|
1161
|
-
url = "/services/data/" + SF_API_VERSION + "/sobjects/Timesheet__c/" + timesheetId;
|
|
1202
|
+
url = "/services/data/" + SF_API_VERSION$1 + "/sobjects/Timesheet__c/" + timesheetId;
|
|
1162
1203
|
_context2.next = 3;
|
|
1163
1204
|
return this.axiosInstance.patch(url, body);
|
|
1164
1205
|
case 3:
|
|
@@ -1232,7 +1273,7 @@ var SFPriceClient = /*#__PURE__*/function () {
|
|
|
1232
1273
|
while (1) switch (_context.prev = _context.next) {
|
|
1233
1274
|
case 0:
|
|
1234
1275
|
_context.prev = 0;
|
|
1235
|
-
url = "/services/data/" + SF_API_VERSION + "/query";
|
|
1276
|
+
url = "/services/data/" + SF_API_VERSION$1 + "/query";
|
|
1236
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 + "' ";
|
|
1237
1278
|
_context.next = 5;
|
|
1238
1279
|
return this.axiosInstance.get(url, {
|
|
@@ -1836,5 +1877,7 @@ var Agency;
|
|
|
1836
1877
|
Agency["SSI"] = "99";
|
|
1837
1878
|
})(Agency || (Agency = {}));
|
|
1838
1879
|
|
|
1839
|
-
|
|
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 };
|
|
1840
1883
|
//# sourceMappingURL=pha-hermes.esm.js.map
|