@ovok/core 0.4.31 → 0.4.33
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.
- package/dist/client/ai-fhir/methods/AIFhirResources.d.ts +2 -1
- package/dist/client/ai-fhir/methods/AIFhirResources.js +2 -2
- package/dist/client/auth/errors.d.ts +6 -0
- package/dist/client/auth/errors.js +12 -1
- package/dist/client/auth/methods/appleLogin.d.ts +2 -1
- package/dist/client/auth/methods/appleLogin.js +2 -2
- package/dist/client/auth/methods/changePassword.d.ts +2 -1
- package/dist/client/auth/methods/changePassword.js +2 -2
- package/dist/client/auth/methods/getSessions.d.ts +2 -1
- package/dist/client/auth/methods/getSessions.js +2 -2
- package/dist/client/auth/methods/googleLogin.d.ts +2 -1
- package/dist/client/auth/methods/googleLogin.js +2 -2
- package/dist/client/auth/methods/index.d.ts +1 -0
- package/dist/client/auth/methods/index.js +1 -0
- package/dist/client/auth/methods/login.d.ts +6 -2
- package/dist/client/auth/methods/login.js +60 -44
- package/dist/client/auth/methods/logout.d.ts +2 -1
- package/dist/client/auth/methods/logout.js +2 -2
- package/dist/client/auth/methods/refetchProfile.d.ts +2 -1
- package/dist/client/auth/methods/refetchProfile.js +3 -4
- package/dist/client/auth/methods/register.d.ts +2 -1
- package/dist/client/auth/methods/register.js +2 -2
- package/dist/client/auth/methods/registerPractitioner.d.ts +2 -1
- package/dist/client/auth/methods/registerPractitioner.js +2 -2
- package/dist/client/auth/methods/reloadSession.d.ts +7 -0
- package/dist/client/auth/methods/reloadSession.js +23 -0
- package/dist/client/auth/methods/requestDeleteUser.d.ts +2 -1
- package/dist/client/auth/methods/requestDeleteUser.js +5 -5
- package/dist/client/auth/methods/resetPassword.d.ts +2 -1
- package/dist/client/auth/methods/resetPassword.js +2 -2
- package/dist/client/auth/methods/revokeSessions.d.ts +2 -1
- package/dist/client/auth/methods/revokeSessions.js +2 -2
- package/dist/client/auth/methods/setPasswordFromReset.d.ts +2 -1
- package/dist/client/auth/methods/setPasswordFromReset.js +2 -2
- package/dist/client/auth/types/LoginBody.d.ts +10 -20
- package/dist/client/auth/types/LoginError.d.ts +15 -0
- package/dist/client/auth/types/LoginError.js +15 -0
- package/dist/client/bot/methods/executeBot.d.ts +2 -1
- package/dist/client/bot/methods/executeBot.js +2 -2
- package/dist/client/change-history/methods.d.ts +2 -1
- package/dist/client/change-history/methods.js +2 -2
- package/dist/client/chat/ai/methods/createAiSession.d.ts +2 -1
- package/dist/client/chat/ai/methods/createAiSession.js +2 -2
- package/dist/client/cms/methods.d.ts +6 -5
- package/dist/client/cms/methods.js +10 -10
- package/dist/client/consent/methods.d.ts +5 -4
- package/dist/client/consent/methods.js +8 -8
- package/dist/client/email/methods.d.ts +2 -1
- package/dist/client/email/methods.js +2 -2
- package/dist/client/errors/ovok-error-utils.d.ts +7 -0
- package/dist/client/errors/ovok-error-utils.js +49 -5
- package/dist/client/errors/ovok-error.d.ts +4 -0
- package/dist/client/errors/ovok-error.js +17 -4
- package/dist/client/errors/rate-limit-error.js +5 -3
- package/dist/client/experience/methods.d.ts +32 -31
- package/dist/client/experience/methods.js +62 -62
- package/dist/client/invites/methods.d.ts +6 -5
- package/dist/client/invites/methods.js +17 -11
- package/dist/client/notifications/methods.d.ts +6 -5
- package/dist/client/notifications/methods.js +10 -10
- package/dist/client/notifications/types.d.ts +92 -11
- package/dist/client/observation/methods/getLatestObservationsByCodes.d.ts +2 -1
- package/dist/client/observation/methods/getLatestObservationsByCodes.js +4 -4
- package/dist/client/offline/offline-measurement-queue.d.ts +10 -3
- package/dist/client/offline/offline-measurement-queue.js +44 -29
- package/dist/client/ovok-client.d.ts +17 -7
- package/dist/client/ovok-client.js +235 -43
- package/dist/client/patient/methods.d.ts +24 -23
- package/dist/client/patient/methods.js +49 -49
- package/dist/client/patient-sharing/methods.d.ts +7 -6
- package/dist/client/patient-sharing/methods.js +16 -12
- package/dist/client/platform/methods.d.ts +24 -23
- package/dist/client/platform/methods.js +46 -46
- package/dist/client/questionnaire-response/methods/createQuestionnaireResponseWithObservations.d.ts +2 -1
- package/dist/client/questionnaire-response/methods/createQuestionnaireResponseWithObservations.js +2 -2
- package/dist/client/questionnaire-response/methods/extractQuestionnaireObservations.d.ts +2 -1
- package/dist/client/questionnaire-response/methods/extractQuestionnaireObservations.js +2 -2
- package/dist/client/questionnaire-response/methods/populateQuestionnaire.d.ts +2 -1
- package/dist/client/questionnaire-response/methods/populateQuestionnaire.js +2 -2
- package/dist/client/questionnaire-response/methods/submitQuestionnaireResponse.d.ts +2 -1
- package/dist/client/questionnaire-response/methods/submitQuestionnaireResponse.js +2 -2
- package/dist/client/signals/methods.d.ts +22 -21
- package/dist/client/signals/methods.js +42 -42
- package/dist/client/slim/methods.d.ts +93 -57
- package/dist/client/slim/methods.js +295 -108
- package/dist/client/slim/paging.d.ts +18 -0
- package/dist/client/slim/paging.js +57 -0
- package/dist/client/slim/types.d.ts +370 -3
- package/dist/conformance/api-requirements.js +22 -0
- package/dist/conformance/capability-requirements.js +1 -1
- package/dist/hooks/account-hooks.js +7 -7
- package/dist/hooks/api-hooks.d.ts +5 -2
- package/dist/hooks/api-hooks.js +39 -16
- package/dist/hooks/cms-hooks.js +3 -3
- package/dist/hooks/email-hooks.js +1 -1
- package/dist/hooks/experience-hooks.js +5 -5
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +5 -3
- package/dist/hooks/invites-hooks.js +7 -1
- package/dist/hooks/notification-ack-hooks.d.ts +2 -1
- package/dist/hooks/notification-hooks.d.ts +4 -2
- package/dist/hooks/notification-hooks.js +11 -23
- package/dist/hooks/notification-invalidation.d.ts +5 -2
- package/dist/hooks/notification-invalidation.js +10 -1
- package/dist/hooks/notification-note-hooks.js +3 -3
- package/dist/hooks/observation-hooks.d.ts +5 -1
- package/dist/hooks/observation-hooks.js +6 -6
- package/dist/hooks/patient-hooks.js +18 -18
- package/dist/hooks/patient-sharing-hooks.js +19 -5
- package/dist/hooks/platform-hooks.js +3 -3
- package/dist/hooks/poll-hooks.d.ts +14 -0
- package/dist/hooks/poll-hooks.js +127 -0
- package/dist/hooks/signals-alert-hooks.d.ts +5 -20
- package/dist/hooks/signals-alert-hooks.js +38 -34
- package/dist/hooks/signals-alert-item-hooks.d.ts +19 -0
- package/dist/hooks/signals-alert-item-hooks.js +62 -0
- package/dist/hooks/signals-hooks.js +2 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -1
- package/dist/utils/auth/exchange-code.d.ts +2 -0
- package/dist/utils/auth/exchange-code.js +2 -2
- package/dist/utils/auth/handle-tenant-code.d.ts +1 -1
- package/dist/utils/auth/handle-tenant-code.js +13 -4
- package/dist/utils/auth/start-login.d.ts +3 -1
- package/dist/utils/auth/start-login.js +3 -3
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MedplumRequestOptions } from "@medplum/core";
|
|
1
2
|
import { OvokClient } from "../../ovok-client";
|
|
2
3
|
import { AIFhirRequest } from "../types/AIFhirRequest";
|
|
3
4
|
import { AIFhirResponse } from "../types/AIFhirResponse";
|
|
@@ -11,4 +12,4 @@ import { AIFhirResponse } from "../types/AIFhirResponse";
|
|
|
11
12
|
* @param request - The search request containing the text to search for
|
|
12
13
|
* @returns Promise with the search response containing markdown, plan, and results
|
|
13
14
|
*/
|
|
14
|
-
export declare function AIFhirResources(this: OvokClient, request: AIFhirRequest): Promise<AIFhirResponse>;
|
|
15
|
+
export declare function AIFhirResources(this: OvokClient, request: AIFhirRequest, requestOptions?: MedplumRequestOptions): Promise<AIFhirResponse>;
|
|
@@ -11,6 +11,6 @@ exports.AIFhirResources = AIFhirResources;
|
|
|
11
11
|
* @param request - The search request containing the text to search for
|
|
12
12
|
* @returns Promise with the search response containing markdown, plan, and results
|
|
13
13
|
*/
|
|
14
|
-
async function AIFhirResources(request) {
|
|
15
|
-
return this.post("/ai/fhir/search", request);
|
|
14
|
+
async function AIFhirResources(request, requestOptions) {
|
|
15
|
+
return this.post("/ai/fhir/search", request, undefined, requestOptions);
|
|
16
16
|
}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
export declare const REGISTRATION_FAILED_MESSAGE = "Registration failed.";
|
|
2
|
+
export type OvokAccountErrorCode = "account_not_found" | "account_expired";
|
|
3
|
+
/** A safe, stable account error that does not include the account reference. */
|
|
4
|
+
export declare class OvokAccountError extends Error {
|
|
5
|
+
readonly code: OvokAccountErrorCode;
|
|
6
|
+
constructor(code: OvokAccountErrorCode);
|
|
7
|
+
}
|
|
2
8
|
/** Returns true when signup was refused because the address already has an account. */
|
|
3
9
|
export declare function isRegistrationFailed(error: unknown): boolean;
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.REGISTRATION_FAILED_MESSAGE = void 0;
|
|
3
|
+
exports.OvokAccountError = exports.REGISTRATION_FAILED_MESSAGE = void 0;
|
|
4
4
|
exports.isRegistrationFailed = isRegistrationFailed;
|
|
5
5
|
const ovok_error_1 = require("../errors/ovok-error");
|
|
6
6
|
exports.REGISTRATION_FAILED_MESSAGE = "Registration failed.";
|
|
7
|
+
/** A safe, stable account error that does not include the account reference. */
|
|
8
|
+
class OvokAccountError extends Error {
|
|
9
|
+
constructor(code) {
|
|
10
|
+
super(code === "account_not_found"
|
|
11
|
+
? "Saved account was not found."
|
|
12
|
+
: "This account's session has expired. Sign in again.");
|
|
13
|
+
this.code = code;
|
|
14
|
+
this.name = "OvokAccountError";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.OvokAccountError = OvokAccountError;
|
|
7
18
|
/** Returns true when signup was refused because the address already has an account. */
|
|
8
19
|
function isRegistrationFailed(error) {
|
|
9
20
|
const details = (0, ovok_error_1.readOvokError)(error);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import type { MedplumRequestOptions } from "@medplum/core";
|
|
1
2
|
import { OvokClient } from "../../ovok-client";
|
|
2
3
|
import { AppleLoginBody } from "../types/AppleLoginBody";
|
|
3
4
|
import { AuthResponse } from "../types/AuthResponse";
|
|
4
|
-
export declare function appleLogin(this: OvokClient, body: AppleLoginBody): Promise<AuthResponse>;
|
|
5
|
+
export declare function appleLogin(this: OvokClient, body: AppleLoginBody, requestOptions?: MedplumRequestOptions): Promise<AuthResponse>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.appleLogin = appleLogin;
|
|
4
|
-
async function appleLogin(body) {
|
|
4
|
+
async function appleLogin(body, requestOptions) {
|
|
5
5
|
const { internalId, ...rest } = body;
|
|
6
6
|
const queryParams = new URLSearchParams({
|
|
7
7
|
client: `ClientApplication/${this.socialLoginClientId}`,
|
|
8
8
|
internalId,
|
|
9
9
|
});
|
|
10
|
-
return this.post(`auth/external/apple?${queryParams.toString()}`, rest, "application/json");
|
|
10
|
+
return this.post(`auth/external/apple?${queryParams.toString()}`, rest, "application/json", requestOptions);
|
|
11
11
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import type { MedplumRequestOptions } from "@medplum/core";
|
|
1
2
|
import { OvokClient } from "../../ovok-client";
|
|
2
3
|
import { ChangePasswordBody } from "../types/ChangePasswordBody";
|
|
3
4
|
import { ChangePasswordResponse } from "../types/ChangePasswordResponse";
|
|
4
|
-
export declare function changePassword(this: OvokClient, body: ChangePasswordBody): Promise<ChangePasswordResponse>;
|
|
5
|
+
export declare function changePassword(this: OvokClient, body: ChangePasswordBody, requestOptions?: MedplumRequestOptions): Promise<ChangePasswordResponse>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.changePassword = changePassword;
|
|
4
|
-
async function changePassword(body) {
|
|
4
|
+
async function changePassword(body, requestOptions) {
|
|
5
5
|
const { oldPassword, newPassword } = body;
|
|
6
|
-
return this.patch("v2/auth/change-password", { oldPassword, newPassword });
|
|
6
|
+
return this.patch("v2/auth/change-password", { oldPassword, newPassword }, ...(requestOptions === undefined ? [] : [requestOptions]));
|
|
7
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import type { MedplumRequestOptions } from "@medplum/core";
|
|
1
2
|
import { OvokClient } from "../../ovok-client";
|
|
2
3
|
import { OvokSession } from "../types/Session";
|
|
3
4
|
/** Lists the server-side sessions for the current account. */
|
|
4
|
-
export declare function getSessions(this: OvokClient): Promise<OvokSession[]>;
|
|
5
|
+
export declare function getSessions(this: OvokClient, requestOptions?: MedplumRequestOptions): Promise<OvokSession[]>;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSessions = getSessions;
|
|
4
4
|
/** Lists the server-side sessions for the current account. */
|
|
5
|
-
async function getSessions() {
|
|
6
|
-
return this.get("auth/session");
|
|
5
|
+
async function getSessions(requestOptions) {
|
|
6
|
+
return this.get("auth/session", ...(requestOptions === undefined ? [] : [requestOptions]));
|
|
7
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import type { MedplumRequestOptions } from "@medplum/core";
|
|
1
2
|
import { OvokClient } from "../../ovok-client";
|
|
2
3
|
import { AuthResponse } from "../types/AuthResponse";
|
|
3
4
|
import { GoogleLoginBody } from "../types/GoogleLoginBody";
|
|
4
|
-
export declare function googleLogin(this: OvokClient, body: GoogleLoginBody): Promise<AuthResponse>;
|
|
5
|
+
export declare function googleLogin(this: OvokClient, body: GoogleLoginBody, requestOptions?: MedplumRequestOptions): Promise<AuthResponse>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.googleLogin = googleLogin;
|
|
4
|
-
async function googleLogin(body) {
|
|
4
|
+
async function googleLogin(body, requestOptions) {
|
|
5
5
|
const { internalId, ...rest } = body;
|
|
6
6
|
const queryParams = new URLSearchParams({
|
|
7
7
|
client: `ClientApplication/${this.socialLoginClientId}`,
|
|
8
8
|
internalId,
|
|
9
9
|
});
|
|
10
|
-
return this.post(`auth/external/google?${queryParams.toString()}`, rest, "application/json");
|
|
10
|
+
return this.post(`auth/external/google?${queryParams.toString()}`, rest, "application/json", requestOptions);
|
|
11
11
|
}
|
|
@@ -2,6 +2,7 @@ export * from "./login";
|
|
|
2
2
|
export * from "./register";
|
|
3
3
|
export * from "./registerPractitioner";
|
|
4
4
|
export * from "./refetchProfile";
|
|
5
|
+
export * from "./reloadSession";
|
|
5
6
|
export * from "./changePassword";
|
|
6
7
|
export * from "./requestDeleteUser";
|
|
7
8
|
export * from "./googleLogin";
|
|
@@ -18,6 +18,7 @@ __exportStar(require("./login"), exports);
|
|
|
18
18
|
__exportStar(require("./register"), exports);
|
|
19
19
|
__exportStar(require("./registerPractitioner"), exports);
|
|
20
20
|
__exportStar(require("./refetchProfile"), exports);
|
|
21
|
+
__exportStar(require("./reloadSession"), exports);
|
|
21
22
|
__exportStar(require("./changePassword"), exports);
|
|
22
23
|
__exportStar(require("./requestDeleteUser"), exports);
|
|
23
24
|
__exportStar(require("./googleLogin"), exports);
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import type { TenantLoginStart } from "../types/LoginError";
|
|
2
|
+
import type { MedplumRequestOptions } from "@medplum/core";
|
|
1
3
|
import { OvokClient } from "../../ovok-client";
|
|
2
|
-
import { LoginBody } from "../types/LoginBody";
|
|
4
|
+
import { LoginBody, PractitionerLoginBody } from "../types/LoginBody";
|
|
3
5
|
import { LoginResponse } from "../types/LoginResponse";
|
|
4
|
-
|
|
6
|
+
/** Starts practitioner sign-in and lets the app choose among returned projects. */
|
|
7
|
+
export declare function startTenantLogin(this: OvokClient, body: PractitionerLoginBody, requestOptions?: MedplumRequestOptions): Promise<TenantLoginStart>;
|
|
8
|
+
export declare function login(this: OvokClient, body: LoginBody, requestOptions?: MedplumRequestOptions): Promise<LoginResponse>;
|
|
@@ -1,75 +1,91 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.startTenantLogin = startTenantLogin;
|
|
3
4
|
exports.login = login;
|
|
4
5
|
const exchange_code_1 = require("../../../utils/auth/exchange-code");
|
|
5
6
|
const generate_code_challenge_and_verifier_1 = require("../../../utils/auth/generate-code-challenge-and-verifier");
|
|
6
7
|
const handle_tenant_code_1 = require("../../../utils/auth/handle-tenant-code");
|
|
7
8
|
const start_login_1 = require("../../../utils/auth/start-login");
|
|
8
|
-
|
|
9
|
+
const LoginError_1 = require("../types/LoginError");
|
|
10
|
+
/** Starts practitioner sign-in and lets the app choose among returned projects. */
|
|
11
|
+
async function startTenantLogin(body, requestOptions) {
|
|
12
|
+
const { codeVerifier, codeChallenge } = (0, generate_code_challenge_and_verifier_1.generateCodeChallengeAndVerifier)();
|
|
13
|
+
const startResponse = await (0, start_login_1.startLogin)({ client: this, body, codeChallenge, requestOptions });
|
|
14
|
+
const profiles = startResponse.profiles;
|
|
15
|
+
return {
|
|
16
|
+
profiles: profiles !== null && profiles !== void 0 ? profiles : [],
|
|
17
|
+
exchange: async (selectedTenantCode) => {
|
|
18
|
+
const tenantCode = (0, handle_tenant_code_1.handleTenantCode)({
|
|
19
|
+
profiles,
|
|
20
|
+
tenantCode: selectedTenantCode !== null && selectedTenantCode !== void 0 ? selectedTenantCode : body.tenantCode,
|
|
21
|
+
type: "Practitioner",
|
|
22
|
+
});
|
|
23
|
+
if (!tenantCode) {
|
|
24
|
+
throw new LoginError_1.LoginError("tenant_code_required", "Choose a project before completing sign-in.", profiles);
|
|
25
|
+
}
|
|
26
|
+
if (startResponse.nextStep === "mfa") {
|
|
27
|
+
return {
|
|
28
|
+
nextStep: "mfa",
|
|
29
|
+
verify: async (code) => {
|
|
30
|
+
const mfaResponse = await this.post("auth/tenant/Practitioner/login/mfa", { loginId: startResponse.loginId, mfaToken: code }, "application/json", requestOptions);
|
|
31
|
+
return (0, exchange_code_1.exchangeCode)({
|
|
32
|
+
client: this,
|
|
33
|
+
type: "Practitioner",
|
|
34
|
+
sessionCode: mfaResponse.sessionCode,
|
|
35
|
+
codeVerifier,
|
|
36
|
+
tenantCode,
|
|
37
|
+
requestOptions,
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return (0, exchange_code_1.exchangeCode)({
|
|
43
|
+
client: this,
|
|
44
|
+
type: "Practitioner",
|
|
45
|
+
sessionCode: startResponse.sessionCode,
|
|
46
|
+
codeVerifier,
|
|
47
|
+
tenantCode,
|
|
48
|
+
requestOptions,
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
async function login(body, requestOptions) {
|
|
54
|
+
if (body.type === "Practitioner") {
|
|
55
|
+
const start = await startTenantLogin.call(this, body, ...(requestOptions === undefined ? [] : [requestOptions]));
|
|
56
|
+
return start.exchange(body.tenantCode);
|
|
57
|
+
}
|
|
9
58
|
const { codeVerifier, codeChallenge } = (0, generate_code_challenge_and_verifier_1.generateCodeChallengeAndVerifier)();
|
|
10
59
|
const startResponse = await (0, start_login_1.startLogin)({
|
|
11
60
|
client: this,
|
|
12
61
|
body,
|
|
13
62
|
codeChallenge,
|
|
63
|
+
requestOptions,
|
|
14
64
|
});
|
|
15
65
|
if (startResponse.nextStep === "mfa") {
|
|
16
66
|
return {
|
|
17
67
|
nextStep: "mfa",
|
|
18
68
|
verify: async (code) => {
|
|
19
|
-
const tenantCode = body.type === "Practitioner" && !startResponse.profiles
|
|
20
|
-
? body.tenantCode
|
|
21
|
-
: (0, handle_tenant_code_1.handleTenantCode)({
|
|
22
|
-
profiles: startResponse.profiles,
|
|
23
|
-
tenantCode: body.tenantCode,
|
|
24
|
-
type: body.type,
|
|
25
|
-
});
|
|
26
|
-
const practitionerTenantCode = tenantCode;
|
|
27
|
-
if (body.type === "Practitioner" && !practitionerTenantCode) {
|
|
28
|
-
throw new Error("No tenant code found");
|
|
29
|
-
}
|
|
30
69
|
const mfaResponse = await this.post(`auth/tenant/${body.type}/login/mfa`, {
|
|
31
70
|
loginId: startResponse.loginId,
|
|
32
71
|
mfaToken: code,
|
|
33
|
-
}, "application/json");
|
|
34
|
-
if (body.type === "Practitioner") {
|
|
35
|
-
return (0, exchange_code_1.exchangeCode)({
|
|
36
|
-
client: this,
|
|
37
|
-
type: "Practitioner",
|
|
38
|
-
sessionCode: mfaResponse.sessionCode,
|
|
39
|
-
codeVerifier,
|
|
40
|
-
tenantCode: practitionerTenantCode,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
72
|
+
}, "application/json", requestOptions);
|
|
43
73
|
return (0, exchange_code_1.exchangeCode)({
|
|
44
74
|
client: this,
|
|
45
75
|
type: "Patient",
|
|
46
76
|
sessionCode: mfaResponse.sessionCode,
|
|
47
77
|
codeVerifier,
|
|
78
|
+
requestOptions,
|
|
48
79
|
});
|
|
49
80
|
},
|
|
50
81
|
};
|
|
51
82
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
type:
|
|
83
|
+
(0, handle_tenant_code_1.handleTenantCode)({ profiles: startResponse.profiles, tenantCode: body.tenantCode, type: "Patient" });
|
|
84
|
+
return (0, exchange_code_1.exchangeCode)({
|
|
85
|
+
client: this,
|
|
86
|
+
type: "Patient",
|
|
87
|
+
sessionCode: startResponse.sessionCode,
|
|
88
|
+
codeVerifier,
|
|
89
|
+
requestOptions,
|
|
56
90
|
});
|
|
57
|
-
if (!tenantCode) {
|
|
58
|
-
throw new Error("No tenant code found");
|
|
59
|
-
}
|
|
60
|
-
const exchangeCodeProps = body.type === "Practitioner"
|
|
61
|
-
? {
|
|
62
|
-
client: this,
|
|
63
|
-
type: "Practitioner",
|
|
64
|
-
sessionCode: startResponse.sessionCode,
|
|
65
|
-
codeVerifier,
|
|
66
|
-
tenantCode,
|
|
67
|
-
}
|
|
68
|
-
: {
|
|
69
|
-
client: this,
|
|
70
|
-
type: "Patient",
|
|
71
|
-
sessionCode: startResponse.sessionCode,
|
|
72
|
-
codeVerifier,
|
|
73
|
-
};
|
|
74
|
-
return (0, exchange_code_1.exchangeCode)(exchangeCodeProps);
|
|
75
91
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MedplumRequestOptions } from "@medplum/core";
|
|
1
2
|
import { OvokClient } from "../../ovok-client";
|
|
2
3
|
/** Revokes the current server session and always removes its local account. */
|
|
3
|
-
export declare function logout(this: OvokClient): Promise<void>;
|
|
4
|
+
export declare function logout(this: OvokClient, requestOptions?: MedplumRequestOptions): Promise<void>;
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.logout = logout;
|
|
4
4
|
const account_storage_1 = require("../account-storage");
|
|
5
5
|
/** Revokes the current server session and always removes its local account. */
|
|
6
|
-
async function logout() {
|
|
6
|
+
async function logout(requestOptions) {
|
|
7
7
|
var _a, _b;
|
|
8
8
|
const accountId = (_b = (_a = this.getActiveLogin()) === null || _a === void 0 ? void 0 : _a.profile) === null || _b === void 0 ? void 0 : _b.reference;
|
|
9
9
|
try {
|
|
10
|
-
await this.delete("auth/session/current");
|
|
10
|
+
await this.delete("auth/session/current", ...(requestOptions === undefined ? [] : [requestOptions]));
|
|
11
11
|
}
|
|
12
12
|
finally {
|
|
13
13
|
this.clearActiveLogin();
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { OvokClient } from "../../ovok-client";
|
|
2
|
-
|
|
2
|
+
/** @deprecated Use reloadSession() to receive the refreshed session fields. */
|
|
3
|
+
export declare function refetchProfile(this: OvokClient): Promise<import("@medplum/core").ProfileResource | undefined>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.refetchProfile = refetchProfile;
|
|
4
|
+
const reloadSession_1 = require("./reloadSession");
|
|
5
|
+
/** @deprecated Use reloadSession() to receive the refreshed session fields. */
|
|
4
6
|
async function refetchProfile() {
|
|
5
|
-
|
|
6
|
-
// Right now this function is private and I have to call this to refresh profile after update it
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
-
return this.refreshProfile();
|
|
7
|
+
return (await reloadSession_1.reloadSession.call(this)).profile;
|
|
9
8
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import type { MedplumRequestOptions } from "@medplum/core";
|
|
1
2
|
import { OvokClient } from "../../ovok-client";
|
|
2
3
|
import { RegisterBody } from "../types/RegisterBody";
|
|
3
4
|
import { RegisterResponse } from "../types/RegisterResponse";
|
|
4
|
-
export declare function register(this: OvokClient, body: RegisterBody): Promise<RegisterResponse>;
|
|
5
|
+
export declare function register(this: OvokClient, body: RegisterBody, requestOptions?: MedplumRequestOptions): Promise<RegisterResponse>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = register;
|
|
4
|
-
async function register(body) {
|
|
4
|
+
async function register(body, requestOptions) {
|
|
5
5
|
if (body.password !== body.passwordConfirm) {
|
|
6
6
|
throw new Error("Password and password confirm do not match");
|
|
7
7
|
}
|
|
@@ -14,5 +14,5 @@ async function register(body) {
|
|
|
14
14
|
...(body.continueAsPatientToken !== undefined
|
|
15
15
|
? { continueAsPatientToken: body.continueAsPatientToken }
|
|
16
16
|
: {}),
|
|
17
|
-
}, "application/json");
|
|
17
|
+
}, "application/json", requestOptions);
|
|
18
18
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import type { MedplumRequestOptions } from "@medplum/core";
|
|
1
2
|
import { OvokClient } from "../../ovok-client";
|
|
2
3
|
import { AuthResponse } from "../types/AuthResponse";
|
|
3
4
|
import { RegisterPractitionerBody } from "../types/RegisterPractitionerBody";
|
|
4
|
-
export declare function registerPractitioner(this: OvokClient, body: RegisterPractitionerBody): Promise<AuthResponse>;
|
|
5
|
+
export declare function registerPractitioner(this: OvokClient, body: RegisterPractitionerBody, requestOptions?: MedplumRequestOptions): Promise<AuthResponse>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.registerPractitioner = registerPractitioner;
|
|
4
|
-
async function registerPractitioner(body) {
|
|
4
|
+
async function registerPractitioner(body, requestOptions) {
|
|
5
5
|
if (body.password !== body.passwordConfirm) {
|
|
6
6
|
throw new Error("Password and password confirm do not match");
|
|
7
7
|
}
|
|
@@ -11,5 +11,5 @@ async function registerPractitioner(body) {
|
|
|
11
11
|
name: body.name,
|
|
12
12
|
surname: body.surname,
|
|
13
13
|
tenantCode: body.tenantCode,
|
|
14
|
-
}, "application/json");
|
|
14
|
+
}, "application/json", requestOptions);
|
|
15
15
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OvokClient } from "../../ovok-client";
|
|
2
|
+
/** Reloads the active profile, project membership, and access policy from auth/me. */
|
|
3
|
+
export declare function reloadSession(this: OvokClient): Promise<{
|
|
4
|
+
profile: ReturnType<OvokClient["getProfile"]>;
|
|
5
|
+
membership: ReturnType<OvokClient["getProjectMembership"]>;
|
|
6
|
+
accessPolicy: ReturnType<OvokClient["getAccessPolicy"]>;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reloadSession = reloadSession;
|
|
4
|
+
/** Reloads the active profile, project membership, and access policy from auth/me. */
|
|
5
|
+
async function reloadSession() {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
const login = this.getActiveLogin();
|
|
8
|
+
if (!login) {
|
|
9
|
+
throw new Error("Cannot reload a session while signed out.");
|
|
10
|
+
}
|
|
11
|
+
const profileId = (_a = this.getProfile()) === null || _a === void 0 ? void 0 : _a.id;
|
|
12
|
+
const previousMembership = JSON.stringify(this.getProjectMembership());
|
|
13
|
+
const previousAccessPolicy = JSON.stringify(this.getAccessPolicy());
|
|
14
|
+
await this.setActiveLogin(login);
|
|
15
|
+
const membership = this.getProjectMembership();
|
|
16
|
+
const accessPolicy = this.getAccessPolicy();
|
|
17
|
+
if (profileId === ((_b = this.getProfile()) === null || _b === void 0 ? void 0 : _b.id) &&
|
|
18
|
+
(previousMembership !== JSON.stringify(membership) ||
|
|
19
|
+
previousAccessPolicy !== JSON.stringify(accessPolicy))) {
|
|
20
|
+
this.dispatchEvent({ type: "change" });
|
|
21
|
+
}
|
|
22
|
+
return { profile: this.getProfile(), membership, accessPolicy };
|
|
23
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MedplumRequestOptions } from "@medplum/core";
|
|
1
2
|
import { OvokClient } from "../../ovok-client";
|
|
2
3
|
import { RequestDeleteUserBody } from "../types/RequestDeleteUserBody";
|
|
3
4
|
import { RequestDeleteUserResponse } from "../types/RequestDeleteUserResponse";
|
|
@@ -8,4 +9,4 @@ import { RequestDeleteUserResponse } from "../types/RequestDeleteUserResponse";
|
|
|
8
9
|
* @param {boolean} body.shouldPurgeAllMedicalData - If true, deletes all user's medical data
|
|
9
10
|
* @returns {Promise<RequestDeleteUserResponse>} Response containing scheduled deletion status and user information
|
|
10
11
|
*/
|
|
11
|
-
export declare function requestDeleteUser(this: OvokClient, body: RequestDeleteUserBody): Promise<RequestDeleteUserResponse>;
|
|
12
|
+
export declare function requestDeleteUser(this: OvokClient, body: RequestDeleteUserBody, requestOptions?: MedplumRequestOptions): Promise<RequestDeleteUserResponse>;
|
|
@@ -8,9 +8,9 @@ exports.requestDeleteUser = requestDeleteUser;
|
|
|
8
8
|
* @param {boolean} body.shouldPurgeAllMedicalData - If true, deletes all user's medical data
|
|
9
9
|
* @returns {Promise<RequestDeleteUserResponse>} Response containing scheduled deletion status and user information
|
|
10
10
|
*/
|
|
11
|
-
async function requestDeleteUser(body) {
|
|
12
|
-
return this.delete("auth/delete", {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
async function requestDeleteUser(body, requestOptions) {
|
|
12
|
+
return this.delete("auth/delete", { ...{
|
|
13
|
+
body: JSON.stringify(body),
|
|
14
|
+
headers: { "Content-Type": "application/json" },
|
|
15
|
+
}, ...requestOptions });
|
|
16
16
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OperationOutcome } from "@medplum/fhirtypes";
|
|
2
|
+
import type { MedplumRequestOptions } from "@medplum/core";
|
|
2
3
|
import { OvokClient } from "../../ovok-client";
|
|
3
4
|
import { ResetPasswordBody } from "../types/ResetPasswordBody";
|
|
4
5
|
/**
|
|
@@ -10,4 +11,4 @@ import { ResetPasswordBody } from "../types/ResetPasswordBody";
|
|
|
10
11
|
* @returns Promise with the OperationOutcome
|
|
11
12
|
* @throws Reset password error response
|
|
12
13
|
*/
|
|
13
|
-
export declare function resetPassword(this: OvokClient, body: ResetPasswordBody): Promise<OperationOutcome>;
|
|
14
|
+
export declare function resetPassword(this: OvokClient, body: ResetPasswordBody, requestOptions?: MedplumRequestOptions): Promise<OperationOutcome>;
|
|
@@ -10,10 +10,10 @@ exports.resetPassword = resetPassword;
|
|
|
10
10
|
* @returns Promise with the OperationOutcome
|
|
11
11
|
* @throws Reset password error response
|
|
12
12
|
*/
|
|
13
|
-
async function resetPassword(body) {
|
|
13
|
+
async function resetPassword(body, requestOptions) {
|
|
14
14
|
var _a;
|
|
15
15
|
return this.post("v2/auth/reset-password", {
|
|
16
16
|
...body,
|
|
17
17
|
clientId: (_a = body.clientId) !== null && _a !== void 0 ? _a : this.socialLoginClientId,
|
|
18
|
-
}, "application/json");
|
|
18
|
+
}, "application/json", requestOptions);
|
|
19
19
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import type { MedplumRequestOptions } from "@medplum/core";
|
|
1
2
|
import { OvokClient } from "../../ovok-client";
|
|
2
3
|
import { SessionRevokeOption } from "../types/Session";
|
|
3
4
|
/** Revokes the selected server-side session or session group. */
|
|
4
|
-
export declare function revokeSessions(this: OvokClient, option: SessionRevokeOption): Promise<void>;
|
|
5
|
+
export declare function revokeSessions(this: OvokClient, option: SessionRevokeOption, requestOptions?: MedplumRequestOptions): Promise<void>;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.revokeSessions = revokeSessions;
|
|
4
4
|
/** Revokes the selected server-side session or session group. */
|
|
5
|
-
async function revokeSessions(option) {
|
|
6
|
-
await this.delete(`auth/session/${encodeURIComponent(option)}
|
|
5
|
+
async function revokeSessions(option, requestOptions) {
|
|
6
|
+
await this.delete(`auth/session/${encodeURIComponent(option)}`, ...(requestOptions === undefined ? [] : [requestOptions]));
|
|
7
7
|
if (option === "current") {
|
|
8
8
|
this.clearActiveLogin();
|
|
9
9
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OperationOutcome } from "@medplum/fhirtypes";
|
|
2
|
+
import type { MedplumRequestOptions } from "@medplum/core";
|
|
2
3
|
import { OvokClient } from "../../ovok-client";
|
|
3
4
|
import { CompletePasswordResetBody } from "../types/CompletePasswordResetBody";
|
|
4
|
-
export declare function setPasswordFromReset(this: OvokClient, body: CompletePasswordResetBody): Promise<OperationOutcome>;
|
|
5
|
+
export declare function setPasswordFromReset(this: OvokClient, body: CompletePasswordResetBody, requestOptions?: MedplumRequestOptions): Promise<OperationOutcome>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setPasswordFromReset = setPasswordFromReset;
|
|
4
|
-
async function setPasswordFromReset(body) {
|
|
5
|
-
return this.post("v2/auth/reset-password/process", body, "application/json");
|
|
4
|
+
async function setPasswordFromReset(body, requestOptions) {
|
|
5
|
+
return this.post("v2/auth/reset-password/process", body, "application/json", requestOptions);
|
|
6
6
|
}
|
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* The email address of the patient
|
|
4
|
-
*/
|
|
1
|
+
type LoginCredentials = {
|
|
5
2
|
email: string;
|
|
6
|
-
/**
|
|
7
|
-
* The password of the patient
|
|
8
|
-
*/
|
|
9
3
|
password: string;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*/
|
|
13
|
-
type: "Patient" | "Practitioner";
|
|
14
|
-
} & ({
|
|
4
|
+
};
|
|
5
|
+
export type PatientLoginBody = LoginCredentials & {
|
|
15
6
|
type: "Patient";
|
|
16
|
-
/**
|
|
17
|
-
* The tenant code to login to. This is required for patient login.
|
|
18
|
-
*/
|
|
7
|
+
/** The tenant code to log in to. */
|
|
19
8
|
tenantCode: string;
|
|
20
|
-
}
|
|
9
|
+
};
|
|
10
|
+
export type PractitionerLoginBody = LoginCredentials & {
|
|
21
11
|
type: "Practitioner";
|
|
22
|
-
/**
|
|
23
|
-
* The tenant code to login to. This is optional for practitioner login. If not provided, the first tenant code will be used.
|
|
24
|
-
*/
|
|
12
|
+
/** Selects a project when the person belongs to multiple projects. */
|
|
25
13
|
tenantCode?: string;
|
|
26
|
-
}
|
|
14
|
+
};
|
|
15
|
+
export type LoginBody = PatientLoginBody | PractitionerLoginBody;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LoginResponse } from "./LoginResponse";
|
|
2
|
+
import type { StartLoginResponse } from "./StartLoginResponse";
|
|
3
|
+
/** A login selection error with fields apps can branch on without parsing prose. */
|
|
4
|
+
export declare class LoginError extends Error {
|
|
5
|
+
readonly code: "profile_not_found" | "tenant_code_required" | "tenant_code_not_found";
|
|
6
|
+
readonly profiles: LoginProfile[];
|
|
7
|
+
readonly status = 400;
|
|
8
|
+
readonly requestId: string | undefined;
|
|
9
|
+
constructor(code: "profile_not_found" | "tenant_code_required" | "tenant_code_not_found", message: string, profiles?: LoginProfile[], requestId?: string);
|
|
10
|
+
}
|
|
11
|
+
export type LoginProfile = NonNullable<StartLoginResponse["profiles"]>[number];
|
|
12
|
+
export type TenantLoginStart = {
|
|
13
|
+
profiles: LoginProfile[];
|
|
14
|
+
exchange: (tenantCode?: string) => Promise<LoginResponse>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LoginError = void 0;
|
|
4
|
+
/** A login selection error with fields apps can branch on without parsing prose. */
|
|
5
|
+
class LoginError extends Error {
|
|
6
|
+
constructor(code, message, profiles = [], requestId) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.code = code;
|
|
9
|
+
this.profiles = profiles;
|
|
10
|
+
this.status = 400;
|
|
11
|
+
this.name = "LoginError";
|
|
12
|
+
this.requestId = requestId;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.LoginError = LoginError;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MedplumRequestOptions } from "@medplum/core";
|
|
1
2
|
import { OvokClient } from "../../ovok-client";
|
|
2
3
|
/**
|
|
3
4
|
* Executes a bot by identifier using the Ovok API
|
|
@@ -7,4 +8,4 @@ import { OvokClient } from "../../ovok-client";
|
|
|
7
8
|
* @param parameters Additional parameters to pass to the bot
|
|
8
9
|
* @returns Promise with the bot execution result
|
|
9
10
|
*/
|
|
10
|
-
export declare function executeBot(this: OvokClient, identifier: string, parameters: Record<string, unknown
|
|
11
|
+
export declare function executeBot(this: OvokClient, identifier: string, parameters: Record<string, unknown>, _contentType?: string, requestOptions?: MedplumRequestOptions): Promise<Record<string, unknown>>;
|
|
@@ -9,6 +9,6 @@ exports.executeBot = executeBot;
|
|
|
9
9
|
* @param parameters Additional parameters to pass to the bot
|
|
10
10
|
* @returns Promise with the bot execution result
|
|
11
11
|
*/
|
|
12
|
-
async function executeBot(identifier, parameters) {
|
|
13
|
-
return this.post(`/bots?identifier=${encodeURIComponent(identifier)}`, parameters, "application/json");
|
|
12
|
+
async function executeBot(identifier, parameters, _contentType, requestOptions) {
|
|
13
|
+
return this.post(`/bots?identifier=${encodeURIComponent(identifier)}`, parameters, "application/json", requestOptions);
|
|
14
14
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import type { MedplumRequestOptions } from "@medplum/core";
|
|
1
2
|
import { OvokClient } from "../ovok-client";
|
|
2
3
|
import { ChangeHistoryPage, ChangeHistoryQuery } from "./types";
|
|
3
4
|
export declare function serializeChangeHistoryQuery(params?: ChangeHistoryQuery): string;
|
|
4
|
-
export declare function listChangeHistory(this: OvokClient, params?: ChangeHistoryQuery): Promise<ChangeHistoryPage>;
|
|
5
|
+
export declare function listChangeHistory(this: OvokClient, params?: ChangeHistoryQuery, requestOptions?: MedplumRequestOptions): Promise<ChangeHistoryPage>;
|