pha-hermes 1.26.0 → 1.27.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/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,OA5DdD,EAEKE,0BAAc,IAAAC,EAAAC,EAAAC,IAAAC,MAApB,SAAAC,EACIC,EACAC,EACAC,GAA0E,IAAAC,OAAA,OAAAN,IAAAO,eAAAC,GAAA,cAAAA,EAAAC,KAAAD,EAAAE,MAAA,OAAA,OAAAF,EAAAE,OAEtDtB,KAAKuB,UAAUR,EAAUC,GAAa,OAC1DhB,KAAKF,2BAA2BO,SAASmB,QAAQC,OAAsB,wBAD5DL,EAAAM,KAGX1B,KAAKF,2BAA2B6B,aAAaC,SAASC,KAClD,SAAAD,GAAQ,OAAIA,eAAQ,IAAAE,EAAAn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fzb,EAEDghB,iBAAA,WACI,OAAOvhB,KAAKyE,eACf0c,MVxDOlR,EAAAA,iBAAAA,6BAERA,eACAA,oBACAA,UACAA,kBACAA,wBACAA,sBACAA,wBACAA,gBACAA,eWVSlL,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/models/regions.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 let 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 records = []\n let done = false\n do {\n const {\n data: { records: pageRecords, nextRecordsUrl, done: isDone }\n } = await this.axiosInstance.get(url, {\n params: { q: query }\n })\n records.push(...pageRecords)\n done = isDone\n url = nextRecordsUrl\n } while (!done)\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","export enum LipheRegion {\n 'Abitibi-Témiscaminque',\n 'Alberta',\n 'Autre',\n 'Baie d\\'Hudson',\n 'Baie James',\n 'Bas St-Laurent',\n 'British Columbia',\n 'Charlevoix',\n 'Estrie',\n 'Gaspésie',\n 'Haut St-Maurice',\n 'Iles de la Madeleine',\n 'Lanaudière',\n 'Laurentides',\n 'Laval',\n 'Manitoba',\n 'Mauricie',\n 'Montérégie',\n 'Montréal',\n 'New Brunswick',\n 'Newfoundland and Labrador',\n 'Northwest Territories',\n 'Nova Scotia',\n 'Nunavut',\n 'Ontario',\n 'Outaouais',\n 'Prince Edward Island',\n 'Québec',\n 'Rivière du Loup / Matane',\n 'Saguenay',\n 'Saskatchewan',\n 'Sept-Iles / Côte-Nord',\n 'Thetford Mines',\n 'Ungava',\n 'Yukon',\n}\n\nexport enum LipheGeographicalArea {\n 'Berthierville',\n 'Bordeaux-Cartierville',\n 'Labelle',\n 'Laval',\n 'Le Gardeur',\n 'Lindsay - Gingras',\n 'Montréal',\n 'Montréal - Est',\n 'Montréal - Ouest',\n 'Outaouais',\n 'Rive - Sud',\n 'Ste - Adèle',\n 'Ste - Agathe',\n 'St - Eustache',\n 'St - Jérôme',\n 'Verdun',\n 'Mont - Tremblant',\n 'Montréal(centre - ville)',\n 'Basses Laurentides',\n 'Valleyfield',\n 'Argenteuil',\n 'Lachute',\n 'Lanaudière SUD',\n 'Lanaudière NORD',\n 'Granby',\n 'Sorel',\n 'Longueuil',\n 'Châteauguay',\n 'St - Jean sur Richelieu',\n 'St - Hyacinthe',\n 'Drummondville',\n 'Blainville',\n 'La Prairie',\n 'Mont - Laurier',\n 'Pierre - Boucher',\n 'Berthiaume du Tremblay',\n 'Grand Nord',\n 'Montréal Nord',\n 'Rouyn Noranda',\n 'Chicoutimi',\n 'Québec',\n 'Sherbrooke',\n 'Trois - Rivières',\n 'Gaspésie',\n 'Côte - Nord',\n 'Abitibi - Témiscamingue',\n 'Portneuf',\n 'Charlevoix',\n 'CHUQ',\n 'Thetford Mines',\n 'Chaudière - Appalaches',\n 'Saint - Raymond',\n 'Limoilou',\n 'Ancienne - Lorette',\n 'Malbaie',\n 'Baie - Saint - Paul',\n 'St - Anne de Beaupré',\n 'Loretteville',\n 'Valcartier',\n 'Rivière - du - Loup',\n 'Maria',\n 'Manicouagan',\n 'Sept - Iles',\n 'Basse - Côte - Nord',\n 'Port - Cartier',\n 'Sherfferville',\n 'Minganie',\n 'Natashquan',\n 'Chibougamau',\n 'Mauricie',\n 'Maskinongé',\n 'Parent',\n 'Mémphrémagog',\n 'Coaticook',\n 'Victoriaville',\n 'Rimouski',\n 'Shawinigan',\n 'Matane',\n 'Santa - Cabrini',\n 'Marie - Clarac',\n 'Hôpital lachine',\n 'Rivière - Rouge',\n 'Jeanne - Mance',\n 'Le Repair',\n 'Montérégie',\n 'Estrie',\n 'Villa - Medica',\n 'Laurentides',\n 'Hors - Qc',\n 'Hors - Can',\n 'Hors Pays',\n 'Hors Province',\n 'Baie James',\n 'Nunavut',\n 'Ungava',\n 'Inuulitsivik',\n 'Bas Saint - Laurent',\n 'Lévis',\n 'Îles de la Madeleine',\n 'Saguenay',\n 'Alberta',\n 'British Columbia',\n 'Yukon',\n 'Northwest Territories',\n 'Saskatchewan',\n 'Manitoba',\n 'Ontario',\n 'New Brunswick',\n 'Newfoundland and Labrador',\n 'Prince Edward Island',\n 'Nova Scotia',\n}\n\nexport enum Province {\n AB = 'AB',\n BC = 'BC',\n MB = 'MB',\n NB = 'NB',\n NL = 'NL',\n NS = 'NS',\n NT = 'NT',\n NU = 'NU',\n ON = 'ON',\n PE = 'PE',\n QC = 'QC',\n SK = 'SK',\n YT = 'YT'\n}\n\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, active?: boolean, 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?.active) query += ` AND Active__c = true`\n\n let records = []\n let done = false\n let url = `/services/data/v57.0/query`\n do {\n const { data: { records: pageRecords, nextRecordsUrl, done: isDone } } = await this.axiosInstance.get(url, { params: { q: query } })\n records.push(...pageRecords)\n done = isDone\n url = nextRecordsUrl\n } while (!done)\n const accounts: Account[] = records.map(record => this.buildAccount(record))\n\n for (const i in accounts)\n if (accounts[i].accountTypeName === 'healthAuthority')\n (accounts[i] as HealthAuthority).children = await this.fetchAccounts<Establishment>('establishment', { parentId: accounts[i].id, active: options?.active })\n\n return accounts as T[]\n } catch (error) {\n console.error(`Error fetching ${type} accounts: `, 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\n const fields = ['street', 'city', 'state', 'country', 'postalCode']\n const address = fields\n .map(field => record.BillingAddress?.[field]?.trim() ?? '')\n .filter(Boolean)\n .join('\\n')\n\n return {\n id: record.Id,\n name: record.Name,\n address: address,\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'\nexport { LipheRegion, Province, LipheGeographicalArea } from './models/regions'"],"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","_yield$this$axiosInst2","nextRecordsUrl","isDone","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","LipheRegion","LipheGeographicalArea","Province","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","parentId","active","buildAccount","t1","keys","t2","accountTypeName","children","t3","failfast","Type","address","_record$BillingAddres","_record$BillingAddres2","BillingAddress","filter","Boolean","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","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,OA5DdD,EAEKE,0BAAc,IAAAC,EAAAC,EAAAC,IAAAC,MAApB,SAAAC,EACIC,EACAC,EACAC,GAA0E,IAAAC,OAAA,OAAAN,IAAAO,eAAAC,GAAA,cAAAA,EAAAC,KAAAD,EAAAE,MAAA,OAAA,OAAAF,EAAAE,OAEtDtB,KAAKuB,UAAUR,EAAUC,GAAa,OAC1DhB,KAAKF,2BAA2BO,SAASmB,QAAQC,OAAsB,wBAD5DL,EAAAM,KAGX1B,KAAKF,2BAA2B6B,aAAaC,SAASC,KAClD,SAAAD,GAAQ,OAAIA,eAAQ,IAAAE,EAAAnB,EAAAC,IAAAC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B,EAAA/gB,UAeA,OAfAD,EACKib,gBAAI,IAAAC,EAAA9a,EAAAC,IAAAC,MAAV,SAAAkB,IAAA,OAAAnB,IAAAO,eAAAkB,GAAA,cAAAA,EAAAhB,KAAAgB,EAAAf,MAAA,OAAA,OAAAe,EAAAf,OACUtB,KAAK4b,cAAcnb,iBAAgB,OAAA,UAAA,OAAA4B,EAAAc,UAAApB,YADnC,OAET,WAFS,OAAA0Z,EAAApY,WAAAC,eAAA/C,EAIV6b,YAAA,SAAYC,GACRrc,KAAKqc,SAAWA,GACnB9b,EAED+b,YAAA,WACI,OAAOtc,KAAKqc,UACf9b,EAEDohB,iBAAA,WACI,OAAO3hB,KAAKyE,eACf8c,MXxDOnR,EAAAA,iBAAAA,6BAERA,eACAA,oBACAA,UACAA,kBACAA,wBACAA,sBACAA,wBACAA,gBACAA,YCVQC,EAAAA,sBAAAA,+EAERA,yBACAA,qBACAA,wCACAA,kCACAA,0CACAA,8CACAA,+BACAA,uBACAA,8BACAA,6CACAA,uDACAA,mCACAA,kCACAA,sBACAA,4BACAA,4BACAA,mCACAA,+BACAA,yCACAA,iEACAA,yDACAA,qCACAA,0BACAA,0BACAA,8BACAA,uDACAA,2BACAA,+DACAA,4BACAA,oCACAA,yDACAA,2CACAA,wBACAA,uBAGQC,EAAAA,gCAAAA,sEAERA,wDACAA,yBACAA,qBACAA,kCACAA,gDACAA,8BACAA,0CACAA,8CACAA,6BACAA,mCACAA,qCACAA,uCACAA,yCACAA,qCACAA,wBACAA,+CACAA,+DACAA,mDACAA,kCACAA,gCACAA,0BACAA,2CACAA,6CACAA,wBACAA,sBACAA,8BACAA,qCACAA,6DACAA,2CACAA,sCACAA,gCACAA,mCACAA,2CACAA,+CACAA,2DACAA,mCACAA,yCACAA,yCACAA,gCACAA,2BACAA,gCACAA,+CACAA,+BACAA,qCACAA,6DACAA,4BACAA,gCACAA,oBACAA,2CACAA,2DACAA,6CACAA,4BACAA,mDACAA,0BACAA,qDACAA,uDACAA,oCACAA,gCACAA,qDACAA,sBACAA,kCACAA,qCACAA,qDACAA,2CACAA,sCACAA,4BACAA,gCACAA,kCACAA,4BACAA,mCACAA,wBACAA,uCACAA,8BACAA,sCACAA,4BACAA,gCACAA,wBACAA,6CACAA,2CACAA,6CACAA,6CACAA,2CACAA,iCACAA,mCACAA,wBACAA,2CACAA,kCACAA,iCACAA,mCACAA,iCACAA,yCACAA,mCACAA,0BACAA,wBACAA,oCACAA,qDACAA,yBACAA,uDACAA,4BACAA,2BACAA,gDACAA,uBACAA,0DACAA,qCACAA,6BACAA,2BACAA,0CACAA,kEACAA,wDACAA,uCAGQC,EAAAA,mBAAAA,8BAERA,UACAA,UACAA,UACAA,UACAA,UACAA,UACAA,UACAA,UACAA,UACAA,UACAA,UACAA,cWrKSxL,EAAyB"}