@ovok/core 0.4.36 → 0.4.38
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/auth/account-storage.d.ts +1 -0
- package/dist/client/auth/account-storage.js +2 -1
- package/dist/{utils → client}/auth/exchange-code.d.ts +1 -1
- package/dist/{utils → client}/auth/generate-code-challenge-and-verifier.js +5 -17
- package/dist/{utils → client}/auth/handle-tenant-code.d.ts +1 -1
- package/dist/{utils → client}/auth/handle-tenant-code.js +1 -1
- package/dist/client/auth/methods/appleLogin.js +2 -6
- package/dist/client/auth/methods/changePassword.js +2 -1
- package/dist/client/auth/methods/getSessions.js +2 -1
- package/dist/client/auth/methods/googleLogin.js +2 -6
- package/dist/client/auth/methods/login.js +26 -44
- package/dist/client/auth/methods/logout.js +2 -1
- package/dist/client/auth/methods/requestDeleteUser.js +5 -4
- package/dist/client/auth/methods/revokeSessions.js +2 -1
- package/dist/client/auth/methods/socialLogin.d.ts +7 -0
- package/dist/client/auth/methods/socialLogin.js +11 -0
- package/dist/client/auth/session-fetch.d.ts +35 -0
- package/dist/client/auth/session-fetch.js +206 -0
- package/dist/client/auth/session-http.d.ts +11 -0
- package/dist/client/auth/session-http.js +169 -0
- package/dist/client/auth/sha256.d.ts +2 -0
- package/dist/client/auth/sha256.js +65 -0
- package/dist/{utils → client}/auth/start-login.d.ts +2 -2
- package/dist/client/change-history/methods.js +2 -1
- package/dist/client/cms/methods.js +16 -28
- package/dist/client/consent/methods.js +3 -2
- package/dist/client/email/methods.js +2 -1
- package/dist/client/errors/ovok-error-utils.d.ts +6 -0
- package/dist/client/errors/ovok-error-utils.js +10 -1
- package/dist/client/errors/ovok-error.js +6 -13
- package/dist/client/errors/rate-limit-error.js +2 -6
- package/dist/client/experience/methods.js +28 -37
- package/dist/client/invites/methods.js +8 -12
- package/dist/client/notifications/methods.js +5 -5
- package/dist/client/observation/fhir-systems.d.ts +4 -0
- package/dist/client/observation/fhir-systems.js +7 -0
- package/dist/client/observation/methods/generateObservationBodiesByMeasurement.js +23 -29
- package/dist/client/observation/methods/getLatestObservationsByCodes.js +6 -9
- package/dist/client/observation/methods/observationsToMeasurements.js +44 -91
- package/dist/client/observation/services/base-observation-service.js +4 -3
- package/dist/client/observation/services/blood-pressure.js +1 -4
- package/dist/client/observation/services/{baby-sleep.d.ts → component-observation-services.d.ts} +18 -13
- package/dist/client/observation/services/component-observation-services.js +69 -0
- package/dist/client/observation/services/creator.d.ts +1 -2
- package/dist/client/observation/services/creator.js +15 -33
- package/dist/client/observation/services/ecg-observation-fragments.js +5 -6
- package/dist/client/observation/services/ecg.js +3 -2
- package/dist/client/observation/services/lipid-panel.js +8 -12
- package/dist/client/observation/services/measurement-time.d.ts +4 -0
- package/dist/client/observation/services/measurement-time.js +6 -0
- package/dist/client/observation/services/single-value-services.d.ts +36 -0
- package/dist/client/observation/services/single-value-services.js +100 -0
- package/dist/client/observation/services/uric-acid-service.js +6 -7
- package/dist/client/observation/types/generate-measurement/HealthConnectTypes.d.ts +2 -458
- package/dist/client/observation/types/generate-measurement/HealthConnectTypes.js +0 -6
- package/dist/client/offline/offline-measurement-queue.js +31 -28
- package/dist/client/ovok-client.d.ts +7 -15
- package/dist/client/ovok-client.js +54 -398
- package/dist/client/patient/methods.js +27 -36
- package/dist/client/patient-sharing/methods.js +4 -4
- package/dist/client/platform/methods.js +21 -30
- package/dist/client/platform/types.d.ts +3 -6
- package/dist/client/query-string.d.ts +3 -0
- package/dist/client/query-string.js +15 -0
- package/dist/client/questionnaire-response/methods/createQuestionnaireResponseWithObservations.js +2 -1
- package/dist/client/questionnaire-response/methods/extractQuestionnaireObservations.js +1 -2
- package/dist/client/questionnaire-response/methods/populateQuestionnaire.js +1 -2
- package/dist/client/questionnaire-response/methods/submitQuestionnaireResponse.js +2 -1
- package/dist/client/request-options.d.ts +2 -0
- package/dist/client/request-options.js +6 -0
- package/dist/client/signals/errors.js +2 -6
- package/dist/client/signals/methods.js +22 -22
- package/dist/client/slim/live-read.d.ts +4 -0
- package/dist/client/slim/live-read.js +87 -0
- package/dist/client/slim/methods.d.ts +3 -0
- package/dist/client/slim/methods.js +73 -166
- package/dist/client/storage.js +3 -2
- package/dist/conformance/capability-requirements.js +1 -1
- package/dist/conformance/capability.js +8 -7
- package/dist/hooks/account-hooks.js +6 -68
- package/dist/hooks/api-hooks.d.ts +10 -6
- package/dist/hooks/api-hooks.js +29 -88
- package/dist/hooks/cms-hooks.js +8 -13
- package/dist/hooks/email-hooks.js +1 -40
- package/dist/hooks/experience-hooks.js +4 -60
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +4 -4
- package/dist/hooks/invites-hooks.js +0 -1
- package/dist/hooks/notification-hooks.d.ts +4 -1
- package/dist/hooks/notification-hooks.js +29 -86
- package/dist/hooks/notification-invalidation.d.ts +6 -0
- package/dist/hooks/notification-invalidation.js +52 -0
- package/dist/hooks/notification-note-hooks.js +13 -28
- package/dist/hooks/observation-hooks.js +2 -4
- package/dist/hooks/patient-hooks.js +13 -113
- package/dist/hooks/patient-sharing-hooks.js +2 -7
- package/dist/hooks/platform-hooks.js +3 -51
- package/dist/hooks/poll-hooks.js +10 -8
- package/dist/hooks/signals-alert-hooks.js +4 -6
- package/dist/hooks/signals-hooks.js +2 -45
- package/package.json +1 -1
- package/dist/client/observation/services/baby-sleep.js +0 -69
- package/dist/client/observation/services/blood-glucose.d.ts +0 -12
- package/dist/client/observation/services/blood-glucose.js +0 -36
- package/dist/client/observation/services/body-temperature.d.ts +0 -13
- package/dist/client/observation/services/body-temperature.js +0 -36
- package/dist/client/observation/services/body-weight.d.ts +0 -13
- package/dist/client/observation/services/body-weight.js +0 -36
- package/dist/client/observation/services/heart-rate-variability.d.ts +0 -13
- package/dist/client/observation/services/heart-rate-variability.js +0 -38
- package/dist/client/observation/services/heart-rate.d.ts +0 -13
- package/dist/client/observation/services/heart-rate.js +0 -39
- package/dist/client/observation/services/respiratory-rate.d.ts +0 -13
- package/dist/client/observation/services/respiratory-rate.js +0 -38
- package/dist/client/observation/services/respiratory-therapy.d.ts +0 -28
- package/dist/client/observation/services/respiratory-therapy.js +0 -69
- package/dist/client/observation/services/resting-heart-rate.d.ts +0 -13
- package/dist/client/observation/services/resting-heart-rate.js +0 -38
- package/dist/client/observation/services/vo2-max.d.ts +0 -13
- package/dist/client/observation/services/vo2-max.js +0 -38
- package/dist/client/observation/services/walking-heart-rate-average.d.ts +0 -12
- package/dist/client/observation/services/walking-heart-rate-average.js +0 -38
- package/dist/utils/auth/sha256.d.ts +0 -8
- package/dist/utils/auth/sha256.js +0 -300
- /package/dist/{utils → client}/auth/exchange-code.js +0 -0
- /package/dist/{utils → client}/auth/generate-code-challenge-and-verifier.d.ts +0 -0
- /package/dist/{utils → client}/auth/start-login.js +0 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.refreshBackoffMs = exports.fetchWithTimeout = exports.isNetworkError = exports.refreshResponseError = exports.refreshUnavailableError = exports.isTemporaryRefreshFailure = exports.waitForRetry = exports.withHttpErrorMetadata = exports.retryAfterMs = void 0;
|
|
4
|
+
const ovok_error_utils_1 = require("../errors/ovok-error-utils");
|
|
5
|
+
const retryAfterMs = (response) => {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
const value = (_b = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get) === null || _b === void 0 ? void 0 : _b.call(_a, "Retry-After");
|
|
8
|
+
if (!value) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
const seconds = Number(value);
|
|
12
|
+
if (Number.isFinite(seconds)) {
|
|
13
|
+
return Math.max(0, seconds * 1000);
|
|
14
|
+
}
|
|
15
|
+
const date = Date.parse(value);
|
|
16
|
+
return Number.isFinite(date) ? Math.max(0, date - Date.now()) : undefined;
|
|
17
|
+
};
|
|
18
|
+
exports.retryAfterMs = retryAfterMs;
|
|
19
|
+
const timeoutError = () => (0, ovok_error_utils_1.namedError)("TimeoutError", "The request timed out.");
|
|
20
|
+
const withHttpErrorMetadata = async (response) => {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
if (response.ok || typeof response.clone !== "function") {
|
|
23
|
+
return response;
|
|
24
|
+
}
|
|
25
|
+
let bodyText = "";
|
|
26
|
+
let body;
|
|
27
|
+
try {
|
|
28
|
+
bodyText = await response.clone().text();
|
|
29
|
+
body = JSON.parse(bodyText);
|
|
30
|
+
}
|
|
31
|
+
catch (_c) {
|
|
32
|
+
body = undefined;
|
|
33
|
+
}
|
|
34
|
+
const outcome = body && typeof body === "object" && body.resourceType === "OperationOutcome"
|
|
35
|
+
? body
|
|
36
|
+
: undefined;
|
|
37
|
+
const envelope = body && typeof body === "object" ? body : undefined;
|
|
38
|
+
const nestedError = (envelope === null || envelope === void 0 ? void 0 : envelope.error) && typeof envelope.error === "object"
|
|
39
|
+
? envelope.error
|
|
40
|
+
: undefined;
|
|
41
|
+
const safeResponse = envelope
|
|
42
|
+
? Object.fromEntries(Object.entries(envelope).filter(([key]) => ["code", "error", "message", "requestId", "retryAfterSec", "status", "statusCode", "errors", "missing"].includes(key)))
|
|
43
|
+
: { message: typeof body === "string" ? body : response.statusText };
|
|
44
|
+
const status = response.status;
|
|
45
|
+
const retryAfter = (_a = (0, exports.retryAfterMs)(response)) !== null && _a !== void 0 ? _a : (typeof (envelope === null || envelope === void 0 ? void 0 : envelope.retryAfterSec) === "number" ? envelope.retryAfterSec * 1000 : undefined);
|
|
46
|
+
const requestId = (_b = response.headers.get("x-request-id")) !== null && _b !== void 0 ? _b : (typeof (envelope === null || envelope === void 0 ? void 0 : envelope.requestId) === "string" ? envelope.requestId : undefined);
|
|
47
|
+
const message = typeof (envelope === null || envelope === void 0 ? void 0 : envelope.message) === "string"
|
|
48
|
+
? envelope.message
|
|
49
|
+
: typeof (nestedError === null || nestedError === void 0 ? void 0 : nestedError.message) === "string"
|
|
50
|
+
? nestedError.message
|
|
51
|
+
: response.statusText || `HTTP ${status}`;
|
|
52
|
+
const extensions = [];
|
|
53
|
+
const addMetadata = (url, value, kind) => {
|
|
54
|
+
if (value !== undefined) {
|
|
55
|
+
extensions.push({ url, [`value${kind}`]: value });
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
addMetadata("status", status, "Integer");
|
|
59
|
+
addMetadata("requestId", requestId, "String");
|
|
60
|
+
addMetadata("retryAfterMs", retryAfter, "Integer");
|
|
61
|
+
if (!outcome) {
|
|
62
|
+
extensions.push({ url: "response", valueString: JSON.stringify(safeResponse) });
|
|
63
|
+
}
|
|
64
|
+
const enrichedOutcome = outcome !== null && outcome !== void 0 ? outcome : {
|
|
65
|
+
resourceType: "OperationOutcome",
|
|
66
|
+
id: "ovok-http-error",
|
|
67
|
+
issue: [{
|
|
68
|
+
severity: "error",
|
|
69
|
+
code: status === 429 ? "throttled" : "exception",
|
|
70
|
+
details: { text: bodyText || message },
|
|
71
|
+
}],
|
|
72
|
+
};
|
|
73
|
+
const existingExtensions = Array.isArray(enrichedOutcome.extension)
|
|
74
|
+
? enrichedOutcome.extension
|
|
75
|
+
: [];
|
|
76
|
+
enrichedOutcome.extension = [
|
|
77
|
+
...existingExtensions,
|
|
78
|
+
{ url: ovok_error_utils_1.OVOK_HTTP_ERROR_EXTENSION_URL, extension: extensions },
|
|
79
|
+
];
|
|
80
|
+
const headers = new Headers(response.headers);
|
|
81
|
+
headers.delete("content-length");
|
|
82
|
+
headers.set("content-type", "application/fhir+json");
|
|
83
|
+
return new Response(JSON.stringify(enrichedOutcome), {
|
|
84
|
+
status,
|
|
85
|
+
statusText: response.statusText,
|
|
86
|
+
headers,
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
exports.withHttpErrorMetadata = withHttpErrorMetadata;
|
|
90
|
+
const waitForRetry = (milliseconds, signal) => new Promise((resolve, reject) => {
|
|
91
|
+
var _a;
|
|
92
|
+
if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
|
|
93
|
+
reject((_a = signal.reason) !== null && _a !== void 0 ? _a : (0, ovok_error_utils_1.namedError)("AbortError", "Token refresh aborted"));
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const timer = setTimeout(() => {
|
|
97
|
+
signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", abort);
|
|
98
|
+
resolve();
|
|
99
|
+
}, milliseconds);
|
|
100
|
+
const abort = () => {
|
|
101
|
+
var _a;
|
|
102
|
+
clearTimeout(timer);
|
|
103
|
+
reject((_a = signal === null || signal === void 0 ? void 0 : signal.reason) !== null && _a !== void 0 ? _a : (0, ovok_error_utils_1.namedError)("AbortError", "Token refresh aborted"));
|
|
104
|
+
};
|
|
105
|
+
signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", abort, { once: true });
|
|
106
|
+
});
|
|
107
|
+
exports.waitForRetry = waitForRetry;
|
|
108
|
+
const isTemporaryRefreshFailure = (status) => status === 429 || (status >= 500 && status <= 599);
|
|
109
|
+
exports.isTemporaryRefreshFailure = isTemporaryRefreshFailure;
|
|
110
|
+
const refreshUnavailableError = (response) => {
|
|
111
|
+
return Object.assign((0, ovok_error_utils_1.namedError)("NetworkError", "Token refresh is temporarily unavailable"), { cause: response });
|
|
112
|
+
};
|
|
113
|
+
exports.refreshUnavailableError = refreshUnavailableError;
|
|
114
|
+
const refreshResponseError = (response) => {
|
|
115
|
+
return Object.assign((0, ovok_error_utils_1.namedError)("TokenRefreshError", `Token refresh returned HTTP ${response.status}`), {
|
|
116
|
+
status: response.status,
|
|
117
|
+
cause: response,
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
exports.refreshResponseError = refreshResponseError;
|
|
121
|
+
const isNetworkError = (error) => {
|
|
122
|
+
if (!(error instanceof Error)) {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
if (error.name === "NetworkError" ||
|
|
126
|
+
error.name === "UnknownHostException" ||
|
|
127
|
+
/network request failed|failed to fetch|load failed|unknownhostexception|econn|enotfound/i.test(error.message)) {
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
return (0, exports.isNetworkError)(error.cause);
|
|
131
|
+
};
|
|
132
|
+
exports.isNetworkError = isNetworkError;
|
|
133
|
+
/** Fetches with an upper time bound, still honouring the caller's own abort signal. */
|
|
134
|
+
const fetchWithTimeout = async (fetchImplementation, url, options, requestTimeoutMs) => {
|
|
135
|
+
if (requestTimeoutMs === undefined) {
|
|
136
|
+
return fetchImplementation(url, options);
|
|
137
|
+
}
|
|
138
|
+
const controller = new AbortController();
|
|
139
|
+
const callerSignal = options === null || options === void 0 ? void 0 : options.signal;
|
|
140
|
+
let timedOut = false;
|
|
141
|
+
const abortFromCaller = () => controller.abort(callerSignal === null || callerSignal === void 0 ? void 0 : callerSignal.reason);
|
|
142
|
+
const timeout = setTimeout(() => {
|
|
143
|
+
timedOut = true;
|
|
144
|
+
controller.abort(timeoutError());
|
|
145
|
+
}, requestTimeoutMs);
|
|
146
|
+
if (callerSignal === null || callerSignal === void 0 ? void 0 : callerSignal.aborted) {
|
|
147
|
+
abortFromCaller();
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
callerSignal === null || callerSignal === void 0 ? void 0 : callerSignal.addEventListener("abort", abortFromCaller, { once: true });
|
|
151
|
+
}
|
|
152
|
+
try {
|
|
153
|
+
return await fetchImplementation(url, { ...options, signal: controller.signal });
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
if (timedOut) {
|
|
157
|
+
throw timeoutError();
|
|
158
|
+
}
|
|
159
|
+
throw error;
|
|
160
|
+
}
|
|
161
|
+
finally {
|
|
162
|
+
clearTimeout(timeout);
|
|
163
|
+
callerSignal === null || callerSignal === void 0 ? void 0 : callerSignal.removeEventListener("abort", abortFromCaller);
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
exports.fetchWithTimeout = fetchWithTimeout;
|
|
167
|
+
/** Exponential refresh backoff: 500 ms doubling per attempt, capped at 30 s. */
|
|
168
|
+
const refreshBackoffMs = (attempt) => Math.min(500 * (2 ** Math.min(attempt, 6)), 30000);
|
|
169
|
+
exports.refreshBackoffMs = refreshBackoffMs;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// SHA-256 (FIPS 180-4), synchronous and dependency-free: React Native has no `crypto.subtle`,
|
|
3
|
+
// and the PKCE login start is synchronous.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.sha256Bytes = void 0;
|
|
6
|
+
const K = new Uint32Array([
|
|
7
|
+
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
|
8
|
+
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
|
9
|
+
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
|
10
|
+
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
|
11
|
+
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
|
12
|
+
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
|
13
|
+
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
|
14
|
+
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
|
|
15
|
+
]);
|
|
16
|
+
const rotr = (x, n) => (x >>> n) | (x << (32 - n));
|
|
17
|
+
/** SHA-256 digest of an ASCII string (a PKCE verifier is `[A-Za-z0-9-._~]`). */
|
|
18
|
+
const sha256Bytes = (ascii) => {
|
|
19
|
+
const blocks = new Uint8Array(Math.ceil((ascii.length + 9) / 64) * 64);
|
|
20
|
+
const view = new DataView(blocks.buffer);
|
|
21
|
+
for (let i = 0; i < ascii.length; i += 1) {
|
|
22
|
+
const code = ascii.charCodeAt(i);
|
|
23
|
+
if (code > 0x7f) {
|
|
24
|
+
throw new RangeError("sha256Bytes hashes ASCII input only.");
|
|
25
|
+
}
|
|
26
|
+
blocks[i] = code;
|
|
27
|
+
}
|
|
28
|
+
blocks[ascii.length] = 0x80;
|
|
29
|
+
view.setUint32(blocks.length - 4, ascii.length * 8);
|
|
30
|
+
const hash = new Uint32Array([
|
|
31
|
+
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
|
|
32
|
+
]);
|
|
33
|
+
const w = new Uint32Array(64);
|
|
34
|
+
for (let offset = 0; offset < blocks.length; offset += 64) {
|
|
35
|
+
for (let t = 0; t < 16; t += 1) {
|
|
36
|
+
w[t] = view.getUint32(offset + t * 4);
|
|
37
|
+
}
|
|
38
|
+
for (let t = 16; t < 64; t += 1) {
|
|
39
|
+
const s0 = rotr(w[t - 15], 7) ^ rotr(w[t - 15], 18) ^ (w[t - 15] >>> 3);
|
|
40
|
+
const s1 = rotr(w[t - 2], 17) ^ rotr(w[t - 2], 19) ^ (w[t - 2] >>> 10);
|
|
41
|
+
w[t] = w[t - 16] + s0 + w[t - 7] + s1;
|
|
42
|
+
}
|
|
43
|
+
let [a, b, c, d, e, f, g, h] = hash;
|
|
44
|
+
for (let t = 0; t < 64; t += 1) {
|
|
45
|
+
const t1 = (h + (rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25)) + ((e & f) ^ (~e & g)) + K[t] + w[t]) >>> 0;
|
|
46
|
+
const t2 = ((rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) + ((a & b) ^ (a & c) ^ (b & c))) >>> 0;
|
|
47
|
+
h = g;
|
|
48
|
+
g = f;
|
|
49
|
+
f = e;
|
|
50
|
+
e = (d + t1) >>> 0;
|
|
51
|
+
d = c;
|
|
52
|
+
c = b;
|
|
53
|
+
b = a;
|
|
54
|
+
a = (t1 + t2) >>> 0;
|
|
55
|
+
}
|
|
56
|
+
[a, b, c, d, e, f, g, h].forEach((value, index) => {
|
|
57
|
+
hash[index] += value;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const digest = new Uint8Array(32);
|
|
61
|
+
const digestView = new DataView(digest.buffer);
|
|
62
|
+
hash.forEach((word, index) => digestView.setUint32(index * 4, word));
|
|
63
|
+
return digest;
|
|
64
|
+
};
|
|
65
|
+
exports.sha256Bytes = sha256Bytes;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MedplumRequestOptions } from "@medplum/core";
|
|
2
|
-
import { StartLoginResponse } from "../../client/auth/types/StartLoginResponse";
|
|
3
|
-
import { OvokClient } from "../../client/ovok-client";
|
|
4
2
|
import { LoginBody } from "../../types";
|
|
3
|
+
import { OvokClient } from "../ovok-client";
|
|
4
|
+
import { StartLoginResponse } from "./types/StartLoginResponse";
|
|
5
5
|
type StartLoginProps = {
|
|
6
6
|
client: OvokClient;
|
|
7
7
|
body: LoginBody;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.serializeChangeHistoryQuery = serializeChangeHistoryQuery;
|
|
4
4
|
exports.listChangeHistory = listChangeHistory;
|
|
5
|
+
const request_options_1 = require("../request-options");
|
|
5
6
|
function serializeChangeHistoryQuery(params = {}) {
|
|
6
7
|
const search = new URLSearchParams();
|
|
7
8
|
for (const [key, value] of Object.entries(params)) {
|
|
@@ -21,5 +22,5 @@ function serializeChangeHistoryQuery(params = {}) {
|
|
|
21
22
|
return encoded ? `?${encoded}` : "";
|
|
22
23
|
}
|
|
23
24
|
function listChangeHistory(params = {}, requestOptions) {
|
|
24
|
-
return this.get(`/v1/slim/change-history${serializeChangeHistoryQuery(params)}`, ...(
|
|
25
|
+
return this.get(`/v1/slim/change-history${serializeChangeHistoryQuery(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
25
26
|
}
|
|
@@ -6,31 +6,19 @@ exports.getLegalPage = getLegalPage;
|
|
|
6
6
|
exports.listReleaseNotes = listReleaseNotes;
|
|
7
7
|
exports.getTranslations = getTranslations;
|
|
8
8
|
const sign_in_required_error_1 = require("../errors/sign-in-required-error");
|
|
9
|
+
const query_string_1 = require("../query-string");
|
|
10
|
+
const request_options_1 = require("../request-options");
|
|
9
11
|
const locale_1 = require("./locale");
|
|
10
12
|
const collectionPath = (collection) => `/v1/public/cms/collections/${encodeURIComponent(collection)}/items`;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
params.set("environment", environment);
|
|
21
|
-
}
|
|
22
|
-
if (page !== undefined) {
|
|
23
|
-
params.set("page", String(page));
|
|
24
|
-
}
|
|
25
|
-
if (limit !== undefined) {
|
|
26
|
-
params.set("limit", String(limit));
|
|
27
|
-
}
|
|
28
|
-
if (sort) {
|
|
29
|
-
params.set("sort", sort);
|
|
30
|
-
}
|
|
31
|
-
const query = params.toString();
|
|
32
|
-
return query ? `?${query}` : "";
|
|
33
|
-
};
|
|
13
|
+
// Empty strings count as absent, like undefined.
|
|
14
|
+
const cmsQuery = ({ locale, tenantCode, environment, page, limit, sort }) => (0, query_string_1.toQueryString)({
|
|
15
|
+
locale: locale ? (0, locale_1.toCmsLocale)(locale) : undefined,
|
|
16
|
+
tenant: tenantCode || undefined,
|
|
17
|
+
environment,
|
|
18
|
+
page,
|
|
19
|
+
limit,
|
|
20
|
+
sort: sort || undefined,
|
|
21
|
+
});
|
|
34
22
|
/**
|
|
35
23
|
* Signed out, the backend serves only a few collections, read by tenant code;
|
|
36
24
|
* any other read is a 401, which MedplumClient answers by clearing its
|
|
@@ -53,7 +41,7 @@ async function getCmsDocument(collection, slug, options = {}, requestOptions) {
|
|
|
53
41
|
throw new Error("A CMS document read needs a slug.");
|
|
54
42
|
}
|
|
55
43
|
assertReadable(this, collection, options);
|
|
56
|
-
return this.get(`${collectionPath(collection)}/${encodeURIComponent(slug)}${cmsQuery(options)}`, ...(
|
|
44
|
+
return this.get(`${collectionPath(collection)}/${encodeURIComponent(slug)}${cmsQuery(options)}`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
57
45
|
}
|
|
58
46
|
/**
|
|
59
47
|
* A page of a CMS collection's published documents, merged with the shared
|
|
@@ -61,17 +49,17 @@ async function getCmsDocument(collection, slug, options = {}, requestOptions) {
|
|
|
61
49
|
*/
|
|
62
50
|
async function listCmsDocuments(collection, options = {}, requestOptions) {
|
|
63
51
|
assertReadable(this, collection, options);
|
|
64
|
-
return this.get(`${collectionPath(collection)}${cmsQuery(options)}`, ...(
|
|
52
|
+
return this.get(`${collectionPath(collection)}${cmsQuery(options)}`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
65
53
|
}
|
|
66
54
|
/** A legal page ("terms-and-conditions", "data-privacy", …). Readable before sign-in with a tenant code. */
|
|
67
55
|
function getLegalPage(slug, options = {}, requestOptions) {
|
|
68
56
|
var _a;
|
|
69
|
-
return this.getCmsDocument("legal-pages", slug, { ...options, allowSignedOut: (_a = options.allowSignedOut) !== null && _a !== void 0 ? _a : true }, ...(
|
|
57
|
+
return this.getCmsDocument("legal-pages", slug, { ...options, allowSignedOut: (_a = options.allowSignedOut) !== null && _a !== void 0 ? _a : true }, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
70
58
|
}
|
|
71
59
|
/** Release notes, newest first unless `sort` says otherwise. Needs a session. */
|
|
72
60
|
function listReleaseNotes(options = {}, requestOptions) {
|
|
73
61
|
var _a;
|
|
74
|
-
return this.listCmsDocuments("release-notes", { ...options, sort: (_a = options.sort) !== null && _a !== void 0 ? _a : "-publishedAt" }, ...(
|
|
62
|
+
return this.listCmsDocuments("release-notes", { ...options, sort: (_a = options.sort) !== null && _a !== void 0 ? _a : "-publishedAt" }, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
75
63
|
}
|
|
76
64
|
/** A translations read takes pages of 50 documents, the CMS's most, and at most this many. */
|
|
77
65
|
const MAX_TRANSLATION_PAGES = 20;
|
|
@@ -127,7 +115,7 @@ async function getTranslations(options = {}, requestOptions) {
|
|
|
127
115
|
const readOptions = { ...options, allowSignedOut: (_a = options.allowSignedOut) !== null && _a !== void 0 ? _a : true };
|
|
128
116
|
const translations = {};
|
|
129
117
|
for (let page = 1; page <= MAX_TRANSLATION_PAGES; page++) {
|
|
130
|
-
const { docs, hasNextPage } = await this.listCmsDocuments("translations", { ...readOptions, page, limit: 50 }, ...(
|
|
118
|
+
const { docs, hasNextPage } = await this.listCmsDocuments("translations", { ...readOptions, page, limit: 50 }, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
131
119
|
addTranslations(translations, docs);
|
|
132
120
|
if (!hasNextPage) {
|
|
133
121
|
break;
|
|
@@ -4,15 +4,16 @@ exports.getLegalConsent = getLegalConsent;
|
|
|
4
4
|
exports.setLegalConsent = setLegalConsent;
|
|
5
5
|
exports.getMedicalConsent = getMedicalConsent;
|
|
6
6
|
exports.setMedicalConsent = setMedicalConsent;
|
|
7
|
+
const request_options_1 = require("../request-options");
|
|
7
8
|
function getLegalConsent(requestOptions) {
|
|
8
|
-
return this.get("/v1/me/consent/legal", ...(
|
|
9
|
+
return this.get("/v1/me/consent/legal", ...(0, request_options_1.optionalArg)(requestOptions));
|
|
9
10
|
}
|
|
10
11
|
function setLegalConsent(accepted, requestOptions) {
|
|
11
12
|
const body = { termsAndConditionsConsent: accepted };
|
|
12
13
|
return this.post("/v1/me/consent/legal", body, undefined, requestOptions);
|
|
13
14
|
}
|
|
14
15
|
function getMedicalConsent(requestOptions) {
|
|
15
|
-
return this.get("/v1/me/consent/medical", ...(
|
|
16
|
+
return this.get("/v1/me/consent/medical", ...(0, request_options_1.optionalArg)(requestOptions));
|
|
16
17
|
}
|
|
17
18
|
function setMedicalConsent(accepted, requestOptions) {
|
|
18
19
|
const body = { medicalSettingsNotificationsConsent: accepted };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getEmailTemplates = getEmailTemplates;
|
|
4
|
+
const request_options_1 = require("../request-options");
|
|
4
5
|
function getEmailTemplates(requestOptions) {
|
|
5
|
-
return this.get("/v1/email/templates", ...(
|
|
6
|
+
return this.get("/v1/email/templates", ...(0, request_options_1.optionalArg)(requestOptions));
|
|
6
7
|
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { ValidationError } from "../../types/ValidationError";
|
|
2
2
|
export declare const OVOK_HTTP_ERROR_EXTENSION_URL = "https://api.ovok.com/fhir/StructureDefinition/http-error-metadata";
|
|
3
|
+
/** `reason` itself when it is an Error, else an Error carrying its string form. */
|
|
4
|
+
export declare const toError: (reason: unknown) => Error;
|
|
5
|
+
/** An Error with its `name` set, e.g. `namedError("AbortError", "The request was aborted.")`. */
|
|
6
|
+
export declare const namedError: (name: string, message: string) => Error;
|
|
7
|
+
/** Sets `cause` the way the SDK's typed errors expose it: read-only and not enumerable. */
|
|
8
|
+
export declare const withCause: <T extends Error>(error: T, cause: unknown) => T;
|
|
3
9
|
export declare const asRecord: (value: unknown) => Record<string, unknown> | undefined;
|
|
4
10
|
export declare function readMessage(payload: Record<string, unknown> | undefined, error: unknown): string;
|
|
5
11
|
export declare function readFieldErrors(payload: Record<string, unknown> | undefined): ValidationError[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.asRecord = exports.OVOK_HTTP_ERROR_EXTENSION_URL = void 0;
|
|
3
|
+
exports.asRecord = exports.withCause = exports.namedError = exports.toError = exports.OVOK_HTTP_ERROR_EXTENSION_URL = void 0;
|
|
4
4
|
exports.readMessage = readMessage;
|
|
5
5
|
exports.readFieldErrors = readFieldErrors;
|
|
6
6
|
exports.codeValue = codeValue;
|
|
@@ -11,6 +11,15 @@ exports.numberValue = numberValue;
|
|
|
11
11
|
exports.stringValue = stringValue;
|
|
12
12
|
exports.parseJson = parseJson;
|
|
13
13
|
exports.OVOK_HTTP_ERROR_EXTENSION_URL = "https://api.ovok.com/fhir/StructureDefinition/http-error-metadata";
|
|
14
|
+
/** `reason` itself when it is an Error, else an Error carrying its string form. */
|
|
15
|
+
const toError = (reason) => reason instanceof Error ? reason : new Error(String(reason));
|
|
16
|
+
exports.toError = toError;
|
|
17
|
+
/** An Error with its `name` set, e.g. `namedError("AbortError", "The request was aborted.")`. */
|
|
18
|
+
const namedError = (name, message) => Object.assign(new Error(message), { name });
|
|
19
|
+
exports.namedError = namedError;
|
|
20
|
+
/** Sets `cause` the way the SDK's typed errors expose it: read-only and not enumerable. */
|
|
21
|
+
const withCause = (error, cause) => Object.defineProperty(error, "cause", { configurable: true, enumerable: false, value: cause, writable: false });
|
|
22
|
+
exports.withCause = withCause;
|
|
14
23
|
const asRecord = (value) => value && typeof value === "object" ? value : undefined;
|
|
15
24
|
exports.asRecord = asRecord;
|
|
16
25
|
function readMessage(payload, error) {
|
|
@@ -26,7 +26,7 @@ const HTTP_REASON_PHRASES = new Set([
|
|
|
26
26
|
]);
|
|
27
27
|
/** Reads the error details Medplum preserves from Ovok's non-FHIR responses. */
|
|
28
28
|
const readOvokError = (error) => {
|
|
29
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y
|
|
29
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
30
30
|
if (error instanceof OvokApiError) {
|
|
31
31
|
return {
|
|
32
32
|
status: error.status,
|
|
@@ -62,15 +62,13 @@ const readOvokError = (error) => {
|
|
|
62
62
|
const missing = Array.isArray(payload === null || payload === void 0 ? void 0 : payload.missing)
|
|
63
63
|
? payload.missing.filter((entry) => typeof entry === "string")
|
|
64
64
|
: [];
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
const retryAfterSec = (0, ovok_error_utils_1.numberValue)(payload === null || payload === void 0 ? void 0 : payload.retryAfterSec);
|
|
66
|
+
const retryAfterMs = (_x = (_w = metadata.retryAfterMs) !== null && _w !== void 0 ? _w : (0, ovok_error_utils_1.numberValue)(payload === null || payload === void 0 ? void 0 : payload.retryAfterMs)) !== null && _x !== void 0 ? _x : (retryAfterSec === undefined ? undefined : retryAfterSec * 1000);
|
|
67
|
+
const requestId = (_y = metadata.requestId) !== null && _y !== void 0 ? _y : (0, ovok_error_utils_1.stringValue)(payload === null || payload === void 0 ? void 0 : payload.requestId);
|
|
68
68
|
return {
|
|
69
69
|
status,
|
|
70
70
|
code,
|
|
71
|
-
...(
|
|
72
|
-
? {}
|
|
73
|
-
: { requestId: (_z = metadata.requestId) !== null && _z !== void 0 ? _z : (0, ovok_error_utils_1.stringValue)(payload === null || payload === void 0 ? void 0 : payload.requestId) }),
|
|
71
|
+
...(requestId === undefined ? {} : { requestId }),
|
|
74
72
|
...(retryAfterMs === undefined ? {} : { retryAfterMs }),
|
|
75
73
|
message: (0, ovok_error_utils_1.readMessage)(payload, error),
|
|
76
74
|
fieldErrors,
|
|
@@ -90,12 +88,7 @@ class OvokApiError extends Error {
|
|
|
90
88
|
this.missing = details.missing;
|
|
91
89
|
this.requestId = details.requestId;
|
|
92
90
|
this.retryAfterMs = details.retryAfterMs;
|
|
93
|
-
|
|
94
|
-
configurable: true,
|
|
95
|
-
enumerable: false,
|
|
96
|
-
value: cause,
|
|
97
|
-
writable: false,
|
|
98
|
-
});
|
|
91
|
+
(0, ovok_error_utils_1.withCause)(this, cause);
|
|
99
92
|
}
|
|
100
93
|
}
|
|
101
94
|
exports.OvokApiError = OvokApiError;
|
|
@@ -5,6 +5,7 @@ exports.isRateLimitError = isRateLimitError;
|
|
|
5
5
|
exports.mapRateLimitError = mapRateLimitError;
|
|
6
6
|
const core_1 = require("@medplum/core");
|
|
7
7
|
const ovok_error_1 = require("./ovok-error");
|
|
8
|
+
const ovok_error_utils_1 = require("./ovok-error-utils");
|
|
8
9
|
const RATE_LIMIT_RESET_EXTENSION_URL = "https://medplum.com/fhir/StructureDefinition/rate-limit-reset";
|
|
9
10
|
/** A typed error returned when the server asks the client to slow down. */
|
|
10
11
|
class RateLimitError extends Error {
|
|
@@ -14,12 +15,7 @@ class RateLimitError extends Error {
|
|
|
14
15
|
this.name = "RateLimitError";
|
|
15
16
|
this.retryAfterMs = retryAfterMs;
|
|
16
17
|
if (options) {
|
|
17
|
-
|
|
18
|
-
configurable: true,
|
|
19
|
-
enumerable: false,
|
|
20
|
-
value: options.cause,
|
|
21
|
-
writable: false,
|
|
22
|
-
});
|
|
18
|
+
(0, ovok_error_utils_1.withCause)(this, options.cause);
|
|
23
19
|
}
|
|
24
20
|
}
|
|
25
21
|
}
|
|
@@ -34,85 +34,76 @@ exports.listChatSessions = listChatSessions;
|
|
|
34
34
|
exports.getChatSession = getChatSession;
|
|
35
35
|
exports.listChatMessages = listChatMessages;
|
|
36
36
|
exports.searchAIFhir = searchAIFhir;
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
for (const [key, value] of Object.entries(params)) {
|
|
41
|
-
if (value !== undefined) {
|
|
42
|
-
values.set(key, String(value));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
const encoded = values.toString();
|
|
46
|
-
return encoded === "" ? "" : `?${encoded}`;
|
|
47
|
-
};
|
|
48
|
-
const documentUrl = (client, path, params) => `${client.getBaseUrl().replace(/\/$/, "")}${path}${query(params)}`;
|
|
37
|
+
const query_string_1 = require("../query-string");
|
|
38
|
+
const request_options_1 = require("../request-options");
|
|
39
|
+
const documentUrl = (client, path, params) => `${client.getBaseUrl().replace(/\/$/, "")}${path}${(0, query_string_1.toQueryString)(params)}`;
|
|
49
40
|
async function requestConsentSignature(consentId, requestOptions) {
|
|
50
|
-
return this.post(`/consent/signature/${
|
|
41
|
+
return this.post(`/consent/signature/${encodeURIComponent(consentId)}`, undefined, undefined, requestOptions);
|
|
51
42
|
}
|
|
52
43
|
async function createDocumentUpload(body, requestOptions) {
|
|
53
44
|
return this.post("/document", body, undefined, requestOptions);
|
|
54
45
|
}
|
|
55
46
|
async function listDocuments(params = {}, requestOptions) {
|
|
56
|
-
return this.get(`/document${
|
|
47
|
+
return this.get(`/document${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
57
48
|
}
|
|
58
49
|
/** Returns the authenticated document endpoint; navigating/fetching it follows the backend redirect. */
|
|
59
50
|
async function getDocumentDownloadUrl(documentId, params = {}) {
|
|
60
|
-
return documentUrl(this, `/document/${
|
|
51
|
+
return documentUrl(this, `/document/${encodeURIComponent(documentId)}`, params);
|
|
61
52
|
}
|
|
62
53
|
/** Returns a public document endpoint for use in an image, download, or media element. */
|
|
63
54
|
async function getPublicDocumentDownloadUrl(token, params = {}) {
|
|
64
|
-
return documentUrl(this, `/document/public/${
|
|
55
|
+
return documentUrl(this, `/document/public/${encodeURIComponent(token)}`, params);
|
|
65
56
|
}
|
|
66
57
|
async function deleteDocument(documentId, requestOptions) {
|
|
67
|
-
return (await this.delete(`/document/${
|
|
58
|
+
return (await this.delete(`/document/${encodeURIComponent(documentId)}`, ...(0, request_options_1.optionalArg)(requestOptions)));
|
|
68
59
|
}
|
|
69
60
|
async function updateDocumentMetadata(documentId, body, requestOptions) {
|
|
70
|
-
return (await this.patch(`/document/${
|
|
61
|
+
return (await this.patch(`/document/${encodeURIComponent(documentId)}`, body, ...(0, request_options_1.optionalArg)(requestOptions)));
|
|
71
62
|
}
|
|
72
63
|
async function generateDocumentReplacementUpload(documentId, body, requestOptions) {
|
|
73
|
-
return this.post(`/document/${
|
|
64
|
+
return this.post(`/document/${encodeURIComponent(documentId)}`, body, undefined, requestOptions);
|
|
74
65
|
}
|
|
75
66
|
async function searchMappedContent(type, language, params = {}, requestOptions) {
|
|
76
|
-
return this.get(`/cms/${
|
|
67
|
+
return this.get(`/cms/${encodeURIComponent(type)}/map/${encodeURIComponent(language)}${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
77
68
|
}
|
|
78
69
|
async function copyContentsFromParent(type, language, requestOptions) {
|
|
79
|
-
return this.post(`/cms/${
|
|
70
|
+
return this.post(`/cms/${encodeURIComponent(type)}/${encodeURIComponent(language)}/copy-from-parent-project`, undefined, undefined, requestOptions);
|
|
80
71
|
}
|
|
81
72
|
async function copyContentFromParent(type, language, key, requestOptions) {
|
|
82
|
-
return this.post(`/cms/${
|
|
73
|
+
return this.post(`/cms/${encodeURIComponent(type)}/${encodeURIComponent(language)}/${encodeURIComponent(key)}/copy-from-parent-project`, undefined, undefined, requestOptions);
|
|
83
74
|
}
|
|
84
75
|
async function createContent(type, language, body, requestOptions) {
|
|
85
|
-
return this.post(`/cms/${
|
|
76
|
+
return this.post(`/cms/${encodeURIComponent(type)}/${encodeURIComponent(language)}`, body, undefined, requestOptions);
|
|
86
77
|
}
|
|
87
78
|
async function updateContent(type, language, key, body, requestOptions) {
|
|
88
|
-
return (await this.put(`/cms/${
|
|
79
|
+
return (await this.put(`/cms/${encodeURIComponent(type)}/${encodeURIComponent(language)}/${encodeURIComponent(key)}`, body, undefined, requestOptions));
|
|
89
80
|
}
|
|
90
81
|
async function getContent(type, language, key, requestOptions) {
|
|
91
|
-
return this.get(`/cms/${
|
|
82
|
+
return this.get(`/cms/${encodeURIComponent(type)}/${encodeURIComponent(language)}/${encodeURIComponent(key)}`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
92
83
|
}
|
|
93
84
|
async function deleteContent(type, language, key, requestOptions) {
|
|
94
|
-
await this.delete(`/cms/${
|
|
85
|
+
await this.delete(`/cms/${encodeURIComponent(type)}/${encodeURIComponent(language)}/${encodeURIComponent(key)}`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
95
86
|
}
|
|
96
87
|
async function searchContent(type, language, params = {}, requestOptions) {
|
|
97
|
-
return this.get(`/cms/${
|
|
88
|
+
return this.get(`/cms/${encodeURIComponent(type)}/${encodeURIComponent(language)}${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
98
89
|
}
|
|
99
90
|
async function createVideoCallAppointment(body, requestOptions) {
|
|
100
91
|
return this.post("/video-call/livekit/appointment", body, undefined, requestOptions);
|
|
101
92
|
}
|
|
102
93
|
async function updateVideoCallAppointment(appointmentId, body, requestOptions) {
|
|
103
|
-
return (await this.put(`/video-call/livekit/appointment/${
|
|
94
|
+
return (await this.put(`/video-call/livekit/appointment/${encodeURIComponent(appointmentId)}`, body, undefined, requestOptions));
|
|
104
95
|
}
|
|
105
96
|
async function listVideoCallAppointments(params = {}, requestOptions) {
|
|
106
|
-
return this.get(`/video-call/livekit/appointment${
|
|
97
|
+
return this.get(`/video-call/livekit/appointment${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
107
98
|
}
|
|
108
99
|
async function getVideoCallAccessPermission(appointmentId, requestOptions) {
|
|
109
|
-
return this.get(`/video-call/livekit/access-permission/${
|
|
100
|
+
return this.get(`/video-call/livekit/access-permission/${encodeURIComponent(appointmentId)}`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
110
101
|
}
|
|
111
102
|
async function createVideoCallGuestAccess(appointmentId, body, requestOptions) {
|
|
112
|
-
return this.post(`/video-call/livekit/guest-access/${
|
|
103
|
+
return this.post(`/video-call/livekit/guest-access/${encodeURIComponent(appointmentId)}`, body, undefined, requestOptions);
|
|
113
104
|
}
|
|
114
105
|
async function createVideoCallUserAccess(appointmentId, requestOptions) {
|
|
115
|
-
return this.post(`/video-call/livekit/user-access/${
|
|
106
|
+
return this.post(`/video-call/livekit/user-access/${encodeURIComponent(appointmentId)}`, undefined, undefined, requestOptions);
|
|
116
107
|
}
|
|
117
108
|
async function sendVideoCallInvite(body, requestOptions) {
|
|
118
109
|
return this.post("/video-call/livekit/mail/invite", body, undefined, requestOptions);
|
|
@@ -124,7 +115,7 @@ async function sendVideoCallCancellation(body, requestOptions) {
|
|
|
124
115
|
return this.post("/video-call/livekit/mail/cancel", body, undefined, requestOptions);
|
|
125
116
|
}
|
|
126
117
|
async function sendVideoCallActiveNotification(appointmentId, requestOptions) {
|
|
127
|
-
return this.post(`/video-call/livekit/notification/active-call/${
|
|
118
|
+
return this.post(`/video-call/livekit/notification/active-call/${encodeURIComponent(appointmentId)}`, undefined, undefined, requestOptions);
|
|
128
119
|
}
|
|
129
120
|
async function translate(body, requestOptions) {
|
|
130
121
|
return this.post("/ai/translation", body, undefined, requestOptions);
|
|
@@ -133,16 +124,16 @@ async function createChatSession(body, requestOptions) {
|
|
|
133
124
|
return this.post("/ai/session", body, undefined, requestOptions);
|
|
134
125
|
}
|
|
135
126
|
async function sendChatMessage(sessionId, body, requestOptions) {
|
|
136
|
-
return this.post(`/ai/session/${
|
|
127
|
+
return this.post(`/ai/session/${encodeURIComponent(sessionId)}/message`, body, undefined, requestOptions);
|
|
137
128
|
}
|
|
138
129
|
async function listChatSessions(params = {}, requestOptions) {
|
|
139
|
-
return this.get(`/ai/session${
|
|
130
|
+
return this.get(`/ai/session${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
140
131
|
}
|
|
141
132
|
async function getChatSession(sessionId, params = {}, requestOptions) {
|
|
142
|
-
return this.get(`/ai/session/${
|
|
133
|
+
return this.get(`/ai/session/${encodeURIComponent(sessionId)}${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
143
134
|
}
|
|
144
135
|
async function listChatMessages(sessionId, params = {}, requestOptions) {
|
|
145
|
-
return this.get(`/ai/session/${
|
|
136
|
+
return this.get(`/ai/session/${encodeURIComponent(sessionId)}/message${(0, query_string_1.toQueryString)(params)}`, ...(0, request_options_1.optionalArg)(requestOptions));
|
|
146
137
|
}
|
|
147
138
|
async function searchAIFhir(request, requestOptions) {
|
|
148
139
|
return this.post("/ai/fhir/search", request, undefined, requestOptions);
|