pha-hermes 1.27.0 → 1.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.27.0",
2
+ "version": "1.28.0",
3
3
  "main": "dist/index.js",
4
4
  "typings": "dist/index.d.ts",
5
5
  "files": [
@@ -1,4 +1,4 @@
1
- import { AxiosInstance } from "axios"
1
+ import { AxiosInstance } from 'axios'
2
2
 
3
3
  export interface Account {
4
4
  id: string
@@ -16,6 +16,7 @@ export interface Account {
16
16
  fax: string | null
17
17
  email: string
18
18
  lang: 'eng' | 'fra'
19
+ clientNumber: string
19
20
  }
20
21
 
21
22
  export interface HealthAuthority extends Account {
@@ -39,7 +40,8 @@ const ACCOUNT_FIELDS = [
39
40
  'BillingAddress',
40
41
  'Phone',
41
42
  'Fax',
42
- 'Type'
43
+ 'Type',
44
+ 'Client_Number__c'
43
45
  ] as const
44
46
 
45
47
  export class SFAccounts {
@@ -49,7 +51,10 @@ export class SFAccounts {
49
51
  this.axiosInstance = axiosInstance
50
52
  }
51
53
 
52
- async fetchAccounts<T extends Account>(type: AccountType, options?: { parentId?: string, active?: boolean, failfast?: boolean }): Promise<T[]> {
54
+ async fetchAccounts<T extends Account>(
55
+ type: AccountType,
56
+ options?: { parentId?: string; active?: boolean; failfast?: boolean }
57
+ ): Promise<T[]> {
53
58
  try {
54
59
  let accountType: 'Health Authority' | 'Hospital'
55
60
  switch (type) {
@@ -68,7 +73,9 @@ export class SFAccounts {
68
73
  let done = false
69
74
  let url = `/services/data/v57.0/query`
70
75
  do {
71
- const { data: { records: pageRecords, nextRecordsUrl, done: isDone } } = await this.axiosInstance.get(url, { params: { q: query } })
76
+ const {
77
+ data: { records: pageRecords, nextRecordsUrl, done: isDone }
78
+ } = await this.axiosInstance.get(url, { params: { q: query } })
72
79
  records.push(...pageRecords)
73
80
  done = isDone
74
81
  url = nextRecordsUrl
@@ -77,13 +84,16 @@ export class SFAccounts {
77
84
 
78
85
  for (const i in accounts)
79
86
  if (accounts[i].accountTypeName === 'healthAuthority')
80
- (accounts[i] as HealthAuthority).children = await this.fetchAccounts<Establishment>('establishment', { parentId: accounts[i].id, active: options?.active })
87
+ (accounts[i] as HealthAuthority).children =
88
+ await this.fetchAccounts<Establishment>('establishment', {
89
+ parentId: accounts[i].id,
90
+ active: options?.active
91
+ })
81
92
 
82
93
  return accounts as T[]
83
94
  } catch (error) {
84
95
  console.error(`Error fetching ${type} accounts: `, error.message)
85
- if (options?.failfast)
86
- throw error
96
+ if (options?.failfast) throw error
87
97
  return []
88
98
  }
89
99
  }
@@ -119,7 +129,8 @@ export class SFAccounts {
119
129
  email: null,
120
130
  phone2: null,
121
131
  cellular: null,
122
- lang: 'eng'
132
+ lang: 'eng',
133
+ clientNumber: record.Client_Number__c
123
134
  }
124
135
  }
125
- }
136
+ }