pha-hermes 1.25.0 → 1.26.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.
@@ -1 +1 @@
1
- {"version":3,"file":"pha-hermes.cjs.production.min.js","sources":["../src/api/salesforce/auth/auth.ts","../src/api/salesforce/timesheet/timesheetClient.ts","../src/api/salesforce/practitioner/practitionerClient.ts","../src/models/index.ts","../src/api/salesforce/workorder/workorderClient.ts","../src/api/salesforce/payperiod/payperiodClient.ts","../src/api/salesforce/expenses/expenseClient.ts","../src/api/salesforce/prices/priceClient.ts","../src/api/salesforce/apiClient.ts","../src/api/liphe_legacy/auth/authClient.ts","../src/api/liphe_legacy/practitioner/practitionerClient.ts","../src/api/liphe_legacy/contract_request_period/contractRequestPeriodClient.ts","../src/api/liphe_legacy/lipheApiClient.ts","../src/index.ts"],"sourcesContent":["import axios, { AxiosInstance } from 'axios'\nimport FormData from 'form-data'\n\nexport class SFAuthenticator {\n axiosTokenInstance: AxiosInstance = axios.create()\n authenticatedAxiosInstance: AxiosInstance\n token: string | undefined = undefined\n private refreshToken: string | undefined = undefined\n private tokenRefreshPromise: Promise<string> | null = null\n\n constructor(authenticatedAxiosInstance: AxiosInstance, baseUrl: string) {\n this.axiosTokenInstance.defaults.baseURL = baseUrl\n this.authenticatedAxiosInstance = authenticatedAxiosInstance\n }\n\n async initializeAuth(\n clientId: string,\n clientSecret: string,\n onTokenRefresh?: () => Promise<{ clientId: string; clientSecret: string }>\n ) {\n const token = await this.postToken(clientId, clientSecret)\n this.authenticatedAxiosInstance.defaults.headers.common['Authorization'] = `Bearer ${token}`\n\n this.authenticatedAxiosInstance.interceptors.response.use(\n response => response,\n async error => {\n const originalRequest = error.config\n originalRequest._retryCount = originalRequest._retryCount || 0\n\n // If the error is 401 and we haven't exceeded max retries\n if (error.response?.status === 401 && originalRequest._retryCount < 3) {\n originalRequest._retryCount++\n\n try {\n // Use existing token refresh if one is in progress\n if (!this.tokenRefreshPromise) {\n const newClientCredentials = await onTokenRefresh?.()\n const newClientId = newClientCredentials?.clientId || clientId\n const newClientSecret =\n newClientCredentials?.clientSecret || clientSecret\n this.tokenRefreshPromise = this.postToken(newClientId, newClientSecret)\n }\n\n const newToken = await this.tokenRefreshPromise\n // Clear the refresh promise after it completes\n this.tokenRefreshPromise = null\n\n this.authenticatedAxiosInstance.defaults.headers.common['Authorization'] =\n `Bearer ${newToken}`\n originalRequest.headers['Authorization'] = `Bearer ${newToken}`\n\n originalRequest.timeout = 5000\n\n return await Promise.race([\n this.authenticatedAxiosInstance(originalRequest),\n new Promise((_, reject) =>\n setTimeout(\n () => reject(new Error('Retry request timeout')),\n originalRequest.timeout\n )\n )\n ])\n } catch (refreshError) {\n // Clear the refresh promise if it fails\n this.tokenRefreshPromise = null\n return Promise.reject(refreshError)\n }\n }\n return Promise.reject(error)\n }\n )\n }\n\n async postToken(clientId?: string, clientSecret?: string): Promise<string> {\n const tokenFormRequestBody = new FormData()\n if (this.refreshToken) {\n tokenFormRequestBody.append('refresh_token', this.refreshToken)\n tokenFormRequestBody.append('grant_type', 'refresh_token')\n } else if (clientId && clientSecret) {\n tokenFormRequestBody.append('client_id', clientId)\n tokenFormRequestBody.append('client_secret', clientSecret)\n tokenFormRequestBody.append('grant_type', 'client_credentials')\n } else {\n throw new Error(\n 'Authentication failed, either the RefreshToken, or ClientId and ClientSecret need to be provided'\n )\n }\n const response = await this.axiosTokenInstance.post(\n '/services/oauth2/token',\n tokenFormRequestBody,\n {\n headers: tokenFormRequestBody.getHeaders()\n }\n )\n this.token = response?.data?.['access_token']\n if (!this.token) throw new Error('Authentication failed, could not get the access token')\n return this.token\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { TimesheetDayEntry } from '../../../models'\nimport { SF_API_VERSION } from '../../../index'\nimport FormData from 'form-data'\n\ninterface SFTimesheetHourField {\n Id: string\n Date__c: Date\n Callback__c: number\n HoursEBAdjusted__c: number\n Misc__c: number\n OT1__c: number\n OT2__c: number\n OnCall__c: number\n Misc1__c: number\n Misc_1_Hours__c: number\n Misc_2_Hours__c: number\n Misc_3_Hours__c: number\n Misc_4_Hours__c: number\n Stat1__c: number\n Stat2__c: number\n In_Charge__c: number\n Shift_Travel_Stipend__c: number\n LastModifiedDate: Date\n}\ntype SFTimesheetHourFieldKeys = (keyof SFTimesheetHourField)[]\n\nexport class SFTimesheetClient {\n private axiosInstance: AxiosInstance\n\n constructor(axiosInstance: AxiosInstance) {\n this.axiosInstance = axiosInstance\n }\n\n async updateTimesheetHour(timesheetHourId: string, timesheet: TimesheetDayEntry) {\n try {\n const url = `/services/data/${SF_API_VERSION}/sobjects/TimeSheetHour__c/${timesheetHourId}`\n const response = await this.axiosInstance.patch(url, {\n Date__c: timesheet.date,\n Callback__c: timesheet.callbackHours,\n HoursEBAdjusted__c: timesheet.regularHours,\n Misc__c: timesheet.miscHours,\n OT1__c: timesheet.overtime1Hours,\n OT2__c: timesheet.overtime2Hours,\n OnCall__c: timesheet.onCallHours,\n Misc1__c: timesheet.misc1HoursA,\n Misc_1_Hours__c: timesheet.misc1HoursB,\n Misc_2_Hours__c: timesheet.misc2Hours,\n Misc_3_Hours__c: timesheet.misc3Hours,\n Misc_4_Hours__c: timesheet.misc4Hours,\n Stat1__c: timesheet.stat1Hours,\n Stat2__c: timesheet.stat2Hours,\n In_Charge__c: timesheet.inChargeHours,\n Shift_Travel_Stipend__c: timesheet.shiftTravelPerDiemHours\n })\n\n if (![200, 204, 304].includes(response.status))\n throw new Error(`got error status code ${response.status}`)\n } catch (error) {\n console.error('Error Updating Timesheet Hour: ', error.message)\n }\n }\n\n async getTimesheetIds(\n workorderId: string,\n periodStartDate?: Date,\n periodEndDate?: Date\n ): Promise<string[]> {\n // Find all timesheet Ids that belong to this WO\n const url = `/services/data/${SF_API_VERSION}/query`\n let query = `SELECT Id\n FROM Timesheet__c\n WHERE WorkOrder__c = '${workorderId}'`\n try {\n if (periodStartDate && periodEndDate) {\n query += `\n AND PayPeriodStartDate__c <= ${new Date(periodStartDate).toISOString().substring(0, 10)}\n AND PayPeriodEndDate__c >= ${new Date(periodEndDate).toISOString().substring(0, 10)}\n `\n }\n } catch (error) {\n console.error('Invalid period dates', error)\n }\n const {\n data: { records }\n } = await this.axiosInstance.get(url, {\n params: { q: query }\n })\n return records.map(record => record.Id)\n }\n\n async getTimesheetsForPractitioner(personnelID: string) {\n const url = `/services/data/${SF_API_VERSION}/query`\n\n const 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}')`\n\n const data = await this.axiosInstance.get(url, { params: { q: query } })\n\n let timesheets = []\n\n for (const timesheet of data.data.records) {\n timesheets.push({\n workorderId: timesheet.WorkOrder__c,\n id: timesheet.Id,\n updatedAt: timesheet.LastModifiedDate\n })\n }\n\n return timesheets\n }\n\n async getTimesheetHours(\n workorderId: string,\n fields?: SFTimesheetHourFieldKeys[],\n periodStartDate?: Date,\n periodEndDate?: Date\n ): Promise<TimesheetDayEntry[]> {\n const timesheetIds = await this.getTimesheetIds(workorderId, periodStartDate, periodEndDate)\n\n const allHours: SFTimesheetHourField[] = []\n const url = `/services/data/${SF_API_VERSION}/query`\n for (const timesheetId of timesheetIds) {\n let query = `\n SELECT ${fields?.join(',') || 'FIELDS(STANDARD)'}\n FROM TimesheetHour__c\n WHERE Timesheet__c = '${timesheetId}'`\n try {\n if (fields?.length && periodStartDate && periodEndDate) {\n query += `\n AND Date__c >= ${new Date(periodStartDate).toISOString().substring(0, 10)}\n AND Date__c <= ${new Date(periodEndDate).toISOString().substring(0, 10)}`\n }\n\n const {\n data: { records }\n } = await this.axiosInstance.get<{ records: SFTimesheetHourField[] }>(url, {\n params: { q: query }\n })\n allHours.push(...records)\n } catch (err) {\n console.error(`Failed to fetch`, err)\n }\n }\n return allHours.map(toTimesheetDayEntry)\n }\n\n async getPayPeriods(): Promise<any> {\n const url = `/services/data/${SF_API_VERSION}/query`\n\n const query = `SELECT Name,\n StartDate__c,\n EndDate__c\n FROM PayPeriod__c`\n\n const data = await this.axiosInstance.get(url, { params: { q: query } })\n\n let payPeriods = []\n\n for (const payPeriod of data.data.records) {\n payPeriods.push({\n name: payPeriod.Name,\n startDate: payPeriod.StartDate__c,\n endDate: payPeriod.EndDate__c\n })\n }\n\n return payPeriods\n }\n\n async uploadImageToTimesheet(\n file: Buffer,\n filename: string,\n timesheetId: string\n ): Promise<void> {\n try {\n const form = new FormData()\n form.append(\n 'entity_content',\n JSON.stringify({\n Title: filename,\n PathOnClient: filename\n }),\n { contentType: 'application/json' }\n )\n\n form.append('VersionData', file, {\n filename,\n contentType: 'application/octet-stream'\n })\n const uploadRes = await this.axiosInstance.post(\n `/services/data/${SF_API_VERSION}/sobjects/ContentVersion`,\n form,\n { headers: form.getHeaders() }\n )\n\n const versionId = uploadRes.data.id\n\n //get ContentDocumentId\n const { data } = await this.axiosInstance.get(\n `/services/data/${SF_API_VERSION}/query`,\n {\n params: {\n q: `SELECT ContentDocumentId FROM ContentVersion WHERE Id = '${versionId}'`\n }\n }\n )\n const contentDocumentId = data.records[0].ContentDocumentId\n\n await this.axiosInstance.post(\n `/services/data/${SF_API_VERSION}/sobjects/ContentDocumentLink`,\n {\n ContentDocumentId: contentDocumentId,\n LinkedEntityId: timesheetId,\n ShareType: 'V',\n Visibility: 'AllUsers'\n }\n )\n } catch (err) {\n console.error('Salesforce error response:', err?.response?.data)\n console.error('Error uploading and linking image:', err?.message)\n }\n }\n}\n\nfunction toTimesheetDayEntry(raw: SFTimesheetHourField): TimesheetDayEntry {\n return {\n id: raw.Id,\n date: raw.Date__c,\n callbackHours: raw.Callback__c,\n regularHours: raw.HoursEBAdjusted__c,\n miscHours: raw.Misc__c,\n overtime1Hours: raw.OT1__c,\n overtime2Hours: raw.OT2__c,\n onCallHours: raw.OnCall__c,\n misc1HoursA: raw.Misc1__c,\n misc1HoursB: raw.Misc_1_Hours__c,\n misc2Hours: raw.Misc_2_Hours__c,\n misc3Hours: raw.Misc_3_Hours__c,\n misc4Hours: raw.Misc_4_Hours__c,\n stat1Hours: raw.Stat1__c,\n stat2Hours: raw.Stat2__c,\n inChargeHours: raw.In_Charge__c,\n shiftTravelPerDiemHours: raw.Shift_Travel_Stipend__c,\n lastModified: raw.LastModifiedDate\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { Practitioner, PractitionerExport, Role } from '../../../models'\nimport { SF_API_VERSION } from '../../../index'\n\nexport class SFPractitionerClient {\n private PRACTITIONER_FIELDS = {\n default: ['Id', 'FirstName__c', 'LastName__c', 'Email__c', 'StaffID__c', 'CreatedDate'],\n export: [\n 'Id',\n 'FirstName__c',\n 'LastName__c',\n 'Email__c',\n 'StaffID__c',\n 'CreatedDate',\n 'DaytimePhone__c',\n 'Status__c',\n 'ProfessionalDesignation__c',\n 'CANSocialInsuranceNumber__c',\n 'Date_of_Hire__c',\n 'DateApplied__c',\n 'Birthdate__c',\n 'MailingStreetAddress__c',\n 'MailingCity__c',\n 'MailingStateProvince__c',\n 'MailingZipPostalCode__c'\n ]\n } as const\n\n private axiosInstance: AxiosInstance\n\n constructor(axiosInstance: AxiosInstance) {\n this.axiosInstance = axiosInstance\n }\n\n async fetchPractitioners(options: {\n createdAt?: string\n limit?: number\n forExport: true\n }): Promise<PractitionerExport[]>\n\n async fetchPractitioners(options?: {\n createdAt?: string\n limit?: number\n forExport?: false | undefined\n }): Promise<Practitioner[]>\n\n async fetchPractitioners(options?: {\n createdAt?: string\n limit?: number\n forExport?: boolean\n }): Promise<Practitioner[] | PractitionerExport[]> {\n try {\n const conditions: string[] = [`Status__c = 'Active'`]\n if (options?.createdAt) {\n conditions.push(`CreatedDate > ${options.createdAt}`)\n }\n const whereClause = conditions.length ? `WHERE ${conditions.join(' AND ')}` : ''\n const limitClause =\n typeof options?.limit === 'number' && options.limit > 0\n ? `LIMIT ${Math.floor(options.limit)}`\n : ''\n const url = `/services/data/${SF_API_VERSION}/query`\n const fields = (\n options?.forExport\n ? this.PRACTITIONER_FIELDS.export\n : this.PRACTITIONER_FIELDS.default\n ).join(', ')\n\n const query = `\n SELECT ${fields}\n FROM Personnel__c\n ${whereClause}\n ORDER BY CreatedDate ASC, StaffID__c ASC\n ${limitClause}\n `\n const {\n data: { records }\n } = await this.axiosInstance.get(url, {\n params: { q: query }\n })\n\n return options?.forExport\n ? records.map(toPractitionerExport)\n : records.map(toPractitioner)\n } catch (error) {\n console.error('Error fetching practitioners: ', error.message)\n throw error\n }\n }\n\n async fetchPractitionerByEmail(email: string): Promise<Practitioner | null> {\n try {\n const url = `/services/data/${SF_API_VERSION}/query`\n const 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 `\n const {\n data: { records }\n } = await this.axiosInstance.get(url, {\n params: { q: query }\n })\n if (records.length === 0) {\n return null\n }\n return toPractitioner(records[0])\n } catch (error) {\n console.error('Error fetching practitioner by email:', error)\n throw error\n }\n }\n\n async fetchRoles(): Promise<Role[]> {\n try {\n const url = `/services/data/${SF_API_VERSION}/query`\n const query = `SELECT Label, Value FROM PicklistValueInfo \\\n WHERE EntityParticle.EntityDefinition.QualifiedApiName = 'WorkOrder__c'\\\n AND EntityParticle.QualifiedApiName = 'ProfessionalDesignation__c' \\\n AND isActive = true`\n return this.axiosInstance\n .get(url, {\n params: { q: query }\n })\n .then(({ data: { records } }) =>\n records.map(\n (record): Role => ({\n label: record.Label,\n value: record.Value\n })\n )\n )\n .catch(error => {\n console.error('Error fetching roles: ', error.message)\n throw error\n })\n } catch (error) {\n console.error('Error fetching roles: ', error.message)\n throw error\n }\n }\n}\n\nfunction toPractitioner(raw: any): Practitioner {\n return {\n id: raw.Id,\n firstName: raw.FirstName__c,\n lastName: raw.LastName__c,\n email: raw.Email__c,\n staffId: raw.StaffID__c,\n createdAt: raw.CreatedDate ? raw.CreatedDate.replace(/\\+0000$/, 'Z') : undefined\n }\n}\n\nfunction toPractitionerExport(raw: any): PractitionerExport {\n return {\n ...toPractitioner(raw),\n phone: raw.DaytimePhone__c,\n status: raw.Status__c,\n professionalDesignation: raw.ProfessionalDesignation__c,\n SIN: raw.CANSocialInsuranceNumber__c,\n hiringDate: raw.Date_of_Hire__c,\n dateApplied: raw.DateApplied__c,\n birthdate: raw.Birthdate__c,\n mailingStreetAddress: raw.MailingStreetAddress__c,\n mailingCity: raw.MailingCity__c,\n mailingProvince: raw.MailingStateProvince__c,\n mailingZip: raw.MailingZipPostalCode__c\n }\n}\n","export enum Agency {\n CHCA = \"7\",\n CodeBleu = \"5\",\n NordikOntario = \"6\",\n PHA = \"8\",\n PremierSoin = \"1\",\n PremierSoinNordik = \"3\",\n SolutionNursing = \"4\",\n SolutionsStaffing = \"9\",\n Transport = \"2\",\n SSI = \"99\"\n}\n\nexport * from './timesheet'\nexport * from './user'\nexport * from './workorder'\n","import { AxiosInstance } from 'axios'\nimport { SF_API_VERSION } from '../../../index'\nimport { Workorder } from '../../../models'\n\nexport class SFWorkorderClient {\n private axiosInstance: AxiosInstance\n\n constructor(axiosInstance: AxiosInstance) {\n this.axiosInstance = axiosInstance\n }\n\n async getWorkordersForPractitioner(\n practitionerId?: string,\n options?: { startDate?: Date; endDate?: Date; provinces?: string[] }\n ): Promise<Workorder[]> {\n try {\n const filters: string[] = []\n if (practitionerId) {\n filters.push(`Personnel__c = '${practitionerId}'`)\n }\n if (options?.startDate) {\n const isoStart = options.startDate.toISOString().split('T')[0]\n filters.push(`EndDate__c >= ${isoStart}`)\n }\n if (options?.endDate) {\n const isoEnd = options.endDate.toISOString().split('T')[0]\n filters.push(`startdate__c <= ${isoEnd}`)\n }\n\n if (options?.provinces?.length) {\n const provincesList = options?.provinces?.map(p => `'${p}'`).join(', ')\n filters.push(`Region__c IN (${provincesList})`)\n }\n const whereClause = filters.length ? `WHERE ${filters.join(' AND ')}` : ''\n const url = `/services/data/${SF_API_VERSION}/query`\n const 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}`\n return await this.axiosInstance\n .get(url, {\n params: { q: query }\n })\n .then(({ data: { records } }) => {\n return records.map(\n (record): Workorder => ({\n id: record.Id,\n name: record.Name,\n establishmentId: record.HospitalID__c,\n region: record.Region__c,\n establishmentName: record.HospitalName__c,\n role: record.ProfessionalDesignation__c,\n practitionerId: record.Personnel__c,\n startDate: new Date(record.startdate__c),\n endDate: new Date(record.EndDate__c),\n createdAt: new Date(record.CreatedDate),\n updatedAt: new Date(record.LastModifiedDate),\n unit: formatString(record.Unit__c),\n externalUnitId: formatId(record.Unit__c),\n healthAuthority: formatString(record.HealthAuthority__c),\n externalHealthAuthorityId: formatId(record.HealthAuthority__c),\n price: record.UnitPrice__r.Price__c,\n travelInTime: new Date(record.TravelDate__c),\n travelOutTime: new Date(record.ReturnDate__c)\n })\n )\n })\n } catch (error) {\n console.error('Error fetching work orders: ', error.message)\n throw error\n }\n }\n}\n\nconst formatString = (unformattedUnit: string) =>\n !unformattedUnit ? '' : unformattedUnit.replace(/<[^>]*>/g, '').trim()\n\nconst formatId = (htmlString: string): string => {\n if (!htmlString) return ''\n\n const hrefMatch = htmlString.match(/href=\"\\/([^\"]+)\"/i)\n return hrefMatch ? hrefMatch[1] : ''\n}\n","import { AxiosInstance } from 'axios'\nimport { SF_API_VERSION } from '../../../index'\nimport { Period } from '../../../models'\n\nexport class SFPayPeriodClient {\n private axiosInstance: AxiosInstance\n\n constructor(axiosInstance: AxiosInstance) {\n this.axiosInstance = axiosInstance\n }\n\n async getPayPeriodAndTimesheetIdsForWorkorder(workorderID: string) {\n const url = `/services/data/${SF_API_VERSION}/query`\n\n const query = `SELECT PayPeriod__c, ID\n FROM Timesheet__c\n WHERE WorkOrder__c = '${workorderID}'`\n\n const data = await this.axiosInstance.get(url, { params: { q: query } })\n\n let payPeriodIds = []\n\n for (const payPeriods of data.data.records) {\n payPeriodIds.push({\n timesheetId: payPeriods.Id,\n payPeriodId: payPeriods.PayPeriod__c\n })\n }\n\n return payPeriodIds\n }\n\n async getPayPeriodDatesForPayPeriodIds(payPeriodIDs: string[]): Promise<Period[]> {\n const url = `/services/data/${SF_API_VERSION}/query`\n\n const query = `SELECT ID, StartDate__c, EndDate__c\n FROM PayPeriod__c\n WHERE id IN ${listOfIdsForQuery(payPeriodIDs)}`\n\n const data = await this.axiosInstance.get(url, { params: { q: query } })\n\n let payPeriodDates = []\n\n for (const payPeriod of data.data.records) {\n payPeriodDates.push({\n payPeriodId: payPeriod.Id,\n startDate: new Date(payPeriod.StartDate__c),\n endDate: new Date(payPeriod.EndDate__c)\n })\n }\n\n return payPeriodDates\n }\n}\n\nconst listOfIdsForQuery = (payPeriodIDs: string[]) => `('${payPeriodIDs.join(\"', '\")}')`\n","import { AxiosInstance } from 'axios'\nimport { Expense } from '../../../models/expense'\nimport { SF_API_VERSION } from '../../../index'\n\ntype FrontendExpense = {\n workorderPeriodId: string\n submittedValue: string\n type: 'Other' | 'Lodging' | 'Transportation' | 'Travel (Hours)' | 'Per diem' | 'Meals'\n}\n\nconst EXPENSE_FIELD_MAP = {\n Lodging: 'StipendTotalOverride__c',\n 'Per diem': 'Per_Diem_Total__c',\n Other: 'Reimburseable_Expenses__c',\n Transportation: 'TaxiAmount__c'\n} as const\n\ntype SupportedExpenseType = keyof typeof EXPENSE_FIELD_MAP\n\nexport class SFExpenseClient {\n private axiosInstance: AxiosInstance\n\n constructor(axiosInstance: AxiosInstance) {\n this.axiosInstance = axiosInstance\n }\n\n async fetchExpenseTotals(timesheetId: string): Promise<Expense | null> {\n try {\n const url = `/services/data/${SF_API_VERSION}/sobjects/Timesheet__c/${timesheetId}`\n const { data } = await this.axiosInstance.get(url, {\n params: {\n fields: 'Reimburseable_Expenses__c,Per_Diem_Total__c,StipendTotalOverride__c,TaxiAmount__c'\n }\n })\n if (!data) return null\n return toExpense(data)\n } catch (err) {\n console.error('Failed to fetch expense totals', err)\n throw err\n }\n }\n\n private async patchTimesheet(timesheetId: string, body: Record<string, number>): Promise<void> {\n const url = `/services/data/${SF_API_VERSION}/sobjects/Timesheet__c/${timesheetId}`\n const res = await this.axiosInstance.patch(url, body)\n if (![200, 204, 304].includes(res.status)) {\n throw new Error(`Unexpected status ${res.status}`)\n }\n }\n\n async updateExpense(expense: FrontendExpense): Promise<void> {\n const timesheetId = expense.workorderPeriodId\n const submittedValue = Number(expense.submittedValue)\n const field = EXPENSE_FIELD_MAP[expense.type as SupportedExpenseType]\n if (!field) {\n throw new Error(`Unsupported expense type: ${expense.type}`)\n }\n\n await this.patchTimesheet(timesheetId, { [field]: submittedValue })\n }\n}\n\nfunction toExpense(raw: any): Expense {\n return {\n reimbursable: Number(raw.Reimburseable_Expenses__c ?? 0),\n perDiem: Number(raw.Per_Diem_Total__c ?? 0),\n lodging: Number(raw.StipendTotalOverride__c ?? 0),\n transportation: Number(raw.TaxiAmount__c ?? 0)\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { Price } from '../../../models/price'\nimport { SF_API_VERSION } from '../../../index'\n\nexport class SFPriceClient {\n private axiosInstance: AxiosInstance\n\n constructor(axiosInstance: AxiosInstance) {\n this.axiosInstance = axiosInstance\n }\n\n async getPriceListByWorkorderId(workorderId?: string): Promise<Price> {\n try {\n const url = `/services/data/${SF_API_VERSION}/query`\n const 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}' `\n\n return await this.axiosInstance\n .get(url, {\n params: { q: query }\n })\n .then(({ data: { records } }) => {\n return records.map(\n (record): Price => ({\n id: record?.UnitPrice__r?.Price__r.Id,\n name: record?.UnitPrice__r?.Price__r.Name,\n mileageBillingRate:\n record?.UnitPrice__r?.Price__r.MileageBillingRate__c,\n mileageWageRate: record?.UnitPrice__r?.Price__r.MileageWageRate__c,\n regularBillingRate: record?.UnitPrice__r?.Price__r.BillingRate__c,\n regularWageRate: record?.UnitPrice__r?.Price__r.WageRate__c,\n overtime1BillingRate:\n record?.UnitPrice__r?.Price__r.Overtime1BillingRate__c,\n overtime1WageRate: record?.UnitPrice__r?.Price__r.Overtime1WageRate__c,\n overtime2BillingRate:\n record?.UnitPrice__r?.Price__r.Overtime2BillingRate__c,\n overtime2WageRate: record?.UnitPrice__r?.Price__r.Overtime2WageRate__c,\n callbackBillingRate:\n record?.UnitPrice__r?.Price__r.CallBackBillingRate__c,\n callbackWageRate: record?.UnitPrice__r?.Price__r.CallBackWageRate__c,\n onCallBillingRate: record?.UnitPrice__r?.Price__r.OnCallBillingRate__c,\n onCallWageRate: record?.UnitPrice__r?.Price__r.OnCallWageRate__c,\n additionalBillingInfo:\n record?.UnitPrice__r?.Price__r.Additional_Billing_Information__c,\n additionalWageInfo:\n record?.UnitPrice__r?.Price__r.Additional_Wage_Information__c\n })\n )\n })\n } catch (error) {\n console.error('Error fetching Price list: ', error.message)\n throw error\n }\n }\n}\n","import axios, { AxiosInstance } from 'axios'\nimport { SFAuthenticator } from './auth/auth'\nimport { SFTimesheetClient } from './timesheet/timesheetClient'\nimport { SFPractitionerClient } from './practitioner/practitionerClient'\nimport { Role } from '../../models'\nimport { SFWorkorderClient } from './workorder/workorderClient'\nimport { SFPayPeriodClient } from './payperiod/payperiodClient'\nimport { SFExpenseClient } from './expenses/expenseClient'\nimport { SFPriceClient } from './prices/priceClient'\n\nexport const SF_API_VERSION: string = 'v57.0'\n\nexport class SFApiClient {\n private instance: SFApiClient | undefined = undefined\n private axiosInstance: AxiosInstance = axios.create()\n private authenticator: SFAuthenticator\n private baseUrl: string\n timesheetClient: SFTimesheetClient\n workorderClient: SFWorkorderClient\n practitionerClient: SFPractitionerClient\n payPeriodClient: SFPayPeriodClient\n expenseClient: SFExpenseClient\n priceClient: SFPriceClient\n\n async init(\n baseUrl: string,\n sfClientId: string,\n sfClientSecret: string,\n onTokenRefresh?: () => Promise<{ clientId: string; clientSecret: string }>\n ) {\n this.baseUrl = baseUrl\n this.axiosInstance.defaults.baseURL = baseUrl\n this.authenticator = new SFAuthenticator(this.axiosInstance, this.baseUrl)\n this.timesheetClient = new SFTimesheetClient(this.axiosInstance)\n this.workorderClient = new SFWorkorderClient(this.axiosInstance)\n this.practitionerClient = new SFPractitionerClient(this.axiosInstance)\n this.payPeriodClient = new SFPayPeriodClient(this.axiosInstance)\n this.expenseClient = new SFExpenseClient(this.axiosInstance)\n this.priceClient = new SFPriceClient(this.axiosInstance)\n // creates authenticator and adds token to axios instance\n await this.authenticator.initializeAuth(sfClientId, sfClientSecret, onTokenRefresh)\n }\n\n setInstance(instance: SFApiClient) {\n this.instance = instance\n }\n getInstance(): SFApiClient {\n if (!this.instance) {\n throw new Error('Salesforce Api client not initialized')\n }\n return this.instance\n }\n\n async fetchRoles(): Promise<Role[]> {\n try {\n const url = `/services/data/${SF_API_VERSION}/query`\n const query = `SELECT Label, Value FROM PicklistValueInfo \\\n WHERE EntityParticle.EntityDefinition.QualifiedApiName = 'WorkOrder__c'\\\n AND EntityParticle.QualifiedApiName = 'ProfessionalDesignation__c' \\\n AND isActive = true`\n return this.axiosInstance\n .get(url, {\n params: { q: query }\n })\n .then(({ data: { records } }) =>\n records.map(\n (record): Role => ({\n label: record.Label,\n value: record.Value\n })\n )\n )\n } catch (error) {\n console.error('Error fetching roles: ', error.message)\n throw error\n }\n }\n}\n","import axios, { AxiosInstance } from 'axios'\nimport axiosRetry from 'axios-retry'\nimport FormData from 'form-data'\n\nexport class LipheAuthenticator {\n axiosTokenInstance: AxiosInstance = axios.create()\n authenticatedAxiosInstance: AxiosInstance\n token: string | undefined = undefined\n private tokenRefreshPromise: Promise<string> | null = null\n private email: string\n private password: string\n private type: string\n\n constructor(\n authenticatedAxiosInstance: AxiosInstance,\n baseUrl: string,\n email: string,\n password: string,\n type: 'user' | 'client' = 'user'\n ) {\n this.authenticatedAxiosInstance = authenticatedAxiosInstance\n\n axiosRetry(this.axiosTokenInstance, {\n retries: 10,\n retryDelay: retryCount => {\n return Math.min(1000 * Math.pow(2, retryCount - 1), 30000)\n }\n })\n\n this.email = email\n this.password = password\n this.type = type\n this.axiosTokenInstance.defaults.baseURL = baseUrl\n }\n\n async initializeAuth() {\n const token = await this.login()\n\n this.authenticatedAxiosInstance.defaults.headers.common['X-Auth-Token'] = token\n\n this.authenticatedAxiosInstance.interceptors.response.use(\n response => response,\n async error => {\n const originalRequest = error.config\n originalRequest._retryCount = originalRequest._retryCount || 0\n\n if (error.response?.status === 401 && originalRequest._retryCount < 1) {\n originalRequest._retryCount++\n try {\n if (!this.tokenRefreshPromise) {\n this.tokenRefreshPromise = this.login()\n }\n const newToken = await this.tokenRefreshPromise\n this.tokenRefreshPromise = null\n\n this.authenticatedAxiosInstance.defaults.headers.common['X-Auth-Token'] =\n newToken\n\n return await this.authenticatedAxiosInstance(originalRequest)\n } catch (refreshError) {\n this.tokenRefreshPromise = null\n return Promise.reject(refreshError)\n }\n }\n return Promise.reject(error)\n }\n )\n }\n private async login(): Promise<string> {\n const form = new FormData()\n form.append('email', this.email)\n form.append('password', this.password)\n form.append('type', this.type)\n\n const response = await this.axiosTokenInstance.post('v2/signin', form, {\n headers: form.getHeaders()\n })\n const token = response?.data?.data?.token\n if (!token) {\n throw new Error('Authentication failed: no token return')\n }\n this.token = token\n return token\n }\n}\n","import type { AxiosInstance } from 'axios'\nimport { Practitioner } from '../../../models'\n\ninterface LiphePractitioner {\n id: number\n firstname: string\n lastname: string\n email: string\n communicationMode?: number\n}\n\nexport class LiphePractitionerClient {\n private axios: AxiosInstance\n\n constructor(axiosInstance: AxiosInstance) {\n this.axios = axiosInstance\n }\n async fetchAllPractitioners(agencyId: number = 1): Promise<Practitioner[]> {\n let practitioners: LiphePractitioner[] = []\n let page = 1\n let nextPage = true\n\n while (nextPage) {\n const response = await this.axios.get('v2/employees', {\n params: {\n agency_id: agencyId,\n page\n }\n })\n const data = response?.data?.data\n if (!data?.data || !Array.isArray(data.data)) {\n throw new Error('Unexpected responses.')\n }\n\n const pagePractitioners = data.data.map(\n (p: any): LiphePractitioner => ({\n id: p.id,\n firstname: p.firstname,\n lastname: p.lastname,\n email: p.email,\n communicationMode: p.communicationMode\n })\n )\n\n practitioners.push(...pagePractitioners)\n nextPage = Boolean(data.next_page_url)\n page++\n }\n return practitioners.map(p => ({\n id: String(p.id),\n firstName: p.firstname,\n lastName: p.lastname,\n email: p.email,\n staffId: String(p.id)\n }))\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { Agency, Period, Workorder } from '../../../models'\nimport { LipheContractRequest } from '../contract_request/contractRequestClient'\nimport { LipheAssignment } from '../assignment/assignmentClient'\ninterface LipheContractRequestPeriods {\n message: string\n status: boolean\n data: LipheContractRequestPeriodData[]\n meta: {\n current_page: number\n from: number\n last_page: number\n path: string\n per_page: number\n to: number\n total: number\n }\n}\n\ninterface LipheContractRequestPeriod {\n message: string\n status: boolean\n data: LipheContractRequestPeriodData\n meta: {\n current_page: number\n from: number\n last_page: number\n path: string\n per_page: number\n to: number\n total: number\n }\n}\n\ninterface LipheContractRequestPeriodData {\n id: number\n contract_request_id: number\n start_date: Date\n end_date: Date\n shift: 'morning' | 'afternoon' | 'evening' | 'night'\n start_time: Date\n end_time: Date\n departement_id: number\n note: string\n assignment_id: number\n assignment_parent_id: number | null\n created_at: Date\n updated_at: Date\n contract_request: LipheContractRequest\n department: string | null\n assignment: LipheAssignment\n assigned_employee_details: UserDetails\n assignment_employee: any\n}\n\ninterface UserDetails {\n id: number\n name: string\n email: string | null\n}\n\nexport class ContractRequestPeriodClient {\n private axiosInstance: AxiosInstance\n\n constructor(axiosInstance: AxiosInstance) {\n this.axiosInstance = axiosInstance\n }\n\n async fetchAllContractRequestPeriods(\n agencyId: Agency,\n from?: Date,\n to?: Date,\n page: number = 1,\n activeAssignationsOnly: boolean = true,\n assignedPractitionerId?: string\n ): Promise<Workorder[]> {\n const url = `v2/contract-request-periods/agency/${agencyId}`\n const params = new URLSearchParams()\n const periods: Workorder[] = []\n let nextPage = true\n\n if (from) {\n params.append('from', from.toISOString().split('T')[0] + ' 00:00:00')\n }\n if (to) {\n params.append('to', to.toISOString().split('T')[0] + ' 23:59:59')\n }\n if (page) {\n params.append('page', page.toString())\n }\n if (activeAssignationsOnly) {\n params.append('active_assignations_only', activeAssignationsOnly ? '1' : '0')\n }\n\n if (assignedPractitionerId) {\n params.append('assigned_employee_id', assignedPractitionerId)\n }\n\n while (nextPage) {\n params.set('page', page.toString())\n\n const response = await this.axiosInstance.get<LipheContractRequestPeriods>(url, {\n params\n })\n\n for (const period of response.data.data) {\n periods.push({\n id: period.id.toString(),\n name: period.id.toString(),\n establishmentId: period.contract_request.community.id.toString(),\n region: period.contract_request.community.contact.address_state,\n establishmentName: period.contract_request.community.name,\n role: this.getRole(period),\n practitionerId: period.assignment.selected_client.id,\n startDate: new Date(period.start_date),\n endDate: new Date(period.end_date),\n createdAt: new Date(period.created_at),\n updatedAt: new Date(period.updated_at)\n })\n }\n\n nextPage = page < response.data.meta.last_page\n page++\n }\n\n return periods\n }\n\n async fetchContractRequestPeriod(workorderId: string) {\n const url = `v2/contract-request-periods/${workorderId}`\n const params = new URLSearchParams()\n const response = await this.axiosInstance.get<LipheContractRequestPeriod>(url, { params })\n\n return response.data.data\n }\n\n async getPayPeriodDatesForPayPeriodId(payPeriodId: string): Promise<Period[]> {\n const period = await this.fetchContractRequestPeriod(payPeriodId)\n const payPeriods: {\n payPeriodId: string\n startDate: string\n endDate: string\n workorderId: string\n }[] = []\n\n const firstPayPeriodDate = this.getPayPeriodDayBeforeStartDate(\n new Date(period.assignment.selected_client.agency.date_first_periode_paie),\n new Date(period.start_date)\n )\n\n const lastPayPeriodDate = this.getLastDayOfPayPeriod(\n new Date(firstPayPeriodDate),\n new Date(period.end_date)\n )\n\n // Calculate the number of weeks between lastPayPeriodDate and firstPayPeriodDate\n const weeksBetween = this.calculateWeeksBetween(firstPayPeriodDate, lastPayPeriodDate)\n\n for (let i = 0; i < weeksBetween; i++) {\n const tempDate = new Date(firstPayPeriodDate)\n\n const startDate = new Date(tempDate.setDate(tempDate.getDate() + 7 * i))\n const endDate = new Date(tempDate.setDate(tempDate.getDate() + 6))\n\n payPeriods.push({\n payPeriodId: '',\n startDate: startDate.toISOString().split('T')[0],\n endDate: endDate.toISOString().split('T')[0],\n workorderId: payPeriodId\n })\n }\n\n return payPeriods as unknown as Period[]\n }\n\n private getRole(period: LipheContractRequestPeriodData) {\n if (period.contract_request.job.translations.length === 0) {\n return ''\n }\n\n if (period.contract_request.job.translations.length > 1) {\n const roleTranslation = period.contract_request.job.translations.find(\n (translation: any) => translation.locale === 'en'\n )\n return roleTranslation?.content\n } else {\n return period.contract_request.job.translations[0].content\n }\n }\n\n /**\n * Calculates the pay period day of week that comes before the start date\n * @param firstPayPeriodDate The first pay period date from the agency\n * @param startDate The start date to find the pay period before\n * @returns The day of week (0-6, where 0 is Sunday) of the pay period before start_date\n */\n private getPayPeriodDayBeforeStartDate(firstPayPeriodDate: Date, startDate: Date): Date {\n const payPeriodDayOfWeek = firstPayPeriodDate.getDay()\n\n // Calculate the most recent pay period date that falls before start_date\n const tempDate = new Date(startDate)\n\n // Go back one week at a time until we find a date that matches the pay period day of week\n while (tempDate.getDay() !== payPeriodDayOfWeek) {\n tempDate.setDate(tempDate.getDate() - 1)\n }\n\n // If the calculated date is not before start_date, go back another week\n if (tempDate >= startDate) {\n tempDate.setDate(tempDate.getDate() - 7)\n }\n\n return tempDate\n }\n\n private getLastDayOfPayPeriod(firstPayPeriodDate: Date, endDate: Date): Date {\n const tempDate = new Date(firstPayPeriodDate)\n\n // Go back one week at a time until we find a date that matches the pay period day of week\n while (endDate > tempDate) {\n tempDate.setDate(tempDate.getDate() + 7)\n }\n\n return tempDate\n }\n\n private calculateWeeksBetween(startDate: Date, endDate: Date): number {\n const diffTime = Math.abs(endDate.getTime() - startDate.getTime())\n const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24))\n const weeks = Math.floor(diffDays / 7)\n return weeks\n }\n}\n","import axios, { AxiosInstance } from 'axios'\nimport { LipheAuthenticator } from './auth/authClient'\nimport { LiphePractitionerClient } from './practitioner/practitionerClient'\nimport { ContractRequestPeriodClient } from './contract_request_period/contractRequestPeriodClient'\nimport axiosRetry from 'axios-retry'\n\nexport class LipheApiClient {\n private instance: LipheApiClient | undefined = undefined\n private axiosInstance: AxiosInstance = axios.create()\n private authenticator: LipheAuthenticator\n public practitionerClient: LiphePractitionerClient\n public contractRequestPeriodClient: ContractRequestPeriodClient\n\n constructor(\n baseUrl: string,\n email: string,\n password: string,\n type: 'user' | 'client' = 'user'\n ) {\n this.axiosInstance.defaults.baseURL = baseUrl\n\n this.authenticator = new LipheAuthenticator(\n this.axiosInstance,\n baseUrl,\n email,\n password,\n type\n )\n\n axiosRetry(this.axiosInstance, {\n retries: 10,\n retryDelay: retryCount => {\n return Math.min(1000 * Math.pow(2, retryCount - 1), 30000)\n },\n onRetry: (retryCount, error) => {\n console.log(`Retry attempt ${retryCount} failed: ${error.message}`)\n }\n })\n\n this.practitionerClient = new LiphePractitionerClient(this.axiosInstance)\n this.contractRequestPeriodClient = new ContractRequestPeriodClient(this.axiosInstance)\n }\n async init() {\n await this.authenticator.initializeAuth()\n }\n\n setInstance(instance: LipheApiClient) {\n this.instance = instance\n }\n\n getInstance(): LipheApiClient {\n return this.instance\n }\n\n getAxiosInstance(): AxiosInstance {\n return this.axiosInstance\n }\n}\n","export const SF_API_VERSION: string = 'v57.0'\n\n// Salesforce API\nexport { SFApiClient } from './api/salesforce/apiClient'\nexport { SFPractitionerClient } from './api/salesforce/practitioner/practitionerClient'\nexport { SFTimesheetClient } from './api/salesforce/timesheet/timesheetClient'\nexport { SFAuthenticator } from './api/salesforce/auth/auth'\nexport { SFPriceClient } from './api/salesforce/prices/priceClient'\nexport { SFExpenseClient } from './api/salesforce/expenses/expenseClient'\n\n// Liphe API\nexport { LipheApiClient } from './api/liphe_legacy/lipheApiClient'\nexport { LipheAuthenticator } from './api/liphe_legacy/auth/authClient'\nexport { LiphePractitionerClient } from './api/liphe_legacy/practitioner/practitionerClient'\n\n// Common Models\nexport { Practitioner, Role, TimesheetDayEntry, Workorder, Agency, Period } from './models'\n"],"names":["SFAuthenticator","authenticatedAxiosInstance","baseUrl","this","axios","create","undefined","axiosTokenInstance","defaults","baseURL","_proto","prototype","initializeAuth","_initializeAuth","_asyncToGenerator","_regeneratorRuntime","mark","_callee2","clientId","clientSecret","onTokenRefresh","_this","wrap","_context2","prev","next","postToken","headers","common","sent","interceptors","response","use","_ref","_callee","error","_error$response","originalRequest","newClientCredentials","newToken","_context","config","_retryCount","status","tokenRefreshPromise","timeout","Promise","race","_","reject","setTimeout","Error","abrupt","t0","stop","_x4","apply","arguments","_x","_x2","_x3","_postToken","_callee3","_response$data","tokenFormRequestBody","_context3","FormData","refreshToken","append","post","getHeaders","token","data","_x5","_x6","SFTimesheetClient","axiosInstance","updateTimesheetHour","_updateTimesheetHour","timesheetHourId","timesheet","url","SF_API_VERSION","patch","Date__c","date","Callback__c","callbackHours","HoursEBAdjusted__c","regularHours","Misc__c","miscHours","OT1__c","overtime1Hours","OT2__c","overtime2Hours","OnCall__c","onCallHours","Misc1__c","misc1HoursA","Misc_1_Hours__c","misc1HoursB","Misc_2_Hours__c","misc2Hours","Misc_3_Hours__c","misc3Hours","Misc_4_Hours__c","misc4Hours","Stat1__c","stat1Hours","Stat2__c","stat2Hours","In_Charge__c","inChargeHours","Shift_Travel_Stipend__c","shiftTravelPerDiemHours","includes","console","message","getTimesheetIds","_getTimesheetIds","workorderId","periodStartDate","periodEndDate","query","Date","toISOString","substring","get","params","q","records","map","record","Id","getTimesheetsForPractitioner","_getTimesheetsForPractitioner","personnelID","timesheets","_iterator","_step","_createForOfIteratorHelperLoose","done","push","value","WorkOrder__c","id","updatedAt","LastModifiedDate","getTimesheetHours","_getTimesheetHours","_callee4","fields","allHours","_iterator2","_step2","timesheetId","_context4","join","length","toTimesheetDayEntry","_x7","_x8","_x9","_x10","getPayPeriods","_getPayPeriods","_callee5","payPeriods","_iterator3","_step3","payPeriod","_context5","name","Name","startDate","StartDate__c","endDate","EndDate__c","uploadImageToTimesheet","_uploadImageToTimesheet","_callee6","file","filename","form","versionId","contentDocumentId","_err$response","_context6","JSON","stringify","Title","PathOnClient","contentType","ContentDocumentId","LinkedEntityId","ShareType","Visibility","_x11","_x12","_x13","raw","lastModified","SFPractitionerClient","default","export","fetchPractitioners","_fetchPractitioners","options","conditions","whereClause","limitClause","createdAt","limit","Math","floor","forExport","PRACTITIONER_FIELDS","toPractitionerExport","toPractitioner","fetchPractitionerByEmail","_fetchPractitionerByEmail","email","fetchRoles","_fetchRoles","then","label","Label","Value","firstName","FirstName__c","lastName","LastName__c","Email__c","staffId","StaffID__c","CreatedDate","replace","_extends","phone","DaytimePhone__c","Status__c","professionalDesignation","ProfessionalDesignation__c","SIN","CANSocialInsuranceNumber__c","hiringDate","Date_of_Hire__c","dateApplied","DateApplied__c","birthdate","Birthdate__c","mailingStreetAddress","MailingStreetAddress__c","mailingCity","MailingCity__c","mailingProvince","MailingStateProvince__c","mailingZip","MailingZipPostalCode__c","Agency","SFWorkorderClient","getWorkordersForPractitioner","_getWorkordersForPractitioner","practitionerId","_options$provinces","filters","isoStart","isoEnd","_options$provinces2","provincesList","split","provinces","p","establishmentId","HospitalID__c","region","Region__c","establishmentName","HospitalName__c","role","Personnel__c","startdate__c","unit","formatString","Unit__c","externalUnitId","formatId","healthAuthority","HealthAuthority__c","externalHealthAuthorityId","price","UnitPrice__r","Price__c","travelInTime","TravelDate__c","travelOutTime","ReturnDate__c","unformattedUnit","trim","htmlString","hrefMatch","match","SFPayPeriodClient","getPayPeriodAndTimesheetIdsForWorkorder","_getPayPeriodAndTimesheetIdsForWorkorder","workorderID","payPeriodIds","payPeriodId","PayPeriod__c","getPayPeriodDatesForPayPeriodIds","_getPayPeriodDatesForPayPeriodIds","payPeriodIDs","payPeriodDates","listOfIdsForQuery","EXPENSE_FIELD_MAP","Lodging","Per diem","Other","Transportation","SFExpenseClient","fetchExpenseTotals","_fetchExpenseTotals","reimbursable","Number","_raw$Reimburseable_Ex","Reimburseable_Expenses__c","perDiem","_raw$Per_Diem_Total__","Per_Diem_Total__c","lodging","_raw$StipendTotalOver","StipendTotalOverride__c","transportation","_raw$TaxiAmount__c","TaxiAmount__c","patchTimesheet","_patchTimesheet","body","res","updateExpense","_updateExpense","expense","_this$patchTimesheet","submittedValue","field","workorderPeriodId","type","SFPriceClient","getPriceListByWorkorderId","_getPriceListByWorkorderId","_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","Price__r","mileageBillingRate","MileageBillingRate__c","mileageWageRate","MileageWageRate__c","regularBillingRate","BillingRate__c","regularWageRate","WageRate__c","overtime1BillingRate","Overtime1BillingRate__c","overtime1WageRate","Overtime1WageRate__c","overtime2BillingRate","Overtime2BillingRate__c","overtime2WageRate","Overtime2WageRate__c","callbackBillingRate","CallBackBillingRate__c","callbackWageRate","CallBackWageRate__c","onCallBillingRate","OnCallBillingRate__c","onCallWageRate","OnCallWageRate__c","additionalBillingInfo","Additional_Billing_Information__c","additionalWageInfo","Additional_Wage_Information__c","SFApiClient","init","_init","sfClientId","sfClientSecret","authenticator","timesheetClient","workorderClient","practitionerClient","payPeriodClient","expenseClient","priceClient","setInstance","instance","getInstance","LipheAuthenticator","password","axiosRetry","retries","retryDelay","retryCount","min","pow","login","_login","LiphePractitionerClient","fetchAllPractitioners","_fetchAllPractitioners","agencyId","practitioners","page","nextPage","agency_id","Array","isArray","pagePractitioners","firstname","lastname","communicationMode","Boolean","next_page_url","String","ContractRequestPeriodClient","fetchAllContractRequestPeriods","_fetchAllContractRequestPeriods","from","to","activeAssignationsOnly","assignedPractitionerId","periods","period","URLSearchParams","toString","set","contract_request","community","contact","address_state","getRole","assignment","selected_client","start_date","end_date","created_at","updated_at","meta","last_page","fetchContractRequestPeriod","_fetchContractRequestPeriod","getPayPeriodDatesForPayPeriodId","_getPayPeriodDatesForPayPeriodId","firstPayPeriodDate","lastPayPeriodDate","weeksBetween","i","tempDate","getPayPeriodDayBeforeStartDate","agency","date_first_periode_paie","getLastDayOfPayPeriod","calculateWeeksBetween","setDate","getDate","job","translations","roleTranslation","find","translation","locale","content","payPeriodDayOfWeek","getDay","diffTime","abs","getTime","diffDays","ceil","LipheApiClient","onRetry","log","contractRequestPeriodClient","getAxiosInstance"],"mappings":"q3PAGaA,aAOT,SAAAA,EAAYC,EAA2CC,GANvDC,wBAAoCC,EAAMC,SAE1CF,gBAA4BG,EACpBH,uBAAmCG,EACnCH,yBAA8C,KAGlDA,KAAKI,mBAAmBC,SAASC,QAAUP,EAC3CC,KAAKF,2BAA6BA,EACrC,IAAAS,EAAAV,EAAAW,UA4Dc,OA5DdD,EAEKE,0BAAc,IAAAC,EAAAC,EA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AhY,EAAAC,IAAAC,MAAV,SAAAkB,IAAA,OAAAnB,IAAAO,eAAAkB,GAAA,cAAAA,EAAAhB,KAAAgB,EAAAf,MAAA,OAAA,OAAAe,EAAAf,OACUtB,KAAK8Y,cAAcrY,iBAAgB,OAAA,UAAA,OAAA4B,EAAAc,UAAApB,YADnC,OAET,WAFS,OAAA4W,EAAAtV,WAAAC,eAAA/C,EAIV8Y,YAAA,SAAYC,GACRtZ,KAAKsZ,SAAWA,GACnB/Y,EAEDgZ,YAAA,WACI,OAAOvZ,KAAKsZ,UACf/Y,EAEDue,iBAAA,WACI,OAAO9e,KAAKyE,eACfia,MTxDOzO,EAAAA,iBAAAA,6BAERA,eACAA,oBACAA,UACAA,kBACAA,wBACAA,sBACAA,wBACAA,gBACAA,eUVSlL,EAAyB"}
1
+ {"version":3,"file":"pha-hermes.cjs.production.min.js","sources":["../src/api/salesforce/auth/auth.ts","../src/api/salesforce/timesheet/timesheetClient.ts","../src/api/salesforce/practitioner/practitionerClient.ts","../src/models/index.ts","../src/api/salesforce/workorder/workorderClient.ts","../src/api/salesforce/payperiod/payperiodClient.ts","../src/api/salesforce/expenses/expenseClient.ts","../src/api/salesforce/prices/priceClient.ts","../src/api/salesforce/accounts/accounts.ts","../src/api/salesforce/apiClient.ts","../src/api/liphe_legacy/auth/authClient.ts","../src/api/liphe_legacy/practitioner/practitionerClient.ts","../src/api/liphe_legacy/contract_request_period/contractRequestPeriodClient.ts","../src/api/liphe_legacy/lipheApiClient.ts","../src/index.ts"],"sourcesContent":["import axios, { AxiosInstance } from 'axios'\nimport FormData from 'form-data'\n\nexport class SFAuthenticator {\n axiosTokenInstance: AxiosInstance = axios.create()\n authenticatedAxiosInstance: AxiosInstance\n token: string | undefined = undefined\n private refreshToken: string | undefined = undefined\n private tokenRefreshPromise: Promise<string> | null = null\n\n constructor(authenticatedAxiosInstance: AxiosInstance, baseUrl: string) {\n this.axiosTokenInstance.defaults.baseURL = baseUrl\n this.authenticatedAxiosInstance = authenticatedAxiosInstance\n }\n\n async initializeAuth(\n clientId: string,\n clientSecret: string,\n onTokenRefresh?: () => Promise<{ clientId: string; clientSecret: string }>\n ) {\n const token = await this.postToken(clientId, clientSecret)\n this.authenticatedAxiosInstance.defaults.headers.common['Authorization'] = `Bearer ${token}`\n\n this.authenticatedAxiosInstance.interceptors.response.use(\n response => response,\n async error => {\n const originalRequest = error.config\n originalRequest._retryCount = originalRequest._retryCount || 0\n\n // If the error is 401 and we haven't exceeded max retries\n if (error.response?.status === 401 && originalRequest._retryCount < 3) {\n originalRequest._retryCount++\n\n try {\n // Use existing token refresh if one is in progress\n if (!this.tokenRefreshPromise) {\n const newClientCredentials = await onTokenRefresh?.()\n const newClientId = newClientCredentials?.clientId || clientId\n const newClientSecret =\n newClientCredentials?.clientSecret || clientSecret\n this.tokenRefreshPromise = this.postToken(newClientId, newClientSecret)\n }\n\n const newToken = await this.tokenRefreshPromise\n // Clear the refresh promise after it completes\n this.tokenRefreshPromise = null\n\n this.authenticatedAxiosInstance.defaults.headers.common['Authorization'] =\n `Bearer ${newToken}`\n originalRequest.headers['Authorization'] = `Bearer ${newToken}`\n\n originalRequest.timeout = 5000\n\n return await Promise.race([\n this.authenticatedAxiosInstance(originalRequest),\n new Promise((_, reject) =>\n setTimeout(\n () => reject(new Error('Retry request timeout')),\n originalRequest.timeout\n )\n )\n ])\n } catch (refreshError) {\n // Clear the refresh promise if it fails\n this.tokenRefreshPromise = null\n return Promise.reject(refreshError)\n }\n }\n return Promise.reject(error)\n }\n )\n }\n\n async postToken(clientId?: string, clientSecret?: string): Promise<string> {\n const tokenFormRequestBody = new FormData()\n if (this.refreshToken) {\n tokenFormRequestBody.append('refresh_token', this.refreshToken)\n tokenFormRequestBody.append('grant_type', 'refresh_token')\n } else if (clientId && clientSecret) {\n tokenFormRequestBody.append('client_id', clientId)\n tokenFormRequestBody.append('client_secret', clientSecret)\n tokenFormRequestBody.append('grant_type', 'client_credentials')\n } else {\n throw new Error(\n 'Authentication failed, either the RefreshToken, or ClientId and ClientSecret need to be provided'\n )\n }\n const response = await this.axiosTokenInstance.post(\n '/services/oauth2/token',\n tokenFormRequestBody,\n {\n headers: tokenFormRequestBody.getHeaders()\n }\n )\n this.token = response?.data?.['access_token']\n if (!this.token) throw new Error('Authentication failed, could not get the access token')\n return this.token\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { TimesheetDayEntry } from '../../../models'\nimport { SF_API_VERSION } from '../../../index'\nimport FormData from 'form-data'\n\ninterface SFTimesheetHourField {\n Id: string\n Date__c: Date\n Callback__c: number\n HoursEBAdjusted__c: number\n Misc__c: number\n OT1__c: number\n OT2__c: number\n OnCall__c: number\n Misc1__c: number\n Misc_1_Hours__c: number\n Misc_2_Hours__c: number\n Misc_3_Hours__c: number\n Misc_4_Hours__c: number\n Stat1__c: number\n Stat2__c: number\n In_Charge__c: number\n Shift_Travel_Stipend__c: number\n LastModifiedDate: Date\n}\ntype SFTimesheetHourFieldKeys = (keyof SFTimesheetHourField)[]\n\nexport class SFTimesheetClient {\n private axiosInstance: AxiosInstance\n\n constructor(axiosInstance: AxiosInstance) {\n this.axiosInstance = axiosInstance\n }\n\n async updateTimesheetHour(timesheetHourId: string, timesheet: TimesheetDayEntry) {\n try {\n const url = `/services/data/${SF_API_VERSION}/sobjects/TimeSheetHour__c/${timesheetHourId}`\n const response = await this.axiosInstance.patch(url, {\n Date__c: timesheet.date,\n Callback__c: timesheet.callbackHours,\n HoursEBAdjusted__c: timesheet.regularHours,\n Misc__c: timesheet.miscHours,\n OT1__c: timesheet.overtime1Hours,\n OT2__c: timesheet.overtime2Hours,\n OnCall__c: timesheet.onCallHours,\n Misc1__c: timesheet.misc1HoursA,\n Misc_1_Hours__c: timesheet.misc1HoursB,\n Misc_2_Hours__c: timesheet.misc2Hours,\n Misc_3_Hours__c: timesheet.misc3Hours,\n Misc_4_Hours__c: timesheet.misc4Hours,\n Stat1__c: timesheet.stat1Hours,\n Stat2__c: timesheet.stat2Hours,\n In_Charge__c: timesheet.inChargeHours,\n Shift_Travel_Stipend__c: timesheet.shiftTravelPerDiemHours\n })\n\n if (![200, 204, 304].includes(response.status))\n throw new Error(`got error status code ${response.status}`)\n } catch (error) {\n console.error('Error Updating Timesheet Hour: ', error.message)\n }\n }\n\n async getTimesheetIds(\n workorderId: string,\n periodStartDate?: Date,\n periodEndDate?: Date\n ): Promise<string[]> {\n // Find all timesheet Ids that belong to this WO\n const url = `/services/data/${SF_API_VERSION}/query`\n let query = `SELECT Id\n FROM Timesheet__c\n WHERE WorkOrder__c = '${workorderId}'`\n try {\n if (periodStartDate && periodEndDate) {\n query += `\n AND PayPeriodStartDate__c <= ${new Date(periodStartDate).toISOString().substring(0, 10)}\n AND PayPeriodEndDate__c >= ${new Date(periodEndDate).toISOString().substring(0, 10)}\n `\n }\n } catch (error) {\n console.error('Invalid period dates', error)\n }\n const {\n data: { records }\n } = await this.axiosInstance.get(url, {\n params: { q: query }\n })\n return records.map(record => record.Id)\n }\n\n async getTimesheetsForPractitioner(personnelID: string) {\n const url = `/services/data/${SF_API_VERSION}/query`\n\n const 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}')`\n\n const data = await this.axiosInstance.get(url, { params: { q: query } })\n\n let timesheets = []\n\n for (const timesheet of data.data.records) {\n timesheets.push({\n workorderId: timesheet.WorkOrder__c,\n id: timesheet.Id,\n updatedAt: timesheet.LastModifiedDate\n })\n }\n\n return timesheets\n }\n\n async getTimesheetHours(\n workorderId: string,\n fields?: SFTimesheetHourFieldKeys[],\n periodStartDate?: Date,\n periodEndDate?: Date\n ): Promise<TimesheetDayEntry[]> {\n const timesheetIds = await this.getTimesheetIds(workorderId, periodStartDate, periodEndDate)\n\n const allHours: SFTimesheetHourField[] = []\n const url = `/services/data/${SF_API_VERSION}/query`\n for (const timesheetId of timesheetIds) {\n let query = `\n SELECT ${fields?.join(',') || 'FIELDS(STANDARD)'}\n FROM TimesheetHour__c\n WHERE Timesheet__c = '${timesheetId}'`\n try {\n if (fields?.length && periodStartDate && periodEndDate) {\n query += `\n AND Date__c >= ${new Date(periodStartDate).toISOString().substring(0, 10)}\n AND Date__c <= ${new Date(periodEndDate).toISOString().substring(0, 10)}`\n }\n\n const {\n data: { records }\n } = await this.axiosInstance.get<{ records: SFTimesheetHourField[] }>(url, {\n params: { q: query }\n })\n allHours.push(...records)\n } catch (err) {\n console.error(`Failed to fetch`, err)\n }\n }\n return allHours.map(toTimesheetDayEntry)\n }\n\n async getPayPeriods(): Promise<any> {\n const url = `/services/data/${SF_API_VERSION}/query`\n\n const query = `SELECT Name,\n StartDate__c,\n EndDate__c\n FROM PayPeriod__c`\n\n const data = await this.axiosInstance.get(url, { params: { q: query } })\n\n let payPeriods = []\n\n for (const payPeriod of data.data.records) {\n payPeriods.push({\n name: payPeriod.Name,\n startDate: payPeriod.StartDate__c,\n endDate: payPeriod.EndDate__c\n })\n }\n\n return payPeriods\n }\n\n async uploadImageToTimesheet(\n file: Buffer,\n filename: string,\n timesheetId: string\n ): Promise<void> {\n try {\n const form = new FormData()\n form.append(\n 'entity_content',\n JSON.stringify({\n Title: filename,\n PathOnClient: filename\n }),\n { contentType: 'application/json' }\n )\n\n form.append('VersionData', file, {\n filename,\n contentType: 'application/octet-stream'\n })\n const uploadRes = await this.axiosInstance.post(\n `/services/data/${SF_API_VERSION}/sobjects/ContentVersion`,\n form,\n { headers: form.getHeaders() }\n )\n\n const versionId = uploadRes.data.id\n\n //get ContentDocumentId\n const { data } = await this.axiosInstance.get(\n `/services/data/${SF_API_VERSION}/query`,\n {\n params: {\n q: `SELECT ContentDocumentId FROM ContentVersion WHERE Id = '${versionId}'`\n }\n }\n )\n const contentDocumentId = data.records[0].ContentDocumentId\n\n await this.axiosInstance.post(\n `/services/data/${SF_API_VERSION}/sobjects/ContentDocumentLink`,\n {\n ContentDocumentId: contentDocumentId,\n LinkedEntityId: timesheetId,\n ShareType: 'V',\n Visibility: 'AllUsers'\n }\n )\n } catch (err) {\n console.error('Salesforce error response:', err?.response?.data)\n console.error('Error uploading and linking image:', err?.message)\n }\n }\n}\n\nfunction toTimesheetDayEntry(raw: SFTimesheetHourField): TimesheetDayEntry {\n return {\n id: raw.Id,\n date: raw.Date__c,\n callbackHours: raw.Callback__c,\n regularHours: raw.HoursEBAdjusted__c,\n miscHours: raw.Misc__c,\n overtime1Hours: raw.OT1__c,\n overtime2Hours: raw.OT2__c,\n onCallHours: raw.OnCall__c,\n misc1HoursA: raw.Misc1__c,\n misc1HoursB: raw.Misc_1_Hours__c,\n misc2Hours: raw.Misc_2_Hours__c,\n misc3Hours: raw.Misc_3_Hours__c,\n misc4Hours: raw.Misc_4_Hours__c,\n stat1Hours: raw.Stat1__c,\n stat2Hours: raw.Stat2__c,\n inChargeHours: raw.In_Charge__c,\n shiftTravelPerDiemHours: raw.Shift_Travel_Stipend__c,\n lastModified: raw.LastModifiedDate\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { Practitioner, PractitionerExport, Role } from '../../../models'\nimport { SF_API_VERSION } from '../../../index'\n\nexport class SFPractitionerClient {\n private PRACTITIONER_FIELDS = {\n default: ['Id', 'FirstName__c', 'LastName__c', 'Email__c', 'StaffID__c', 'CreatedDate'],\n export: [\n 'Id',\n 'FirstName__c',\n 'LastName__c',\n 'Email__c',\n 'StaffID__c',\n 'CreatedDate',\n 'DaytimePhone__c',\n 'Status__c',\n 'ProfessionalDesignation__c',\n 'CANSocialInsuranceNumber__c',\n 'Date_of_Hire__c',\n 'DateApplied__c',\n 'Birthdate__c',\n 'MailingStreetAddress__c',\n 'MailingCity__c',\n 'MailingStateProvince__c',\n 'MailingZipPostalCode__c'\n ]\n } as const\n\n private axiosInstance: AxiosInstance\n\n constructor(axiosInstance: AxiosInstance) {\n this.axiosInstance = axiosInstance\n }\n\n async fetchPractitioners(options: {\n createdAt?: string\n limit?: number\n forExport: true\n }): Promise<PractitionerExport[]>\n\n async fetchPractitioners(options?: {\n createdAt?: string\n limit?: number\n forExport?: false | undefined\n }): Promise<Practitioner[]>\n\n async fetchPractitioners(options?: {\n createdAt?: string\n limit?: number\n forExport?: boolean\n }): Promise<Practitioner[] | PractitionerExport[]> {\n try {\n const conditions: string[] = [`Status__c = 'Active'`]\n if (options?.createdAt) {\n conditions.push(`CreatedDate > ${options.createdAt}`)\n }\n const whereClause = conditions.length ? `WHERE ${conditions.join(' AND ')}` : ''\n const limitClause =\n typeof options?.limit === 'number' && options.limit > 0\n ? `LIMIT ${Math.floor(options.limit)}`\n : ''\n const url = `/services/data/${SF_API_VERSION}/query`\n const fields = (\n options?.forExport\n ? this.PRACTITIONER_FIELDS.export\n : this.PRACTITIONER_FIELDS.default\n ).join(', ')\n\n const query = `\n SELECT ${fields}\n FROM Personnel__c\n ${whereClause}\n ORDER BY CreatedDate ASC, StaffID__c ASC\n ${limitClause}\n `\n const {\n data: { records }\n } = await this.axiosInstance.get(url, {\n params: { q: query }\n })\n\n return options?.forExport\n ? records.map(toPractitionerExport)\n : records.map(toPractitioner)\n } catch (error) {\n console.error('Error fetching practitioners: ', error.message)\n throw error\n }\n }\n\n async fetchPractitionerByEmail(email: string): Promise<Practitioner | null> {\n try {\n const url = `/services/data/${SF_API_VERSION}/query`\n const 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 `\n const {\n data: { records }\n } = await this.axiosInstance.get(url, {\n params: { q: query }\n })\n if (records.length === 0) {\n return null\n }\n return toPractitioner(records[0])\n } catch (error) {\n console.error('Error fetching practitioner by email:', error)\n throw error\n }\n }\n\n async fetchRoles(): Promise<Role[]> {\n try {\n const url = `/services/data/${SF_API_VERSION}/query`\n const query = `SELECT Label, Value FROM PicklistValueInfo \\\n WHERE EntityParticle.EntityDefinition.QualifiedApiName = 'WorkOrder__c'\\\n AND EntityParticle.QualifiedApiName = 'ProfessionalDesignation__c' \\\n AND isActive = true`\n return this.axiosInstance\n .get(url, {\n params: { q: query }\n })\n .then(({ data: { records } }) =>\n records.map(\n (record): Role => ({\n label: record.Label,\n value: record.Value\n })\n )\n )\n .catch(error => {\n console.error('Error fetching roles: ', error.message)\n throw error\n })\n } catch (error) {\n console.error('Error fetching roles: ', error.message)\n throw error\n }\n }\n}\n\nfunction toPractitioner(raw: any): Practitioner {\n return {\n id: raw.Id,\n firstName: raw.FirstName__c,\n lastName: raw.LastName__c,\n email: raw.Email__c,\n staffId: raw.StaffID__c,\n createdAt: raw.CreatedDate ? raw.CreatedDate.replace(/\\+0000$/, 'Z') : undefined\n }\n}\n\nfunction toPractitionerExport(raw: any): PractitionerExport {\n return {\n ...toPractitioner(raw),\n phone: raw.DaytimePhone__c,\n status: raw.Status__c,\n professionalDesignation: raw.ProfessionalDesignation__c,\n SIN: raw.CANSocialInsuranceNumber__c,\n hiringDate: raw.Date_of_Hire__c,\n dateApplied: raw.DateApplied__c,\n birthdate: raw.Birthdate__c,\n mailingStreetAddress: raw.MailingStreetAddress__c,\n mailingCity: raw.MailingCity__c,\n mailingProvince: raw.MailingStateProvince__c,\n mailingZip: raw.MailingZipPostalCode__c\n }\n}\n","export enum Agency {\n CHCA = \"7\",\n CodeBleu = \"5\",\n NordikOntario = \"6\",\n PHA = \"8\",\n PremierSoin = \"1\",\n PremierSoinNordik = \"3\",\n SolutionNursing = \"4\",\n SolutionsStaffing = \"9\",\n Transport = \"2\",\n SSI = \"99\"\n}\n\nexport * from './timesheet'\nexport * from './user'\nexport * from './workorder'\n","import { AxiosInstance } from 'axios'\nimport { SF_API_VERSION } from '../../../index'\nimport { Workorder } from '../../../models'\n\nexport class SFWorkorderClient {\n private axiosInstance: AxiosInstance\n\n constructor(axiosInstance: AxiosInstance) {\n this.axiosInstance = axiosInstance\n }\n\n async getWorkordersForPractitioner(\n practitionerId?: string,\n options?: { startDate?: Date; endDate?: Date; provinces?: string[] }\n ): Promise<Workorder[]> {\n try {\n const filters: string[] = []\n if (practitionerId) {\n filters.push(`Personnel__c = '${practitionerId}'`)\n }\n if (options?.startDate) {\n const isoStart = options.startDate.toISOString().split('T')[0]\n filters.push(`EndDate__c >= ${isoStart}`)\n }\n if (options?.endDate) {\n const isoEnd = options.endDate.toISOString().split('T')[0]\n filters.push(`startdate__c <= ${isoEnd}`)\n }\n\n if (options?.provinces?.length) {\n const provincesList = options?.provinces?.map(p => `'${p}'`).join(', ')\n filters.push(`Region__c IN (${provincesList})`)\n }\n const whereClause = filters.length ? `WHERE ${filters.join(' AND ')}` : ''\n const url = `/services/data/${SF_API_VERSION}/query`\n const 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}`\n return await this.axiosInstance\n .get(url, {\n params: { q: query }\n })\n .then(({ data: { records } }) => {\n return records.map(\n (record): Workorder => ({\n id: record.Id,\n name: record.Name,\n establishmentId: record.HospitalID__c,\n region: record.Region__c,\n establishmentName: record.HospitalName__c,\n role: record.ProfessionalDesignation__c,\n practitionerId: record.Personnel__c,\n startDate: new Date(record.startdate__c),\n endDate: new Date(record.EndDate__c),\n createdAt: new Date(record.CreatedDate),\n updatedAt: new Date(record.LastModifiedDate),\n unit: formatString(record.Unit__c),\n externalUnitId: formatId(record.Unit__c),\n healthAuthority: formatString(record.HealthAuthority__c),\n externalHealthAuthorityId: formatId(record.HealthAuthority__c),\n price: record.UnitPrice__r.Price__c,\n travelInTime: new Date(record.TravelDate__c),\n travelOutTime: new Date(record.ReturnDate__c)\n })\n )\n })\n } catch (error) {\n console.error('Error fetching work orders: ', error.message)\n throw error\n }\n }\n}\n\nconst formatString = (unformattedUnit: string) =>\n !unformattedUnit ? '' : unformattedUnit.replace(/<[^>]*>/g, '').trim()\n\nconst formatId = (htmlString: string): string => {\n if (!htmlString) return ''\n\n const hrefMatch = htmlString.match(/href=\"\\/([^\"]+)\"/i)\n return hrefMatch ? hrefMatch[1] : ''\n}\n","import { AxiosInstance } from 'axios'\nimport { SF_API_VERSION } from '../../../index'\nimport { Period } from '../../../models'\n\nexport class SFPayPeriodClient {\n private axiosInstance: AxiosInstance\n\n constructor(axiosInstance: AxiosInstance) {\n this.axiosInstance = axiosInstance\n }\n\n async getPayPeriodAndTimesheetIdsForWorkorder(workorderID: string) {\n const url = `/services/data/${SF_API_VERSION}/query`\n\n const query = `SELECT PayPeriod__c, ID\n FROM Timesheet__c\n WHERE WorkOrder__c = '${workorderID}'`\n\n const data = await this.axiosInstance.get(url, { params: { q: query } })\n\n let payPeriodIds = []\n\n for (const payPeriods of data.data.records) {\n payPeriodIds.push({\n timesheetId: payPeriods.Id,\n payPeriodId: payPeriods.PayPeriod__c\n })\n }\n\n return payPeriodIds\n }\n\n async getPayPeriodDatesForPayPeriodIds(payPeriodIDs: string[]): Promise<Period[]> {\n const url = `/services/data/${SF_API_VERSION}/query`\n\n const query = `SELECT ID, StartDate__c, EndDate__c\n FROM PayPeriod__c\n WHERE id IN ${listOfIdsForQuery(payPeriodIDs)}`\n\n const data = await this.axiosInstance.get(url, { params: { q: query } })\n\n let payPeriodDates = []\n\n for (const payPeriod of data.data.records) {\n payPeriodDates.push({\n payPeriodId: payPeriod.Id,\n startDate: new Date(payPeriod.StartDate__c),\n endDate: new Date(payPeriod.EndDate__c)\n })\n }\n\n return payPeriodDates\n }\n}\n\nconst listOfIdsForQuery = (payPeriodIDs: string[]) => `('${payPeriodIDs.join(\"', '\")}')`\n","import { AxiosInstance } from 'axios'\nimport { Expense } from '../../../models/expense'\nimport { SF_API_VERSION } from '../../../index'\n\ntype FrontendExpense = {\n workorderPeriodId: string\n submittedValue: string\n type: 'Other' | 'Lodging' | 'Transportation' | 'Travel (Hours)' | 'Per diem' | 'Meals'\n}\n\nconst EXPENSE_FIELD_MAP = {\n Lodging: 'StipendTotalOverride__c',\n 'Per diem': 'Per_Diem_Total__c',\n Other: 'Reimburseable_Expenses__c',\n Transportation: 'TaxiAmount__c'\n} as const\n\ntype SupportedExpenseType = keyof typeof EXPENSE_FIELD_MAP\n\nexport class SFExpenseClient {\n private axiosInstance: AxiosInstance\n\n constructor(axiosInstance: AxiosInstance) {\n this.axiosInstance = axiosInstance\n }\n\n async fetchExpenseTotals(timesheetId: string): Promise<Expense | null> {\n try {\n const url = `/services/data/${SF_API_VERSION}/sobjects/Timesheet__c/${timesheetId}`\n const { data } = await this.axiosInstance.get(url, {\n params: {\n fields: 'Reimburseable_Expenses__c,Per_Diem_Total__c,StipendTotalOverride__c,TaxiAmount__c'\n }\n })\n if (!data) return null\n return toExpense(data)\n } catch (err) {\n console.error('Failed to fetch expense totals', err)\n throw err\n }\n }\n\n private async patchTimesheet(timesheetId: string, body: Record<string, number>): Promise<void> {\n const url = `/services/data/${SF_API_VERSION}/sobjects/Timesheet__c/${timesheetId}`\n const res = await this.axiosInstance.patch(url, body)\n if (![200, 204, 304].includes(res.status)) {\n throw new Error(`Unexpected status ${res.status}`)\n }\n }\n\n async updateExpense(expense: FrontendExpense): Promise<void> {\n const timesheetId = expense.workorderPeriodId\n const submittedValue = Number(expense.submittedValue)\n const field = EXPENSE_FIELD_MAP[expense.type as SupportedExpenseType]\n if (!field) {\n throw new Error(`Unsupported expense type: ${expense.type}`)\n }\n\n await this.patchTimesheet(timesheetId, { [field]: submittedValue })\n }\n}\n\nfunction toExpense(raw: any): Expense {\n return {\n reimbursable: Number(raw.Reimburseable_Expenses__c ?? 0),\n perDiem: Number(raw.Per_Diem_Total__c ?? 0),\n lodging: Number(raw.StipendTotalOverride__c ?? 0),\n transportation: Number(raw.TaxiAmount__c ?? 0)\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { Price } from '../../../models/price'\nimport { SF_API_VERSION } from '../../../index'\n\nexport class SFPriceClient {\n private axiosInstance: AxiosInstance\n\n constructor(axiosInstance: AxiosInstance) {\n this.axiosInstance = axiosInstance\n }\n\n async getPriceListByWorkorderId(workorderId?: string): Promise<Price> {\n try {\n const url = `/services/data/${SF_API_VERSION}/query`\n const 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}' `\n\n return await this.axiosInstance\n .get(url, {\n params: { q: query }\n })\n .then(({ data: { records } }) => {\n return records.map(\n (record): Price => ({\n id: record?.UnitPrice__r?.Price__r.Id,\n name: record?.UnitPrice__r?.Price__r.Name,\n mileageBillingRate:\n record?.UnitPrice__r?.Price__r.MileageBillingRate__c,\n mileageWageRate: record?.UnitPrice__r?.Price__r.MileageWageRate__c,\n regularBillingRate: record?.UnitPrice__r?.Price__r.BillingRate__c,\n regularWageRate: record?.UnitPrice__r?.Price__r.WageRate__c,\n overtime1BillingRate:\n record?.UnitPrice__r?.Price__r.Overtime1BillingRate__c,\n overtime1WageRate: record?.UnitPrice__r?.Price__r.Overtime1WageRate__c,\n overtime2BillingRate:\n record?.UnitPrice__r?.Price__r.Overtime2BillingRate__c,\n overtime2WageRate: record?.UnitPrice__r?.Price__r.Overtime2WageRate__c,\n callbackBillingRate:\n record?.UnitPrice__r?.Price__r.CallBackBillingRate__c,\n callbackWageRate: record?.UnitPrice__r?.Price__r.CallBackWageRate__c,\n onCallBillingRate: record?.UnitPrice__r?.Price__r.OnCallBillingRate__c,\n onCallWageRate: record?.UnitPrice__r?.Price__r.OnCallWageRate__c,\n additionalBillingInfo:\n record?.UnitPrice__r?.Price__r.Additional_Billing_Information__c,\n additionalWageInfo:\n record?.UnitPrice__r?.Price__r.Additional_Wage_Information__c\n })\n )\n })\n } catch (error) {\n console.error('Error fetching Price list: ', error.message)\n throw error\n }\n }\n}\n","import { AxiosInstance } from \"axios\"\n\nexport interface Account {\n id: string\n name: string\n accountTypeName: AccountType\n regionName: string\n geographicalAreaName: string | null\n address: string | null\n city: string | null\n province: string | null\n postalCode: string | null\n phone: string | null\n phone2: string | null\n cellular: string | null\n fax: string | null\n email: string\n lang: 'eng' | 'fra'\n}\n\nexport interface HealthAuthority extends Account {\n accountTypeName: 'healthAuthority'\n children: Establishment[]\n}\n\nexport interface Establishment extends Account {\n accountTypeName: 'establishment'\n}\n\ntype AccountType = 'healthAuthority' | 'establishment'\n\nconst ACCOUNT_FIELDS = [\n 'Id',\n 'Name',\n 'BillingCity',\n 'BillingState',\n 'BillingPostalCode',\n 'BillingCountry',\n 'BillingAddress',\n 'Phone',\n 'Fax',\n 'Type'\n] as const\n\nexport class SFAccounts {\n private axiosInstance: AxiosInstance\n\n constructor(axiosInstance: AxiosInstance) {\n this.axiosInstance = axiosInstance\n }\n\n async fetchAccounts<T extends Account>(type: AccountType, options?: { parentId?: string, pageSize?: number, pageNumber?: number, failfast?: boolean }): Promise<T[]> {\n try {\n let accountType: 'Health Authority' | 'Hospital'\n switch (type) {\n case 'healthAuthority':\n accountType = 'Health Authority'\n break\n case 'establishment':\n accountType = 'Hospital'\n }\n\n let query = `SELECT ${ACCOUNT_FIELDS.join(',')} FROM Account WHERE Type = '${accountType}'`\n if (options?.parentId) query += ` AND ParentId = '${options.parentId}'`\n if (options?.pageSize) query += ` LIMIT ${options.pageSize}`\n if (options?.pageNumber) query += ` OFFSET ${options.pageNumber * options.pageSize}`\n\n const response = await this.axiosInstance.get(`/services/data/v57.0/query?q=${query}`)\n const accounts: Account[] = response.data.records.map(record => this.buildAccount(record))\n\n for (const i in accounts) {\n if (accounts[i].accountTypeName === 'healthAuthority') {\n let pageNumber = 0\n const childAccounts = []\n let returnedPageSize = 0\n do {\n const pageAccounts = await this.fetchAccounts<Establishment>('establishment', { parentId: accounts[i].id, pageSize: options?.pageSize ?? 100, pageNumber, failfast: options?.failfast })\n childAccounts.push(...pageAccounts)\n returnedPageSize = pageAccounts.length\n pageNumber++\n } while (returnedPageSize > 0);\n (accounts[i] as HealthAuthority).children = childAccounts\n }\n }\n return accounts as T[]\n } catch (error) {\n console.error(`Error fetching ${type}s: `, error.message)\n if (options?.failfast)\n throw error\n return []\n }\n }\n private buildAccount(record: any): Account {\n let accountType: AccountType\n\n switch (record.Type) {\n case 'Health Authority':\n accountType = 'healthAuthority'\n break\n case 'Hospital':\n accountType = 'establishment'\n }\n return {\n id: record.Id,\n name: record.Name,\n address: record.BillingAddress,\n city: record.BillingCity,\n province: record.BillingState,\n postalCode: record.BillingPostalCode,\n geographicalAreaName: record.BillingGeocodeAccuracy,\n phone: record.Phone,\n fax: record.Fax,\n regionName: record.RegionName,\n accountTypeName: accountType,\n email: null,\n phone2: null,\n cellular: null,\n lang: 'eng'\n }\n }\n}","import axios, { AxiosInstance } from 'axios'\nimport { SFAuthenticator } from './auth/auth'\nimport { SFTimesheetClient } from './timesheet/timesheetClient'\nimport { SFPractitionerClient } from './practitioner/practitionerClient'\nimport { Role } from '../../models'\nimport { SFWorkorderClient } from './workorder/workorderClient'\nimport { SFPayPeriodClient } from './payperiod/payperiodClient'\nimport { SFExpenseClient } from './expenses/expenseClient'\nimport { SFPriceClient } from './prices/priceClient'\nimport { SFAccounts } from './accounts/accounts'\n\nexport const SF_API_VERSION: string = 'v57.0'\n\nexport class SFApiClient {\n private instance: SFApiClient | undefined = undefined\n private axiosInstance: AxiosInstance = axios.create()\n private authenticator: SFAuthenticator\n private baseUrl: string\n timesheetClient: SFTimesheetClient\n workorderClient: SFWorkorderClient\n practitionerClient: SFPractitionerClient\n payPeriodClient: SFPayPeriodClient\n expenseClient: SFExpenseClient\n priceClient: SFPriceClient\n accountsClient: SFAccounts\n\n async init(\n baseUrl: string,\n sfClientId: string,\n sfClientSecret: string,\n onTokenRefresh?: () => Promise<{ clientId: string; clientSecret: string }>\n ) {\n this.baseUrl = baseUrl\n this.axiosInstance.defaults.baseURL = baseUrl\n this.authenticator = new SFAuthenticator(this.axiosInstance, this.baseUrl)\n this.timesheetClient = new SFTimesheetClient(this.axiosInstance)\n this.workorderClient = new SFWorkorderClient(this.axiosInstance)\n this.practitionerClient = new SFPractitionerClient(this.axiosInstance)\n this.payPeriodClient = new SFPayPeriodClient(this.axiosInstance)\n this.expenseClient = new SFExpenseClient(this.axiosInstance)\n this.priceClient = new SFPriceClient(this.axiosInstance)\n this.accountsClient = new SFAccounts(this.axiosInstance)\n // creates authenticator and adds token to axios instance\n await this.authenticator.initializeAuth(sfClientId, sfClientSecret, onTokenRefresh)\n }\n\n setInstance(instance: SFApiClient) {\n this.instance = instance\n }\n getInstance(): SFApiClient {\n if (!this.instance) {\n throw new Error('Salesforce Api client not initialized')\n }\n return this.instance\n }\n\n async fetchRoles(): Promise<Role[]> {\n try {\n const url = `/services/data/${SF_API_VERSION}/query`\n const query = `SELECT Label, Value FROM PicklistValueInfo \\\n WHERE EntityParticle.EntityDefinition.QualifiedApiName = 'WorkOrder__c'\\\n AND EntityParticle.QualifiedApiName = 'ProfessionalDesignation__c' \\\n AND isActive = true`\n return this.axiosInstance\n .get(url, {\n params: { q: query }\n })\n .then(({ data: { records } }) =>\n records.map(\n (record): Role => ({\n label: record.Label,\n value: record.Value\n })\n )\n )\n } catch (error) {\n console.error('Error fetching roles: ', error.message)\n throw error\n }\n }\n}\n","import axios, { AxiosInstance } from 'axios'\nimport axiosRetry from 'axios-retry'\nimport FormData from 'form-data'\n\nexport class LipheAuthenticator {\n axiosTokenInstance: AxiosInstance = axios.create()\n authenticatedAxiosInstance: AxiosInstance\n token: string | undefined = undefined\n private tokenRefreshPromise: Promise<string> | null = null\n private email: string\n private password: string\n private type: string\n\n constructor(\n authenticatedAxiosInstance: AxiosInstance,\n baseUrl: string,\n email: string,\n password: string,\n type: 'user' | 'client' = 'user'\n ) {\n this.authenticatedAxiosInstance = authenticatedAxiosInstance\n\n axiosRetry(this.axiosTokenInstance, {\n retries: 10,\n retryDelay: retryCount => {\n return Math.min(1000 * Math.pow(2, retryCount - 1), 30000)\n }\n })\n\n this.email = email\n this.password = password\n this.type = type\n this.axiosTokenInstance.defaults.baseURL = baseUrl\n }\n\n async initializeAuth() {\n const token = await this.login()\n\n this.authenticatedAxiosInstance.defaults.headers.common['X-Auth-Token'] = token\n\n this.authenticatedAxiosInstance.interceptors.response.use(\n response => response,\n async error => {\n const originalRequest = error.config\n originalRequest._retryCount = originalRequest._retryCount || 0\n\n if (error.response?.status === 401 && originalRequest._retryCount < 1) {\n originalRequest._retryCount++\n try {\n if (!this.tokenRefreshPromise) {\n this.tokenRefreshPromise = this.login()\n }\n const newToken = await this.tokenRefreshPromise\n this.tokenRefreshPromise = null\n\n this.authenticatedAxiosInstance.defaults.headers.common['X-Auth-Token'] =\n newToken\n\n return await this.authenticatedAxiosInstance(originalRequest)\n } catch (refreshError) {\n this.tokenRefreshPromise = null\n return Promise.reject(refreshError)\n }\n }\n return Promise.reject(error)\n }\n )\n }\n private async login(): Promise<string> {\n const form = new FormData()\n form.append('email', this.email)\n form.append('password', this.password)\n form.append('type', this.type)\n\n const response = await this.axiosTokenInstance.post('v2/signin', form, {\n headers: form.getHeaders()\n })\n const token = response?.data?.data?.token\n if (!token) {\n throw new Error('Authentication failed: no token return')\n }\n this.token = token\n return token\n }\n}\n","import type { AxiosInstance } from 'axios'\nimport { Practitioner } from '../../../models'\n\ninterface LiphePractitioner {\n id: number\n firstname: string\n lastname: string\n email: string\n communicationMode?: number\n}\n\nexport class LiphePractitionerClient {\n private axios: AxiosInstance\n\n constructor(axiosInstance: AxiosInstance) {\n this.axios = axiosInstance\n }\n async fetchAllPractitioners(agencyId: number = 1): Promise<Practitioner[]> {\n let practitioners: LiphePractitioner[] = []\n let page = 1\n let nextPage = true\n\n while (nextPage) {\n const response = await this.axios.get('v2/employees', {\n params: {\n agency_id: agencyId,\n page\n }\n })\n const data = response?.data?.data\n if (!data?.data || !Array.isArray(data.data)) {\n throw new Error('Unexpected responses.')\n }\n\n const pagePractitioners = data.data.map(\n (p: any): LiphePractitioner => ({\n id: p.id,\n firstname: p.firstname,\n lastname: p.lastname,\n email: p.email,\n communicationMode: p.communicationMode\n })\n )\n\n practitioners.push(...pagePractitioners)\n nextPage = Boolean(data.next_page_url)\n page++\n }\n return practitioners.map(p => ({\n id: String(p.id),\n firstName: p.firstname,\n lastName: p.lastname,\n email: p.email,\n staffId: String(p.id)\n }))\n }\n}\n","import { AxiosInstance } from 'axios'\nimport { Agency, Period, Workorder } from '../../../models'\nimport { LipheContractRequest } from '../contract_request/contractRequestClient'\nimport { LipheAssignment } from '../assignment/assignmentClient'\ninterface LipheContractRequestPeriods {\n message: string\n status: boolean\n data: LipheContractRequestPeriodData[]\n meta: {\n current_page: number\n from: number\n last_page: number\n path: string\n per_page: number\n to: number\n total: number\n }\n}\n\ninterface LipheContractRequestPeriod {\n message: string\n status: boolean\n data: LipheContractRequestPeriodData\n meta: {\n current_page: number\n from: number\n last_page: number\n path: string\n per_page: number\n to: number\n total: number\n }\n}\n\ninterface LipheContractRequestPeriodData {\n id: number\n contract_request_id: number\n start_date: Date\n end_date: Date\n shift: 'morning' | 'afternoon' | 'evening' | 'night'\n start_time: Date\n end_time: Date\n departement_id: number\n note: string\n assignment_id: number\n assignment_parent_id: number | null\n created_at: Date\n updated_at: Date\n contract_request: LipheContractRequest\n department: string | null\n assignment: LipheAssignment\n assigned_employee_details: UserDetails\n assignment_employee: any\n}\n\ninterface UserDetails {\n id: number\n name: string\n email: string | null\n}\n\nexport class ContractRequestPeriodClient {\n private axiosInstance: AxiosInstance\n\n constructor(axiosInstance: AxiosInstance) {\n this.axiosInstance = axiosInstance\n }\n\n async fetchAllContractRequestPeriods(\n agencyId: Agency,\n from?: Date,\n to?: Date,\n page: number = 1,\n activeAssignationsOnly: boolean = true,\n assignedPractitionerId?: string\n ): Promise<Workorder[]> {\n const url = `v2/contract-request-periods/agency/${agencyId}`\n const params = new URLSearchParams()\n const periods: Workorder[] = []\n let nextPage = true\n\n if (from) {\n params.append('from', from.toISOString().split('T')[0] + ' 00:00:00')\n }\n if (to) {\n params.append('to', to.toISOString().split('T')[0] + ' 23:59:59')\n }\n if (page) {\n params.append('page', page.toString())\n }\n if (activeAssignationsOnly) {\n params.append('active_assignations_only', activeAssignationsOnly ? '1' : '0')\n }\n\n if (assignedPractitionerId) {\n params.append('assigned_employee_id', assignedPractitionerId)\n }\n\n while (nextPage) {\n params.set('page', page.toString())\n\n const response = await this.axiosInstance.get<LipheContractRequestPeriods>(url, {\n params\n })\n\n for (const period of response.data.data) {\n periods.push({\n id: period.id.toString(),\n name: period.id.toString(),\n establishmentId: period.contract_request.community.id.toString(),\n region: period.contract_request.community.contact.address_state,\n establishmentName: period.contract_request.community.name,\n role: this.getRole(period),\n practitionerId: period.assignment.selected_client.id,\n startDate: new Date(period.start_date),\n endDate: new Date(period.end_date),\n createdAt: new Date(period.created_at),\n updatedAt: new Date(period.updated_at)\n })\n }\n\n nextPage = page < response.data.meta.last_page\n page++\n }\n\n return periods\n }\n\n async fetchContractRequestPeriod(workorderId: string) {\n const url = `v2/contract-request-periods/${workorderId}`\n const params = new URLSearchParams()\n const response = await this.axiosInstance.get<LipheContractRequestPeriod>(url, { params })\n\n return response.data.data\n }\n\n async getPayPeriodDatesForPayPeriodId(payPeriodId: string): Promise<Period[]> {\n const period = await this.fetchContractRequestPeriod(payPeriodId)\n const payPeriods: {\n payPeriodId: string\n startDate: string\n endDate: string\n workorderId: string\n }[] = []\n\n const firstPayPeriodDate = this.getPayPeriodDayBeforeStartDate(\n new Date(period.assignment.selected_client.agency.date_first_periode_paie),\n new Date(period.start_date)\n )\n\n const lastPayPeriodDate = this.getLastDayOfPayPeriod(\n new Date(firstPayPeriodDate),\n new Date(period.end_date)\n )\n\n // Calculate the number of weeks between lastPayPeriodDate and firstPayPeriodDate\n const weeksBetween = this.calculateWeeksBetween(firstPayPeriodDate, lastPayPeriodDate)\n\n for (let i = 0; i < weeksBetween; i++) {\n const tempDate = new Date(firstPayPeriodDate)\n\n const startDate = new Date(tempDate.setDate(tempDate.getDate() + 7 * i))\n const endDate = new Date(tempDate.setDate(tempDate.getDate() + 6))\n\n payPeriods.push({\n payPeriodId: '',\n startDate: startDate.toISOString().split('T')[0],\n endDate: endDate.toISOString().split('T')[0],\n workorderId: payPeriodId\n })\n }\n\n return payPeriods as unknown as Period[]\n }\n\n private getRole(period: LipheContractRequestPeriodData) {\n if (period.contract_request.job.translations.length === 0) {\n return ''\n }\n\n if (period.contract_request.job.translations.length > 1) {\n const roleTranslation = period.contract_request.job.translations.find(\n (translation: any) => translation.locale === 'en'\n )\n return roleTranslation?.content\n } else {\n return period.contract_request.job.translations[0].content\n }\n }\n\n /**\n * Calculates the pay period day of week that comes before the start date\n * @param firstPayPeriodDate The first pay period date from the agency\n * @param startDate The start date to find the pay period before\n * @returns The day of week (0-6, where 0 is Sunday) of the pay period before start_date\n */\n private getPayPeriodDayBeforeStartDate(firstPayPeriodDate: Date, startDate: Date): Date {\n const payPeriodDayOfWeek = firstPayPeriodDate.getDay()\n\n // Calculate the most recent pay period date that falls before start_date\n const tempDate = new Date(startDate)\n\n // Go back one week at a time until we find a date that matches the pay period day of week\n while (tempDate.getDay() !== payPeriodDayOfWeek) {\n tempDate.setDate(tempDate.getDate() - 1)\n }\n\n // If the calculated date is not before start_date, go back another week\n if (tempDate >= startDate) {\n tempDate.setDate(tempDate.getDate() - 7)\n }\n\n return tempDate\n }\n\n private getLastDayOfPayPeriod(firstPayPeriodDate: Date, endDate: Date): Date {\n const tempDate = new Date(firstPayPeriodDate)\n\n // Go back one week at a time until we find a date that matches the pay period day of week\n while (endDate > tempDate) {\n tempDate.setDate(tempDate.getDate() + 7)\n }\n\n return tempDate\n }\n\n private calculateWeeksBetween(startDate: Date, endDate: Date): number {\n const diffTime = Math.abs(endDate.getTime() - startDate.getTime())\n const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24))\n const weeks = Math.floor(diffDays / 7)\n return weeks\n }\n}\n","import axios, { AxiosInstance } from 'axios'\nimport { LipheAuthenticator } from './auth/authClient'\nimport { LiphePractitionerClient } from './practitioner/practitionerClient'\nimport { ContractRequestPeriodClient } from './contract_request_period/contractRequestPeriodClient'\nimport axiosRetry from 'axios-retry'\n\nexport class LipheApiClient {\n private instance: LipheApiClient | undefined = undefined\n private axiosInstance: AxiosInstance = axios.create()\n private authenticator: LipheAuthenticator\n public practitionerClient: LiphePractitionerClient\n public contractRequestPeriodClient: ContractRequestPeriodClient\n\n constructor(\n baseUrl: string,\n email: string,\n password: string,\n type: 'user' | 'client' = 'user'\n ) {\n this.axiosInstance.defaults.baseURL = baseUrl\n\n this.authenticator = new LipheAuthenticator(\n this.axiosInstance,\n baseUrl,\n email,\n password,\n type\n )\n\n axiosRetry(this.axiosInstance, {\n retries: 10,\n retryDelay: retryCount => {\n return Math.min(1000 * Math.pow(2, retryCount - 1), 30000)\n },\n onRetry: (retryCount, error) => {\n console.log(`Retry attempt ${retryCount} failed: ${error.message}`)\n }\n })\n\n this.practitionerClient = new LiphePractitionerClient(this.axiosInstance)\n this.contractRequestPeriodClient = new ContractRequestPeriodClient(this.axiosInstance)\n }\n async init() {\n await this.authenticator.initializeAuth()\n }\n\n setInstance(instance: LipheApiClient) {\n this.instance = instance\n }\n\n getInstance(): LipheApiClient {\n return this.instance\n }\n\n getAxiosInstance(): AxiosInstance {\n return this.axiosInstance\n }\n}\n","export const SF_API_VERSION: string = 'v57.0'\n\n// Salesforce API\nexport { SFApiClient } from './api/salesforce/apiClient'\nexport { SFPractitionerClient } from './api/salesforce/practitioner/practitionerClient'\nexport { SFTimesheetClient } from './api/salesforce/timesheet/timesheetClient'\nexport { SFAuthenticator } from './api/salesforce/auth/auth'\nexport { SFPriceClient } from './api/salesforce/prices/priceClient'\nexport { SFExpenseClient } from './api/salesforce/expenses/expenseClient'\n\n// Liphe API\nexport { LipheApiClient } from './api/liphe_legacy/lipheApiClient'\nexport { LipheAuthenticator } from './api/liphe_legacy/auth/authClient'\nexport { LiphePractitionerClient } from './api/liphe_legacy/practitioner/practitionerClient'\n\n// Common Models\nexport { Practitioner, Role, TimesheetDayEntry, Workorder, Agency, Period } from './models'\n"],"names":["SFAuthenticator","authenticatedAxiosInstance","baseUrl","this","axios","create","undefined","axiosTokenInstance","defaults","baseURL","_proto","prototype","initializeAuth","_initializeAuth","_asyncToGenerator","_regeneratorRuntime","mark","_callee2","clientId","clientSecret","onTokenRefresh","_this","wrap","_context2","prev","next","postToken","headers","common","sent","interceptors","response","use","_ref","_callee","error","_error$response","originalRequest","newClientCredentials","newToken","_context","config","_retryCount","status","tokenRefreshPromise","timeout","Promise","race","_","reject","setTimeout","Error","abrupt","t0","stop","_x4","apply","arguments","_x","_x2","_x3","_postToken","_callee3","_response$data","tokenFormRequestBody","_context3","FormData","refreshToken","append","post","getHeaders","token","data","_x5","_x6","SFTimesheetClient","axiosInstance","updateTimesheetHour","_updateTimesheetHour","timesheetHourId","timesheet","url","SF_API_VERSION","patch","Date__c","date","Callback__c","callbackHours","HoursEBAdjusted__c","regularHours","Misc__c","miscHours","OT1__c","overtime1Hours","OT2__c","overtime2Hours","OnCall__c","onCallHours","Misc1__c","misc1HoursA","Misc_1_Hours__c","misc1HoursB","Misc_2_Hours__c","misc2Hours","Misc_3_Hours__c","misc3Hours","Misc_4_Hours__c","misc4Hours","Stat1__c","stat1Hours","Stat2__c","stat2Hours","In_Charge__c","inChargeHours","Shift_Travel_Stipend__c","shiftTravelPerDiemHours","includes","console","message","getTimesheetIds","_getTimesheetIds","workorderId","periodStartDate","periodEndDate","query","Date","toISOString","substring","get","params","q","records","map","record","Id","getTimesheetsForPractitioner","_getTimesheetsForPractitioner","personnelID","timesheets","_iterator","_step","_createForOfIteratorHelperLoose","done","push","value","WorkOrder__c","id","updatedAt","LastModifiedDate","getTimesheetHours","_getTimesheetHours","_callee4","fields","allHours","_iterator2","_step2","timesheetId","_context4","join","length","toTimesheetDayEntry","_x7","_x8","_x9","_x10","getPayPeriods","_getPayPeriods","_callee5","payPeriods","_iterator3","_step3","payPeriod","_context5","name","Name","startDate","StartDate__c","endDate","EndDate__c","uploadImageToTimesheet","_uploadImageToTimesheet","_callee6","file","filename","form","versionId","contentDocumentId","_err$response","_context6","JSON","stringify","Title","PathOnClient","contentType","ContentDocumentId","LinkedEntityId","ShareType","Visibility","_x11","_x12","_x13","raw","lastModified","SFPractitionerClient","default","export","fetchPractitioners","_fetchPractitioners","options","conditions","whereClause","limitClause","createdAt","limit","Math","floor","forExport","PRACTITIONER_FIELDS","toPractitionerExport","toPractitioner","fetchPractitionerByEmail","_fetchPractitionerByEmail","email","fetchRoles","_fetchRoles","then","label","Label","Value","firstName","FirstName__c","lastName","LastName__c","Email__c","staffId","StaffID__c","CreatedDate","replace","_extends","phone","DaytimePhone__c","Status__c","professionalDesignation","ProfessionalDesignation__c","SIN","CANSocialInsuranceNumber__c","hiringDate","Date_of_Hire__c","dateApplied","DateApplied__c","birthdate","Birthdate__c","mailingStreetAddress","MailingStreetAddress__c","mailingCity","MailingCity__c","mailingProvince","MailingStateProvince__c","mailingZip","MailingZipPostalCode__c","Agency","SFWorkorderClient","getWorkordersForPractitioner","_getWorkordersForPractitioner","practitionerId","_options$provinces","filters","isoStart","isoEnd","_options$provinces2","provincesList","split","provinces","p","establishmentId","HospitalID__c","region","Region__c","establishmentName","HospitalName__c","role","Personnel__c","startdate__c","unit","formatString","Unit__c","externalUnitId","formatId","healthAuthority","HealthAuthority__c","externalHealthAuthorityId","price","UnitPrice__r","Price__c","travelInTime","TravelDate__c","travelOutTime","ReturnDate__c","unformattedUnit","trim","htmlString","hrefMatch","match","SFPayPeriodClient","getPayPeriodAndTimesheetIdsForWorkorder","_getPayPeriodAndTimesheetIdsForWorkorder","workorderID","payPeriodIds","payPeriodId","PayPeriod__c","getPayPeriodDatesForPayPeriodIds","_getPayPeriodDatesForPayPeriodIds","payPeriodIDs","payPeriodDates","listOfIdsForQuery","EXPENSE_FIELD_MAP","Lodging","Per diem","Other","Transportation","SFExpenseClient","fetchExpenseTotals","_fetchExpenseTotals","reimbursable","Number","_raw$Reimburseable_Ex","Reimburseable_Expenses__c","perDiem","_raw$Per_Diem_Total__","Per_Diem_Total__c","lodging","_raw$StipendTotalOver","StipendTotalOverride__c","transportation","_raw$TaxiAmount__c","TaxiAmount__c","patchTimesheet","_patchTimesheet","body","res","updateExpense","_updateExpense","expense","_this$patchTimesheet","submittedValue","field","workorderPeriodId","type","SFPriceClient","getPriceListByWorkorderId","_getPriceListByWorkorderId","_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","Price__r","mileageBillingRate","MileageBillingRate__c","mileageWageRate","MileageWageRate__c","regularBillingRate","BillingRate__c","regularWageRate","WageRate__c","overtime1BillingRate","Overtime1BillingRate__c","overtime1WageRate","Overtime1WageRate__c","overtime2BillingRate","Overtime2BillingRate__c","overtime2WageRate","Overtime2WageRate__c","callbackBillingRate","CallBackBillingRate__c","callbackWageRate","CallBackWageRate__c","onCallBillingRate","OnCallBillingRate__c","onCallWageRate","OnCallWageRate__c","additionalBillingInfo","Additional_Billing_Information__c","additionalWageInfo","Additional_Wage_Information__c","ACCOUNT_FIELDS","SFAccounts","fetchAccounts","_fetchAccounts","accountType","accounts","i","pageNumber","childAccounts","returnedPageSize","_options$pageSize","pageAccounts","parentId","pageSize","buildAccount","t1","keys","t2","accountTypeName","failfast","children","t3","Type","address","BillingAddress","city","BillingCity","province","BillingState","postalCode","BillingPostalCode","geographicalAreaName","BillingGeocodeAccuracy","Phone","fax","Fax","regionName","RegionName","phone2","cellular","lang","SFApiClient","init","_init","sfClientId","sfClientSecret","authenticator","timesheetClient","workorderClient","practitionerClient","payPeriodClient","expenseClient","priceClient","accountsClient","setInstance","instance","getInstance","LipheAuthenticator","password","axiosRetry","retries","retryDelay","retryCount","min","pow","login","_login","LiphePractitionerClient","fetchAllPractitioners","_fetchAllPractitioners","agencyId","practitioners","page","nextPage","agency_id","Array","isArray","pagePractitioners","firstname","lastname","communicationMode","Boolean","next_page_url","String","ContractRequestPeriodClient","fetchAllContractRequestPeriods","_fetchAllContractRequestPeriods","from","to","activeAssignationsOnly","assignedPractitionerId","periods","period","URLSearchParams","toString","set","contract_request","community","contact","address_state","getRole","assignment","selected_client","start_date","end_date","created_at","updated_at","meta","last_page","fetchContractRequestPeriod","_fetchContractRequestPeriod","getPayPeriodDatesForPayPeriodId","_getPayPeriodDatesForPayPeriodId","firstPayPeriodDate","lastPayPeriodDate","weeksBetween","tempDate","getPayPeriodDayBeforeStartDate","agency","date_first_periode_paie","getLastDayOfPayPeriod","calculateWeeksBetween","setDate","getDate","job","translations","roleTranslation","find","translation","locale","content","payPeriodDayOfWeek","getDay","diffTime","abs","getTime","diffDays","ceil","LipheApiClient","onRetry","log","contractRequestPeriodClient","getAxiosInstance"],"mappings":"q3PAGaA,aAOT,SAAAA,EAAYC,EAA2CC,GANvDC,wBAAoCC,EAAMC,SAE1CF,gBAA4BG,EACpBH,uBAAmCG,EACnCH,yBAA8C,KAGlDA,KAAKI,mBAAmBC,SAASC,QAAUP,EAC3CC,KAAKF,2BAA6BA,EACrC,IAAAS,EAAAV,EAAAW,UA4Dc,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A3gB,UAeA,OAfAD,EACK4a,gBAAI,IAAAC,EAAAza,EAAAC,IAAAC,MAAV,SAAAkB,IAAA,OAAAnB,IAAAO,eAAAkB,GAAA,cAAAA,EAAAhB,KAAAgB,EAAAf,MAAA,OAAA,OAAAe,EAAAf,OACUtB,KAAKub,cAAc9a,iBAAgB,OAAA,UAAA,OAAA4B,EAAAc,UAAApB,YADnC,OAET,WAFS,OAAAqZ,EAAA/X,WAAAC,eAAA/C,EAIVwb,YAAA,SAAYC,GACRhc,KAAKgc,SAAWA,GACnBzb,EAED0b,YAAA,WACI,OAAOjc,KAAKgc,UACfzb,EAEDghB,iBAAA,WACI,OAAOvhB,KAAKyE,eACf0c,MVxDOlR,EAAAA,iBAAAA,6BAERA,eACAA,oBACAA,UACAA,kBACAA,wBACAA,sBACAA,wBACAA,gBACAA,eWVSlL,EAAyB"}
@@ -1354,6 +1354,131 @@ var SFPriceClient = /*#__PURE__*/function () {
1354
1354
  return SFPriceClient;
1355
1355
  }();
1356
1356
 
1357
+ var ACCOUNT_FIELDS = ['Id', 'Name', 'BillingCity', 'BillingState', 'BillingPostalCode', 'BillingCountry', 'BillingAddress', 'Phone', 'Fax', 'Type'];
1358
+ var SFAccounts = /*#__PURE__*/function () {
1359
+ function SFAccounts(axiosInstance) {
1360
+ this.axiosInstance = axiosInstance;
1361
+ }
1362
+ var _proto = SFAccounts.prototype;
1363
+ _proto.fetchAccounts = /*#__PURE__*/function () {
1364
+ var _fetchAccounts = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(type, options) {
1365
+ var _this = this;
1366
+ var accountType, query, response, accounts, i, pageNumber, childAccounts, returnedPageSize, _options$pageSize, pageAccounts;
1367
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1368
+ while (1) switch (_context.prev = _context.next) {
1369
+ case 0:
1370
+ _context.prev = 0;
1371
+ _context.t0 = type;
1372
+ _context.next = _context.t0 === 'healthAuthority' ? 4 : _context.t0 === 'establishment' ? 6 : 7;
1373
+ break;
1374
+ case 4:
1375
+ accountType = 'Health Authority';
1376
+ return _context.abrupt("break", 7);
1377
+ case 6:
1378
+ accountType = 'Hospital';
1379
+ case 7:
1380
+ query = "SELECT " + ACCOUNT_FIELDS.join(',') + " FROM Account WHERE Type = '" + accountType + "'";
1381
+ if (options != null && options.parentId) query += " AND ParentId = '" + options.parentId + "'";
1382
+ if (options != null && options.pageSize) query += " LIMIT " + options.pageSize;
1383
+ if (options != null && options.pageNumber) query += " OFFSET " + options.pageNumber * options.pageSize;
1384
+ _context.next = 13;
1385
+ return this.axiosInstance.get("/services/data/v57.0/query?q=" + query);
1386
+ case 13:
1387
+ response = _context.sent;
1388
+ accounts = response.data.records.map(function (record) {
1389
+ return _this.buildAccount(record);
1390
+ });
1391
+ _context.t1 = _regeneratorRuntime().keys(accounts);
1392
+ case 16:
1393
+ if ((_context.t2 = _context.t1()).done) {
1394
+ _context.next = 32;
1395
+ break;
1396
+ }
1397
+ i = _context.t2.value;
1398
+ if (!(accounts[i].accountTypeName === 'healthAuthority')) {
1399
+ _context.next = 30;
1400
+ break;
1401
+ }
1402
+ pageNumber = 0;
1403
+ childAccounts = [];
1404
+ returnedPageSize = 0;
1405
+ case 22:
1406
+ _context.next = 24;
1407
+ return this.fetchAccounts('establishment', {
1408
+ parentId: accounts[i].id,
1409
+ pageSize: (_options$pageSize = options == null ? void 0 : options.pageSize) != null ? _options$pageSize : 100,
1410
+ pageNumber: pageNumber,
1411
+ failfast: options == null ? void 0 : options.failfast
1412
+ });
1413
+ case 24:
1414
+ pageAccounts = _context.sent;
1415
+ childAccounts.push.apply(childAccounts, pageAccounts);
1416
+ returnedPageSize = pageAccounts.length;
1417
+ pageNumber++;
1418
+ case 28:
1419
+ if (returnedPageSize > 0) {
1420
+ _context.next = 22;
1421
+ break;
1422
+ }
1423
+ case 29:
1424
+ accounts[i].children = childAccounts;
1425
+ case 30:
1426
+ _context.next = 16;
1427
+ break;
1428
+ case 32:
1429
+ return _context.abrupt("return", accounts);
1430
+ case 35:
1431
+ _context.prev = 35;
1432
+ _context.t3 = _context["catch"](0);
1433
+ console.error("Error fetching " + type + "s: ", _context.t3.message);
1434
+ if (!(options != null && options.failfast)) {
1435
+ _context.next = 40;
1436
+ break;
1437
+ }
1438
+ throw _context.t3;
1439
+ case 40:
1440
+ return _context.abrupt("return", []);
1441
+ case 41:
1442
+ case "end":
1443
+ return _context.stop();
1444
+ }
1445
+ }, _callee, this, [[0, 35]]);
1446
+ }));
1447
+ function fetchAccounts(_x, _x2) {
1448
+ return _fetchAccounts.apply(this, arguments);
1449
+ }
1450
+ return fetchAccounts;
1451
+ }();
1452
+ _proto.buildAccount = function buildAccount(record) {
1453
+ var accountType;
1454
+ switch (record.Type) {
1455
+ case 'Health Authority':
1456
+ accountType = 'healthAuthority';
1457
+ break;
1458
+ case 'Hospital':
1459
+ accountType = 'establishment';
1460
+ }
1461
+ return {
1462
+ id: record.Id,
1463
+ name: record.Name,
1464
+ address: record.BillingAddress,
1465
+ city: record.BillingCity,
1466
+ province: record.BillingState,
1467
+ postalCode: record.BillingPostalCode,
1468
+ geographicalAreaName: record.BillingGeocodeAccuracy,
1469
+ phone: record.Phone,
1470
+ fax: record.Fax,
1471
+ regionName: record.RegionName,
1472
+ accountTypeName: accountType,
1473
+ email: null,
1474
+ phone2: null,
1475
+ cellular: null,
1476
+ lang: 'eng'
1477
+ };
1478
+ };
1479
+ return SFAccounts;
1480
+ }();
1481
+
1357
1482
  var SF_API_VERSION = 'v57.0';
1358
1483
  var SFApiClient = /*#__PURE__*/function () {
1359
1484
  function SFApiClient() {
@@ -1375,10 +1500,11 @@ var SFApiClient = /*#__PURE__*/function () {
1375
1500
  this.payPeriodClient = new SFPayPeriodClient(this.axiosInstance);
1376
1501
  this.expenseClient = new SFExpenseClient(this.axiosInstance);
1377
1502
  this.priceClient = new SFPriceClient(this.axiosInstance);
1503
+ this.accountsClient = new SFAccounts(this.axiosInstance);
1378
1504
  // creates authenticator and adds token to axios instance
1379
- _context.next = 11;
1505
+ _context.next = 12;
1380
1506
  return this.authenticator.initializeAuth(sfClientId, sfClientSecret, onTokenRefresh);
1381
- case 11:
1507
+ case 12:
1382
1508
  case "end":
1383
1509
  return _context.stop();
1384
1510
  }