oro-sdk-apis 1.0.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 (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +35 -0
  3. package/dist/index.d.ts +27 -0
  4. package/dist/index.js +8 -0
  5. package/dist/models/consult.d.ts +102 -0
  6. package/dist/models/diagnosis.d.ts +122 -0
  7. package/dist/models/error.d.ts +12 -0
  8. package/dist/models/guard.d.ts +119 -0
  9. package/dist/models/index.d.ts +8 -0
  10. package/dist/models/practice.d.ts +353 -0
  11. package/dist/models/shared.d.ts +8 -0
  12. package/dist/models/vault.d.ts +124 -0
  13. package/dist/models/workflow.d.ts +106 -0
  14. package/dist/oro-sdk-apis.cjs.development.js +3019 -0
  15. package/dist/oro-sdk-apis.cjs.development.js.map +1 -0
  16. package/dist/oro-sdk-apis.cjs.production.min.js +2 -0
  17. package/dist/oro-sdk-apis.cjs.production.min.js.map +1 -0
  18. package/dist/oro-sdk-apis.esm.js +3051 -0
  19. package/dist/oro-sdk-apis.esm.js.map +1 -0
  20. package/dist/services/api.d.ts +11 -0
  21. package/dist/services/axios.d.ts +14 -0
  22. package/dist/services/consult.d.ts +54 -0
  23. package/dist/services/diagnosis.d.ts +44 -0
  24. package/dist/services/guard.d.ts +92 -0
  25. package/dist/services/index.d.ts +9 -0
  26. package/dist/services/practice.d.ts +98 -0
  27. package/dist/services/teller.d.ts +9 -0
  28. package/dist/services/vault.d.ts +54 -0
  29. package/dist/services/workflow.d.ts +21 -0
  30. package/package.json +62 -0
  31. package/src/index.ts +56 -0
  32. package/src/models/consult.ts +110 -0
  33. package/src/models/diagnosis.ts +141 -0
  34. package/src/models/error.ts +6 -0
  35. package/src/models/guard.ts +136 -0
  36. package/src/models/index.ts +8 -0
  37. package/src/models/practice.ts +411 -0
  38. package/src/models/shared.ts +6 -0
  39. package/src/models/vault.ts +158 -0
  40. package/src/models/workflow.ts +142 -0
  41. package/src/services/api.ts +77 -0
  42. package/src/services/axios.ts +91 -0
  43. package/src/services/consult.ts +264 -0
  44. package/src/services/diagnosis.ts +144 -0
  45. package/src/services/guard.ts +228 -0
  46. package/src/services/index.ts +9 -0
  47. package/src/services/practice.ts +430 -0
  48. package/src/services/teller.ts +39 -0
  49. package/src/services/vault.ts +178 -0
  50. package/src/services/workflow.ts +36 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 ORO Health Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # oro-sdk-apis
2
+
3
+ ORO SDK apis package is intended to be run in browser or Node.js environment. It contains all models and apis services.
4
+
5
+ ## Requirements
6
+
7
+ - npm >=6.14.13
8
+
9
+ > Powered by [tsdx](https://github.com/formium/tsdx)
10
+
11
+ ## Local development
12
+
13
+ > If you cannot see Jest types try opening this folder in a seperate VSCode window.
14
+ ### Set up project
15
+
16
+ ```bash
17
+ npm install
18
+ ```
19
+
20
+ Then, it's possible to either build/watch component by using
21
+
22
+ ```bash
23
+ npm start # watch
24
+ npm build # build
25
+ ```
26
+
27
+ ### Linking the apis locally:
28
+
29
+ If you need to link `oro-sdk-apis` to app please see https://github.com/OROHealth/oro-apis/blob/main/sdk/ts/README.md#linking-the-sdk-locally
30
+
31
+ In all cases (node.js or app), you need to use:
32
+ ```bash
33
+ npm install
34
+ npm run link:watch
35
+ ```
@@ -0,0 +1,27 @@
1
+ import { TellerService, VaultService, GuardService, PracticeService, ConsultService, WorkflowService, DiagnosisService } from './services';
2
+ /**
3
+ * This function is used to initialize services with a provided url
4
+ * @param services an object containing the url of the services to init
5
+ * @param (optional) authenticationCallback the authentification callback
6
+ * @returns an instance of each services with a provided url
7
+ */
8
+ declare const init: (services: {
9
+ tellerBaseURL?: string;
10
+ vaultBaseURL?: string;
11
+ guardBaseURL?: string;
12
+ practiceBaseURL?: string;
13
+ consultBaseURL?: string;
14
+ workflowBaseURL?: string;
15
+ diagnosisBaseURL?: string;
16
+ }, authenticationCallback?: ((err: Error) => void) | undefined) => {
17
+ tellerService: TellerService | undefined;
18
+ practiceService: PracticeService | undefined;
19
+ consultService: ConsultService | undefined;
20
+ vaultService: VaultService | undefined;
21
+ guardService: GuardService | undefined;
22
+ workflowService: WorkflowService | undefined;
23
+ diagnosisService: DiagnosisService | undefined;
24
+ };
25
+ export * from './models';
26
+ export * from './services';
27
+ export default init;
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+
2
+ 'use strict'
3
+
4
+ if (process.env.NODE_ENV === 'production') {
5
+ module.exports = require('./oro-sdk-apis.cjs.production.min.js')
6
+ } else {
7
+ module.exports = require('./oro-sdk-apis.cjs.development.js')
8
+ }
@@ -0,0 +1,102 @@
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
+ }
@@ -0,0 +1,122 @@
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
+ }
@@ -0,0 +1,12 @@
1
+ export declare class AuthenticationFailed extends Error {
2
+ }
3
+ export declare class AuthenticationBadRequest extends Error {
4
+ }
5
+ export declare class AuthenticationServerError extends Error {
6
+ }
7
+ export declare class IdentityCreationFailed extends Error {
8
+ }
9
+ export declare class IdentityCreationBadRequest extends Error {
10
+ }
11
+ export declare class IdentityCreationConflict extends Error {
12
+ }
@@ -0,0 +1,119 @@
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
+ }
@@ -0,0 +1,8 @@
1
+ export * from './consult';
2
+ export * from './diagnosis';
3
+ export * from './error';
4
+ export * from './guard';
5
+ export * from './practice';
6
+ export * from './shared';
7
+ export * from './vault';
8
+ export * from './workflow';