@ovok/core 0.4.49-dev.495 → 0.4.49-dev.497
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/saved-accounts-store.d.ts +26 -0
- package/dist/next/auth/saved-accounts-store.js +93 -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 +39 -0
- package/dist/next/auth/user-session.js +183 -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-account-error.d.ts +5 -0
- package/dist/next/errors/ovok-account-error.js +13 -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 +36 -0
- package/dist/next/http/http-client.js +116 -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 +74 -0
- package/dist/next/index.js +35 -0
- package/dist/next/ovok.d.ts +54 -0
- package/dist/next/ovok.js +77 -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 +22 -0
- package/dist/next/resources/invites/invites-resource.js +29 -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/session/saved-accounts-resource.d.ts +13 -0
- package/dist/next/resources/session/saved-accounts-resource.js +44 -0
- package/dist/next/resources/session/session-resource.d.ts +11 -0
- package/dist/next/resources/session/session-resource.js +15 -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 +13 -0
- package/dist/next/resources/slim/live-reads.js +87 -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 +29 -0
- package/dist/next/resources/slim/slim-devices-resource.js +81 -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 +39 -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,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pagePromise = pagePromise;
|
|
4
|
+
function pagePromise(loadFirst) {
|
|
5
|
+
const first = loadFirst();
|
|
6
|
+
const firstPage = first.then((loaded) => loaded.page);
|
|
7
|
+
// A caller that only iterates never awaits firstPage; its rejection still reaches them through first.
|
|
8
|
+
firstPage.catch(() => undefined);
|
|
9
|
+
return Object.assign(firstPage, { [Symbol.asyncIterator]: () => everyItem(first) });
|
|
10
|
+
}
|
|
11
|
+
async function* everyItem(first) {
|
|
12
|
+
let loaded = await first;
|
|
13
|
+
while (loaded !== null) {
|
|
14
|
+
yield* loaded.page.data;
|
|
15
|
+
loaded = loaded.next === null ? null : await loaded.next();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { OvokAccount } from "../../../client/platform/types";
|
|
2
|
+
import { HttpClient } from "../../http/http-client";
|
|
3
|
+
import { RequestOptions } from "../../http/transmit";
|
|
4
|
+
export declare class AccountsResource {
|
|
5
|
+
private readonly http;
|
|
6
|
+
constructor(http: HttpClient);
|
|
7
|
+
list(options?: RequestOptions): Promise<OvokAccount[]>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccountsResource = void 0;
|
|
4
|
+
const ACCOUNTS_PATH = "accounts";
|
|
5
|
+
class AccountsResource {
|
|
6
|
+
constructor(http) {
|
|
7
|
+
this.http = http;
|
|
8
|
+
}
|
|
9
|
+
list(options) {
|
|
10
|
+
return this.http.get(ACCOUNTS_PATH, options);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.AccountsResource = AccountsResource;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HttpClient } from "../../http/http-client";
|
|
2
|
+
import { ChatMessagesResource } from "./chat-messages-resource";
|
|
3
|
+
import { ChatSessionsResource } from "./chat-sessions-resource";
|
|
4
|
+
export declare class AiChatResource {
|
|
5
|
+
readonly sessions: ChatSessionsResource;
|
|
6
|
+
readonly messages: ChatMessagesResource;
|
|
7
|
+
constructor(ai: HttpClient);
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AiChatResource = void 0;
|
|
4
|
+
const chat_messages_resource_1 = require("./chat-messages-resource");
|
|
5
|
+
const chat_sessions_resource_1 = require("./chat-sessions-resource");
|
|
6
|
+
class AiChatResource {
|
|
7
|
+
constructor(ai) {
|
|
8
|
+
this.sessions = new chat_sessions_resource_1.ChatSessionsResource(ai);
|
|
9
|
+
this.messages = new chat_messages_resource_1.ChatMessagesResource(ai);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.AiChatResource = AiChatResource;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AIFhirRequest, AIFhirResponse } from "../../../client/ai-fhir/types";
|
|
2
|
+
import type { OvokTranslationRequest, OvokTranslationResponse } from "../../../client/experience/types";
|
|
3
|
+
import { HttpClient } from "../../http/http-client";
|
|
4
|
+
import { RequestOptions } from "../../http/transmit";
|
|
5
|
+
import { AiChatResource } from "./ai-chat-resource";
|
|
6
|
+
export type AiFhirSearchRequest = AIFhirRequest & {
|
|
7
|
+
fhirVersion?: "R4" | "R5";
|
|
8
|
+
};
|
|
9
|
+
export declare class AiResource {
|
|
10
|
+
readonly chat: AiChatResource;
|
|
11
|
+
private readonly ai;
|
|
12
|
+
constructor(http: HttpClient);
|
|
13
|
+
translate(body: OvokTranslationRequest, options?: RequestOptions): Promise<OvokTranslationResponse>;
|
|
14
|
+
/** An LLM plans and runs the FHIR queries, so the answer can be wrong or invented. */
|
|
15
|
+
fhirSearch(body: AiFhirSearchRequest, options?: RequestOptions): Promise<AIFhirResponse>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AiResource = void 0;
|
|
4
|
+
const ai_chat_resource_1 = require("./ai-chat-resource");
|
|
5
|
+
const AI_PATH = "ai";
|
|
6
|
+
class AiResource {
|
|
7
|
+
constructor(http) {
|
|
8
|
+
this.ai = http.under(AI_PATH);
|
|
9
|
+
this.chat = new ai_chat_resource_1.AiChatResource(this.ai);
|
|
10
|
+
}
|
|
11
|
+
translate(body, options) {
|
|
12
|
+
return this.ai.post("translation", body, options);
|
|
13
|
+
}
|
|
14
|
+
/** An LLM plans and runs the FHIR queries, so the answer can be wrong or invented. */
|
|
15
|
+
fhirSearch(body, options) {
|
|
16
|
+
return this.ai.post("fhir/search", body, options);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.AiResource = AiResource;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { OvokChatMessage, OvokChatMessageInput, OvokChatMessageQuery, OvokChatMessagesResponse } from "../../../client/experience/types";
|
|
2
|
+
import { HttpClient } from "../../http/http-client";
|
|
3
|
+
import { RequestOptions } from "../../http/transmit";
|
|
4
|
+
export declare class ChatMessagesResource {
|
|
5
|
+
private readonly ai;
|
|
6
|
+
constructor(ai: HttpClient);
|
|
7
|
+
list(sessionId: string, params?: OvokChatMessageQuery, options?: RequestOptions): Promise<OvokChatMessagesResponse>;
|
|
8
|
+
send(sessionId: string, body: OvokChatMessageInput, options?: RequestOptions): Promise<OvokChatMessage>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChatMessagesResource = void 0;
|
|
4
|
+
const query_string_1 = require("../../../client/query-string");
|
|
5
|
+
const chat_sessions_resource_1 = require("./chat-sessions-resource");
|
|
6
|
+
const messagesPath = (sessionId) => `${(0, chat_sessions_resource_1.sessionPath)(sessionId)}/message`;
|
|
7
|
+
class ChatMessagesResource {
|
|
8
|
+
constructor(ai) {
|
|
9
|
+
this.ai = ai;
|
|
10
|
+
}
|
|
11
|
+
list(sessionId, params = {}, options) {
|
|
12
|
+
return this.ai.get(`${messagesPath(sessionId)}${(0, query_string_1.toQueryString)(params)}`, options);
|
|
13
|
+
}
|
|
14
|
+
send(sessionId, body, options) {
|
|
15
|
+
return this.ai.post(messagesPath(sessionId), body, options);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.ChatMessagesResource = ChatMessagesResource;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { OvokChatSession, OvokChatSessionQuery, OvokChatSessionsResponse, OvokCreateChatSession } from "../../../client/experience/types";
|
|
2
|
+
import { HttpClient } from "../../http/http-client";
|
|
3
|
+
import { RequestOptions } from "../../http/transmit";
|
|
4
|
+
export type ChatSessionRetrieveParams = {
|
|
5
|
+
messageCount?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const sessionPath: (sessionId: string) => string;
|
|
8
|
+
export declare class ChatSessionsResource {
|
|
9
|
+
private readonly ai;
|
|
10
|
+
constructor(ai: HttpClient);
|
|
11
|
+
create(body: OvokCreateChatSession, options?: RequestOptions): Promise<OvokChatSession>;
|
|
12
|
+
list(params?: OvokChatSessionQuery, options?: RequestOptions): Promise<OvokChatSessionsResponse>;
|
|
13
|
+
retrieve(sessionId: string, params?: ChatSessionRetrieveParams, options?: RequestOptions): Promise<OvokChatSession>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChatSessionsResource = exports.sessionPath = void 0;
|
|
4
|
+
const query_string_1 = require("../../../client/query-string");
|
|
5
|
+
const url_1 = require("../../http/url");
|
|
6
|
+
const SESSION_PATH = "session";
|
|
7
|
+
const sessionPath = (sessionId) => `${SESSION_PATH}/${(0, url_1.pathSegment)(sessionId)}`;
|
|
8
|
+
exports.sessionPath = sessionPath;
|
|
9
|
+
class ChatSessionsResource {
|
|
10
|
+
constructor(ai) {
|
|
11
|
+
this.ai = ai;
|
|
12
|
+
}
|
|
13
|
+
create(body, options) {
|
|
14
|
+
return this.ai.post(SESSION_PATH, body, options);
|
|
15
|
+
}
|
|
16
|
+
list(params = {}, options) {
|
|
17
|
+
return this.ai.get(`${SESSION_PATH}${(0, query_string_1.toQueryString)(params)}`, options);
|
|
18
|
+
}
|
|
19
|
+
retrieve(sessionId, params = {}, options) {
|
|
20
|
+
return this.ai.get(`${(0, exports.sessionPath)(sessionId)}${(0, query_string_1.toQueryString)(params)}`, options);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.ChatSessionsResource = ChatSessionsResource;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { OvokSession, SessionRevokeOption } from "../../../client/auth/types/Session";
|
|
2
|
+
import { UserSession } from "../../auth/user-session";
|
|
3
|
+
import { HttpClient } from "../../http/http-client";
|
|
4
|
+
import { RequestOptions } from "../../http/transmit";
|
|
5
|
+
/** The account's sessions on the server. */
|
|
6
|
+
export declare class AuthSessionsResource {
|
|
7
|
+
private readonly http;
|
|
8
|
+
private readonly session;
|
|
9
|
+
constructor(http: HttpClient, session: UserSession | null);
|
|
10
|
+
list(options?: RequestOptions): Promise<OvokSession[]>;
|
|
11
|
+
/** Revoking the current session also ends it here. */
|
|
12
|
+
revoke(option: SessionRevokeOption, options?: RequestOptions): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthSessionsResource = void 0;
|
|
4
|
+
const url_1 = require("../../http/url");
|
|
5
|
+
const SESSIONS_PATH = "auth/session";
|
|
6
|
+
const CURRENT_SESSION = "current";
|
|
7
|
+
/** The account's sessions on the server. */
|
|
8
|
+
class AuthSessionsResource {
|
|
9
|
+
constructor(http, session) {
|
|
10
|
+
this.http = http;
|
|
11
|
+
this.session = session;
|
|
12
|
+
}
|
|
13
|
+
list(options) {
|
|
14
|
+
return this.http.get(SESSIONS_PATH, options);
|
|
15
|
+
}
|
|
16
|
+
/** Revoking the current session also ends it here. */
|
|
17
|
+
async revoke(option, options) {
|
|
18
|
+
var _a;
|
|
19
|
+
await this.http.delete(`${SESSIONS_PATH}/${(0, url_1.pathSegment)(option)}`, options);
|
|
20
|
+
if (option === CURRENT_SESSION) {
|
|
21
|
+
await ((_a = this.session) === null || _a === void 0 ? void 0 : _a.end());
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.AuthSessionsResource = AuthSessionsResource;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { RegisterBody } from "../../../client/auth/types/RegisterBody";
|
|
2
|
+
import type { RegisterPractitionerBody } from "../../../client/auth/types/RegisterPractitionerBody";
|
|
3
|
+
import type { ClinicianInviteStep } from "../../../client/auth/types/RegisterResponse";
|
|
4
|
+
import { LoginTokens, Session } from "../../auth/session";
|
|
5
|
+
/** The tenant comes from the client's config, as it does for login. */
|
|
6
|
+
export type PatientRegistration = Omit<RegisterBody, "tenantCode">;
|
|
7
|
+
export type PractitionerRegistration = Omit<RegisterPractitionerBody, "tenantCode">;
|
|
8
|
+
export type RegisterResult = {
|
|
9
|
+
status: "signed-in";
|
|
10
|
+
session: Session;
|
|
11
|
+
} | {
|
|
12
|
+
status: "clinician-invite";
|
|
13
|
+
};
|
|
14
|
+
export type RegisterResponse = LoginTokens | ClinicianInviteStep;
|
|
15
|
+
export declare const REGISTER_PATHS: {
|
|
16
|
+
readonly patient: "auth/tenant/Patient/register";
|
|
17
|
+
readonly practitioner: "auth/tenant/Practitioner/register";
|
|
18
|
+
};
|
|
19
|
+
export declare const isClinicianInvite: (response: RegisterResponse) => response is ClinicianInviteStep;
|
|
20
|
+
/** The confirmation is checked here and never sent. */
|
|
21
|
+
export declare function practitionerRegistrationBody(details: PractitionerRegistration, tenantCode: string): {
|
|
22
|
+
email: string;
|
|
23
|
+
password: string;
|
|
24
|
+
name: string;
|
|
25
|
+
surname: string;
|
|
26
|
+
tenantCode: string;
|
|
27
|
+
};
|
|
28
|
+
export declare const patientRegistrationBody: (details: PatientRegistration, tenantCode: string) => {
|
|
29
|
+
continueAsPatientToken: string | undefined;
|
|
30
|
+
email: string;
|
|
31
|
+
password: string;
|
|
32
|
+
name: string;
|
|
33
|
+
surname: string;
|
|
34
|
+
tenantCode: string;
|
|
35
|
+
};
|
|
@@ -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
|
+
}
|