oro-sdk 2.1.4-dev1.0 → 2.2.1

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 (63) hide show
  1. package/README.md +26 -34
  2. package/dist/client.d.ts +4 -4
  3. package/dist/helpers/client.d.ts +1 -1
  4. package/dist/helpers/patient-registration.d.ts +1 -1
  5. package/dist/helpers/vault-grants.d.ts +1 -1
  6. package/dist/helpers/workflow.d.ts +1 -1
  7. package/dist/index.d.ts +15 -1
  8. package/dist/models/client.d.ts +1 -1
  9. package/dist/models/error.d.ts +0 -14
  10. package/dist/models/index.d.ts +0 -7
  11. package/dist/oro-sdk.cjs.development.js +313 -2367
  12. package/dist/oro-sdk.cjs.development.js.map +1 -1
  13. package/dist/oro-sdk.cjs.production.min.js +1 -1
  14. package/dist/oro-sdk.cjs.production.min.js.map +1 -1
  15. package/dist/oro-sdk.esm.js +246 -2344
  16. package/dist/oro-sdk.esm.js.map +1 -1
  17. package/dist/sdk-revision/client.d.ts +2 -2
  18. package/dist/services/index.d.ts +0 -9
  19. package/package.json +4 -1
  20. package/src/client.ts +161 -435
  21. package/src/helpers/client.ts +1 -1
  22. package/src/helpers/patient-registration.ts +85 -166
  23. package/src/helpers/vault-grants.ts +1 -1
  24. package/src/helpers/workflow.ts +21 -59
  25. package/src/index.ts +42 -28
  26. package/src/models/client.ts +1 -1
  27. package/src/models/error.ts +6 -13
  28. package/src/models/index.ts +0 -7
  29. package/src/sdk-revision/client.ts +25 -20
  30. package/src/services/external/clinia.ts +1 -1
  31. package/src/services/index.ts +0 -9
  32. package/dist/models/consult.d.ts +0 -102
  33. package/dist/models/diagnosis.d.ts +0 -122
  34. package/dist/models/guard.d.ts +0 -119
  35. package/dist/models/practice.d.ts +0 -353
  36. package/dist/models/shared.d.ts +0 -8
  37. package/dist/models/vault.d.ts +0 -124
  38. package/dist/models/workflow.d.ts +0 -106
  39. package/dist/services/api.d.ts +0 -11
  40. package/dist/services/axios.d.ts +0 -14
  41. package/dist/services/consult.d.ts +0 -54
  42. package/dist/services/diagnosis.d.ts +0 -44
  43. package/dist/services/guard.d.ts +0 -92
  44. package/dist/services/practice.d.ts +0 -100
  45. package/dist/services/teller.d.ts +0 -9
  46. package/dist/services/vault.d.ts +0 -54
  47. package/dist/services/workflow.d.ts +0 -21
  48. package/src/models/consult.ts +0 -110
  49. package/src/models/diagnosis.ts +0 -141
  50. package/src/models/guard.ts +0 -136
  51. package/src/models/practice.ts +0 -411
  52. package/src/models/shared.ts +0 -6
  53. package/src/models/vault.ts +0 -158
  54. package/src/models/workflow.ts +0 -142
  55. package/src/services/api.ts +0 -77
  56. package/src/services/axios.ts +0 -91
  57. package/src/services/consult.ts +0 -265
  58. package/src/services/diagnosis.ts +0 -144
  59. package/src/services/guard.ts +0 -228
  60. package/src/services/practice.ts +0 -537
  61. package/src/services/teller.ts +0 -39
  62. package/src/services/vault.ts +0 -178
  63. package/src/services/workflow.ts +0 -36
@@ -1,13 +1,6 @@
1
- export class IncompleteAuthentication extends Error { }
2
- export class MissingGrant extends Error { }
3
- export class MissingLockbox extends Error { }
4
- export class MissingLockboxOwner extends Error { }
5
- export class IndexBuildError extends Error { }
6
- export class AssociatedLockboxNotFound extends Error { }
7
- export class WorkflowAnswersMissingError extends Error { }
8
- export class AuthenticationFailed extends Error { }
9
- export class AuthenticationBadRequest extends Error { }
10
- export class AuthenticationServerError extends Error { }
11
- export class IdentityCreationFailed extends Error { }
12
- export class IdentityCreationBadRequest extends Error { }
13
- export class IdentityCreationConflict extends Error { }
1
+ export class IncompleteAuthentication extends Error {}
2
+ export class MissingGrant extends Error {}
3
+ export class MissingLockbox extends Error {}
4
+ export class MissingLockboxOwner extends Error {}
5
+ export class AssociatedLockboxNotFound extends Error {}
6
+ export class WorkflowAnswersMissingError extends Error {}
@@ -1,9 +1,2 @@
1
1
  export * from './client'
2
- export * from './consult'
3
- export * from './diagnosis'
4
2
  export * from './error'
5
- export * from './guard'
6
- export * from './practice'
7
- export * from './shared'
8
- export * from './vault'
9
- export * from './workflow'
@@ -1,23 +1,28 @@
1
- import { IndexKey, OroClient, Uuid, VaultIndex } from "..";
2
- import { Grant, MetadataCategory, IndexConsultLockbox } from "../models";
1
+ import { IndexKey, Grant, IndexConsultLockbox, MetadataCategory, VaultIndex } from 'oro-sdk-apis'
2
+ import { OroClient, Uuid } from '..'
3
3
 
4
4
  /**
5
5
  * @name filterGrantsWithLockboxMetadata
6
6
  * @description searches for the applied filters in the vault index
7
7
  * @param oroClient
8
8
  * @param filter: the metadata filter applied to each the lockboxes
9
- * @param vaultIndex: the index to which the filter will be applied
9
+ * @param vaultIndex: the index to which the filter will be applied
10
10
  * @param forceRefresh
11
11
  * @returns the filtered grants
12
12
  */
13
- export async function filterGrantsWithLockboxMetadata(oroClient: OroClient, filter?: { consultationId: Uuid}, vaultIndex?: VaultIndex, forceRefresh = false): Promise<Grant[]> {
13
+ export async function filterGrantsWithLockboxMetadata(
14
+ oroClient: OroClient,
15
+ filter?: { consultationId: Uuid },
16
+ vaultIndex?: VaultIndex,
17
+ forceRefresh = false
18
+ ): Promise<Grant[]> {
14
19
  if (!vaultIndex || forceRefresh) {
15
20
  vaultIndex = await buildLegacyVaultIndex(oroClient)
16
21
  }
17
22
  if (vaultIndex[IndexKey.Consultation] && filter) {
18
- let indexConsults = (vaultIndex[IndexKey.Consultation]??[])
19
- .filter((consultGrant: {consultationId: Uuid}) => consultGrant.consultationId === filter.consultationId)
20
- .map((consultGrant: {consultationId: Uuid, grant: Grant}) => consultGrant.grant as Grant)
23
+ let indexConsults = (vaultIndex[IndexKey.Consultation] ?? [])
24
+ .filter((consultGrant: { consultationId: Uuid }) => consultGrant.consultationId === filter.consultationId)
25
+ .map((consultGrant: { consultationId: Uuid; grant: Grant }) => consultGrant.grant as Grant)
21
26
  return indexConsults as Grant[]
22
27
  } else {
23
28
  // No grants exist and the index has already been built
@@ -35,28 +40,28 @@ export async function buildLegacyVaultIndex(oroClient: OroClient): Promise<Vault
35
40
  let grants = await oroClient.getGrants()
36
41
  let consultGrants: IndexConsultLockbox[] = []
37
42
  for (let grant of grants) {
38
- let consults = (await oroClient.vaultClient
39
- .lockboxMetadataGet(
40
- grant.lockboxUuid!,
41
- ['consultationId'],
42
- [],
43
- { category: MetadataCategory.Consultation },
44
- ))[0] as Uuid[]
43
+ let consults = (
44
+ await oroClient.vaultClient.lockboxMetadataGet(grant.lockboxUuid!, ['consultationId'], [], {
45
+ category: MetadataCategory.Consultation,
46
+ })
47
+ )[0] as Uuid[]
45
48
 
46
- consultGrants = [...consultGrants, ...consults.map((consult: any) => ({
49
+ consultGrants = [
50
+ ...consultGrants,
51
+ ...consults.map((consult: any) => ({
47
52
  ...consult,
48
53
  grant: {
49
- lockboxOwnerUuid:
50
- grant.lockboxOwnerUuid,
54
+ lockboxOwnerUuid: grant.lockboxOwnerUuid,
51
55
  lockboxUuid: grant.lockboxUuid,
52
56
  },
53
- }))]
57
+ })),
58
+ ]
54
59
  }
55
60
 
56
61
  let vaultIndex = {
57
- [IndexKey.Consultation]: consultGrants
62
+ [IndexKey.Consultation]: consultGrants,
58
63
  }
59
64
  oroClient.setVaultIndex(vaultIndex)
60
65
  console.info('[sdk:index] Successfully Built Vault Index')
61
66
  return vaultIndex
62
- }
67
+ }
@@ -1,4 +1,4 @@
1
- import { AxiosService } from ".."
1
+ import { AxiosService } from "oro-sdk-apis"
2
2
 
3
3
  export type FacetFilter = 'type:PHARMACY' | 'type:CLINIC'
4
4
 
@@ -1,10 +1 @@
1
- export * from './axios'
2
- export * from './api'
3
- export * from './consult'
4
- export * from './diagnosis'
5
- export * from './guard'
6
- export * from './practice'
7
- export * from './teller'
8
- export * from './vault'
9
- export * from './workflow'
10
1
  export * from './external'
@@ -1,102 +0,0 @@
1
- export declare enum AssistantType {
2
- MedicalSecretary = "MedicalSecretary",
3
- Nurse = "Nurse",
4
- Specialist = "Specialist",
5
- Administrative = "Administrative",
6
- Other = "Other"
7
- }
8
- export interface ConsultAssignedAssistant {
9
- id?: number;
10
- uuidConsult: string;
11
- uuidAssistant: string;
12
- type: AssistantType;
13
- tagSpecialty?: string;
14
- duuidCurrentTaskDescription?: string;
15
- }
16
- export declare enum TransmissionKind {
17
- Fax = "Fax",
18
- Email = "Email",
19
- SMS = "SMS",
20
- EncryptedEmail = "EncryptedEmail",
21
- Logs = "Logs",
22
- API = "API",
23
- Other = "Other"
24
- }
25
- export declare enum TransmissionStatus {
26
- Preparing = "Preparing",
27
- Sending = "Sending",
28
- Sent = "Sent",
29
- Retrying = "Retrying",
30
- Failed = "Failed",
31
- DriverError = "DriverError",
32
- TimedOut = "TimedOut",
33
- ReceiverNotExist = "ReceiverNotExist",
34
- ReceiverNotAnswering = "ReceiverNotAnswering",
35
- ReceiverIncompatible = "ReceiverIncompatible"
36
- }
37
- export interface ConsultTransmission {
38
- id: number;
39
- uuidConsult: string;
40
- kind: TransmissionKind;
41
- status: TransmissionStatus;
42
- nameDriverReceiver: string;
43
- addressReceiver: string;
44
- idDriverForTransmission: string;
45
- txtLastDriverMessage: string;
46
- numTry: number;
47
- numTryLeft: number;
48
- delay: number;
49
- tsFirstTry: string;
50
- tsLastStatusUpdate: string;
51
- keyWebhookSecret: string;
52
- }
53
- export declare enum FeeStatus {
54
- NoFee = "NoFee",
55
- Pending = "Pending",
56
- Paid = "Paid",
57
- Reimbursed = "Reimbursed",
58
- Cancelled = "Cancelled",
59
- Contested = "Contested"
60
- }
61
- export declare enum MedicalStatus {
62
- Creating = "Creating",
63
- New = "New",
64
- ToAnswer = "ToAnswer",
65
- Answered = "Answered",
66
- Closed = "Closed",
67
- Reopened = "Reopened",
68
- Archived = "Archived"
69
- }
70
- export declare enum TaskStatus {
71
- None = "None",
72
- ToDo = "ToDo",
73
- InProgress = "InProgress",
74
- Blocked = "Blocked",
75
- Done = "Done"
76
- }
77
- export interface ConsultRequest {
78
- uuidPractice: string;
79
- tagSpecialtyRequired: string;
80
- idStripeInvoiceOrPaymentIntent: string;
81
- isoLocalityRequired?: string;
82
- isoLanguageRequired: string;
83
- }
84
- export interface Consult {
85
- uuid: string;
86
- uuidPracticeAdmin: string;
87
- uuidPractice: string;
88
- tagSpecialtyRequired: string;
89
- isoLanguageRequired: string;
90
- idPracticePayment: number;
91
- statusFee?: FeeStatus;
92
- isoLocalityRequired: string;
93
- statusMedical?: MedicalStatus;
94
- uuidAssignedDoctor: string;
95
- uuidCurrentAssigned: string;
96
- statusTask?: TaskStatus;
97
- hasTransmissions?: boolean;
98
- assignedAssistant?: ConsultAssignedAssistant[];
99
- shortId?: string;
100
- createdAt?: string;
101
- expiresAt?: string;
102
- }
@@ -1,122 +0,0 @@
1
- export declare enum DiagnosisType {
2
- Generic = "Generic",
3
- Private = "Private",
4
- Instance = "Instance"
5
- }
6
- export interface DiagnosisRequest {
7
- uuid?: string;
8
- name: string;
9
- description: string;
10
- type: DiagnosisType;
11
- parentUuid?: string;
12
- language: string;
13
- tags?: string[];
14
- urlMultimedia?: string;
15
- }
16
- export interface Diagnosis extends DiagnosisRequest {
17
- uuid: string;
18
- uuidPractice: string;
19
- uuidPractitioner?: string;
20
- createdAt: string;
21
- }
22
- export interface TreatmentRequest {
23
- uuid?: string;
24
- uuidDiagnosis?: string;
25
- name: string;
26
- description: string;
27
- urlMultimedia?: string;
28
- }
29
- export interface Treatment extends TreatmentRequest {
30
- uuid: string;
31
- uuidDiagnosis: string;
32
- createdAt: string;
33
- }
34
- export declare enum DrugType {
35
- Generic = "Generic",
36
- Instance = "Instance"
37
- }
38
- export interface DrugRequest {
39
- name: string;
40
- description: string;
41
- type: DrugType;
42
- language: string;
43
- sideEffects: string;
44
- imageUrl?: string;
45
- parentUuid?: string;
46
- uuid?: string;
47
- }
48
- export interface Drug extends DrugRequest {
49
- uuid: string;
50
- uuidPractice: string;
51
- uuidPractitioner?: string;
52
- createdAt: string;
53
- }
54
- export interface PrescriptionRequest {
55
- uuid?: string;
56
- uuidTreatment?: string;
57
- uuidDrug?: string;
58
- quantity: string;
59
- sig: string;
60
- renewal: string;
61
- }
62
- export interface Prescription extends PrescriptionRequest {
63
- uuid: string;
64
- uuidTreatment: string;
65
- createdAt: string;
66
- }
67
- export declare enum PlanStatus {
68
- Pending = "Pending",
69
- Accepted = "Accepted",
70
- Rejected = "Rejected"
71
- }
72
- export interface TreatmentPlan {
73
- uuid: string;
74
- uuidConsult: string;
75
- uuidDiagnosis: string;
76
- uuidTreatment?: string;
77
- status: PlanStatus;
78
- }
79
- export interface DrugPrescription {
80
- prescription: Prescription;
81
- drug: Drug;
82
- }
83
- export interface TreatmentAndDrugPrescription {
84
- treatment?: Treatment;
85
- prescriptionsAndDrugs?: DrugPrescription[];
86
- status: PlanStatus;
87
- uuidTreatmentPlan: string;
88
- }
89
- export interface TreatmentPlans {
90
- uuidConsult: string;
91
- diagnosis: Diagnosis;
92
- plans?: TreatmentAndDrugPrescription[];
93
- }
94
- export interface DrugPrescriptionRequest {
95
- prescription: PrescriptionRequest;
96
- drug: DrugRequest;
97
- }
98
- export interface TreatmentAndDrugPrescriptionRequest {
99
- trackingId: string;
100
- treatment: TreatmentRequest;
101
- prescriptionsAndDrugs?: DrugPrescriptionRequest[];
102
- }
103
- export interface TreatmentPlansRequest {
104
- uuidConsult: string;
105
- diagnosis: DiagnosisRequest;
106
- plans?: TreatmentAndDrugPrescriptionRequest[];
107
- }
108
- export interface TreatmentAndDrugPrescriptionUpdateRequest {
109
- treatment: Treatment;
110
- prescriptionsAndDrugs?: DrugPrescriptionRequest[];
111
- }
112
- export interface TreatmentPlanUpdateRequest extends TreatmentPlansRequest {
113
- uuidConsult: string;
114
- diagnosis: DiagnosisRequest;
115
- plan: TreatmentAndDrugPrescriptionUpdateRequest;
116
- }
117
- export interface TreatmentPlansResponseEntry {
118
- trackingId?: string;
119
- treatmentPlan: TreatmentPlan;
120
- }
121
- export interface TreatmentPlansResponse extends Array<TreatmentPlansResponseEntry> {
122
- }
@@ -1,119 +0,0 @@
1
- import { Uuid, Base64String, TokenData, RFC3339Date, Url } from './';
2
- export declare type AuthRefreshFunc = (refreshToken?: string) => Promise<AuthTokenResponse>;
3
- export interface Tokens {
4
- accessToken?: string;
5
- refreshToken?: string;
6
- }
7
- export interface AuthTokenRequest {
8
- practiceUuid: string;
9
- email: string;
10
- password: Base64String;
11
- otp?: string;
12
- }
13
- export interface AuthTokenResponse {
14
- accessToken: string;
15
- tokenType: string;
16
- refreshToken: string;
17
- expiresIn: number;
18
- }
19
- export interface AuthRecoverRequest {
20
- practiceUuid: string;
21
- email: string;
22
- }
23
- export interface WhoAmIResponse {
24
- aud: string;
25
- exp: number;
26
- jti: string;
27
- iat: number;
28
- iss: string;
29
- nbf: number;
30
- sub: string;
31
- scope: string;
32
- email: string;
33
- practice: string;
34
- }
35
- export interface IdentityCreateRequest {
36
- practiceUuid: Uuid;
37
- email: string;
38
- password: Base64String;
39
- publicKey: Base64String;
40
- recoveryPassword: Base64String;
41
- tosAndCpAcceptance: TosAndCpAcceptanceRequest;
42
- tokenData?: TokenData;
43
- subscription?: boolean;
44
- }
45
- export interface TosAndCpAcceptanceRequest {
46
- tosVersion: string;
47
- cpVersion: string;
48
- }
49
- export interface IdentityResponse {
50
- id: Uuid;
51
- practiceUuid?: Uuid;
52
- email?: string;
53
- emailConfirmed: boolean;
54
- tokenData?: TokenData;
55
- mfaEnabled?: boolean;
56
- mfaSecret?: Base64String;
57
- publicKey: Base64String;
58
- recoveryLogin?: Uuid;
59
- recoveryPassword: Base64String;
60
- recoveryMasterKey: Base64String;
61
- recoverySecurityQuestions: SecretShard[];
62
- legal?: LegalData;
63
- createdAt?: string;
64
- updatedAt?: string;
65
- refreshToken?: string;
66
- }
67
- export interface IdentityUpdateRequest {
68
- emailConfirmed?: boolean;
69
- password?: PasswordUpdateRequest;
70
- mfaEnable?: MFAEnableRequest;
71
- recoveryPassword?: Base64String;
72
- recoveryMasterKey?: Base64String;
73
- recoverySecurityQuestions?: SecretShard[];
74
- tokenData?: TokenData;
75
- epAcceptance?: EpAcceptanceRequest;
76
- rpAcceptance?: RpAcceptanceRequest;
77
- }
78
- export interface EpAcceptanceRequest {
79
- epVersion: string;
80
- }
81
- export interface RpAcceptanceRequest {
82
- rpVersion: string;
83
- }
84
- export interface PasswordUpdateRequest {
85
- oldPassword?: Base64String;
86
- newPassword: Base64String;
87
- }
88
- export interface QRCodeRequest {
89
- password: Base64String;
90
- }
91
- export interface QRCodeResponse {
92
- url: string;
93
- qrContentType: string;
94
- qrBytes: Base64String;
95
- }
96
- export interface MFAEnableRequest {
97
- password: Base64String;
98
- otp: string;
99
- }
100
- export interface SecretShard {
101
- securityQuestion: string;
102
- securityAnswer?: string;
103
- nonce: Base64String;
104
- encryptedShare: Base64String;
105
- }
106
- export interface LegalData {
107
- tosAcceptedAtTime?: RFC3339Date;
108
- tosAcceptedVersion: Url;
109
- tosAcceptedAtIP?: string;
110
- cpAcceptedAtTime?: RFC3339Date;
111
- cpAcceptedVersion: Url;
112
- cpAcceptedAtIP?: string;
113
- epAcceptedAtTime?: RFC3339Date;
114
- epAcceptedVersion: Url;
115
- epAcceptedAtIP?: string;
116
- rpAcceptedAtTime?: RFC3339Date;
117
- rpAcceptedVersion: Url;
118
- rpAcceptedAtIP?: string;
119
- }