pha-hermes 1.14.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/api/expenses/expenseClient.d.ts +15 -0
  2. package/dist/api/liphe_legacy/assignment/assignmentClient.d.ts +28 -0
  3. package/dist/api/{liphe1.0 → liphe_legacy}/auth/authClient.d.ts +1 -1
  4. package/dist/api/liphe_legacy/contract_request/contractRequestClient.d.ts +80 -0
  5. package/dist/api/liphe_legacy/contract_request_period/contractRequestPeriodClient.d.ts +47 -0
  6. package/dist/api/{lipheApiClient.d.ts → liphe_legacy/lipheApiClient.d.ts} +4 -2
  7. package/dist/api/liphe_legacy/practitioner/practitionerClient.d.ts +7 -0
  8. package/dist/api/{apiClient.d.ts → salesforce/apiClient.d.ts} +3 -1
  9. package/dist/api/{payperiod → salesforce/payperiod}/payperiodClient.d.ts +1 -7
  10. package/dist/api/{practitioner → salesforce/practitioner}/practitionerClient.d.ts +1 -1
  11. package/dist/api/{timesheet → salesforce/timesheet}/timesheetClient.d.ts +1 -1
  12. package/dist/api/{workorder → salesforce/workorder}/workorderClient.d.ts +1 -1
  13. package/dist/index.d.ts +9 -8
  14. package/dist/models/expense.d.ts +6 -0
  15. package/dist/models/index.d.ts +13 -17
  16. package/dist/models/{practitioner.d.ts → user.d.ts} +4 -0
  17. package/dist/models/workorder.d.ts +20 -0
  18. package/dist/pha-hermes.cjs.development.js +356 -3
  19. package/dist/pha-hermes.cjs.development.js.map +1 -1
  20. package/dist/pha-hermes.cjs.production.min.js +1 -1
  21. package/dist/pha-hermes.cjs.production.min.js.map +1 -1
  22. package/dist/pha-hermes.esm.js +357 -4
  23. package/dist/pha-hermes.esm.js.map +1 -1
  24. package/package.json +2 -1
  25. package/src/api/expenses/expenseClient.ts +70 -0
  26. package/src/api/liphe_legacy/assignment/assignmentClient.ts +67 -0
  27. package/src/api/{liphe1.0 → liphe_legacy}/auth/authClient.ts +11 -2
  28. package/src/api/liphe_legacy/contract_request/contractRequestClient.ts +128 -0
  29. package/src/api/liphe_legacy/contract_request_period/contractRequestPeriodClient.ts +233 -0
  30. package/src/api/{lipheApiClient.ts → liphe_legacy/lipheApiClient.ts} +23 -3
  31. package/src/api/{liphe1.0 → liphe_legacy}/practitioner/practitionerClient.ts +12 -4
  32. package/src/api/{apiClient.ts → salesforce/apiClient.ts} +4 -1
  33. package/src/api/{payperiod → salesforce/payperiod}/payperiodClient.ts +1 -8
  34. package/src/api/{practitioner → salesforce/practitioner}/practitionerClient.ts +1 -1
  35. package/src/api/{timesheet → salesforce/timesheet}/timesheetClient.ts +1 -1
  36. package/src/api/{workorder → salesforce/workorder}/workorderClient.ts +1 -1
  37. package/src/index.ts +14 -8
  38. package/src/models/expense.ts +6 -0
  39. package/src/models/index.ts +13 -18
  40. package/src/models/{practitioner.ts → user.ts} +5 -0
  41. package/src/models/workorder.ts +21 -0
  42. package/dist/api/liphe1.0/practitioner/practitionerClient.d.ts +0 -13
  43. package/src/api/.env +0 -5
  44. /package/dist/api/{auth → salesforce/auth}/auth.d.ts +0 -0
  45. /package/src/api/{auth → salesforce/auth}/auth.ts +0 -0
@@ -0,0 +1,15 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { Expense } from '../../models/expense';
3
+ declare type FrontendExpense = {
4
+ workorderPeriodId: string;
5
+ amount: string;
6
+ type: 'Other' | 'Lodging' | 'Transportation' | 'Travel (Hours or Amount)' | 'Per diem' | 'Meals';
7
+ };
8
+ export declare class SFExpenseClient {
9
+ private axiosInstance;
10
+ constructor(axiosInstance: AxiosInstance);
11
+ fetchExpenseTotals(timesheetId: string): Promise<Expense | null>;
12
+ private patchTimesheet;
13
+ updateExpense(expense: FrontendExpense): Promise<void>;
14
+ }
15
+ export {};
@@ -0,0 +1,28 @@
1
+ import { AxiosInstance } from 'axios';
2
+ export interface LipheAssignment {
3
+ id: number;
4
+ request_id: number;
5
+ dates_start: Date;
6
+ dates_end: Date;
7
+ shift: 'morning' | 'afternoon' | 'evening' | 'night';
8
+ time_start: Date;
9
+ time_end: Date;
10
+ status: 'draft' | 'inprogress' | 'approved' | 'rejected';
11
+ selected_client: Record<string, any>;
12
+ approver: string;
13
+ cost_covered: number | null;
14
+ travel: number | null;
15
+ lodging: number | null;
16
+ meal: number | null;
17
+ others: number | null;
18
+ modified_by: string | null;
19
+ created_at: Date;
20
+ updated_at: Date;
21
+ }
22
+ export declare class AssignmentClient {
23
+ private axiosInstance;
24
+ constructor(axiosInstance: AxiosInstance);
25
+ fetchAllAssignments(agencyId?: number, from?: Date, to?: Date, assignedPractitionerId?: string, page?: number, page_size?: number): Promise<LipheAssignment[]>;
26
+ fetchAssignment(assignmentId: string): Promise<LipheAssignment>;
27
+ createAssignment(assignment: LipheAssignment): Promise<LipheAssignment>;
28
+ }
@@ -7,7 +7,7 @@ export declare class LipheAuthenticator {
7
7
  private email;
8
8
  private password;
9
9
  private type;
10
- constructor(authenticatedAxiosInstance: AxiosInstance, baseUrl: string, email: string, password: string, type?: string);
10
+ constructor(authenticatedAxiosInstance: AxiosInstance, baseUrl: string, email: string, password: string, type?: 'user' | 'client');
11
11
  initializeAuth(): Promise<void>;
12
12
  private login;
13
13
  }
@@ -0,0 +1,80 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { Workorder } from '../../../models';
3
+ export interface LipheContractRequest {
4
+ id: number;
5
+ name: string;
6
+ po_number: string | null;
7
+ level: string;
8
+ deadline: string;
9
+ from: string;
10
+ by: string;
11
+ by_value: string;
12
+ date: Date;
13
+ email_request: string;
14
+ type_of_request: string;
15
+ status: string;
16
+ is_deleted: number;
17
+ created_at: Date;
18
+ updated_at: Date;
19
+ created_by: string;
20
+ updated_by: string;
21
+ community_id: number;
22
+ agency_id: number;
23
+ contract_id: number;
24
+ job_id: number;
25
+ start_date: Date;
26
+ end_date: Date;
27
+ department_id: number | null;
28
+ job: LipheJob;
29
+ community: LipheCommunity;
30
+ }
31
+ interface LipheJob {
32
+ id: number;
33
+ code_nethris: number;
34
+ translations: LipheJobTranslation[];
35
+ }
36
+ interface LipheJobTranslation {
37
+ id: number;
38
+ translatable_type: string;
39
+ translatable_id: number;
40
+ column: string;
41
+ content: string;
42
+ locale: string;
43
+ created_at: Date;
44
+ updated_at: Date;
45
+ }
46
+ interface LipheCommunity {
47
+ id: number;
48
+ name: string;
49
+ region: LipheRegion;
50
+ contact: LipheContact;
51
+ }
52
+ interface LipheRegion {
53
+ id: number;
54
+ translations: LipheRegionTranslation[];
55
+ }
56
+ interface LipheRegionTranslation {
57
+ id: number;
58
+ translatable_type: string;
59
+ translatable_id: number;
60
+ column: string;
61
+ content: string;
62
+ locale: string;
63
+ created_at: Date;
64
+ updated_at: Date;
65
+ }
66
+ interface LipheContact {
67
+ id: number;
68
+ address: string;
69
+ address_city: string;
70
+ address_zip: string;
71
+ address_country: string;
72
+ address_state: string;
73
+ phone: string;
74
+ }
75
+ export declare class ContractRequestClient {
76
+ private axiosInstance;
77
+ constructor(axiosInstance: AxiosInstance);
78
+ fetchAllContractRequests(agencyId: number, from?: Date, to?: Date, page?: number, page_size?: number): Promise<Workorder[]>;
79
+ }
80
+ export {};
@@ -0,0 +1,47 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { Agency, Period, Workorder } from '../../../models';
3
+ import { LipheContractRequest } from '../contract_request/contractRequestClient';
4
+ import { LipheAssignment } from '../assignment/assignmentClient';
5
+ interface LipheContractRequestPeriodData {
6
+ id: number;
7
+ contract_request_id: number;
8
+ start_date: Date;
9
+ end_date: Date;
10
+ shift: 'morning' | 'afternoon' | 'evening' | 'night';
11
+ start_time: Date;
12
+ end_time: Date;
13
+ departement_id: number;
14
+ note: string;
15
+ assignment_id: number;
16
+ assignment_parent_id: number | null;
17
+ created_at: Date;
18
+ updated_at: Date;
19
+ contract_request: LipheContractRequest;
20
+ department: string | null;
21
+ assignment: LipheAssignment;
22
+ assigned_employee_details: UserDetails;
23
+ assignment_employee: any;
24
+ }
25
+ interface UserDetails {
26
+ id: number;
27
+ name: string;
28
+ email: string | null;
29
+ }
30
+ export declare class ContractRequestPeriodClient {
31
+ private axiosInstance;
32
+ constructor(axiosInstance: AxiosInstance);
33
+ fetchAllContractRequestPeriods(agencyId: Agency, from?: Date, to?: Date, page?: number, activeAssignationsOnly?: boolean, assignedPractitionerId?: string): Promise<Workorder[]>;
34
+ fetchContractRequestPeriod(workorderId: string): Promise<LipheContractRequestPeriodData>;
35
+ getPayPeriodDatesForPayPeriodId(payPeriodId: string): Promise<Period[]>;
36
+ private getRole;
37
+ /**
38
+ * Calculates the pay period day of week that comes before the start date
39
+ * @param firstPayPeriodDate The first pay period date from the agency
40
+ * @param startDate The start date to find the pay period before
41
+ * @returns The day of week (0-6, where 0 is Sunday) of the pay period before start_date
42
+ */
43
+ private getPayPeriodDayBeforeStartDate;
44
+ private getLastDayOfPayPeriod;
45
+ private calculateWeeksBetween;
46
+ }
47
+ export {};
@@ -1,11 +1,13 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { LiphePractitionerClient } from './liphe1.0/practitioner/practitionerClient';
2
+ import { LiphePractitionerClient } from './practitioner/practitionerClient';
3
+ import { ContractRequestPeriodClient } from './contract_request_period/contractRequestPeriodClient';
3
4
  export declare class LipheApiClient {
4
5
  private instance;
5
6
  private axiosInstance;
6
7
  private authenticator;
7
8
  practitionerClient: LiphePractitionerClient;
8
- constructor(baseUrl: string, email: string, password: string, type?: string);
9
+ contractRequestPeriodClient: ContractRequestPeriodClient;
10
+ constructor(baseUrl: string, email: string, password: string, type?: 'user' | 'client');
9
11
  init(): Promise<void>;
10
12
  setInstance(instance: LipheApiClient): void;
11
13
  getInstance(): LipheApiClient;
@@ -0,0 +1,7 @@
1
+ import type { AxiosInstance } from 'axios';
2
+ import { Practitioner } from '../../../models';
3
+ export declare class LiphePractitionerClient {
4
+ private axios;
5
+ constructor(axiosInstance: AxiosInstance);
6
+ fetchAllPractitioners(agencyId?: number): Promise<Practitioner[]>;
7
+ }
@@ -1,8 +1,9 @@
1
1
  import { SFTimesheetClient } from './timesheet/timesheetClient';
2
2
  import { SFPractitionerClient } from './practitioner/practitionerClient';
3
- import { Role } from '../models';
3
+ import { Role } from '../../models';
4
4
  import { SFWorkorderClient } from './workorder/workorderClient';
5
5
  import { SFPayPeriodClient } from './payperiod/payperiodClient';
6
+ import { SFExpenseClient } from '../expenses/expenseClient';
6
7
  export declare const SF_API_VERSION: string;
7
8
  export declare class SFApiClient {
8
9
  private instance;
@@ -13,6 +14,7 @@ export declare class SFApiClient {
13
14
  workorderClient: SFWorkorderClient;
14
15
  practitionerClient: SFPractitionerClient;
15
16
  payPeriodClient: SFPayPeriodClient;
17
+ expenseClient: SFExpenseClient;
16
18
  constructor(baseUrl?: string);
17
19
  init(sfClientId: string, sfClientSecret: string, onTokenRefresh?: () => Promise<{
18
20
  clientId: string;
@@ -1,11 +1,5 @@
1
1
  import { AxiosInstance } from 'axios';
2
- export interface Period {
3
- payPeriodId: string;
4
- startDate: Date;
5
- endDate: Date;
6
- timesheetId?: string;
7
- workorderId?: string;
8
- }
2
+ import { Period } from '../../../models';
9
3
  export declare class SFPayPeriodClient {
10
4
  private axiosInstance;
11
5
  constructor(axiosInstance: AxiosInstance);
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { Practitioner } from '../../models';
2
+ import { Practitioner } from '../../../models';
3
3
  export declare class SFPractitionerClient {
4
4
  private axiosInstance;
5
5
  constructor(axiosInstance: AxiosInstance);
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { AxiosInstance } from 'axios';
3
- import { TimesheetDayEntry } from '../../models';
3
+ import { TimesheetDayEntry } from '../../../models';
4
4
  interface SFTimesheetHourField {
5
5
  Id: string;
6
6
  Date__c: Date;
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { Workorder } from '../../models';
2
+ import { Workorder } from '../../../models';
3
3
  export declare class SFWorkorderClient {
4
4
  private axiosInstance;
5
5
  constructor(axiosInstance: AxiosInstance);
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- export { SFApiClient } from './api/apiClient';
2
- export { SFPractitionerClient } from './api/practitioner/practitionerClient';
3
- export { SFTimesheetClient } from './api/timesheet/timesheetClient';
4
- export { SFAuthenticator } from './api/auth/auth';
5
- export { Practitioner, Role, TimesheetDayEntry, Workorder } from './models';
6
- export { LipheApiClient } from './api/lipheApiClient';
7
- export { LipheAuthenticator } from './api/liphe1.0/auth/authClient';
8
- export { LiphePractitionerClient } from './api/liphe1.0/practitioner/practitionerClient';
1
+ export { SFApiClient } from './api/salesforce/apiClient';
2
+ export { SFPractitionerClient } from './api/salesforce/practitioner/practitionerClient';
3
+ export { SFTimesheetClient } from './api/salesforce/timesheet/timesheetClient';
4
+ export { SFAuthenticator } from './api/salesforce/auth/auth';
5
+ export { LipheApiClient } from './api/liphe_legacy/lipheApiClient';
6
+ export { LipheAuthenticator } from './api/liphe_legacy/auth/authClient';
7
+ export { LiphePractitionerClient } from './api/liphe_legacy/practitioner/practitionerClient';
8
+ export { SFExpenseClient } from './api/expenses/expenseClient';
9
+ export { Practitioner, Role, TimesheetDayEntry, Workorder, Agency, Period } from './models';
@@ -0,0 +1,6 @@
1
+ export interface Expense {
2
+ reimbursable: number;
3
+ perDiem: number;
4
+ lodging: number;
5
+ transportation: number;
6
+ }
@@ -1,19 +1,15 @@
1
- export interface Role {
2
- label: string;
3
- value: string;
4
- }
5
- export interface Workorder {
6
- id: string;
7
- name: string;
8
- region: string;
9
- establishmentName: string;
10
- establishmentId: string;
11
- role: string;
12
- practitionerId: string;
13
- startDate: Date;
14
- endDate: Date;
15
- createdAt: Date;
16
- updatedAt: Date;
1
+ export declare enum Agency {
2
+ CHCA = "7",
3
+ CodeBleu = "5",
4
+ NordikOntario = "6",
5
+ PHA = "8",
6
+ PremierSoin = "1",
7
+ PremierSoinNordik = "3",
8
+ SolutionNursing = "4",
9
+ SolutionsStaffing = "9",
10
+ Transport = "2",
11
+ SSI = "99"
17
12
  }
18
13
  export * from './timesheet';
19
- export * from './practitioner';
14
+ export * from './user';
15
+ export * from './workorder';
@@ -5,3 +5,7 @@ export interface Practitioner {
5
5
  email: string;
6
6
  staffId: string;
7
7
  }
8
+ export interface Role {
9
+ label: string;
10
+ value: string;
11
+ }
@@ -0,0 +1,20 @@
1
+ export interface Period {
2
+ payPeriodId: string;
3
+ startDate: Date;
4
+ endDate: Date;
5
+ timesheetId?: string;
6
+ workorderId?: string;
7
+ }
8
+ export interface Workorder {
9
+ id: string;
10
+ name: string;
11
+ region: string;
12
+ establishmentName: string;
13
+ establishmentId: string;
14
+ role: string;
15
+ practitionerId?: string;
16
+ startDate: Date;
17
+ endDate: Date;
18
+ createdAt?: Date;
19
+ updatedAt?: Date;
20
+ }