oro-sdk 2.2.0 → 2.5.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 (63) hide show
  1. package/README.md +49 -31
  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
package/README.md CHANGED
@@ -4,13 +4,14 @@ ORO SDK package is intended to be run in browser only. It contains everything ne
4
4
 
5
5
  ## Requirements
6
6
 
7
- - npm 6.14.11
7
+ - npm >=6.14.13
8
8
 
9
9
  > Powered by [tsdx](https://github.com/formium/tsdx)
10
10
 
11
11
  ## Local development
12
12
 
13
13
  > If you cannot see Jest types try opening this folder in a seperate VSCode window.
14
+
14
15
  ### Set up project
15
16
 
16
17
  ```bash
@@ -24,49 +25,66 @@ npm start # watch
24
25
  npm build # build
25
26
  ```
26
27
 
27
- ### Linking the SDK locally:
28
+ ### Linking and running the app with sdk
28
29
 
29
- Ensure that you are running `node v14.17.0` and `npm v6.14.13`, you can use nvm to quickly install and use different versions of node via the commandline https://github.com/nvm-sh/nvm
30
- ```
31
- ❯ npm -v
32
- 6.14.13
30
+ #### First you need to publish locally the `oro-sdk`
33
31
 
34
- node -v
35
- v14.17.0
36
- ```
37
- In **`oro-apis/sdk/js`**:
32
+ Two cases are possible:
38
33
 
39
- Use [npm link](https://docs.npmjs.com/cli/v7/commands/npm-link)
34
+ 1. You are updating `oro-apis/sdk/ts`:
40
35
 
41
- ```bash
42
- npm install
43
- npm run link:watch
44
- ```
36
+ In **`oro-apis/sdk/ts`**:
37
+
38
+ ```bash
39
+ npm install
40
+ npm run link:watch
41
+ ```
42
+
43
+ 2. You are updating `oro-apis/sdk/apis`:
44
+
45
+ In **`oro-apis/sdk/apis`**:
46
+
47
+ ```bash
48
+ npm install
49
+ npm run link:watch
50
+ ```
51
+
52
+ In **`oro-apis/sdk/ts`**:
53
+
54
+ ```bash
55
+ npm install
56
+ npm uninstall oro-sdk-apis # optional
57
+ npm run link:watch:apis
58
+ ```
59
+
60
+ #### Then you need to link it locally to the app
45
61
 
46
62
  In **`oro-apps/web`**:
47
63
 
48
64
  ```bash
49
- npm uninstall oro-sdk-ts
50
- npm link oro-sdk-ts
65
+ npm uninstall oro-sdk # optional
66
+ npm run dev:link
51
67
  ```
52
68
 
53
- in `/web/src/services/oro-client.ts` set the correct module, at line 15 comment out the module definition and use the already written local definition, don't forget to change PATH_TO_oro-apis to what it is on your machine. When done it should look like this:
69
+ ### Publishing package
54
70
 
55
- ```js
56
- const module = await import('PATH_TO_oro-apis/sdk/js/node_modules/oro-toolbox')
57
- //const module = await import('oro-toolbox')
58
- ```
71
+ 1. (Only first time) Locally run `npm login` and use the creds in 1password (tech-team-oro) . This will create ~/.npmrc . You will require a OTP but it's sent on tech@orohealth.me so you should all have it.
72
+ 2. Run `docker-compose up --build sdk-publisher`
59
73
 
60
- Do the same for `/web/src/server.ts` uncomment line 94 and update the path to match your machine:
74
+ #### Versioning of `oro-sdk` and `oro-sdk-apis`
61
75
 
62
- ```js
63
- sirv('PATH_TO_oro-apis/sdk/js/node_modules/oro-toolbox', { dev }),
64
- ```
76
+ As `oro-sdk-apis` is a dependency of `oro-sdk`, if you do some changes on `oro-sdk-apis` you will need to update `oro-sdk` and web app as well.
65
77
 
66
- You can then run the app locally:
78
+ The versionning should be the same for `oro-sdk-apis` and `oro-sdk`. In other words, as we are using semantic versioning if we update patch/minor/major version of `oro-sdk-apis` we must update the same on `oro-sdk`.
67
79
 
68
- ```bash
69
- npm run dev
70
- ```
80
+ >Example:
81
+ >
82
+ >I want to update the minor version of `oro-sdk-apis`: 1.2.5 -> 1.3.0
83
+ >
84
+ >Then I also need to update `package.json` of `oro-sdk` with the dependency `oro-sdk-apis@1.3.0` and I update the minor version of `oro-sdk`: 2.3.2 -> 2.4.0
85
+
86
+ You then need to publish packages in following order: `oro-sdk-apis`, `oro-sdk`:
87
+
88
+ Then, you update web app dependencies with `oro-sdk@2.4.0`
71
89
 
72
- > Caveat: There is some caveat using `npm link` please see [doc](https://docs.npmjs.com/cli/v7/commands/npm-link#caveat)
90
+ Done.
package/dist/client.d.ts CHANGED
@@ -1,6 +1,6 @@
1
+ import { Consult, ConsultRequest, ConsultService, DataCreateResponse, DiagnosisService, Document, DocumentType, Grant, GuardService, IdentityResponse, LocalizedData, LockboxManifest, Meta, Metadata, MetadataCategory, PopulatedWorkflowData, Practice, PracticeService, TellerService, TokenData, TosAndCpAcceptanceRequest, Uuid, VaultIndex, VaultService, WorkflowData, WorkflowService } from 'oro-sdk-apis';
1
2
  import * as OroToolbox from 'oro-toolbox';
2
- import { Consult, ConsultRequest, DataCreateResponse, Document, DocumentType, Grant, IdentityResponse, LocalEncryptedData, LocalizedData, LockboxManifest, Meta, Metadata, MetadataCategory, PopulatedWorkflowData, Practice, RecoveryData, RegisterPatientOutput, TokenData, TosAndCpAcceptanceRequest, UserPreference, Uuid, VaultIndex, WorkflowData } from './models';
3
- import { ConsultService, DiagnosisService, GuardService, PracticeService, TellerService, VaultService, WorkflowService } from './services';
3
+ import { LocalEncryptedData, RecoveryData, RegisterPatientOutput, UserPreference } from './models';
4
4
  export declare class OroClient {
5
5
  private toolbox;
6
6
  tellerClient: TellerService;
@@ -19,7 +19,7 @@ export declare class OroClient {
19
19
  constructor(toolbox: typeof OroToolbox, tellerClient: TellerService, vaultClient: VaultService, guardClient: GuardService, practiceClient: PracticeService, consultClient: ConsultService, workflowClient: WorkflowService, diagnosisClient: DiagnosisService, authenticationCallback?: ((err: Error) => void) | undefined);
20
20
  /**
21
21
  * clears the vaultIndex and cached metadata grants
22
- */
22
+ */
23
23
  cleanIndex(): Promise<void>;
24
24
  /**
25
25
  * Generates an RSA key pair and password payload (rsa private key encrypted with the password)
@@ -70,7 +70,7 @@ export declare class OroClient {
70
70
  * @throws IncompleteAuthentication if rsa is not set
71
71
  * @calls authenticationCallback if rsa is not set
72
72
  */
73
- localDecryptJsonPayload({ encryptedKey, encryptedData, }: LocalEncryptedData): any;
73
+ localDecryptJsonPayload({ encryptedKey, encryptedData }: LocalEncryptedData): any;
74
74
  /**
75
75
  * Effectively kills your "session"
76
76
  */
@@ -1,4 +1,4 @@
1
- import { PopulatedWorkflowData, MetadataCategory, SelectedAnswersData } from '../models';
1
+ import { PopulatedWorkflowData, MetadataCategory, SelectedAnswersData } from 'oro-sdk-apis';
2
2
  import { PersonalInformations } from '../models/client';
3
3
  /**
4
4
  * This function extract PersonalInformations from data input object coming from workflow
@@ -1,5 +1,5 @@
1
+ import { ConsultRequest, MetadataCategory, Uuid, WorkflowData } from 'oro-sdk-apis';
1
2
  import { OroClient, RegisterPatientOutput } from '..';
2
- import { ConsultRequest, MetadataCategory, Uuid, WorkflowData } from '../models';
3
3
  export declare function registerPatient(patientUuid: Uuid, consultRequest: ConsultRequest, workflow: WorkflowData, oroClient: OroClient, masterKey?: Uuid, recoveryQA?: {
4
4
  recoverySecurityQuestions: string[];
5
5
  recoverySecurityAnswers: string[];
@@ -1,5 +1,5 @@
1
1
  import { CryptoRSA } from "oro-toolbox";
2
- import { EncryptedIndexEntry, Grant } from "..";
2
+ import { EncryptedIndexEntry, Grant } from "oro-sdk-apis";
3
3
  /**
4
4
  * Decrypts and returns the encrypted grants
5
5
  * If something went wrong during decryption, that grant will be removed from the list
@@ -1,4 +1,4 @@
1
- import { MetadataCategory, PopulatedWorkflowData, SelectedAnswerData, SelectedAnswersData, WorkflowData, WorkflowUploadedImage } from '../models';
1
+ import { MetadataCategory, PopulatedWorkflowData, SelectedAnswerData, SelectedAnswersData, WorkflowData, WorkflowUploadedImage } from 'oro-sdk-apis';
2
2
  export declare function filterTriggeredAnsweredWithKind(workflowData: WorkflowData, kind: 'text' | 'date' | 'number' | 'images' | 'images-alias' | 'body-parts' | 'pharmacy-picker'): Promise<SelectedAnswerData[]>;
3
3
  /**
4
4
  * Filters and Populates the `selectedAnswers` from the workflow by
package/dist/index.d.ts CHANGED
@@ -2,8 +2,22 @@ import { OroClient } from './client';
2
2
  import * as OroToolboxNamespace from 'oro-toolbox';
3
3
  export declare type OroToolbox = typeof OroToolboxNamespace;
4
4
  export declare let wasmPath: string;
5
- declare const init: (toolbox: OroToolbox, tellerBaseURL: string, vaultBaseURL: string, guardBaseURL: string, practiceBaseURL: string, consultBaseURL: string, workflowBaseURL: string, diagnosisBaseUrl: string, authenticationCallback?: ((err: Error) => void) | undefined) => OroClient;
5
+ /**
6
+ * This function helps you to initialize and OroClient instance
7
+ * @param toolbox the OroToolbox object
8
+ * @param tellerBaseURL the teller service base URL
9
+ * @param vaultBaseURL the vault service base URL
10
+ * @param guardBaseURL the guard service base URL
11
+ * @param practiceBaseURL the practice service base URL
12
+ * @param consultBaseURL the consult service base URL
13
+ * @param workflowBaseURL the workflow service base URL
14
+ * @param diagnosisBaseURL the diagnosis service base URL
15
+ * @param authenticationCallback (optional) authenticationCallback the authentification callback
16
+ * @returns an instance of OroClient
17
+ */
18
+ declare const init: (toolbox: OroToolbox, tellerBaseURL: string, vaultBaseURL: string, guardBaseURL: string, practiceBaseURL: string, consultBaseURL: string, workflowBaseURL: string, diagnosisBaseURL: string, authenticationCallback?: ((err: Error) => void) | undefined) => OroClient;
6
19
  export { OroClient } from './client';
20
+ export * from 'oro-sdk-apis';
7
21
  export * from './models';
8
22
  export * from './helpers';
9
23
  export * from './services';
@@ -1,5 +1,5 @@
1
1
  import { PlaceData } from '../services/external/clinia';
2
- import { Uuid } from './shared';
2
+ import { Uuid } from 'oro-sdk-apis';
3
3
  export interface PersonalInformations {
4
4
  birthday?: string;
5
5
  firstname?: string;
@@ -6,21 +6,7 @@ export declare class MissingLockbox extends Error {
6
6
  }
7
7
  export declare class MissingLockboxOwner extends Error {
8
8
  }
9
- export declare class IndexBuildError extends Error {
10
- }
11
9
  export declare class AssociatedLockboxNotFound extends Error {
12
10
  }
13
11
  export declare class WorkflowAnswersMissingError extends Error {
14
12
  }
15
- export declare class AuthenticationFailed extends Error {
16
- }
17
- export declare class AuthenticationBadRequest extends Error {
18
- }
19
- export declare class AuthenticationServerError extends Error {
20
- }
21
- export declare class IdentityCreationFailed extends Error {
22
- }
23
- export declare class IdentityCreationBadRequest extends Error {
24
- }
25
- export declare class IdentityCreationConflict extends Error {
26
- }
@@ -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';