@extrahorizon/javascript-sdk 8.2.0 → 8.2.1-dev-48-41fd1f1

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 (152) hide show
  1. package/CHANGELOG.md +1177 -1161
  2. package/README.md +108 -119
  3. package/build/index.cjs.js +1 -1
  4. package/build/index.mjs +1 -1
  5. package/build/types/btoa.d.ts +6 -6
  6. package/build/types/client.d.ts +136 -136
  7. package/build/types/constants.d.ts +15 -15
  8. package/build/types/errorHandler.d.ts +2 -2
  9. package/build/types/errors.d.ts +332 -332
  10. package/build/types/http/client.d.ts +2 -2
  11. package/build/types/http/index.d.ts +4 -4
  12. package/build/types/http/interceptors.d.ts +9 -9
  13. package/build/types/http/oAuth1Signature.d.ts +14 -14
  14. package/build/types/http/oauth1.d.ts +3 -3
  15. package/build/types/http/oauth2.d.ts +3 -3
  16. package/build/types/http/proxy.d.ts +3 -3
  17. package/build/types/http/types.d.ts +331 -331
  18. package/build/types/http/utils.d.ts +21 -21
  19. package/build/types/index.d.ts +9 -9
  20. package/build/types/mock.d.ts +43 -43
  21. package/build/types/mockType.d.ts +1547 -1511
  22. package/build/types/parseStoredCredentials.d.ts +11 -11
  23. package/build/types/rql/index.d.ts +16 -16
  24. package/build/types/rql/parser.d.ts +1 -1
  25. package/build/types/rql/types.d.ts +168 -168
  26. package/build/types/services/auth/applications/index.d.ts +5 -5
  27. package/build/types/services/auth/applications/types.d.ts +260 -190
  28. package/build/types/services/auth/index.d.ts +3 -3
  29. package/build/types/services/auth/oauth1/index.d.ts +5 -5
  30. package/build/types/services/auth/oauth1/types.d.ts +63 -63
  31. package/build/types/services/auth/oauth2/index.d.ts +5 -5
  32. package/build/types/services/auth/oauth2/types.d.ts +52 -52
  33. package/build/types/services/auth/oidc/index.d.ts +5 -5
  34. package/build/types/services/auth/oidc/loginAttempts/index.d.ts +5 -5
  35. package/build/types/services/auth/oidc/loginAttempts/types.d.ts +67 -67
  36. package/build/types/services/auth/oidc/providers/index.d.ts +5 -5
  37. package/build/types/services/auth/oidc/providers/types.d.ts +144 -144
  38. package/build/types/services/auth/oidc/types.d.ts +40 -40
  39. package/build/types/services/auth/types.d.ts +39 -39
  40. package/build/types/services/auth/users/index.d.ts +5 -5
  41. package/build/types/services/auth/users/types.d.ts +121 -121
  42. package/build/types/services/configurations/general.d.ts +5 -5
  43. package/build/types/services/configurations/groups.d.ts +5 -5
  44. package/build/types/services/configurations/index.d.ts +10 -10
  45. package/build/types/services/configurations/patients.d.ts +5 -5
  46. package/build/types/services/configurations/staff.d.ts +5 -5
  47. package/build/types/services/configurations/types.d.ts +222 -222
  48. package/build/types/services/configurations/users.d.ts +5 -5
  49. package/build/types/services/data/comments.d.ts +5 -5
  50. package/build/types/services/data/documents.d.ts +5 -5
  51. package/build/types/services/data/index.d.ts +13 -13
  52. package/build/types/services/data/indexes.d.ts +5 -5
  53. package/build/types/services/data/infrastructure.d.ts +10 -10
  54. package/build/types/services/data/json-schema.d.ts +121 -121
  55. package/build/types/services/data/properties.d.ts +5 -5
  56. package/build/types/services/data/schemas.d.ts +5 -5
  57. package/build/types/services/data/statuses.d.ts +5 -5
  58. package/build/types/services/data/transitions.d.ts +5 -5
  59. package/build/types/services/data/types.d.ts +899 -899
  60. package/build/types/services/dispatchers/actions/index.d.ts +5 -5
  61. package/build/types/services/dispatchers/actions/types.d.ts +78 -78
  62. package/build/types/services/dispatchers/dispatchers/index.d.ts +5 -5
  63. package/build/types/services/dispatchers/dispatchers/types.d.ts +111 -111
  64. package/build/types/services/dispatchers/index.d.ts +7 -7
  65. package/build/types/services/dispatchers/types.d.ts +2 -2
  66. package/build/types/services/events/events.d.ts +5 -5
  67. package/build/types/services/events/health.d.ts +9 -9
  68. package/build/types/services/events/index.d.ts +6 -6
  69. package/build/types/services/events/subscriptions.d.ts +5 -5
  70. package/build/types/services/events/types.d.ts +90 -90
  71. package/build/types/services/files/files.d.ts +5 -5
  72. package/build/types/services/files/formHelpers.d.ts +3 -3
  73. package/build/types/services/files/index.d.ts +6 -6
  74. package/build/types/services/files/settings/index.d.ts +5 -5
  75. package/build/types/services/files/settings/types.d.ts +38 -38
  76. package/build/types/services/files/tokens.d.ts +5 -5
  77. package/build/types/services/files/types.d.ts +185 -185
  78. package/build/types/services/helpers.d.ts +7 -7
  79. package/build/types/services/http-client.d.ts +22 -22
  80. package/build/types/services/index.d.ts +15 -15
  81. package/build/types/services/localizations/countries.d.ts +5 -5
  82. package/build/types/services/localizations/health.d.ts +9 -9
  83. package/build/types/services/localizations/index.d.ts +4 -4
  84. package/build/types/services/localizations/languages.d.ts +5 -5
  85. package/build/types/services/localizations/localizations.d.ts +5 -5
  86. package/build/types/services/localizations/types.d.ts +145 -145
  87. package/build/types/services/logs/access/index.d.ts +5 -5
  88. package/build/types/services/logs/access/types.d.ts +41 -41
  89. package/build/types/services/logs/index.d.ts +3 -3
  90. package/build/types/services/logs/types.d.ts +4 -4
  91. package/build/types/services/mails/index.d.ts +3 -3
  92. package/build/types/services/mails/mails.d.ts +5 -5
  93. package/build/types/services/mails/types.d.ts +141 -141
  94. package/build/types/services/notifications/health.d.ts +9 -9
  95. package/build/types/services/notifications/index.d.ts +7 -7
  96. package/build/types/services/notifications/notifications.d.ts +5 -5
  97. package/build/types/services/notifications/settings.d.ts +5 -5
  98. package/build/types/services/notifications/types.d.ts +222 -222
  99. package/build/types/services/payments/appStore.d.ts +5 -5
  100. package/build/types/services/payments/appStoreSubscriptions.d.ts +5 -5
  101. package/build/types/services/payments/health.d.ts +9 -9
  102. package/build/types/services/payments/index.d.ts +15 -15
  103. package/build/types/services/payments/orders.d.ts +5 -5
  104. package/build/types/services/payments/playStore.d.ts +5 -5
  105. package/build/types/services/payments/playStoreHistory.d.ts +5 -5
  106. package/build/types/services/payments/playStoreSubscriptions.d.ts +5 -5
  107. package/build/types/services/payments/products.d.ts +5 -5
  108. package/build/types/services/payments/stripe.d.ts +5 -5
  109. package/build/types/services/payments/subscriptions.d.ts +5 -5
  110. package/build/types/services/payments/types.d.ts +1189 -1189
  111. package/build/types/services/profiles/groups.d.ts +5 -5
  112. package/build/types/services/profiles/health.d.ts +9 -9
  113. package/build/types/services/profiles/index.d.ts +9 -9
  114. package/build/types/services/profiles/logs.d.ts +5 -5
  115. package/build/types/services/profiles/profiles.d.ts +5 -5
  116. package/build/types/services/profiles/types.d.ts +370 -369
  117. package/build/types/services/tasks/api/index.d.ts +5 -5
  118. package/build/types/services/tasks/api/types.d.ts +146 -146
  119. package/build/types/services/tasks/apiRequests/index.d.ts +5 -5
  120. package/build/types/services/tasks/apiRequests/logs/index.d.ts +5 -5
  121. package/build/types/services/tasks/apiRequests/logs/types.d.ts +25 -25
  122. package/build/types/services/tasks/apiRequests/types.d.ts +83 -83
  123. package/build/types/services/tasks/functions/index.d.ts +5 -5
  124. package/build/types/services/tasks/functions/types.d.ts +27 -27
  125. package/build/types/services/tasks/index.d.ts +15 -15
  126. package/build/types/services/tasks/logs/index.d.ts +5 -5
  127. package/build/types/services/tasks/logs/types.d.ts +28 -28
  128. package/build/types/services/tasks/schedules/index.d.ts +5 -5
  129. package/build/types/services/tasks/schedules/types.d.ts +88 -88
  130. package/build/types/services/tasks/tasks.d.ts +5 -5
  131. package/build/types/services/tasks/types.d.ts +107 -107
  132. package/build/types/services/templates/index.d.ts +3 -3
  133. package/build/types/services/templates/templates.d.ts +5 -5
  134. package/build/types/services/templates/types.d.ts +202 -202
  135. package/build/types/services/types.d.ts +77 -77
  136. package/build/types/services/users/activationRequests/index.d.ts +4 -4
  137. package/build/types/services/users/activationRequests/types.d.ts +70 -70
  138. package/build/types/services/users/forgotPasswordRequests/index.d.ts +4 -4
  139. package/build/types/services/users/forgotPasswordRequests/types.d.ts +70 -70
  140. package/build/types/services/users/globalRoles.d.ts +5 -5
  141. package/build/types/services/users/groupRoles.d.ts +5 -5
  142. package/build/types/services/users/health.d.ts +9 -9
  143. package/build/types/services/users/index.d.ts +16 -16
  144. package/build/types/services/users/settings/index.d.ts +4 -4
  145. package/build/types/services/users/settings/types.d.ts +47 -47
  146. package/build/types/services/users/types.d.ts +1116 -1055
  147. package/build/types/services/users/users.d.ts +5 -5
  148. package/build/types/sha1.d.ts +11 -11
  149. package/build/types/types.d.ts +102 -102
  150. package/build/types/utils.d.ts +4 -4
  151. package/build/types/version.d.ts +1 -1
  152. package/package.json +62 -62
@@ -1,369 +1,370 @@
1
- import { RQLString } from '../../rql';
2
- import { FindAllIterator } from '../../services/helpers';
3
- import { AffectedRecords, ObjectId, OptionsBase, OptionsWithRql, PagedResult } from '../types';
4
- export interface Profile {
5
- id: ObjectId;
6
- addressLine1?: string;
7
- addressLine2?: string;
8
- country: string;
9
- region?: string;
10
- city?: string;
11
- postalCode?: string;
12
- birthday: string;
13
- /**
14
- * See ISO 5218
15
- */
16
- gender: number;
17
- length?: number;
18
- weight?: number;
19
- afHistory?: boolean;
20
- comorbidities?: Array<Comorbidities>;
21
- physician?: string;
22
- smoker?: boolean;
23
- activity?: ProfileActivity;
24
- impediments?: Array<Impediments>;
25
- medication?: Array<Medication>;
26
- groups?: Array<Group>;
27
- customFields?: Record<string, string>;
28
- fibricheckInfo?: {
29
- app?: {
30
- version?: string;
31
- build?: string;
32
- branch?: string;
33
- };
34
- device?: {
35
- os?: string;
36
- model?: string;
37
- type?: 'android' | 'ios';
38
- manufacturer?: string;
39
- };
40
- };
41
- creationTimestamp?: Date;
42
- updateTimestamp?: Date;
43
- }
44
- export declare type ProfileCreation = Pick<Profile, 'id' | 'country' | 'region' | 'birthday' | 'gender'>;
45
- export declare enum ProfileActivity {
46
- NOT_ACTIVE = "NOT_ACTIVE",
47
- SLIGHTLY_ACTIVE = "SLIGHTLY_ACTIVE",
48
- MODERATELY_ACTIVE = "MODERATELY_ACTIVE",
49
- ACTIVE = "ACTIVE",
50
- VERY_ACTIVE = "VERY_ACTIVE"
51
- }
52
- export declare enum Comorbidities {
53
- HEART_FAILURE = "HEART_FAILURE",
54
- DIABETES = "DIABETES",
55
- COPD = "COPD",
56
- HYPERTENSION = "HYPERTENSION",
57
- VASCULAR_DISEASE = "VASCULAR_DISEASE",
58
- HISTORY_OF_TIA_STROKE = "HISTORY_OF_TIA_STROKE"
59
- }
60
- export declare enum Impediments {
61
- TREMOR = "TREMOR",
62
- PERNIOSIS = "PERNIOSIS",
63
- CALLUS = "CALLUS"
64
- }
65
- export interface Medication {
66
- name: string;
67
- dosis: {
68
- number?: number;
69
- unit?: MedicationUnit;
70
- };
71
- medicationFrequency?: MedicationFrequency;
72
- count: number;
73
- }
74
- export declare enum MedicationUnit {
75
- MG = "mg",
76
- ML = "ml",
77
- PILL = "pill"
78
- }
79
- export declare enum MedicationFrequency {
80
- AS_NEEDED = "AS_NEEDED",
81
- EVERY_DAY = "EVERY_DAY",
82
- EVERY_WEEK = "EVERY_WEEK",
83
- EVERY_MONTH = "EVERY_MONTH",
84
- BIRTH_CONTROL = "BIRTH_CONTROL"
85
- }
86
- export interface Group {
87
- groupId: ObjectId;
88
- reason?: string;
89
- /**
90
- * This serves as a field to link a patient to the medical record of a hospital/physician. This field therefor accepts any string, not just an ObjectId.
91
- *
92
- */
93
- patientId?: string;
94
- customFields?: Record<string, string>;
95
- }
96
- export declare type GroupCreation = Group;
97
- export interface LogEntry {
98
- id?: ObjectId;
99
- profileId?: ObjectId;
100
- groupId?: ObjectId;
101
- userId?: ObjectId;
102
- text?: string;
103
- creationTimestamp?: Date;
104
- updateTimestamp?: Date;
105
- }
106
- export interface ProfileComment {
107
- text: string;
108
- }
109
- export interface ProfilesGroupsService {
110
- /**
111
- * Add a group enlistment to a profile
112
- *
113
- * Permission | Scope | Effect
114
- * - | - | -
115
- * none | | Add a group enlistment for your profile only
116
- * `ADD_PATIENT` | `staff enlistment` | Add a group enlistment for any profile of this group
117
- * `ADD_PATIENT` & `ACTIVATE_PRESCRIPTIONS` | `global` | Add a group enlistment for any profile for any group
118
- * @param profileId Id of the targeted profile
119
- * @param requestBody Group data
120
- * @returns Group
121
- * @throws {ResourceAlreadyExistsError}
122
- * @throws {ResourceUnknownError}
123
- */
124
- create(profileId: ObjectId, requestBody: GroupCreation, options?: OptionsBase): Promise<Group>;
125
- /**
126
- * Update a group enlistment on a profile
127
- *
128
- * Permission | Scope | Effect
129
- * - | - | -
130
- * `UPDATE_PROFILES` | `staff enlistment` | Update a group enlistment for any profile for this group
131
- * `UPDATE_PROFILES` | `global` | Update a group enlistment for any profile for any group
132
- * @param profileId Id of the targeted profile
133
- * @param groupId Id of the targeted group
134
- * @param requestBody Group data to update
135
- * @returns Group
136
- * @throws {ResourceUnknownError}
137
- */
138
- update(profileId: ObjectId, groupId: ObjectId, requestBody: Omit<Group, 'groupId'>, options?: OptionsBase): Promise<Group>;
139
- /**
140
- * Delete a group from a profile
141
- *
142
- * Permission | Scope | Effect
143
- * - | - | -
144
- * none | | Delete a group from your profile only
145
- * `UPDATE_PROFILES` | `staff enlistment` | Delete a group from any profile in this group
146
- * `UPDATE_PROFILES` | `global` | Delete a group from any profile in any group
147
- * @param profileId Id of the targeted profile
148
- * @param groupId Id of the targeted group
149
- * @returns AffectedRecords
150
- * @throws {ResourceUnknownError}
151
- */
152
- remove(profileId: ObjectId, groupId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
153
- /**
154
- * Remove a field on a group enlistment object in a profile
155
- *
156
- * Permission | Scope | Effect
157
- * - | - | -
158
- * `UPDATE_PROFILES` | `staff enlistment` | Remove a field for this group
159
- * `UPDATE_PROFILES` | `global` | Remove a field for any group
160
- * @param profileId Id of the targeted profile
161
- * @param groupId Id of the targeted group
162
- * @param requestBody list of fields to remove
163
- * @returns Group
164
- * @throws {ResourceUnknownError}
165
- */
166
- removeFields(profileId: ObjectId, groupId: ObjectId, requestBody: {
167
- fields: Array<string>;
168
- }, options?: OptionsBase): Promise<Group>;
169
- }
170
- export interface ProfilesLogsService {
171
- /**
172
- * Create a profile log entry
173
- *
174
- * Permission | Scope | Effect
175
- * - | - | -
176
- * `CREATE_PROFILE_LOG_ENTRIES` | `staff enlistment` | Create a log entry for any profile of this group
177
- * `CREATE_PROFILE_LOG_ENTRIES` | `global` | Create a log entry for any profile of any group
178
- * @param profileId Id of the targeted profile
179
- * @param groupId Id of the targeted group
180
- * @param requestBody ProfileComment
181
- * @returns LogEntry
182
- * @throws {ResourceUnknownError}
183
- */
184
- create(profileId: ObjectId, groupId: ObjectId, requestBody: ProfileComment, options?: OptionsBase): Promise<LogEntry>;
185
- /**
186
- * Retrieve all profile log entries
187
- *
188
- * Permission | Scope | Effect
189
- * - | - | -
190
- * `VIEW_PROFILE_LOG_ENTRIES` | `staff enlistment` | Retrieve a list of log entries for any profile of this group
191
- * `VIEW_PROFILE_LOG_ENTRIES` | `global` | Retrieve a list of log entries for any profile of any group
192
- * @param profileId Id of the targeted profile
193
- * @param groupId Id of the targeted group
194
- * @param rql Add filters to the requested list.
195
- * @returns PagedResult<LogEntry>
196
- * @throws {ResourceUnknownError}
197
- */
198
- find(profileId: ObjectId, groupId: ObjectId, options?: OptionsWithRql): Promise<PagedResult<LogEntry>>;
199
- /**
200
- * Request a list of all profile log entries
201
- *
202
- * Do not pass in an rql with limit operator!
203
- *
204
- * Permission | Scope | Effect
205
- * - | - | -
206
- * `VIEW_PROFILE_LOG_ENTRIES` | `staff enlistment` | Retrieve a list of log entries for any profile of this group
207
- * `VIEW_PROFILE_LOG_ENTRIES` | `global` | Retrieve a list of log entries for any profile of any group
208
- * @param profileId Id of the targeted profile
209
- * @param groupId Id of the targeted group
210
- * @param rql Add filters to the requested list.
211
- * @returns LogEntry[]
212
- */
213
- findAll(profileId: ObjectId, groupId: ObjectId, options?: OptionsWithRql): Promise<LogEntry[]>;
214
- /**
215
- * Request a list of all profile log entries
216
- *
217
- * Permission | Scope | Effect
218
- * - | - | -
219
- * `VIEW_PROFILE_LOG_ENTRIES` | `staff enlistment` | Retrieve a list of log entries for any profile of this group
220
- * `VIEW_PROFILE_LOG_ENTRIES` | `global` | Retrieve a list of log entries for any profile of any group
221
- * @param profileId Id of the targeted profile
222
- * @param groupId Id of the targeted group
223
- * @param rql Add filters to the requested list.
224
- * @returns LogEntry[]
225
- */
226
- findAllIterator(profileId: ObjectId, groupId: ObjectId, options?: OptionsWithRql): FindAllIterator<LogEntry>;
227
- /**
228
- * Update a profile log entry
229
- *
230
- * Permission | Scope | Effect
231
- * - | - | -
232
- * `CREATE_PROFILE_LOG_ENTRIES` | `staff enlistment` | Update a log entry, created by the current user, for any profile of this group
233
- * `CREATE_PROFILE_LOG_ENTRIES` | `global` | Update a log entry, created by the current user, for any profile of any group
234
- * @param profileId Id of the targeted profile
235
- * @param groupId Id of the targeted group
236
- * @param entryId Id of the targeted log entry
237
- * @param requestBody ProfileComment
238
- * @returns LogEntry
239
- * @throws {ResourceUnknownError}
240
- */
241
- update(profileId: ObjectId, groupId: ObjectId, entryId: ObjectId, requestBody: ProfileComment, options?: OptionsBase): Promise<LogEntry>;
242
- /**
243
- * Delete a profile log entry
244
- *
245
- * Permission | Scope | Effect
246
- * - | - | -
247
- * `CREATE_PROFILE_LOG_ENTRIES` | `staff enlistment` | Delete a log entry, created by the current user, for any profile of this group
248
- * `CREATE_PROFILE_LOG_ENTRIES` | `global` | Delete a log entry, created by the current user, for any profile of any group
249
- * @param profileId Id of the targeted profile
250
- * @param groupId Id of the targeted group
251
- * @param entryId Id of the targeted log entry
252
- * @returns AffectedRecords
253
- * @throws {ResourceUnknownError}
254
- */
255
- remove(profileId: ObjectId, groupId: ObjectId, entryId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
256
- }
257
- export interface ProfilesService {
258
- /**
259
- * Get a list of profiles
260
- *
261
- * Permission | Scope | Effect
262
- * - | - | -
263
- * none | | View your profile
264
- * none | `staff enlistment` | View all the profiles of the group
265
- * `VIEW_PATIENTS` | `global` | View all profiles
266
- * @param rql an optional rql string
267
- * @returns PagedResult<Profile>
268
- */
269
- find(options?: OptionsWithRql): Promise<PagedResult<Profile>>;
270
- /**
271
- * Request a list of all profiles
272
- *
273
- * Do not pass in an rql with limit operator!
274
- *
275
- * Permission | Scope | Effect
276
- * - | - | -
277
- * none | | View your profile
278
- * none | `staff enlistment` | View all the profiles of the group
279
- * `VIEW_PATIENTS` | `global` | View all profiles
280
- * @param rql Add filters to the requested list.
281
- * @returns Profile[]
282
- */
283
- findAll(options?: OptionsWithRql): Promise<Profile[]>;
284
- /**
285
- * Request a list of all profiles
286
- *
287
- * Permission | Scope | Effect
288
- * - | - | -
289
- * none | | View your profile
290
- * none | `staff enlistment` | View all the profiles of the group
291
- * `VIEW_PATIENTS` | `global` | View all profiles
292
- * @param rql Add filters to the requested list.
293
- * @returns Profile[]
294
- */
295
- findAllIterator(options?: OptionsWithRql): FindAllIterator<Profile>;
296
- /**
297
- * Find By Id
298
- * @param id the Id to search for
299
- * @param rql an optional rql string
300
- * @returns the first element found
301
- */
302
- findById(id: ObjectId, options?: OptionsWithRql): Promise<Profile>;
303
- /**
304
- * Find First
305
- * @param rql an optional rql string
306
- * @returns the first element found
307
- */
308
- findFirst(options?: OptionsWithRql): Promise<Profile>;
309
- /**
310
- * Create a new profile
311
- *
312
- * Permission | Scope | Effect
313
- * - | - | -
314
- * none | | Create a profile for the current user
315
- * `CREATE_PROFILES` | `global` | Create a profile for any user
316
- * @param requestBody ProfileCreation
317
- * @returns Profile
318
- * @throws {ProfileAlreadyExistsError}
319
- */
320
- create(requestBody: ProfileCreation, options?: OptionsBase): Promise<Profile>;
321
- /**
322
- * Update an existing profile
323
- *
324
- * Permission | Scope | Effect
325
- * - | - | -
326
- * none | | Update your profile
327
- * `UPDATE_PROFILES` | `staff enlistment` | Update the profile of any group member
328
- * `UPDATE_PROFILES` | `global` | Update any profile
329
- * @param rql Add filters to the requested list, **required**.
330
- * @param requestBody The Profile data to update
331
- * @returns AffectedRecords
332
- */
333
- update(rql: RQLString, requestBody: Profile, options?: OptionsBase): Promise<AffectedRecords>;
334
- /**
335
- * Remove a given field from all profile records
336
- *
337
- * To make a selection of profiles, use RQL.
338
- * Permission | Scope | Effect
339
- * - | - | -
340
- * none | | Remove a given field from your profile
341
- * `UPDATE_PROFILES` | `staff enlistment` | Remove a given field from any group member
342
- * `UPDATE_PROFILES` | `global` | Remove a given field from any profile
343
- * @param rql Add filters to the requested list, **required**.
344
- * @param requestBody the list of fields to remove
345
- * @returns AffectedRecords
346
- * @throws {RemoveFieldError}
347
- */
348
- removeFields(rql: RQLString, requestBody: {
349
- fields: Array<string>;
350
- }, options?: OptionsBase): Promise<AffectedRecords>;
351
- /**
352
- * Retrieve a list of all the defined comorbidities
353
- *
354
- * Permission | Scope | Effect
355
- * - | - | -
356
- * none | | Everyone can use this endpoint
357
- * @returns PagedResult<Comorbidities>
358
- */
359
- getComorbidities(options?: OptionsBase): Promise<PagedResult<Comorbidities>>;
360
- /**
361
- * Retrieve a list of all the defined impediments
362
- *
363
- * Permission | Scope | Effect
364
- * - | - | -
365
- * none | | Everyone can use this endpoint
366
- * @returns PagedResult<Impediments>
367
- */
368
- getImpediments(options?: OptionsBase): Promise<PagedResult<Impediments>>;
369
- }
1
+ import { RQLString } from '../../rql';
2
+ import { FindAllIterator } from '../../services/helpers';
3
+ import { AffectedRecords, ObjectId, OptionsBase, OptionsWithRql, PagedResult } from '../types';
4
+ export interface Profile {
5
+ id: ObjectId;
6
+ addressLine1?: string;
7
+ addressLine2?: string;
8
+ country: string;
9
+ region?: string;
10
+ city?: string;
11
+ postalCode?: string;
12
+ birthday: string;
13
+ /**
14
+ * See ISO 5218
15
+ */
16
+ gender: number;
17
+ length?: number;
18
+ weight?: number;
19
+ afHistory?: boolean;
20
+ comorbidities?: Array<Comorbidities>;
21
+ physician?: string;
22
+ smoker?: boolean;
23
+ activity?: ProfileActivity;
24
+ impediments?: Array<Impediments>;
25
+ medication?: Array<Medication>;
26
+ groups?: Array<Group>;
27
+ customFields?: Record<string, string>;
28
+ fibricheckInfo?: {
29
+ app?: {
30
+ version?: string;
31
+ build?: string;
32
+ branch?: string;
33
+ };
34
+ device?: {
35
+ os?: string;
36
+ model?: string;
37
+ type?: 'android' | 'ios';
38
+ manufacturer?: string;
39
+ };
40
+ };
41
+ creationTimestamp?: Date;
42
+ updateTimestamp?: Date;
43
+ }
44
+ export declare type ProfileCreation = Pick<Profile, 'id' | 'country' | 'region' | 'birthday' | 'gender'>;
45
+ export declare type ProfileUpdate = Partial<Omit<Profile, 'id' | 'groups' | 'medication' | 'creationTimestamp' | 'updateTimestamp'>>;
46
+ export declare enum ProfileActivity {
47
+ NOT_ACTIVE = "NOT_ACTIVE",
48
+ SLIGHTLY_ACTIVE = "SLIGHTLY_ACTIVE",
49
+ MODERATELY_ACTIVE = "MODERATELY_ACTIVE",
50
+ ACTIVE = "ACTIVE",
51
+ VERY_ACTIVE = "VERY_ACTIVE"
52
+ }
53
+ export declare enum Comorbidities {
54
+ HEART_FAILURE = "HEART_FAILURE",
55
+ DIABETES = "DIABETES",
56
+ COPD = "COPD",
57
+ HYPERTENSION = "HYPERTENSION",
58
+ VASCULAR_DISEASE = "VASCULAR_DISEASE",
59
+ HISTORY_OF_TIA_STROKE = "HISTORY_OF_TIA_STROKE"
60
+ }
61
+ export declare enum Impediments {
62
+ TREMOR = "TREMOR",
63
+ PERNIOSIS = "PERNIOSIS",
64
+ CALLUS = "CALLUS"
65
+ }
66
+ export interface Medication {
67
+ name: string;
68
+ dosis: {
69
+ number?: number;
70
+ unit?: MedicationUnit;
71
+ };
72
+ medicationFrequency?: MedicationFrequency;
73
+ count: number;
74
+ }
75
+ export declare enum MedicationUnit {
76
+ MG = "mg",
77
+ ML = "ml",
78
+ PILL = "pill"
79
+ }
80
+ export declare enum MedicationFrequency {
81
+ AS_NEEDED = "AS_NEEDED",
82
+ EVERY_DAY = "EVERY_DAY",
83
+ EVERY_WEEK = "EVERY_WEEK",
84
+ EVERY_MONTH = "EVERY_MONTH",
85
+ BIRTH_CONTROL = "BIRTH_CONTROL"
86
+ }
87
+ export interface Group {
88
+ groupId: ObjectId;
89
+ reason?: string;
90
+ /**
91
+ * This serves as a field to link a patient to the medical record of a hospital/physician. This field therefor accepts any string, not just an ObjectId.
92
+ *
93
+ */
94
+ patientId?: string;
95
+ customFields?: Record<string, string>;
96
+ }
97
+ export declare type GroupCreation = Group;
98
+ export interface LogEntry {
99
+ id?: ObjectId;
100
+ profileId?: ObjectId;
101
+ groupId?: ObjectId;
102
+ userId?: ObjectId;
103
+ text?: string;
104
+ creationTimestamp?: Date;
105
+ updateTimestamp?: Date;
106
+ }
107
+ export interface ProfileComment {
108
+ text: string;
109
+ }
110
+ export interface ProfilesGroupsService {
111
+ /**
112
+ * Add a group enlistment to a profile
113
+ *
114
+ * Permission | Scope | Effect
115
+ * - | - | -
116
+ * none | | Add a group enlistment for your profile only
117
+ * `ADD_PATIENT` | `staff enlistment` | Add a group enlistment for any profile of this group
118
+ * `ADD_PATIENT` & `ACTIVATE_PRESCRIPTIONS` | `global` | Add a group enlistment for any profile for any group
119
+ * @param profileId Id of the targeted profile
120
+ * @param requestBody Group data
121
+ * @returns Group
122
+ * @throws {ResourceAlreadyExistsError}
123
+ * @throws {ResourceUnknownError}
124
+ */
125
+ create(profileId: ObjectId, requestBody: GroupCreation, options?: OptionsBase): Promise<Group>;
126
+ /**
127
+ * Update a group enlistment on a profile
128
+ *
129
+ * Permission | Scope | Effect
130
+ * - | - | -
131
+ * `UPDATE_PROFILES` | `staff enlistment` | Update a group enlistment for any profile for this group
132
+ * `UPDATE_PROFILES` | `global` | Update a group enlistment for any profile for any group
133
+ * @param profileId Id of the targeted profile
134
+ * @param groupId Id of the targeted group
135
+ * @param requestBody Group data to update
136
+ * @returns Group
137
+ * @throws {ResourceUnknownError}
138
+ */
139
+ update(profileId: ObjectId, groupId: ObjectId, requestBody: Omit<Group, 'groupId'>, options?: OptionsBase): Promise<Group>;
140
+ /**
141
+ * Delete a group from a profile
142
+ *
143
+ * Permission | Scope | Effect
144
+ * - | - | -
145
+ * none | | Delete a group from your profile only
146
+ * `UPDATE_PROFILES` | `staff enlistment` | Delete a group from any profile in this group
147
+ * `UPDATE_PROFILES` | `global` | Delete a group from any profile in any group
148
+ * @param profileId Id of the targeted profile
149
+ * @param groupId Id of the targeted group
150
+ * @returns AffectedRecords
151
+ * @throws {ResourceUnknownError}
152
+ */
153
+ remove(profileId: ObjectId, groupId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
154
+ /**
155
+ * Remove a field on a group enlistment object in a profile
156
+ *
157
+ * Permission | Scope | Effect
158
+ * - | - | -
159
+ * `UPDATE_PROFILES` | `staff enlistment` | Remove a field for this group
160
+ * `UPDATE_PROFILES` | `global` | Remove a field for any group
161
+ * @param profileId Id of the targeted profile
162
+ * @param groupId Id of the targeted group
163
+ * @param requestBody list of fields to remove
164
+ * @returns Group
165
+ * @throws {ResourceUnknownError}
166
+ */
167
+ removeFields(profileId: ObjectId, groupId: ObjectId, requestBody: {
168
+ fields: Array<string>;
169
+ }, options?: OptionsBase): Promise<Group>;
170
+ }
171
+ export interface ProfilesLogsService {
172
+ /**
173
+ * Create a profile log entry
174
+ *
175
+ * Permission | Scope | Effect
176
+ * - | - | -
177
+ * `CREATE_PROFILE_LOG_ENTRIES` | `staff enlistment` | Create a log entry for any profile of this group
178
+ * `CREATE_PROFILE_LOG_ENTRIES` | `global` | Create a log entry for any profile of any group
179
+ * @param profileId Id of the targeted profile
180
+ * @param groupId Id of the targeted group
181
+ * @param requestBody ProfileComment
182
+ * @returns LogEntry
183
+ * @throws {ResourceUnknownError}
184
+ */
185
+ create(profileId: ObjectId, groupId: ObjectId, requestBody: ProfileComment, options?: OptionsBase): Promise<LogEntry>;
186
+ /**
187
+ * Retrieve all profile log entries
188
+ *
189
+ * Permission | Scope | Effect
190
+ * - | - | -
191
+ * `VIEW_PROFILE_LOG_ENTRIES` | `staff enlistment` | Retrieve a list of log entries for any profile of this group
192
+ * `VIEW_PROFILE_LOG_ENTRIES` | `global` | Retrieve a list of log entries for any profile of any group
193
+ * @param profileId Id of the targeted profile
194
+ * @param groupId Id of the targeted group
195
+ * @param rql Add filters to the requested list.
196
+ * @returns PagedResult<LogEntry>
197
+ * @throws {ResourceUnknownError}
198
+ */
199
+ find(profileId: ObjectId, groupId: ObjectId, options?: OptionsWithRql): Promise<PagedResult<LogEntry>>;
200
+ /**
201
+ * Request a list of all profile log entries
202
+ *
203
+ * Do not pass in an rql with limit operator!
204
+ *
205
+ * Permission | Scope | Effect
206
+ * - | - | -
207
+ * `VIEW_PROFILE_LOG_ENTRIES` | `staff enlistment` | Retrieve a list of log entries for any profile of this group
208
+ * `VIEW_PROFILE_LOG_ENTRIES` | `global` | Retrieve a list of log entries for any profile of any group
209
+ * @param profileId Id of the targeted profile
210
+ * @param groupId Id of the targeted group
211
+ * @param rql Add filters to the requested list.
212
+ * @returns LogEntry[]
213
+ */
214
+ findAll(profileId: ObjectId, groupId: ObjectId, options?: OptionsWithRql): Promise<LogEntry[]>;
215
+ /**
216
+ * Request a list of all profile log entries
217
+ *
218
+ * Permission | Scope | Effect
219
+ * - | - | -
220
+ * `VIEW_PROFILE_LOG_ENTRIES` | `staff enlistment` | Retrieve a list of log entries for any profile of this group
221
+ * `VIEW_PROFILE_LOG_ENTRIES` | `global` | Retrieve a list of log entries for any profile of any group
222
+ * @param profileId Id of the targeted profile
223
+ * @param groupId Id of the targeted group
224
+ * @param rql Add filters to the requested list.
225
+ * @returns LogEntry[]
226
+ */
227
+ findAllIterator(profileId: ObjectId, groupId: ObjectId, options?: OptionsWithRql): FindAllIterator<LogEntry>;
228
+ /**
229
+ * Update a profile log entry
230
+ *
231
+ * Permission | Scope | Effect
232
+ * - | - | -
233
+ * `CREATE_PROFILE_LOG_ENTRIES` | `staff enlistment` | Update a log entry, created by the current user, for any profile of this group
234
+ * `CREATE_PROFILE_LOG_ENTRIES` | `global` | Update a log entry, created by the current user, for any profile of any group
235
+ * @param profileId Id of the targeted profile
236
+ * @param groupId Id of the targeted group
237
+ * @param entryId Id of the targeted log entry
238
+ * @param requestBody ProfileComment
239
+ * @returns LogEntry
240
+ * @throws {ResourceUnknownError}
241
+ */
242
+ update(profileId: ObjectId, groupId: ObjectId, entryId: ObjectId, requestBody: ProfileComment, options?: OptionsBase): Promise<LogEntry>;
243
+ /**
244
+ * Delete a profile log entry
245
+ *
246
+ * Permission | Scope | Effect
247
+ * - | - | -
248
+ * `CREATE_PROFILE_LOG_ENTRIES` | `staff enlistment` | Delete a log entry, created by the current user, for any profile of this group
249
+ * `CREATE_PROFILE_LOG_ENTRIES` | `global` | Delete a log entry, created by the current user, for any profile of any group
250
+ * @param profileId Id of the targeted profile
251
+ * @param groupId Id of the targeted group
252
+ * @param entryId Id of the targeted log entry
253
+ * @returns AffectedRecords
254
+ * @throws {ResourceUnknownError}
255
+ */
256
+ remove(profileId: ObjectId, groupId: ObjectId, entryId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
257
+ }
258
+ export interface ProfilesService {
259
+ /**
260
+ * Get a list of profiles
261
+ *
262
+ * Permission | Scope | Effect
263
+ * - | - | -
264
+ * none | | View your profile
265
+ * none | `staff enlistment` | View all the profiles of the group
266
+ * `VIEW_PATIENTS` | `global` | View all profiles
267
+ * @param rql an optional rql string
268
+ * @returns PagedResult<Profile>
269
+ */
270
+ find(options?: OptionsWithRql): Promise<PagedResult<Profile>>;
271
+ /**
272
+ * Request a list of all profiles
273
+ *
274
+ * Do not pass in an rql with limit operator!
275
+ *
276
+ * Permission | Scope | Effect
277
+ * - | - | -
278
+ * none | | View your profile
279
+ * none | `staff enlistment` | View all the profiles of the group
280
+ * `VIEW_PATIENTS` | `global` | View all profiles
281
+ * @param rql Add filters to the requested list.
282
+ * @returns Profile[]
283
+ */
284
+ findAll(options?: OptionsWithRql): Promise<Profile[]>;
285
+ /**
286
+ * Request a list of all profiles
287
+ *
288
+ * Permission | Scope | Effect
289
+ * - | - | -
290
+ * none | | View your profile
291
+ * none | `staff enlistment` | View all the profiles of the group
292
+ * `VIEW_PATIENTS` | `global` | View all profiles
293
+ * @param rql Add filters to the requested list.
294
+ * @returns Profile[]
295
+ */
296
+ findAllIterator(options?: OptionsWithRql): FindAllIterator<Profile>;
297
+ /**
298
+ * Find By Id
299
+ * @param id the Id to search for
300
+ * @param rql an optional rql string
301
+ * @returns the first element found
302
+ */
303
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<Profile>;
304
+ /**
305
+ * Find First
306
+ * @param rql an optional rql string
307
+ * @returns the first element found
308
+ */
309
+ findFirst(options?: OptionsWithRql): Promise<Profile>;
310
+ /**
311
+ * Create a new profile
312
+ *
313
+ * Permission | Scope | Effect
314
+ * - | - | -
315
+ * none | | Create a profile for the current user
316
+ * `CREATE_PROFILES` | `global` | Create a profile for any user
317
+ * @param requestBody ProfileCreation
318
+ * @returns Profile
319
+ * @throws {ProfileAlreadyExistsError}
320
+ */
321
+ create(requestBody: ProfileCreation, options?: OptionsBase): Promise<Profile>;
322
+ /**
323
+ * Update an existing profile
324
+ *
325
+ * Permission | Scope | Effect
326
+ * - | - | -
327
+ * none | | Update your profile
328
+ * `UPDATE_PROFILES` | `staff enlistment` | Update the profile of any group member
329
+ * `UPDATE_PROFILES` | `global` | Update any profile
330
+ * @param rql Add filters to the requested list, **required**.
331
+ * @param requestBody The Profile data to update
332
+ * @returns AffectedRecords
333
+ */
334
+ update(rql: RQLString, requestBody: ProfileUpdate, options?: OptionsBase): Promise<AffectedRecords>;
335
+ /**
336
+ * Remove a given field from all profile records
337
+ *
338
+ * To make a selection of profiles, use RQL.
339
+ * Permission | Scope | Effect
340
+ * - | - | -
341
+ * none | | Remove a given field from your profile
342
+ * `UPDATE_PROFILES` | `staff enlistment` | Remove a given field from any group member
343
+ * `UPDATE_PROFILES` | `global` | Remove a given field from any profile
344
+ * @param rql Add filters to the requested list, **required**.
345
+ * @param requestBody the list of fields to remove
346
+ * @returns AffectedRecords
347
+ * @throws {RemoveFieldError}
348
+ */
349
+ removeFields(rql: RQLString, requestBody: {
350
+ fields: Array<string>;
351
+ }, options?: OptionsBase): Promise<AffectedRecords>;
352
+ /**
353
+ * Retrieve a list of all the defined comorbidities
354
+ *
355
+ * Permission | Scope | Effect
356
+ * - | - | -
357
+ * none | | Everyone can use this endpoint
358
+ * @returns PagedResult<Comorbidities>
359
+ */
360
+ getComorbidities(options?: OptionsBase): Promise<PagedResult<Comorbidities>>;
361
+ /**
362
+ * Retrieve a list of all the defined impediments
363
+ *
364
+ * Permission | Scope | Effect
365
+ * - | - | -
366
+ * none | | Everyone can use this endpoint
367
+ * @returns PagedResult<Impediments>
368
+ */
369
+ getImpediments(options?: OptionsBase): Promise<PagedResult<Impediments>>;
370
+ }