@ovok/core 0.4.49-dev.495 → 0.4.49-dev.496
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/observation/measurement-fields.d.ts +1 -1
- package/dist/client/observation/methods/observationsToMeasurements.d.ts +1 -1
- package/dist/client/observation/methods/observationsToMeasurements.js +59 -59
- package/dist/client/observation/services/base-observation-service.d.ts +1 -1
- package/dist/client/observation/services/blood-oxygen.d.ts +1 -1
- package/dist/client/observation/services/blood-oxygen.js +7 -7
- package/dist/client/observation/services/blood-pressure.d.ts +1 -1
- package/dist/client/observation/services/blood-pressure.js +16 -16
- package/dist/client/observation/services/component-observation-services.d.ts +1 -1
- package/dist/client/observation/services/component-observation-services.js +3 -3
- package/dist/client/observation/services/creator.d.ts +1 -1
- package/dist/client/observation/services/creator.js +10 -10
- package/dist/client/observation/services/ecg-observation-fragments.d.ts +1 -1
- package/dist/client/observation/services/ecg.d.ts +1 -1
- package/dist/client/observation/services/ecg.js +10 -10
- package/dist/client/observation/services/lipid-panel.d.ts +1 -1
- package/dist/client/observation/services/lipid-panel.js +13 -13
- package/dist/client/observation/services/single-value-services.d.ts +1 -1
- package/dist/client/observation/services/single-value-services.js +19 -19
- package/dist/client/observation/services/step-count.d.ts +1 -1
- package/dist/client/observation/services/step-count.js +5 -5
- package/dist/client/observation/services/uric-acid-service.d.ts +1 -1
- package/dist/client/observation/services/uric-acid-service.js +7 -7
- package/dist/client/offline/offline-measurement-queue.d.ts +1 -2
- package/dist/client/wearables/types.d.ts +5 -0
- package/dist/conformance/capability-requirements.js +1 -1
- package/dist/next/auth/access-token.d.ts +9 -0
- package/dist/next/auth/access-token.js +18 -0
- package/dist/next/auth/client-credentials.d.ts +16 -0
- package/dist/next/auth/client-credentials.js +40 -0
- package/dist/next/auth/credentials.d.ts +5 -0
- package/dist/next/auth/credentials.js +7 -0
- package/dist/next/auth/session-store.d.ts +12 -0
- package/dist/next/auth/session-store.js +33 -0
- package/dist/next/auth/session.d.ts +28 -0
- package/dist/next/auth/session.js +27 -0
- package/dist/next/auth/token-endpoint.d.ts +12 -0
- package/dist/next/auth/token-endpoint.js +28 -0
- package/dist/next/auth/user-session.d.ts +27 -0
- package/dist/next/auth/user-session.js +82 -0
- package/dist/next/config/ovok-config.d.ts +42 -0
- package/dist/next/config/ovok-config.js +2 -0
- package/dist/next/config/settings.d.ts +6 -0
- package/dist/next/config/settings.js +74 -0
- package/dist/next/errors/error-from-response.d.ts +2 -0
- package/dist/next/errors/error-from-response.js +35 -0
- package/dist/next/errors/ovok-errors.d.ts +42 -0
- package/dist/next/errors/ovok-errors.js +74 -0
- package/dist/next/http/http-client.d.ts +35 -0
- package/dist/next/http/http-client.js +113 -0
- package/dist/next/http/retry-after.d.ts +1 -0
- package/dist/next/http/retry-after.js +16 -0
- package/dist/next/http/retry-policy.d.ts +13 -0
- package/dist/next/http/retry-policy.js +27 -0
- package/dist/next/http/transmit.d.ts +14 -0
- package/dist/next/http/transmit.js +57 -0
- package/dist/next/http/url.d.ts +6 -0
- package/dist/next/http/url.js +22 -0
- package/dist/next/index.d.ts +69 -0
- package/dist/next/index.js +33 -0
- package/dist/next/ovok.d.ts +52 -0
- package/dist/next/ovok.js +74 -0
- package/dist/next/paging/bundle-page.d.ts +4 -0
- package/dist/next/paging/bundle-page.js +25 -0
- package/dist/next/paging/cursor-pages.d.ts +7 -0
- package/dist/next/paging/cursor-pages.js +14 -0
- package/dist/next/paging/numbered-pages.d.ts +15 -0
- package/dist/next/paging/numbered-pages.js +20 -0
- package/dist/next/paging/page.d.ts +12 -0
- package/dist/next/paging/page.js +17 -0
- package/dist/next/resources/accounts/accounts-resource.d.ts +8 -0
- package/dist/next/resources/accounts/accounts-resource.js +13 -0
- package/dist/next/resources/ai/ai-chat-resource.d.ts +8 -0
- package/dist/next/resources/ai/ai-chat-resource.js +12 -0
- package/dist/next/resources/ai/ai-resource.d.ts +16 -0
- package/dist/next/resources/ai/ai-resource.js +19 -0
- package/dist/next/resources/ai/chat-messages-resource.d.ts +9 -0
- package/dist/next/resources/ai/chat-messages-resource.js +18 -0
- package/dist/next/resources/ai/chat-sessions-resource.d.ts +14 -0
- package/dist/next/resources/ai/chat-sessions-resource.js +23 -0
- package/dist/next/resources/auth/auth-sessions-resource.d.ts +13 -0
- package/dist/next/resources/auth/auth-sessions-resource.js +25 -0
- package/dist/next/resources/auth/registration.d.ts +35 -0
- package/dist/next/resources/auth/registration.js +24 -0
- package/dist/next/resources/auth/social-login.d.ts +8 -0
- package/dist/next/resources/auth/social-login.js +7 -0
- package/dist/next/resources/auth-resource.d.ts +63 -0
- package/dist/next/resources/auth-resource.js +119 -0
- package/dist/next/resources/bots/bots-resource.d.ts +10 -0
- package/dist/next/resources/bots/bots-resource.js +15 -0
- package/dist/next/resources/cms/cms-delivery.d.ts +22 -0
- package/dist/next/resources/cms/cms-delivery.js +36 -0
- package/dist/next/resources/cms/cms-documents-resource.d.ts +11 -0
- package/dist/next/resources/cms/cms-documents-resource.js +17 -0
- package/dist/next/resources/cms/cms-resource.d.ts +17 -0
- package/dist/next/resources/cms/cms-resource.js +38 -0
- package/dist/next/resources/cms/payload-pages.d.ts +6 -0
- package/dist/next/resources/cms/payload-pages.js +15 -0
- package/dist/next/resources/cms/release-notes-resource.d.ts +10 -0
- package/dist/next/resources/cms/release-notes-resource.js +15 -0
- package/dist/next/resources/cms/translation-tree.d.ts +3 -0
- package/dist/next/resources/cms/translation-tree.js +45 -0
- package/dist/next/resources/consent/consent-resource.d.ts +23 -0
- package/dist/next/resources/consent/consent-resource.js +43 -0
- package/dist/next/resources/content/content-resource.d.ts +19 -0
- package/dist/next/resources/content/content-resource.js +41 -0
- package/dist/next/resources/documents/documents-resource.d.ts +26 -0
- package/dist/next/resources/documents/documents-resource.js +41 -0
- package/dist/next/resources/email/email-resource.d.ts +6 -0
- package/dist/next/resources/email/email-resource.js +10 -0
- package/dist/next/resources/email/email-templates-resource.d.ts +8 -0
- package/dist/next/resources/email/email-templates-resource.js +13 -0
- package/dist/next/resources/fhir-resource.d.ts +28 -0
- package/dist/next/resources/fhir-resource.js +64 -0
- package/dist/next/resources/health-resource.d.ts +17 -0
- package/dist/next/resources/health-resource.js +14 -0
- package/dist/next/resources/invites/invite-flow-resource.d.ts +12 -0
- package/dist/next/resources/invites/invite-flow-resource.js +19 -0
- package/dist/next/resources/invites/invites-resource.d.ts +17 -0
- package/dist/next/resources/invites/invites-resource.js +14 -0
- package/dist/next/resources/localization/i18next-resource.d.ts +10 -0
- package/dist/next/resources/localization/i18next-resource.js +18 -0
- package/dist/next/resources/localization/locales-resource.d.ts +9 -0
- package/dist/next/resources/localization/locales-resource.js +16 -0
- package/dist/next/resources/localization/localizations-resource.d.ts +17 -0
- package/dist/next/resources/localization/localizations-resource.js +27 -0
- package/dist/next/resources/measurements/measurements-resource.d.ts +42 -0
- package/dist/next/resources/measurements/measurements-resource.js +77 -0
- package/dist/next/resources/measurements/observation-builder.d.ts +5 -0
- package/dist/next/resources/measurements/observation-builder.js +57 -0
- package/dist/next/resources/measurements/save-error.d.ts +5 -0
- package/dist/next/resources/measurements/save-error.js +18 -0
- package/dist/next/resources/measurements/signed-in-account.d.ts +11 -0
- package/dist/next/resources/measurements/signed-in-account.js +26 -0
- package/dist/next/resources/patient/fhir-records.d.ts +19 -0
- package/dist/next/resources/patient/fhir-records.js +33 -0
- package/dist/next/resources/patient/patient-resource.d.ts +21 -0
- package/dist/next/resources/patient/patient-resource.js +38 -0
- package/dist/next/resources/projects/project-features-resource.d.ts +9 -0
- package/dist/next/resources/projects/project-features-resource.js +17 -0
- package/dist/next/resources/projects/project-members-resource.d.ts +19 -0
- package/dist/next/resources/projects/project-members-resource.js +25 -0
- package/dist/next/resources/projects/project-settings-resource.d.ts +10 -0
- package/dist/next/resources/projects/project-settings-resource.js +21 -0
- package/dist/next/resources/projects/projects-resource.d.ts +20 -0
- package/dist/next/resources/projects/projects-resource.js +21 -0
- package/dist/next/resources/questionnaires/questionnaires-resource.d.ts +18 -0
- package/dist/next/resources/questionnaires/questionnaires-resource.js +36 -0
- package/dist/next/resources/sharing/sharing-invites-resource.d.ts +9 -0
- package/dist/next/resources/sharing/sharing-invites-resource.js +17 -0
- package/dist/next/resources/sharing/sharing-resource.d.ts +10 -0
- package/dist/next/resources/sharing/sharing-resource.js +14 -0
- package/dist/next/resources/sharing/sharing-settings-resource.d.ts +9 -0
- package/dist/next/resources/sharing/sharing-settings-resource.js +16 -0
- package/dist/next/resources/sharing/sharing-shares-resource.d.ts +9 -0
- package/dist/next/resources/sharing/sharing-shares-resource.js +27 -0
- package/dist/next/resources/signals/signals-gateway-resource.d.ts +14 -0
- package/dist/next/resources/signals/signals-gateway-resource.js +44 -0
- package/dist/next/resources/signals/signals-resource.d.ts +13 -0
- package/dist/next/resources/signals/signals-resource.js +19 -0
- package/dist/next/resources/signals/undeliverable-resource.d.ts +26 -0
- package/dist/next/resources/signals/undeliverable-resource.js +18 -0
- package/dist/next/resources/slim/live-reads.d.ts +12 -0
- package/dist/next/resources/slim/live-reads.js +76 -0
- package/dist/next/resources/slim/slim-alarms-resource.d.ts +13 -0
- package/dist/next/resources/slim/slim-alarms-resource.js +25 -0
- package/dist/next/resources/slim/slim-change-history-resource.d.ts +9 -0
- package/dist/next/resources/slim/slim-change-history-resource.js +19 -0
- package/dist/next/resources/slim/slim-child-projects-resource.d.ts +17 -0
- package/dist/next/resources/slim/slim-child-projects-resource.js +22 -0
- package/dist/next/resources/slim/slim-devices-resource.d.ts +28 -0
- package/dist/next/resources/slim/slim-devices-resource.js +80 -0
- package/dist/next/resources/slim/slim-exports-resource.d.ts +8 -0
- package/dist/next/resources/slim/slim-exports-resource.js +14 -0
- package/dist/next/resources/slim/slim-locations-resource.d.ts +14 -0
- package/dist/next/resources/slim/slim-locations-resource.js +30 -0
- package/dist/next/resources/slim/slim-medical-notifications-resource.d.ts +18 -0
- package/dist/next/resources/slim/slim-medical-notifications-resource.js +46 -0
- package/dist/next/resources/slim/slim-notification-notes-resource.d.ts +12 -0
- package/dist/next/resources/slim/slim-notification-notes-resource.js +34 -0
- package/dist/next/resources/slim/slim-notifications-resource.d.ts +19 -0
- package/dist/next/resources/slim/slim-notifications-resource.js +26 -0
- package/dist/next/resources/slim/slim-organizations-resource.d.ts +11 -0
- package/dist/next/resources/slim/slim-organizations-resource.js +25 -0
- package/dist/next/resources/slim/slim-out-of-bed-resource.d.ts +13 -0
- package/dist/next/resources/slim/slim-out-of-bed-resource.js +20 -0
- package/dist/next/resources/slim/slim-paths.d.ts +6 -0
- package/dist/next/resources/slim/slim-paths.js +9 -0
- package/dist/next/resources/slim/slim-patient-thresholds-resource.d.ts +10 -0
- package/dist/next/resources/slim/slim-patient-thresholds-resource.js +20 -0
- package/dist/next/resources/slim/slim-patients-resource.d.ts +20 -0
- package/dist/next/resources/slim/slim-patients-resource.js +39 -0
- package/dist/next/resources/slim/slim-policies-resource.d.ts +12 -0
- package/dist/next/resources/slim/slim-policies-resource.js +29 -0
- package/dist/next/resources/slim/slim-practitioners-resource.d.ts +8 -0
- package/dist/next/resources/slim/slim-practitioners-resource.js +14 -0
- package/dist/next/resources/slim/slim-projects-resource.d.ts +16 -0
- package/dist/next/resources/slim/slim-projects-resource.js +35 -0
- package/dist/next/resources/slim/slim-queries.d.ts +34 -0
- package/dist/next/resources/slim/slim-queries.js +2 -0
- package/dist/next/resources/slim/slim-resource.d.ts +38 -0
- package/dist/next/resources/slim/slim-resource.js +44 -0
- package/dist/next/resources/slim/slim-sleep-resource.d.ts +9 -0
- package/dist/next/resources/slim/slim-sleep-resource.js +15 -0
- package/dist/next/resources/slim/slim-thresholds-resource.d.ts +11 -0
- package/dist/next/resources/slim/slim-thresholds-resource.js +18 -0
- package/dist/next/resources/slim/slim-trends-resource.d.ts +11 -0
- package/dist/next/resources/slim/slim-trends-resource.js +19 -0
- package/dist/next/resources/slim/slim-users-resource.d.ts +11 -0
- package/dist/next/resources/slim/slim-users-resource.js +15 -0
- package/dist/next/resources/slim/slim-zones-resource.d.ts +12 -0
- package/dist/next/resources/slim/slim-zones-resource.js +24 -0
- package/dist/next/resources/video-calls/video-call-access-resource.d.ts +11 -0
- package/dist/next/resources/video-calls/video-call-access-resource.js +19 -0
- package/dist/next/resources/video-calls/video-call-appointments-resource.d.ts +10 -0
- package/dist/next/resources/video-calls/video-call-appointments-resource.js +21 -0
- package/dist/next/resources/video-calls/video-call-emails-resource.d.ts +10 -0
- package/dist/next/resources/video-calls/video-call-emails-resource.js +19 -0
- package/dist/next/resources/video-calls/video-calls-resource.d.ts +14 -0
- package/dist/next/resources/video-calls/video-calls-resource.js +20 -0
- package/dist/next/resources/wearables/wearable-connections-resource.d.ts +12 -0
- package/dist/next/resources/wearables/wearable-connections-resource.js +25 -0
- package/dist/next/resources/wearables/wearable-providers-resource.d.ts +12 -0
- package/dist/next/resources/wearables/wearable-providers-resource.js +27 -0
- package/dist/next/resources/wearables/wearables-resource.d.ts +8 -0
- package/dist/next/resources/wearables/wearables-resource.js +14 -0
- package/dist/next/storage/ovok-storage.d.ts +11 -0
- package/dist/next/storage/ovok-storage.js +19 -0
- package/dist/types/MeasurementTypes.d.ts +5 -0
- package/dist/types/MeasurementTypes.js +21 -0
- package/dist/types/index.d.ts +1 -5
- package/dist/types/index.js +1 -5
- package/next/index.d.ts +1 -0
- package/next/index.js +3 -0
- package/package.json +3 -2
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.patientRegistrationBody = exports.isClinicianInvite = exports.REGISTER_PATHS = void 0;
|
|
4
|
+
exports.practitionerRegistrationBody = practitionerRegistrationBody;
|
|
5
|
+
const ovok_errors_1 = require("../../errors/ovok-errors");
|
|
6
|
+
exports.REGISTER_PATHS = {
|
|
7
|
+
patient: "auth/tenant/Patient/register",
|
|
8
|
+
practitioner: "auth/tenant/Practitioner/register",
|
|
9
|
+
};
|
|
10
|
+
const isClinicianInvite = (response) => "nextStep" in response && response.nextStep === "clinician-invite";
|
|
11
|
+
exports.isClinicianInvite = isClinicianInvite;
|
|
12
|
+
/** The confirmation is checked here and never sent. */
|
|
13
|
+
function practitionerRegistrationBody(details, tenantCode) {
|
|
14
|
+
if (details.password !== details.passwordConfirm) {
|
|
15
|
+
throw new ovok_errors_1.OvokValidationError((0, ovok_errors_1.detailsFor)("Password and password confirm do not match."));
|
|
16
|
+
}
|
|
17
|
+
const { email, password, name, surname } = details;
|
|
18
|
+
return { email, password, name, surname, tenantCode };
|
|
19
|
+
}
|
|
20
|
+
const patientRegistrationBody = (details, tenantCode) => ({
|
|
21
|
+
...practitionerRegistrationBody(details, tenantCode),
|
|
22
|
+
continueAsPatientToken: details.continueAsPatientToken,
|
|
23
|
+
});
|
|
24
|
+
exports.patientRegistrationBody = patientRegistrationBody;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AppleLoginBody } from "../../../client/auth/types/AppleLoginBody";
|
|
2
|
+
import type { GoogleLoginBody } from "../../../client/auth/types/GoogleLoginBody";
|
|
3
|
+
export type SocialCredentials = {
|
|
4
|
+
apple: AppleLoginBody;
|
|
5
|
+
google: GoogleLoginBody;
|
|
6
|
+
};
|
|
7
|
+
export type SocialProvider = keyof SocialCredentials;
|
|
8
|
+
export declare const socialLoginPath: (provider: SocialProvider, clientId: string, internalId: string) => string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.socialLoginPath = void 0;
|
|
4
|
+
const query_string_1 = require("../../../client/query-string");
|
|
5
|
+
const url_1 = require("../../http/url");
|
|
6
|
+
const socialLoginPath = (provider, clientId, internalId) => `auth/external/${(0, url_1.pathSegment)(provider)}${(0, query_string_1.toQueryString)({ client: `ClientApplication/${clientId}`, internalId })}`;
|
|
7
|
+
exports.socialLoginPath = socialLoginPath;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { ChangePasswordBody } from "../../client/auth/types/ChangePasswordBody";
|
|
2
|
+
import type { ChangePasswordResponse } from "../../client/auth/types/ChangePasswordResponse";
|
|
3
|
+
import type { CompletePasswordResetBody } from "../../client/auth/types/CompletePasswordResetBody";
|
|
4
|
+
import type { RequestDeleteUserBody } from "../../client/auth/types/RequestDeleteUserBody";
|
|
5
|
+
import type { RequestDeleteUserResponse } from "../../client/auth/types/RequestDeleteUserResponse";
|
|
6
|
+
import type { ResetPasswordBody } from "../../client/auth/types/ResetPasswordBody";
|
|
7
|
+
import type { OvokCurrentPatientProfile } from "../../client/patient/types";
|
|
8
|
+
import type { OperationOutcome } from "@medplum/fhirtypes";
|
|
9
|
+
import { Session } from "../auth/session";
|
|
10
|
+
import { UserSession } from "../auth/user-session";
|
|
11
|
+
import { HttpClient } from "../http/http-client";
|
|
12
|
+
import { RequestOptions } from "../http/transmit";
|
|
13
|
+
import { AuthSessionsResource } from "./auth/auth-sessions-resource";
|
|
14
|
+
import { PatientRegistration, PractitionerRegistration, RegisterResult } from "./auth/registration";
|
|
15
|
+
import { SocialCredentials, SocialProvider } from "./auth/social-login";
|
|
16
|
+
export type ProfileType = "Patient" | "Practitioner" | "RelatedPerson";
|
|
17
|
+
export type LoginCredentials = {
|
|
18
|
+
profileType: ProfileType;
|
|
19
|
+
email: string;
|
|
20
|
+
password: string;
|
|
21
|
+
};
|
|
22
|
+
/** Hand it back to `verifyMfa`: it carries the PKCE verifier the token exchange needs. */
|
|
23
|
+
export type MfaChallenge = {
|
|
24
|
+
profileType: ProfileType;
|
|
25
|
+
loginId: string;
|
|
26
|
+
codeVerifier: string;
|
|
27
|
+
};
|
|
28
|
+
export type LoginResult = {
|
|
29
|
+
status: "signed-in";
|
|
30
|
+
session: Session;
|
|
31
|
+
} | {
|
|
32
|
+
status: "mfa-required";
|
|
33
|
+
challenge: MfaChallenge;
|
|
34
|
+
};
|
|
35
|
+
export declare const ME_PATH = "auth/me";
|
|
36
|
+
export declare class AuthResource {
|
|
37
|
+
private readonly http;
|
|
38
|
+
private readonly tenantCode;
|
|
39
|
+
private readonly session;
|
|
40
|
+
private readonly clientId;
|
|
41
|
+
readonly sessions: AuthSessionsResource;
|
|
42
|
+
/** `clientId` is the ClientApplication social sign-in and password resets go through. */
|
|
43
|
+
constructor(http: HttpClient, tenantCode: string, session: UserSession | null, clientId?: string | null);
|
|
44
|
+
login(credentials: LoginCredentials, options?: RequestOptions): Promise<LoginResult>;
|
|
45
|
+
verifyMfa(challenge: MfaChallenge, code: string, options?: RequestOptions): Promise<LoginResult>;
|
|
46
|
+
/** A project that routes the email to a clinician invitation signs no one in. */
|
|
47
|
+
register(details: PatientRegistration, options?: RequestOptions): Promise<RegisterResult>;
|
|
48
|
+
registerPractitioner(details: PractitionerRegistration, options?: RequestOptions): Promise<Session>;
|
|
49
|
+
socialLogin<P extends SocialProvider>(provider: P, credential: SocialCredentials[P], options?: RequestOptions): Promise<Session>;
|
|
50
|
+
current(): Promise<Session | null>;
|
|
51
|
+
me(options?: RequestOptions): Promise<OvokCurrentPatientProfile>;
|
|
52
|
+
/** The confirmation is the app's to check; Ovok Core never receives it. */
|
|
53
|
+
changePassword(change: ChangePasswordBody, options?: RequestOptions): Promise<ChangePasswordResponse>;
|
|
54
|
+
resetPassword(request: ResetPasswordBody, options?: RequestOptions): Promise<OperationOutcome>;
|
|
55
|
+
completePasswordReset(body: CompletePasswordResetBody, options?: RequestOptions): Promise<OperationOutcome>;
|
|
56
|
+
/** Schedules the deletion; the account stays signed in until then. */
|
|
57
|
+
deleteAccount(request: RequestDeleteUserBody, options?: RequestOptions): Promise<RequestDeleteUserResponse>;
|
|
58
|
+
/** Ends the session on the server, and always locally, even when the server cannot be reached. */
|
|
59
|
+
logout(options?: RequestOptions): Promise<void>;
|
|
60
|
+
private exchange;
|
|
61
|
+
private userSession;
|
|
62
|
+
private socialLoginClientId;
|
|
63
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthResource = exports.ME_PATH = void 0;
|
|
4
|
+
const generate_code_challenge_and_verifier_1 = require("../../client/auth/generate-code-challenge-and-verifier");
|
|
5
|
+
const ovok_errors_1 = require("../errors/ovok-errors");
|
|
6
|
+
const auth_sessions_resource_1 = require("./auth/auth-sessions-resource");
|
|
7
|
+
const registration_1 = require("./auth/registration");
|
|
8
|
+
const social_login_1 = require("./auth/social-login");
|
|
9
|
+
exports.ME_PATH = "auth/me";
|
|
10
|
+
const LOGOUT_PATH = "auth/session/current";
|
|
11
|
+
const CHANGE_PASSWORD_PATH = "v2/auth/change-password";
|
|
12
|
+
const RESET_PASSWORD_PATH = "v2/auth/reset-password";
|
|
13
|
+
const COMPLETE_PASSWORD_RESET_PATH = "v2/auth/reset-password/process";
|
|
14
|
+
const DELETE_ACCOUNT_PATH = "auth/delete";
|
|
15
|
+
class AuthResource {
|
|
16
|
+
/** `clientId` is the ClientApplication social sign-in and password resets go through. */
|
|
17
|
+
constructor(http, tenantCode, session, clientId = null) {
|
|
18
|
+
this.http = http;
|
|
19
|
+
this.tenantCode = tenantCode;
|
|
20
|
+
this.session = session;
|
|
21
|
+
this.clientId = clientId;
|
|
22
|
+
this.sessions = new auth_sessions_resource_1.AuthSessionsResource(http, session);
|
|
23
|
+
}
|
|
24
|
+
async login(credentials, options) {
|
|
25
|
+
const session = this.userSession();
|
|
26
|
+
const { codeVerifier, codeChallenge } = (0, generate_code_challenge_and_verifier_1.generateCodeChallengeAndVerifier)();
|
|
27
|
+
const { profileType, email, password } = credentials;
|
|
28
|
+
const step = await this.http
|
|
29
|
+
.anonymous()
|
|
30
|
+
.post(loginPath(profileType, "start"), { email, password, codeChallenge }, options);
|
|
31
|
+
if (step.nextStep === "mfa") {
|
|
32
|
+
return { status: "mfa-required", challenge: { profileType, loginId: step.loginId, codeVerifier } };
|
|
33
|
+
}
|
|
34
|
+
return this.exchange(session, { profileType, sessionCode: step.sessionCode, codeVerifier }, options);
|
|
35
|
+
}
|
|
36
|
+
async verifyMfa(challenge, code, options) {
|
|
37
|
+
const session = this.userSession();
|
|
38
|
+
const { profileType, loginId, codeVerifier } = challenge;
|
|
39
|
+
const step = await this.http
|
|
40
|
+
.anonymous()
|
|
41
|
+
.post(loginPath(profileType, "mfa"), { loginId, mfaToken: code }, options);
|
|
42
|
+
return this.exchange(session, { profileType, sessionCode: step.sessionCode, codeVerifier }, options);
|
|
43
|
+
}
|
|
44
|
+
/** A project that routes the email to a clinician invitation signs no one in. */
|
|
45
|
+
async register(details, options) {
|
|
46
|
+
const session = this.userSession();
|
|
47
|
+
const body = (0, registration_1.patientRegistrationBody)(details, this.tenantCode);
|
|
48
|
+
const response = await this.http.anonymous().post(registration_1.REGISTER_PATHS.patient, body, options);
|
|
49
|
+
if ((0, registration_1.isClinicianInvite)(response)) {
|
|
50
|
+
return { status: "clinician-invite" };
|
|
51
|
+
}
|
|
52
|
+
return { status: "signed-in", session: await session.begin(response) };
|
|
53
|
+
}
|
|
54
|
+
async registerPractitioner(details, options) {
|
|
55
|
+
const session = this.userSession();
|
|
56
|
+
const body = (0, registration_1.practitionerRegistrationBody)(details, this.tenantCode);
|
|
57
|
+
return session.begin(await this.http.anonymous().post(registration_1.REGISTER_PATHS.practitioner, body, options));
|
|
58
|
+
}
|
|
59
|
+
async socialLogin(provider, credential, options) {
|
|
60
|
+
const session = this.userSession();
|
|
61
|
+
const { internalId, ...providerResult } = credential;
|
|
62
|
+
const path = (0, social_login_1.socialLoginPath)(provider, this.socialLoginClientId(), internalId);
|
|
63
|
+
return session.begin(await this.http.anonymous().post(path, providerResult, options));
|
|
64
|
+
}
|
|
65
|
+
async current() {
|
|
66
|
+
return this.session === null ? null : this.session.current();
|
|
67
|
+
}
|
|
68
|
+
me(options) {
|
|
69
|
+
return this.http.get(exports.ME_PATH, options);
|
|
70
|
+
}
|
|
71
|
+
/** The confirmation is the app's to check; Ovok Core never receives it. */
|
|
72
|
+
changePassword(change, options) {
|
|
73
|
+
const { oldPassword, newPassword } = change;
|
|
74
|
+
return this.http.patch(CHANGE_PASSWORD_PATH, { oldPassword, newPassword }, options);
|
|
75
|
+
}
|
|
76
|
+
resetPassword(request, options) {
|
|
77
|
+
var _a, _b;
|
|
78
|
+
const body = { ...request, clientId: (_b = (_a = request.clientId) !== null && _a !== void 0 ? _a : this.clientId) !== null && _b !== void 0 ? _b : undefined };
|
|
79
|
+
return this.http.anonymous().post(RESET_PASSWORD_PATH, body, options);
|
|
80
|
+
}
|
|
81
|
+
completePasswordReset(body, options) {
|
|
82
|
+
return this.http.anonymous().post(COMPLETE_PASSWORD_RESET_PATH, body, options);
|
|
83
|
+
}
|
|
84
|
+
/** Schedules the deletion; the account stays signed in until then. */
|
|
85
|
+
deleteAccount(request, options) {
|
|
86
|
+
return this.http.send({ method: "DELETE", path: DELETE_ACCOUNT_PATH, body: request }, options);
|
|
87
|
+
}
|
|
88
|
+
/** Ends the session on the server, and always locally, even when the server cannot be reached. */
|
|
89
|
+
async logout(options) {
|
|
90
|
+
const session = this.userSession();
|
|
91
|
+
try {
|
|
92
|
+
await this.http.delete(LOGOUT_PATH, options);
|
|
93
|
+
}
|
|
94
|
+
finally {
|
|
95
|
+
await session.end();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
async exchange(session, exchange, options) {
|
|
99
|
+
const { profileType, sessionCode, codeVerifier } = exchange;
|
|
100
|
+
const tokens = await this.http
|
|
101
|
+
.anonymous()
|
|
102
|
+
.post(loginPath(profileType, "token"), { sessionCode, codeVerifier, tenantCode: this.tenantCode }, options);
|
|
103
|
+
return { status: "signed-in", session: await session.begin(tokens) };
|
|
104
|
+
}
|
|
105
|
+
userSession() {
|
|
106
|
+
if (this.session === null) {
|
|
107
|
+
throw new ovok_errors_1.OvokConfigError((0, ovok_errors_1.detailsFor)("This client signs in with clientSecret; user sign-in needs a client without one."));
|
|
108
|
+
}
|
|
109
|
+
return this.session;
|
|
110
|
+
}
|
|
111
|
+
socialLoginClientId() {
|
|
112
|
+
if (this.clientId === null) {
|
|
113
|
+
throw new ovok_errors_1.OvokConfigError((0, ovok_errors_1.detailsFor)("Social sign-in needs clientId in the Ovok config."));
|
|
114
|
+
}
|
|
115
|
+
return this.clientId;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.AuthResource = AuthResource;
|
|
119
|
+
const loginPath = (profileType, step) => `auth/tenant/${profileType}/login/${step}`;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HttpClient } from "../../http/http-client";
|
|
2
|
+
import { RequestOptions } from "../../http/transmit";
|
|
3
|
+
export type BotInput = Record<string, unknown>;
|
|
4
|
+
export type BotOutput = Record<string, unknown>;
|
|
5
|
+
export declare class BotsResource {
|
|
6
|
+
private readonly http;
|
|
7
|
+
constructor(http: HttpClient);
|
|
8
|
+
/** `identifier` is the bot's "system|value" identifier. */
|
|
9
|
+
execute(identifier: string, input: BotInput, options?: RequestOptions): Promise<BotOutput>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BotsResource = void 0;
|
|
4
|
+
const query_string_1 = require("../../../client/query-string");
|
|
5
|
+
const BOTS_PATH = "bots";
|
|
6
|
+
class BotsResource {
|
|
7
|
+
constructor(http) {
|
|
8
|
+
this.http = http;
|
|
9
|
+
}
|
|
10
|
+
/** `identifier` is the bot's "system|value" identifier. */
|
|
11
|
+
execute(identifier, input, options) {
|
|
12
|
+
return this.http.post(`${BOTS_PATH}${(0, query_string_1.toQueryString)({ identifier })}`, input, options);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.BotsResource = BotsResource;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { OvokCmsPage } from "../../../client/cms/types";
|
|
2
|
+
import { HttpClient } from "../../http/http-client";
|
|
3
|
+
import { RequestOptions } from "../../http/transmit";
|
|
4
|
+
/** `locale` takes an app language ("de-DE") or a CMS locale ("de"); omitted, the CMS answers in its default. */
|
|
5
|
+
export type CmsReadParams = {
|
|
6
|
+
locale?: string;
|
|
7
|
+
};
|
|
8
|
+
/** `limit` is at most 50; `sort` is a top-level field, "-" for descending. */
|
|
9
|
+
export type CmsListParams = CmsReadParams & {
|
|
10
|
+
page?: number;
|
|
11
|
+
limit?: number;
|
|
12
|
+
sort?: string;
|
|
13
|
+
};
|
|
14
|
+
/** Published documents, always read as the client's tenant: signed out, the CMS knows it only from `?tenant=`. */
|
|
15
|
+
export declare class CmsDelivery {
|
|
16
|
+
private readonly http;
|
|
17
|
+
private readonly tenantCode;
|
|
18
|
+
constructor(http: HttpClient, tenantCode: string);
|
|
19
|
+
listPage<T extends object>(collection: string, params: CmsListParams, options?: RequestOptions): Promise<OvokCmsPage<T>>;
|
|
20
|
+
retrieve<T extends object>(collection: string, slug: string, params: CmsReadParams, options?: RequestOptions): Promise<T>;
|
|
21
|
+
private queryFor;
|
|
22
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CmsDelivery = void 0;
|
|
4
|
+
const locale_1 = require("../../../client/cms/locale");
|
|
5
|
+
const query_string_1 = require("../../../client/query-string");
|
|
6
|
+
const ovok_errors_1 = require("../../errors/ovok-errors");
|
|
7
|
+
const url_1 = require("../../http/url");
|
|
8
|
+
const COLLECTIONS_PATH = "v1/public/cms/collections";
|
|
9
|
+
const itemsPath = (collection) => `${COLLECTIONS_PATH}/${(0, url_1.pathSegment)(collection)}/items`;
|
|
10
|
+
/** Published documents, always read as the client's tenant: signed out, the CMS knows it only from `?tenant=`. */
|
|
11
|
+
class CmsDelivery {
|
|
12
|
+
constructor(http, tenantCode) {
|
|
13
|
+
this.http = http;
|
|
14
|
+
this.tenantCode = tenantCode;
|
|
15
|
+
}
|
|
16
|
+
listPage(collection, params, options) {
|
|
17
|
+
return this.http.get(`${itemsPath(collection)}${this.queryFor(params)}`, options);
|
|
18
|
+
}
|
|
19
|
+
async retrieve(collection, slug, params, options) {
|
|
20
|
+
if (slug === "") {
|
|
21
|
+
throw new ovok_errors_1.OvokValidationError((0, ovok_errors_1.detailsFor)("A CMS document read needs a slug."));
|
|
22
|
+
}
|
|
23
|
+
return this.http.get(`${itemsPath(collection)}/${(0, url_1.pathSegment)(slug)}${this.queryFor(params)}`, options);
|
|
24
|
+
}
|
|
25
|
+
// An empty locale or sort counts as absent.
|
|
26
|
+
queryFor({ locale, page, limit, sort }) {
|
|
27
|
+
return (0, query_string_1.toQueryString)({
|
|
28
|
+
locale: locale ? (0, locale_1.toCmsLocale)(locale) : undefined,
|
|
29
|
+
tenant: this.tenantCode,
|
|
30
|
+
page,
|
|
31
|
+
limit,
|
|
32
|
+
sort: sort || undefined,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.CmsDelivery = CmsDelivery;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { OvokCmsDocument } from "../../../client/cms/types";
|
|
2
|
+
import { RequestOptions } from "../../http/transmit";
|
|
3
|
+
import { PagePromise } from "../../paging/page";
|
|
4
|
+
import { CmsDelivery, CmsListParams, CmsReadParams } from "./cms-delivery";
|
|
5
|
+
/** Published documents of any collection, merged with the shared tenant's. */
|
|
6
|
+
export declare class CmsDocumentsResource {
|
|
7
|
+
private readonly delivery;
|
|
8
|
+
constructor(delivery: CmsDelivery);
|
|
9
|
+
list<T extends object = OvokCmsDocument>(collection: string, params?: CmsListParams, options?: RequestOptions): PagePromise<T>;
|
|
10
|
+
retrieve<T extends object = OvokCmsDocument>(collection: string, slug: string, params?: CmsReadParams, options?: RequestOptions): Promise<T>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CmsDocumentsResource = void 0;
|
|
4
|
+
const payload_pages_1 = require("./payload-pages");
|
|
5
|
+
/** Published documents of any collection, merged with the shared tenant's. */
|
|
6
|
+
class CmsDocumentsResource {
|
|
7
|
+
constructor(delivery) {
|
|
8
|
+
this.delivery = delivery;
|
|
9
|
+
}
|
|
10
|
+
list(collection, params = {}, options) {
|
|
11
|
+
return (0, payload_pages_1.payloadPages)((page) => this.delivery.listPage(collection, { ...params, page }, options), params.page);
|
|
12
|
+
}
|
|
13
|
+
retrieve(collection, slug, params = {}, options) {
|
|
14
|
+
return this.delivery.retrieve(collection, slug, params, options);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.CmsDocumentsResource = CmsDocumentsResource;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { OvokCmsDocument, OvokTranslations } from "../../../client/cms/types";
|
|
2
|
+
import { HttpClient } from "../../http/http-client";
|
|
3
|
+
import { RequestOptions } from "../../http/transmit";
|
|
4
|
+
import { CmsReadParams } from "./cms-delivery";
|
|
5
|
+
import { CmsDocumentsResource } from "./cms-documents-resource";
|
|
6
|
+
import { ReleaseNotesResource } from "./release-notes-resource";
|
|
7
|
+
export declare class CmsResource {
|
|
8
|
+
readonly documents: CmsDocumentsResource;
|
|
9
|
+
readonly releaseNotes: ReleaseNotesResource;
|
|
10
|
+
private readonly delivery;
|
|
11
|
+
constructor(http: HttpClient, tenantCode: string);
|
|
12
|
+
/** "terms-and-conditions", "data-privacy", …: readable before sign-in. */
|
|
13
|
+
legalPage(slug: string, params?: CmsReadParams, options?: RequestOptions): Promise<OvokCmsDocument>;
|
|
14
|
+
/** The `translations` collection as one tree, readable before sign-in; nothing is kept on the device. */
|
|
15
|
+
translations(locale?: string, options?: RequestOptions): Promise<OvokTranslations>;
|
|
16
|
+
private translationDocuments;
|
|
17
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CmsResource = void 0;
|
|
4
|
+
const cms_delivery_1 = require("./cms-delivery");
|
|
5
|
+
const cms_documents_resource_1 = require("./cms-documents-resource");
|
|
6
|
+
const release_notes_resource_1 = require("./release-notes-resource");
|
|
7
|
+
const translation_tree_1 = require("./translation-tree");
|
|
8
|
+
const LEGAL_PAGES = "legal-pages";
|
|
9
|
+
const TRANSLATIONS = "translations";
|
|
10
|
+
const FIRST_PAGE = 1;
|
|
11
|
+
const LARGEST_PAGE_SIZE = 50;
|
|
12
|
+
const MAX_TRANSLATION_PAGES = 20;
|
|
13
|
+
class CmsResource {
|
|
14
|
+
constructor(http, tenantCode) {
|
|
15
|
+
this.delivery = new cms_delivery_1.CmsDelivery(http, tenantCode);
|
|
16
|
+
this.documents = new cms_documents_resource_1.CmsDocumentsResource(this.delivery);
|
|
17
|
+
this.releaseNotes = new release_notes_resource_1.ReleaseNotesResource(this.documents);
|
|
18
|
+
}
|
|
19
|
+
/** "terms-and-conditions", "data-privacy", …: readable before sign-in. */
|
|
20
|
+
legalPage(slug, params = {}, options) {
|
|
21
|
+
return this.documents.retrieve(LEGAL_PAGES, slug, params, options);
|
|
22
|
+
}
|
|
23
|
+
/** The `translations` collection as one tree, readable before sign-in; nothing is kept on the device. */
|
|
24
|
+
async translations(locale, options) {
|
|
25
|
+
return (0, translation_tree_1.translationTree)(await this.translationDocuments(locale, options));
|
|
26
|
+
}
|
|
27
|
+
async translationDocuments(locale, options) {
|
|
28
|
+
const documents = [];
|
|
29
|
+
for (let page = FIRST_PAGE, hasNextPage = true; hasNextPage && page <= MAX_TRANSLATION_PAGES; page++) {
|
|
30
|
+
const params = { locale, page, limit: LARGEST_PAGE_SIZE };
|
|
31
|
+
const result = await this.delivery.listPage(TRANSLATIONS, params, options);
|
|
32
|
+
documents.push(...result.docs);
|
|
33
|
+
hasNextPage = result.hasNextPage;
|
|
34
|
+
}
|
|
35
|
+
return documents;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.CmsResource = CmsResource;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { OvokCmsPage } from "../../../client/cms/types";
|
|
2
|
+
import { PagePromise } from "../../paging/page";
|
|
3
|
+
type LoadPayloadPage<T> = (page: number | undefined) => Promise<OvokCmsPage<T>>;
|
|
4
|
+
/** Payload CMS's list envelope: 1-based pages, with `nextPage` null on the last. */
|
|
5
|
+
export declare function payloadPages<T>(load: LoadPayloadPage<T>, firstPage: number | undefined): PagePromise<T>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.payloadPages = payloadPages;
|
|
4
|
+
const page_1 = require("../../paging/page");
|
|
5
|
+
/** Payload CMS's list envelope: 1-based pages, with `nextPage` null on the last. */
|
|
6
|
+
function payloadPages(load, firstPage) {
|
|
7
|
+
return (0, page_1.pagePromise)(() => loadPayloadPage(load, firstPage));
|
|
8
|
+
}
|
|
9
|
+
async function loadPayloadPage(load, page) {
|
|
10
|
+
const { docs, totalDocs, nextPage } = await load(page);
|
|
11
|
+
return {
|
|
12
|
+
page: { data: docs, hasMore: nextPage !== null, total: totalDocs },
|
|
13
|
+
next: nextPage === null ? null : () => loadPayloadPage(load, nextPage),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { OvokCmsDocument } from "../../../client/cms/types";
|
|
2
|
+
import { RequestOptions } from "../../http/transmit";
|
|
3
|
+
import { PagePromise } from "../../paging/page";
|
|
4
|
+
import { CmsListParams } from "./cms-delivery";
|
|
5
|
+
import { CmsDocumentsResource } from "./cms-documents-resource";
|
|
6
|
+
export declare class ReleaseNotesResource {
|
|
7
|
+
private readonly documents;
|
|
8
|
+
constructor(documents: CmsDocumentsResource);
|
|
9
|
+
list(params?: CmsListParams, options?: RequestOptions): PagePromise<OvokCmsDocument>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReleaseNotesResource = void 0;
|
|
4
|
+
const RELEASE_NOTES = "release-notes";
|
|
5
|
+
const NEWEST_FIRST = "-publishedAt";
|
|
6
|
+
class ReleaseNotesResource {
|
|
7
|
+
constructor(documents) {
|
|
8
|
+
this.documents = documents;
|
|
9
|
+
}
|
|
10
|
+
list(params = {}, options) {
|
|
11
|
+
var _a;
|
|
12
|
+
return this.documents.list(RELEASE_NOTES, { ...params, sort: (_a = params.sort) !== null && _a !== void 0 ? _a : NEWEST_FIRST }, options);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.ReleaseNotesResource = ReleaseNotesResource;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { OvokCmsDocument, OvokTranslations } from "../../../client/cms/types";
|
|
2
|
+
/** A group per document slug, holding each row's `value` at its `key`, nested at the dots; the first row wins. */
|
|
3
|
+
export declare function translationTree(documents: OvokCmsDocument[]): OvokTranslations;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.translationTree = translationTree;
|
|
4
|
+
const KEY_SEPARATOR = ".";
|
|
5
|
+
/** Keys that would reach a prototype instead of the tree; keys are CMS input. */
|
|
6
|
+
const UNSAFE_KEYS = ["__proto__", "constructor", "prototype"];
|
|
7
|
+
const isText = (value) => typeof value === "string" && value !== "";
|
|
8
|
+
const hasOwn = (tree, key) => Object.prototype.hasOwnProperty.call(tree, key);
|
|
9
|
+
/** A group per document slug, holding each row's `value` at its `key`, nested at the dots; the first row wins. */
|
|
10
|
+
function translationTree(documents) {
|
|
11
|
+
const translations = {};
|
|
12
|
+
for (const { slug, strings } of documents) {
|
|
13
|
+
const rows = Array.isArray(strings) ? strings : [];
|
|
14
|
+
if (isText(slug)) {
|
|
15
|
+
rows.forEach((row) => addRow(translations, slug, row));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return translations;
|
|
19
|
+
}
|
|
20
|
+
const addRow = (translations, slug, row) => {
|
|
21
|
+
const { key, value } = row !== null && row !== void 0 ? row : {};
|
|
22
|
+
if (isText(key) && isText(value)) {
|
|
23
|
+
setText(translations, [slug, ...key.split(KEY_SEPARATOR)], value);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const setText = (tree, path, text) => {
|
|
27
|
+
const reachesPrototype = path.some((key) => UNSAFE_KEYS.includes(key));
|
|
28
|
+
const group = reachesPrototype ? null : groupAt(tree, path.slice(0, -1));
|
|
29
|
+
const leaf = path[path.length - 1];
|
|
30
|
+
if (group !== null && !hasOwn(group, leaf)) {
|
|
31
|
+
group[leaf] = text;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
/** The group at `keys`, made where missing; null when a text is in the way. */
|
|
35
|
+
const groupAt = (tree, keys) => {
|
|
36
|
+
let group = tree;
|
|
37
|
+
for (const key of keys) {
|
|
38
|
+
const next = hasOwn(group, key) ? group[key] : (group[key] = {});
|
|
39
|
+
if (typeof next === "string") {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
group = next;
|
|
43
|
+
}
|
|
44
|
+
return group;
|
|
45
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { LegalConsentResponse, MedicalConsentResponse } from "../../../client/consent/types";
|
|
2
|
+
import type { OvokConsentSignatureResponse } from "../../../client/experience/types";
|
|
3
|
+
import { HttpClient } from "../../http/http-client";
|
|
4
|
+
import { RequestOptions } from "../../http/transmit";
|
|
5
|
+
export declare class LegalConsentResource {
|
|
6
|
+
private readonly http;
|
|
7
|
+
constructor(http: HttpClient);
|
|
8
|
+
retrieve(options?: RequestOptions): Promise<LegalConsentResponse>;
|
|
9
|
+
set(accepted: boolean, options?: RequestOptions): Promise<LegalConsentResponse>;
|
|
10
|
+
}
|
|
11
|
+
export declare class MedicalConsentResource {
|
|
12
|
+
private readonly http;
|
|
13
|
+
constructor(http: HttpClient);
|
|
14
|
+
retrieve(options?: RequestOptions): Promise<MedicalConsentResponse>;
|
|
15
|
+
set(accepted: boolean, options?: RequestOptions): Promise<MedicalConsentResponse>;
|
|
16
|
+
}
|
|
17
|
+
export declare class ConsentResource {
|
|
18
|
+
private readonly http;
|
|
19
|
+
readonly legal: LegalConsentResource;
|
|
20
|
+
readonly medical: MedicalConsentResource;
|
|
21
|
+
constructor(http: HttpClient);
|
|
22
|
+
requestSignature(consentId: string, options?: RequestOptions): Promise<OvokConsentSignatureResponse>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConsentResource = exports.MedicalConsentResource = exports.LegalConsentResource = void 0;
|
|
4
|
+
const url_1 = require("../../http/url");
|
|
5
|
+
const LEGAL_CONSENT_PATH = "v1/me/consent/legal";
|
|
6
|
+
const MEDICAL_CONSENT_PATH = "v1/me/consent/medical";
|
|
7
|
+
class LegalConsentResource {
|
|
8
|
+
constructor(http) {
|
|
9
|
+
this.http = http;
|
|
10
|
+
}
|
|
11
|
+
retrieve(options) {
|
|
12
|
+
return this.http.get(LEGAL_CONSENT_PATH, options);
|
|
13
|
+
}
|
|
14
|
+
set(accepted, options) {
|
|
15
|
+
const body = { termsAndConditionsConsent: accepted };
|
|
16
|
+
return this.http.post(LEGAL_CONSENT_PATH, body, options);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.LegalConsentResource = LegalConsentResource;
|
|
20
|
+
class MedicalConsentResource {
|
|
21
|
+
constructor(http) {
|
|
22
|
+
this.http = http;
|
|
23
|
+
}
|
|
24
|
+
retrieve(options) {
|
|
25
|
+
return this.http.get(MEDICAL_CONSENT_PATH, options);
|
|
26
|
+
}
|
|
27
|
+
set(accepted, options) {
|
|
28
|
+
const body = { medicalSettingsNotificationsConsent: accepted };
|
|
29
|
+
return this.http.post(MEDICAL_CONSENT_PATH, body, options);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.MedicalConsentResource = MedicalConsentResource;
|
|
33
|
+
class ConsentResource {
|
|
34
|
+
constructor(http) {
|
|
35
|
+
this.http = http;
|
|
36
|
+
this.legal = new LegalConsentResource(http);
|
|
37
|
+
this.medical = new MedicalConsentResource(http);
|
|
38
|
+
}
|
|
39
|
+
requestSignature(consentId, options) {
|
|
40
|
+
return this.http.post(`consent/signature/${(0, url_1.pathSegment)(consentId)}`, undefined, options);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.ConsentResource = ConsentResource;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { OvokContent, OvokContentBody, OvokContentQuery, OvokContentSearchResponse, OvokMappedContentSearchResponse } from "../../../client/experience/types";
|
|
2
|
+
import { HttpClient } from "../../http/http-client";
|
|
3
|
+
import { RequestOptions } from "../../http/transmit";
|
|
4
|
+
export type CopyFromParentResult = {
|
|
5
|
+
success: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare class ContentResource {
|
|
8
|
+
private readonly http;
|
|
9
|
+
constructor(http: HttpClient);
|
|
10
|
+
search(type: string, language: string, params?: OvokContentQuery, options?: RequestOptions): Promise<OvokContentSearchResponse>;
|
|
11
|
+
retrieve(type: string, language: string, key: string, options?: RequestOptions): Promise<OvokContent>;
|
|
12
|
+
create(type: string, language: string, body: OvokContentBody, options?: RequestOptions): Promise<OvokContent>;
|
|
13
|
+
update(type: string, language: string, key: string, body: OvokContentBody, options?: RequestOptions): Promise<OvokContent>;
|
|
14
|
+
delete(type: string, language: string, key: string, options?: RequestOptions): Promise<void>;
|
|
15
|
+
/** Pairs each default-language item with its `language` translation. */
|
|
16
|
+
map(type: string, language: string, params?: OvokContentQuery, options?: RequestOptions): Promise<OvokMappedContentSearchResponse>;
|
|
17
|
+
copyFromParent(type: string, language: string, key: string, options?: RequestOptions): Promise<CopyFromParentResult>;
|
|
18
|
+
copyAllFromParent(type: string, language: string, options?: RequestOptions): Promise<CopyFromParentResult>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContentResource = void 0;
|
|
4
|
+
const query_string_1 = require("../../../client/query-string");
|
|
5
|
+
const url_1 = require("../../http/url");
|
|
6
|
+
const CONTENT_PATH = "cms";
|
|
7
|
+
const COPY_FROM_PARENT = "copy-from-parent-project";
|
|
8
|
+
const typePath = (type) => `${CONTENT_PATH}/${(0, url_1.pathSegment)(type)}`;
|
|
9
|
+
const languagePath = (type, language) => `${typePath(type)}/${(0, url_1.pathSegment)(language)}`;
|
|
10
|
+
const keyPath = (type, language, key) => `${languagePath(type, language)}/${(0, url_1.pathSegment)(key)}`;
|
|
11
|
+
class ContentResource {
|
|
12
|
+
constructor(http) {
|
|
13
|
+
this.http = http;
|
|
14
|
+
}
|
|
15
|
+
search(type, language, params = {}, options) {
|
|
16
|
+
return this.http.get(`${languagePath(type, language)}${(0, query_string_1.toQueryString)(params)}`, options);
|
|
17
|
+
}
|
|
18
|
+
retrieve(type, language, key, options) {
|
|
19
|
+
return this.http.get(keyPath(type, language, key), options);
|
|
20
|
+
}
|
|
21
|
+
create(type, language, body, options) {
|
|
22
|
+
return this.http.post(languagePath(type, language), body, options);
|
|
23
|
+
}
|
|
24
|
+
update(type, language, key, body, options) {
|
|
25
|
+
return this.http.put(keyPath(type, language, key), body, options);
|
|
26
|
+
}
|
|
27
|
+
delete(type, language, key, options) {
|
|
28
|
+
return this.http.delete(keyPath(type, language, key), options);
|
|
29
|
+
}
|
|
30
|
+
/** Pairs each default-language item with its `language` translation. */
|
|
31
|
+
map(type, language, params = {}, options) {
|
|
32
|
+
return this.http.get(`${typePath(type)}/map/${(0, url_1.pathSegment)(language)}${(0, query_string_1.toQueryString)(params)}`, options);
|
|
33
|
+
}
|
|
34
|
+
copyFromParent(type, language, key, options) {
|
|
35
|
+
return this.http.post(`${keyPath(type, language, key)}/${COPY_FROM_PARENT}`, undefined, options);
|
|
36
|
+
}
|
|
37
|
+
copyAllFromParent(type, language, options) {
|
|
38
|
+
return this.http.post(`${languagePath(type, language)}/${COPY_FROM_PARENT}`, undefined, options);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.ContentResource = ContentResource;
|