oro-sdk 2.1.4-dev1

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 (72) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +72 -0
  3. package/dist/client.d.ts +464 -0
  4. package/dist/helpers/client.d.ts +23 -0
  5. package/dist/helpers/index.d.ts +4 -0
  6. package/dist/helpers/patient-registration.d.ts +16 -0
  7. package/dist/helpers/vault-grants.d.ts +20 -0
  8. package/dist/helpers/workflow.d.ts +23 -0
  9. package/dist/index.d.ts +11 -0
  10. package/dist/index.js +8 -0
  11. package/dist/models/client.d.ts +28 -0
  12. package/dist/models/consult.d.ts +102 -0
  13. package/dist/models/diagnosis.d.ts +122 -0
  14. package/dist/models/error.d.ts +26 -0
  15. package/dist/models/guard.d.ts +119 -0
  16. package/dist/models/index.d.ts +9 -0
  17. package/dist/models/practice.d.ts +353 -0
  18. package/dist/models/shared.d.ts +8 -0
  19. package/dist/models/vault.d.ts +124 -0
  20. package/dist/models/workflow.d.ts +106 -0
  21. package/dist/oro-sdk.cjs.development.js +7685 -0
  22. package/dist/oro-sdk.cjs.development.js.map +1 -0
  23. package/dist/oro-sdk.cjs.production.min.js +2 -0
  24. package/dist/oro-sdk.cjs.production.min.js.map +1 -0
  25. package/dist/oro-sdk.esm.js +7692 -0
  26. package/dist/oro-sdk.esm.js.map +1 -0
  27. package/dist/sdk-revision/client.d.ts +21 -0
  28. package/dist/sdk-revision/index.d.ts +1 -0
  29. package/dist/services/api.d.ts +11 -0
  30. package/dist/services/axios.d.ts +14 -0
  31. package/dist/services/consult.d.ts +54 -0
  32. package/dist/services/diagnosis.d.ts +44 -0
  33. package/dist/services/external/clinia.d.ts +82 -0
  34. package/dist/services/external/index.d.ts +1 -0
  35. package/dist/services/guard.d.ts +92 -0
  36. package/dist/services/index.d.ts +10 -0
  37. package/dist/services/practice.d.ts +100 -0
  38. package/dist/services/teller.d.ts +9 -0
  39. package/dist/services/vault.d.ts +54 -0
  40. package/dist/services/workflow.d.ts +21 -0
  41. package/package.json +63 -0
  42. package/src/client.ts +1843 -0
  43. package/src/helpers/client.ts +199 -0
  44. package/src/helpers/index.ts +4 -0
  45. package/src/helpers/patient-registration.ts +490 -0
  46. package/src/helpers/vault-grants.ts +51 -0
  47. package/src/helpers/workflow.ts +261 -0
  48. package/src/index.ts +61 -0
  49. package/src/models/client.ts +33 -0
  50. package/src/models/consult.ts +110 -0
  51. package/src/models/diagnosis.ts +141 -0
  52. package/src/models/error.ts +13 -0
  53. package/src/models/guard.ts +136 -0
  54. package/src/models/index.ts +9 -0
  55. package/src/models/practice.ts +411 -0
  56. package/src/models/shared.ts +6 -0
  57. package/src/models/vault.ts +158 -0
  58. package/src/models/workflow.ts +142 -0
  59. package/src/sdk-revision/client.ts +62 -0
  60. package/src/sdk-revision/index.ts +1 -0
  61. package/src/services/api.ts +77 -0
  62. package/src/services/axios.ts +91 -0
  63. package/src/services/consult.ts +265 -0
  64. package/src/services/diagnosis.ts +144 -0
  65. package/src/services/external/clinia.ts +133 -0
  66. package/src/services/external/index.ts +1 -0
  67. package/src/services/guard.ts +228 -0
  68. package/src/services/index.ts +10 -0
  69. package/src/services/practice.ts +537 -0
  70. package/src/services/teller.ts +39 -0
  71. package/src/services/vault.ts +178 -0
  72. package/src/services/workflow.ts +36 -0
@@ -0,0 +1,136 @@
1
+ import { Uuid, Base64String, TokenData, RFC3339Date, Url } from './'
2
+
3
+ export type AuthRefreshFunc = (
4
+ refreshToken?: string
5
+ ) => Promise<AuthTokenResponse>
6
+ export interface Tokens {
7
+ accessToken?: string
8
+ refreshToken?: string
9
+ }
10
+ export interface AuthTokenRequest {
11
+ practiceUuid: string
12
+ email: string
13
+ password: Base64String
14
+ otp?: string
15
+ }
16
+
17
+ export interface AuthTokenResponse {
18
+ accessToken: string
19
+ tokenType: string
20
+ refreshToken: string
21
+ expiresIn: number
22
+ }
23
+
24
+ export interface AuthRecoverRequest {
25
+ practiceUuid: string
26
+ email: string
27
+ }
28
+
29
+ export interface WhoAmIResponse {
30
+ aud: string
31
+ exp: number
32
+ jti: string
33
+ iat: number
34
+ iss: string
35
+ nbf: number
36
+ sub: string
37
+ scope: string // Whitespace separated list of practice AllTypeRole
38
+ email: string
39
+ practice: string
40
+ }
41
+
42
+ export interface IdentityCreateRequest {
43
+ practiceUuid: Uuid
44
+ email: string
45
+ password: Base64String
46
+ publicKey: Base64String
47
+ recoveryPassword: Base64String
48
+ tosAndCpAcceptance: TosAndCpAcceptanceRequest
49
+ tokenData?: TokenData
50
+ subscription?: boolean
51
+ }
52
+
53
+ export interface TosAndCpAcceptanceRequest {
54
+ tosVersion: string
55
+ cpVersion: string
56
+ }
57
+
58
+ export interface IdentityResponse {
59
+ id: Uuid
60
+ practiceUuid?: Uuid
61
+ email?: string
62
+ emailConfirmed: boolean
63
+ tokenData?: TokenData
64
+ mfaEnabled?: boolean
65
+ mfaSecret?: Base64String
66
+ publicKey: Base64String
67
+ recoveryLogin?: Uuid
68
+ recoveryPassword: Base64String
69
+ recoveryMasterKey: Base64String
70
+ recoverySecurityQuestions: SecretShard[]
71
+ legal?: LegalData
72
+ createdAt?: string
73
+ updatedAt?: string
74
+ //TODO: remove me when https://github.com/OROHealth/oro-guard/pull/72 is merged
75
+ refreshToken?: string
76
+ }
77
+
78
+ export interface IdentityUpdateRequest {
79
+ emailConfirmed?: boolean
80
+ password?: PasswordUpdateRequest
81
+ mfaEnable?: MFAEnableRequest
82
+ recoveryPassword?: Base64String
83
+ recoveryMasterKey?: Base64String
84
+ recoverySecurityQuestions?: SecretShard[]
85
+ tokenData?: TokenData
86
+ epAcceptance?: EpAcceptanceRequest
87
+ rpAcceptance?: RpAcceptanceRequest
88
+ }
89
+
90
+ export interface EpAcceptanceRequest {
91
+ epVersion: string
92
+ }
93
+
94
+ export interface RpAcceptanceRequest {
95
+ rpVersion: string
96
+ }
97
+
98
+ export interface PasswordUpdateRequest {
99
+ oldPassword?: Base64String
100
+ newPassword: Base64String
101
+ }
102
+
103
+ export interface QRCodeRequest {
104
+ password: Base64String
105
+ }
106
+ export interface QRCodeResponse {
107
+ url: string
108
+ qrContentType: string
109
+ qrBytes: Base64String
110
+ }
111
+
112
+ export interface MFAEnableRequest {
113
+ password: Base64String
114
+ otp: string
115
+ }
116
+ export interface SecretShard {
117
+ securityQuestion: string
118
+ securityAnswer?: string
119
+ nonce: Base64String
120
+ encryptedShare: Base64String
121
+ }
122
+
123
+ export interface LegalData {
124
+ tosAcceptedAtTime?: RFC3339Date
125
+ tosAcceptedVersion: Url
126
+ tosAcceptedAtIP?: string
127
+ cpAcceptedAtTime?: RFC3339Date
128
+ cpAcceptedVersion: Url
129
+ cpAcceptedAtIP?: string
130
+ epAcceptedAtTime?: RFC3339Date
131
+ epAcceptedVersion: Url
132
+ epAcceptedAtIP?: string
133
+ rpAcceptedAtTime?: RFC3339Date
134
+ rpAcceptedVersion: Url
135
+ rpAcceptedAtIP?: string
136
+ }
@@ -0,0 +1,9 @@
1
+ export * from './client'
2
+ export * from './consult'
3
+ export * from './diagnosis'
4
+ export * from './error'
5
+ export * from './guard'
6
+ export * from './practice'
7
+ export * from './shared'
8
+ export * from './vault'
9
+ export * from './workflow'
@@ -0,0 +1,411 @@
1
+ export enum WorkflowType {
2
+ Onboard = 'Onboard',
3
+ Followup = 'Followup',
4
+ Renew = 'Renew',
5
+ DataRetrieve = 'DataRetrieve',
6
+ }
7
+
8
+ export enum RateDimension {
9
+ RatioOnTotal = 'RatioOnTotal',
10
+ FixedOnTotal = 'FixedOnTotal',
11
+ RatioPlatformFee = 'RatioPlatformFee',
12
+ FixedPlatformFee = 'FixedPlatformFee',
13
+ RatioOnPlatformFeeTotal = 'RatioOnPlatformFeeTotal',
14
+ FixedOnPlatformFeeTotal = 'FixedOnPlatformFeeTotal',
15
+ RatioOnItem = 'RatioOnItem',
16
+ FixedOnItem = 'FixedOnItem',
17
+ }
18
+
19
+ export enum PlanType {
20
+ Onboard = 'Onboard',
21
+ Followup = 'Followup',
22
+ Renew = 'Renew',
23
+ DataRetrieve = 'DataRetrieve',
24
+ }
25
+
26
+ export enum PaymentStatus {
27
+ Pending = 'Pending',
28
+ Success = 'Success',
29
+ Failure = 'Failure',
30
+ Canceled = 'Canceled',
31
+ }
32
+
33
+ export enum PractitionerStatus {
34
+ Practicing = 'Practicing',
35
+ Retired = 'Retired',
36
+ NotInvolvedAnymore = 'NotInvolvedAnymore',
37
+ Deactivated = 'Deactivated',
38
+ Flagged = 'Flagged',
39
+ InConflict = 'InConflict',
40
+ Delicensed = 'Delicensed',
41
+ }
42
+
43
+ export enum AssignmentStatus {
44
+ Assigned = 'Assigned',
45
+ Reassigned = 'Reassigned',
46
+ Cancelled = 'Cancelled',
47
+ }
48
+
49
+ export enum PractitionnerRoleType {
50
+ Doctor = 'Doctor',
51
+ MedicalAssistant = 'MedicalAssistant',
52
+ MedicalSecretary = 'MedicalSecretary',
53
+ Nurse = 'Nurse',
54
+ Specialist = 'Specialist',
55
+ LabAssistant = 'LabAssistant',
56
+ Administrative = 'Administrative',
57
+ ManualDispatcher = 'ManualDispatcher',
58
+ Other = 'Other',
59
+ }
60
+
61
+ export enum OtherRoleType {
62
+ Patient = 'Patient',
63
+ User = 'User',
64
+ System = 'System',
65
+ }
66
+
67
+ export type AllRoleType = OtherRoleType | PractitionnerRoleType
68
+
69
+ export enum LicenseStatus {
70
+ Valid = 'Valid',
71
+ Invalid = 'Invalid',
72
+ Expired = 'Expired',
73
+ NA = 'NA',
74
+ Removed = 'Removed',
75
+ }
76
+
77
+ export enum PeriodType {
78
+ PerYear = 'PerYear',
79
+ PerQuarter = 'PerQuarter',
80
+ PerMonth = 'PerMonth',
81
+ PerWeek = 'PerWeek',
82
+ PerBusinessDay = 'PerBusinessDay',
83
+ PerDay = 'PerDay',
84
+ PerHour = 'PerHour',
85
+ }
86
+
87
+ export enum SyncStatus {
88
+ Requested = 'Requested',
89
+ Started = 'Started',
90
+ Succeeded = 'Succeeded',
91
+ Failed = 'Failed',
92
+ Cancelled = 'Cancelled',
93
+ }
94
+
95
+ export enum PracticeEmailKind {
96
+ SignedUp = 'SignedUp',
97
+ Onboarded = 'Onboarded',
98
+ OnboardedPractitioner = 'OnboardedPractitioner',
99
+ OnboardedPatient = 'OnboardedPatient',
100
+ Answered = 'Answered',
101
+ ToAnswer = 'ToAnswer',
102
+ FollowedUp = 'FollowedUp',
103
+ Renewed = 'Renewed',
104
+ DataRetrieved = 'DataRetrieved',
105
+ }
106
+
107
+ export interface PracticeAccount {
108
+ id?: number ///optional for insertion
109
+ uuidPractice: string
110
+ isoLocality?: string
111
+ idStripeAccount?: string
112
+ emailBillingContact: string
113
+ urlSubdomain?: string
114
+ }
115
+
116
+ export enum PracticeConfigKind {
117
+ PractitionerConsultList = 'PractitionerConsultList',
118
+ PractitionerChatbox = 'PractitionerChatbox',
119
+ PracticeTheme = 'PracticeTheme',
120
+ PracticeLocaleSwitcher = 'PracticeLocaleSwitcher',
121
+ PracticeCookieBanner = 'PracticeCookieBanner',
122
+ }
123
+
124
+ export interface PracticeConfig<K, T> {
125
+ uuidPractice: string
126
+ kind: K // PracticeConfigKind
127
+ config: T
128
+ }
129
+
130
+ export type PracticeConfigPractitionerConsultList = PracticeConfig<
131
+ PracticeConfigKind.PractitionerConsultList,
132
+ {
133
+ hideLocality?: boolean
134
+ hideFax?: boolean
135
+ hideExpiresAt?: boolean
136
+ }
137
+ >
138
+
139
+ export type PracticeConfigPracticeLocaleSwitcher = PracticeConfig<
140
+ PracticeConfigKind.PracticeLocaleSwitcher,
141
+ {
142
+ hideLocaleSwitcher?: boolean
143
+ }
144
+ >
145
+
146
+ export type PracticeConfigPractitionerChatbox = PracticeConfig<
147
+ PracticeConfigKind.PractitionerChatbox,
148
+ {
149
+ planAddedMessage?: { [languageISO639_3: string]: string }
150
+ planUpdatedMessage?: { [languageISO639_3: string]: string }
151
+ }
152
+ >
153
+
154
+ export type PracticeConfigPracticeCookieBanner = PracticeConfig<
155
+ PracticeConfigKind.PracticeCookieBanner,
156
+ {
157
+ showCookieBanner?: boolean
158
+ policyLink?: string
159
+ useOfCookieLink?: string
160
+ }
161
+ >
162
+
163
+ // This type is for demonstration only for now
164
+ export type PracticeConfigPracticeTheme = PracticeConfig<
165
+ PracticeConfigKind.PracticeTheme,
166
+ { primaryColor?: string }
167
+ >
168
+
169
+ export type PracticeConfigs =
170
+ | PracticeConfigPractitionerConsultList
171
+ | PracticeConfigPractitionerChatbox
172
+ | PracticeConfigPracticeLocaleSwitcher
173
+ | PracticeConfigPracticeCookieBanner
174
+ | PracticeConfigPracticeTheme // Here for demonstration only
175
+
176
+ export interface PracticeWorkflow {
177
+ id?: number ///optional for insertion
178
+ uuidPractice: string
179
+ uuidWorkflow: string
180
+ typeWorkflow: WorkflowType
181
+ tagSpecialty?: string
182
+ }
183
+
184
+ export type PracticeWorkflowWithTagSpecialty = PracticeWorkflow & {
185
+ tagSpecialty: string
186
+ }
187
+
188
+ export interface PracticePlan {
189
+ id?: number ///optional for insertion
190
+ uuidPractice: string
191
+ isoLocality?: string
192
+ nameDefault: string
193
+ descDefault: string
194
+ hoursExpiration: number
195
+ active: boolean
196
+ namePriceCurrency: string // DEPRECATED: left only for in-app receipt display and lower migration risks
197
+ numPriceAmount: number // DEPRECATED: left only for in-app receipt display and lower migration risks
198
+ numPriceExtDecimal?: number // DEPRECATED: left only for in-app receipt display and lower migration risks
199
+ numPriceExtNegativeExponential?: number // DEPRECATED: left only for in-app receipt display and lower migration risks
200
+ kind: PlanType
201
+ idStripeProduct: string
202
+ idStripePrice: string // DEPRECATED: left only for in-app receipt display and lower migration risks
203
+ dateCreatedAt: Date
204
+ dateUpdateAt: Date
205
+ ratePerThousandOverride: number // DEPRECATED: left only to lower migration risks
206
+ }
207
+
208
+ export enum StripePriceType {
209
+ Default = 'Default',
210
+ Discount = 'Discount',
211
+ }
212
+
213
+ // Subset of Stripe.Price
214
+ export interface PracticePrice {
215
+ /**
216
+ * Unique identifier for the object in Stripe.
217
+ */
218
+ idStripePrice: string
219
+ /**
220
+ * Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
221
+ */
222
+ currency: string
223
+ /**
224
+ * The unit amount in %s to be charged, represented as a whole integer if possible.
225
+ */
226
+ unitAmount: number
227
+ }
228
+
229
+ export interface PracticePlanPrices {
230
+ idPlan: number
231
+ default: PracticePrice
232
+ discount?: PracticePrice
233
+ }
234
+
235
+ export interface PracticeRate {
236
+ id?: number
237
+ uuidPractice: string
238
+ idPlan: number
239
+ isoLocality?: string
240
+ dimension: RateDimension
241
+ description: string
242
+ uidTaxRate: string
243
+ idStripeTaxRate: string
244
+ }
245
+
246
+ export interface PracticePlatformFee {
247
+ uuidPractice: string
248
+ idPlan: number
249
+ isoLocality?: string
250
+ numPlatformFinalFee: number
251
+ }
252
+
253
+ export interface PracticePayment {
254
+ id?: number ///optional for insertion
255
+ uuidPractice: string
256
+ idPlan: number
257
+ uuidConsult: string
258
+ hoursConsultExpiration: number
259
+ idStripeInvoiceOrPaymentIntent: string
260
+ status: PaymentStatus
261
+ dateCreatedAt: Date
262
+ dateUpdateAt: Date
263
+ }
264
+
265
+ export interface PracticePaymentIntent {
266
+ id?: number ///optional for insertion
267
+ uuidPractice: string
268
+ idPlan: number
269
+ idPayment: number
270
+ hoursPlanExpiration: number
271
+ isoLocality?: string
272
+ textPaymentMethodOptions: string
273
+ nameCurrency: string
274
+ numTotalAmount: number
275
+ numPlatformFeeAmount: number
276
+ idStripeInvoice: string
277
+ idStripePaymtIntent: string
278
+ stripeClientSecret: string
279
+ dateCreatedAt?: Date
280
+ dateUpdateAt?: Date
281
+ }
282
+
283
+ export interface Assignment {
284
+ id?: number ///optional for insertion
285
+ uuidPractice: string
286
+ uuidAssignor: string //defaulting for insertion to the default practice admin
287
+ uuidPractitioner?: string
288
+ status?: AssignmentStatus
289
+ uuidConsult?: string
290
+ tagSpecialty?: string
291
+ timeAssigned?: string //defaulting for insertion
292
+ }
293
+
294
+ export interface PractitionerRole {
295
+ id?: number //optional for insertion
296
+ uuidPractice: string
297
+ uuidPractitioner: string
298
+ role: PractitionnerRoleType
299
+ dateGiven?: Date //default during insertion
300
+ }
301
+
302
+ export interface PractitionerLicense {
303
+ id?: number ///optional for insertion
304
+ uuidPractitioner: string
305
+ country: string
306
+ tagSpecialty: string
307
+ isoLocality: string
308
+ txtLicenseNumber: string
309
+ txtComplementary?: string
310
+ dateProvidedAt?: Date
311
+ dateObtainedAt?: Date
312
+ dateRenewedAt?: Date
313
+ status?: LicenseStatus
314
+ }
315
+
316
+ export interface PractitionerPreference {
317
+ id?: number
318
+ uuidPractitioner: string
319
+ uuidPractice: string
320
+ tagSpecialties: string
321
+ isoLocalityConsult?: string
322
+ periodQuotaConsult?: PeriodType
323
+ quantityQuotaConsult?: number
324
+ tagConsultLanguages?: string
325
+ }
326
+
327
+ export interface PractitionerQuota {
328
+ id?: number ///optional for insertion
329
+ uuidPractitioner: string
330
+ uuidPractice: string
331
+ tagSpecialty: string
332
+ isoLocality: string
333
+ quantityLeft?: number
334
+ dateRenewal?: Date
335
+ dateLastUpdate?: Date
336
+ }
337
+
338
+ export interface Practitioner {
339
+ uuid: string
340
+ uuidPractice: string
341
+ txtFirstName: string
342
+ txtLastName: string
343
+ txtTitle: string
344
+ emailAddress: string
345
+ tagsSpecialties: string
346
+ arrLanguages: string
347
+ dateAddedAt?: Date //defaulting for insertion
348
+ status?: PractitionerStatus //defaulting for insertion
349
+ txtAddressTransmission?: string //the default non-fax address to send prescription to
350
+ }
351
+
352
+ export interface HydratedPracticeConfigs {
353
+ [PracticeConfigKind.PractitionerConsultList]?: PracticeConfigPractitionerConsultList
354
+ [PracticeConfigKind.PractitionerChatbox]?: PracticeConfigPractitionerChatbox
355
+ [PracticeConfigKind.PracticeTheme]?: PracticeConfigPracticeTheme
356
+ [PracticeConfigKind.PracticeLocaleSwitcher]?: PracticeConfigPracticeLocaleSwitcher
357
+ [PracticeConfigKind.PracticeCookieBanner]?: PracticeConfigPracticeCookieBanner
358
+ }
359
+
360
+ export interface Practice {
361
+ uuid: string
362
+ name: string
363
+ countryOperating: string
364
+ urlPractice: string
365
+ urlLinkedPage?: string
366
+ urlTos?: string
367
+ urlConfidentiality?: string
368
+ uuidAdmin: string
369
+ uuidDefaultAssigned: string
370
+ uuidDefaultFallback: string
371
+ prefDefaultLang: string
372
+ keyGoogleTagNonProd: string
373
+ keyGoogleTagProd: string
374
+ txtAddress?: string
375
+ phoneBusiness?: string
376
+ urlSupport?: string
377
+ emailSupport?: string
378
+ phoneSupport?: string
379
+ phoneFax?: string
380
+ txtTaxID?: string
381
+ txtVATID?: string
382
+ txtRegistrationID?: string
383
+ txtLegalInfos?: string
384
+ txtDefaultTransmissionDriver?: string
385
+ accounts?: PracticeAccount[]
386
+ configs?: HydratedPracticeConfigs
387
+ }
388
+
389
+ export interface Sync {
390
+ id?: number
391
+ status?: SyncStatus
392
+ descriptionStep: string
393
+ dateStarted?: Date
394
+ dateFinished?: Date
395
+ }
396
+
397
+ export interface PracticeEmail {
398
+ id?: number
399
+ uuidPractice: string
400
+ kind: PracticeEmailKind
401
+ idMailgunTemplate: string
402
+ isoLanguage: string
403
+ tags: string
404
+ }
405
+
406
+ export interface PracticeSubscription {
407
+ id?: number
408
+ uuidPractice: string
409
+ idMailChimpAudience: string
410
+ isoLanguage: string
411
+ }
@@ -0,0 +1,6 @@
1
+ export type Uuid = string
2
+ export type Url = string
3
+ export type Base64String = string
4
+ export type Metadata = { [val: string]: any }
5
+ export type TokenData = Metadata
6
+ export type RFC3339Date = string
@@ -0,0 +1,158 @@
1
+ import { Uuid, Base64String, Metadata } from './shared'
2
+ import { MetadataCategory } from './workflow'
3
+
4
+ export interface LockboxCreateResponse {
5
+ lockboxUuid: Uuid
6
+ }
7
+
8
+ export interface SharedSecretResponse {
9
+ sharedSecret: Base64String
10
+ }
11
+
12
+ export interface LockboxGrantRequest {
13
+ granteeUuid: Uuid
14
+ encryptedSecret: Base64String
15
+ }
16
+
17
+ export interface LockboxDataRequest {
18
+ publicMetadata?: Metadata
19
+ privateMetadata?: Base64String
20
+ data: Base64String
21
+ }
22
+
23
+ export type LockboxManifest = ManifestEntry[]
24
+
25
+ export interface ManifestEntry {
26
+ dataUuid: Uuid
27
+ metadata: Metadata
28
+ }
29
+
30
+ export interface GrantedLockboxes {
31
+ grants: Grant[]
32
+ }
33
+
34
+ export interface Grant {
35
+ lockboxOwnerUuid?: Uuid
36
+ encryptedLockbox?: Base64String
37
+ lockboxUuid?: Uuid
38
+ }
39
+
40
+ export interface DataCreateResponse {
41
+ dataUuid: Uuid
42
+ }
43
+
44
+ export interface DataResponse {
45
+ data: Base64String
46
+ }
47
+
48
+ export interface IndexEntry {
49
+ uuid?: Uuid
50
+ uniqueHash?: Base64String
51
+ timestamp?: Date
52
+ }
53
+
54
+ export interface IndexConsultLockbox extends IndexEntry {
55
+ consultationId: Uuid
56
+ grant: Grant
57
+ }
58
+
59
+ export interface VaultIndex extends IndexEntry {
60
+ [IndexKey.ConsultationLockbox]?: IndexConsultLockbox[] // only one should ever exist at a time
61
+ [IndexKey.Consultation]?: IndexConsultLockbox[] // DEPRECATED REMOVE ME
62
+ }
63
+
64
+ export interface EncryptedVaultIndex {
65
+ [IndexKey.Consultation]?: EncryptedIndexEntry[]
66
+ [IndexKey.ConsultationLockbox]?: EncryptedIndexEntry[]
67
+ [IndexKey.IndexSnapshot]?: EncryptedIndexEntry[]
68
+ }
69
+
70
+ export interface EncryptedIndexEntry extends IndexEntry {
71
+ encryptedIndexEntry: Base64String
72
+ }
73
+
74
+ export enum IndexKey {
75
+ Consultation = 'Consultation', //DEPRECATED REMOVE ME
76
+ IndexSnapshot = 'IndexSnapshot', //DEPRECATED REMOVE ME
77
+ ConsultationLockbox = 'ConsultationLockbox'
78
+ }
79
+
80
+ export interface Document extends ManifestEntry {
81
+ lockboxOwnerUuid?: Uuid
82
+ lockboxUuid: Uuid
83
+ }
84
+
85
+ export interface Meta {
86
+ documentType?: DocumentType
87
+ category: MetadataCategory
88
+ contentType?: string
89
+ }
90
+
91
+ export interface PreferenceMeta extends Meta {
92
+ category: MetadataCategory.Preference
93
+ contentType: 'application/json'
94
+ }
95
+
96
+ export interface RecoveryMeta extends Meta {
97
+ category: MetadataCategory.Recovery
98
+ contentType: 'application/json'
99
+ }
100
+
101
+ export interface RawConsultationMeta extends Meta {
102
+ category: MetadataCategory.Raw
103
+ contentType: 'application/json'
104
+ consultationId?: Uuid
105
+ }
106
+
107
+ export interface ConsultationMeta extends Meta {
108
+ documentType: DocumentType
109
+ category: MetadataCategory.Consultation
110
+ consultationId?: Uuid
111
+ }
112
+
113
+ export interface ConsultationImageMeta extends ConsultationMeta {
114
+ idbId: Uuid
115
+ }
116
+
117
+ export interface MedicalMeta extends Meta {
118
+ documentType:
119
+ | DocumentType.PopulatedWorkflowData
120
+ | DocumentType.Result
121
+ | DocumentType.Prescription
122
+ | DocumentType.DoctorsNote
123
+ category: MetadataCategory.Medical
124
+ consultationIds?: Uuid[]
125
+ }
126
+
127
+ export interface PersonalMeta {
128
+ documentType: DocumentType.PopulatedWorkflowData | DocumentType.Note
129
+ category:
130
+ | MetadataCategory.Personal
131
+ | MetadataCategory.ChildPersonal
132
+ | MetadataCategory.OtherPersonal
133
+ consultationIds?: Uuid[]
134
+ }
135
+
136
+ export enum DocumentType {
137
+ Message = 'Message',
138
+ Note = 'Note',
139
+ DoctorsNote = 'DoctorsNote',
140
+ Prescription = 'Prescription',
141
+ ExamRequest = 'ExamRequest',
142
+ Result = 'Result',
143
+ Attachment = 'Attachment',
144
+ BigFile = 'BigFile',
145
+ MeetingRequest = 'MeetingRequest',
146
+ AudioNote = 'AudioNote',
147
+ VideoNote = 'VideoNote',
148
+ PopulatedWorkflowData = 'PopulatedWorkflowData',
149
+ TreatmentPlan = 'TreatmentPlan',
150
+ ImageAlias = 'ImageAlias',
151
+ }
152
+
153
+ export interface LocalizedData<T = any> {
154
+ lockboxOwnerUuid?: string
155
+ lockboxUuid: string
156
+ dataUuid: string
157
+ data: T
158
+ }