@haau3/sdk 0.1.2 → 0.2.1
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/README.md +37 -2
- package/dist/index.cjs +197 -49
- package/dist/index.d.cts +128 -52
- package/dist/index.d.mts +128 -52
- package/dist/index.mjs +197 -50
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -72,13 +72,32 @@ with its parameters and its answer typed from the published spec.
|
|
|
72
72
|
| `timeout` | `65000` | Milliseconds one attempt may take. |
|
|
73
73
|
| `maxRetries` | `1` | Retries after a timeout, a network failure, a 429 or a 5xx. |
|
|
74
74
|
| `fetch` | the global `fetch` | The fetch to send requests with. |
|
|
75
|
+
| `fetchOptions` | `{ cache: "no-store" }` | Passed on to `fetch` with every request, for any runtime. |
|
|
75
76
|
|
|
76
|
-
Each call takes `{ timeout, maxRetries, signal, headers }` as its last argument, for
|
|
77
|
+
Each call takes `{ timeout, maxRetries, signal, headers, fetchOptions }` as its last argument, for
|
|
78
|
+
that call only:
|
|
77
79
|
|
|
78
80
|
```ts
|
|
79
81
|
await haau3.searchSlots({ state: "MA" }, { timeout: 10_000, maxRetries: 0 });
|
|
80
82
|
```
|
|
81
83
|
|
|
84
|
+
`fetchOptions` passes anything your runtime's `fetch` takes, on the client or on one call: a proxy
|
|
85
|
+
`dispatcher` from undici in Node, Cloudflare's `cf`, Next.js's `next`, `keepalive`. The SDK's own
|
|
86
|
+
method, headers, body, signal and redirect always win.
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
import { ProxyAgent } from "undici";
|
|
90
|
+
|
|
91
|
+
const haau3 = new Haau3({ fetchOptions: { dispatcher: new ProxyAgent("http://proxy.internal:8080") } });
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Unless `fetchOptions` sets `cache`, every request is sent with `cache: "no-store"` where the
|
|
95
|
+
runtime's fetch takes the field (Node's does; on a runtime that refuses it, the SDK sends none). An
|
|
96
|
+
answer is live data for your key, not something a fetch cache should keep. Frameworks that cache
|
|
97
|
+
`fetch` follow it: in Next.js it also keeps `next build` from sending a request while it prerenders
|
|
98
|
+
a page, and `{ next: { revalidate: 60 } }` caches an answer there instead. `{ cache: undefined }`
|
|
99
|
+
sends no `cache` at all.
|
|
100
|
+
|
|
82
101
|
A retry waits a short, growing interval, or what the API's `Retry-After` header says when that is
|
|
83
102
|
60 seconds or less. A longer `Retry-After` fails at once, carrying it.
|
|
84
103
|
|
|
@@ -106,7 +125,23 @@ try {
|
|
|
106
125
|
|
|
107
126
|
No answer is never reported as an empty result, and an empty result is never an error. An error's
|
|
108
127
|
message never includes the body the API answered with, and the body (`outcome` or `problem`) is
|
|
109
|
-
never printed when the error is logged.
|
|
128
|
+
never printed when the error is logged. Every error the API answered carries `attempts` and
|
|
129
|
+
`durationMs` too.
|
|
130
|
+
|
|
131
|
+
A FHIR answer is checked against the resource types its operation answers with. Anything else, a
|
|
132
|
+
`Bundle` where an `InsurancePlan` was asked for, say, is a `NoAnswerError` with reason `"unreadable"`,
|
|
133
|
+
so what a method returns is always the type it says.
|
|
134
|
+
|
|
135
|
+
## Request ids and timing
|
|
136
|
+
|
|
137
|
+
Every method's answer can be awaited as it is, or through `.withResponse()` for the request id and
|
|
138
|
+
timing that came with it, in the same names `request()` uses:
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
const { data: plan, requestId, durationMs, attempts } = await haau3.readInsurancePlan(id).withResponse();
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Quote the `requestId` when you ask for help: it finds the request in the API's own logs.
|
|
110
145
|
|
|
111
146
|
## Paging
|
|
112
147
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,41 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/api-promise.ts
|
|
3
|
+
/**
|
|
4
|
+
* What every typed method returns: a promise of the answer, as before, that can also give the
|
|
5
|
+
* request id and timing that came with it.
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* const plan = await haau3.readInsurancePlan(id);
|
|
9
|
+
* const { data, requestId, durationMs } = await haau3.readInsurancePlan(id).withResponse();
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* The request is sent once, when the method is called, whichever way it is awaited.
|
|
13
|
+
*/
|
|
14
|
+
var APIPromise = class extends Promise {
|
|
15
|
+
#response;
|
|
16
|
+
constructor(response) {
|
|
17
|
+
super((resolve) => resolve(void 0));
|
|
18
|
+
this.#response = response;
|
|
19
|
+
}
|
|
20
|
+
/** The answer, its request id, its timing, its status and its headers. */
|
|
21
|
+
withResponse() {
|
|
22
|
+
return this.#response;
|
|
23
|
+
}
|
|
24
|
+
then(onfulfilled, onrejected) {
|
|
25
|
+
return this.#response.then((response) => response.data).then(onfulfilled, onrejected);
|
|
26
|
+
}
|
|
27
|
+
catch(onrejected) {
|
|
28
|
+
return this.then(void 0, onrejected);
|
|
29
|
+
}
|
|
30
|
+
finally(onfinally) {
|
|
31
|
+
return this.then().finally(onfinally);
|
|
32
|
+
}
|
|
33
|
+
/** `Promise.prototype.then` and friends build plain promises from an APIPromise. */
|
|
34
|
+
static get [Symbol.species]() {
|
|
35
|
+
return Promise;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
//#endregion
|
|
2
39
|
//#region src/errors.ts
|
|
3
40
|
/** What every error this package throws has. */
|
|
4
41
|
var Haau3Error = class extends Error {
|
|
@@ -29,9 +66,15 @@ function attachBody(error, body) {
|
|
|
29
66
|
var AuthError = class extends Haau3Error {
|
|
30
67
|
name = "AuthError";
|
|
31
68
|
status;
|
|
32
|
-
|
|
69
|
+
/** How many attempts were made. */
|
|
70
|
+
attempts;
|
|
71
|
+
/** Milliseconds from the first attempt to the answer. */
|
|
72
|
+
durationMs;
|
|
73
|
+
constructor(message, status, requestId, body, timing) {
|
|
33
74
|
super(message, requestId);
|
|
34
75
|
this.status = status;
|
|
76
|
+
this.attempts = timing?.attempts ?? 1;
|
|
77
|
+
this.durationMs = timing?.durationMs;
|
|
35
78
|
attachBody(this, body);
|
|
36
79
|
}
|
|
37
80
|
};
|
|
@@ -43,9 +86,15 @@ var AuthError = class extends Haau3Error {
|
|
|
43
86
|
var RefusedError = class extends Haau3Error {
|
|
44
87
|
name = "RefusedError";
|
|
45
88
|
status;
|
|
46
|
-
|
|
89
|
+
/** How many attempts were made. */
|
|
90
|
+
attempts;
|
|
91
|
+
/** Milliseconds from the first attempt to the answer. */
|
|
92
|
+
durationMs;
|
|
93
|
+
constructor(message, status, requestId, body, timing) {
|
|
47
94
|
super(message, requestId);
|
|
48
95
|
this.status = status;
|
|
96
|
+
this.attempts = timing?.attempts ?? 1;
|
|
97
|
+
this.durationMs = timing?.durationMs;
|
|
49
98
|
attachBody(this, body);
|
|
50
99
|
}
|
|
51
100
|
};
|
|
@@ -62,19 +111,22 @@ var NoAnswerError = class extends Haau3Error {
|
|
|
62
111
|
retryAfter;
|
|
63
112
|
/** How many attempts were made. */
|
|
64
113
|
attempts;
|
|
114
|
+
/** Milliseconds from the first attempt to the last failure, waits between attempts included. */
|
|
115
|
+
durationMs;
|
|
65
116
|
constructor(message, details) {
|
|
66
117
|
super(message, details.requestId, details.cause === void 0 ? void 0 : { cause: details.cause });
|
|
67
118
|
this.reason = details.reason;
|
|
68
119
|
this.status = details.status;
|
|
69
120
|
this.retryAfter = details.retryAfter;
|
|
70
121
|
this.attempts = details.attempts;
|
|
122
|
+
this.durationMs = details.durationMs;
|
|
71
123
|
attachBody(this, details.body);
|
|
72
124
|
}
|
|
73
125
|
};
|
|
74
126
|
//#endregion
|
|
75
127
|
//#region src/version.ts
|
|
76
128
|
/** This package's version, sent in the `User-Agent` header. A test holds it to package.json. */
|
|
77
|
-
const VERSION = "0.1
|
|
129
|
+
const VERSION = "0.2.1";
|
|
78
130
|
//#endregion
|
|
79
131
|
//#region src/transport.ts
|
|
80
132
|
const DEFAULT_BASE_URL = "https://api.haau3.com";
|
|
@@ -91,6 +143,18 @@ function inBrowser() {
|
|
|
91
143
|
const g = globalThis;
|
|
92
144
|
return typeof g.window !== "undefined" && typeof g.document !== "undefined" && !(g.navigator?.userAgent ?? "").includes("jsdom");
|
|
93
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* Whether this runtime's fetch takes a `cache` field. Node's does. Some edge runtimes have refused
|
|
148
|
+
* the field outright, so the no-store default is sent only where it is taken.
|
|
149
|
+
*/
|
|
150
|
+
function cacheFieldTaken() {
|
|
151
|
+
try {
|
|
152
|
+
new Request("https://api.haau3.com/", { cache: "no-store" });
|
|
153
|
+
return true;
|
|
154
|
+
} catch {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
94
158
|
function envKey() {
|
|
95
159
|
return globalThis.process?.env?.HAAU3_API_KEY || void 0;
|
|
96
160
|
}
|
|
@@ -138,6 +202,13 @@ function readErrorBody(body) {
|
|
|
138
202
|
value: body
|
|
139
203
|
};
|
|
140
204
|
}
|
|
205
|
+
/** A resource type with its article: "a Bundle", "an InsurancePlan". */
|
|
206
|
+
const withArticle = (type) => `${/^[AEIOU]/.test(type) ? "an" : "a"} ${type}`;
|
|
207
|
+
/** How an answer is named in a message: its resource type when it has a plausible one, never a value. */
|
|
208
|
+
function describeAnswer(body) {
|
|
209
|
+
const type = body && typeof body === "object" ? body.resourceType : void 0;
|
|
210
|
+
return typeof type === "string" && /^[A-Z][A-Za-z]{0,63}$/.test(type) ? withArticle(type) : "something that is not a FHIR resource";
|
|
211
|
+
}
|
|
141
212
|
function noAnswerReason(status) {
|
|
142
213
|
if (status === 429) return "rate-limited";
|
|
143
214
|
if (status === 502 || status === 503) return "unavailable";
|
|
@@ -148,6 +219,8 @@ function noAnswerReason(status) {
|
|
|
148
219
|
var Transport = class {
|
|
149
220
|
#apiKey;
|
|
150
221
|
#fetch;
|
|
222
|
+
#fetchOptions;
|
|
223
|
+
#noStoreTaken;
|
|
151
224
|
/** Where requests go. */
|
|
152
225
|
baseURL;
|
|
153
226
|
/** Milliseconds one attempt may take. */
|
|
@@ -162,6 +235,8 @@ var Transport = class {
|
|
|
162
235
|
if (!fetchImpl) throw new Haau3Error("No fetch: pass one as the fetch option. Node 22 and newer have one.");
|
|
163
236
|
this.#apiKey = apiKey;
|
|
164
237
|
this.#fetch = fetchImpl;
|
|
238
|
+
this.#fetchOptions = options.fetchOptions ?? {};
|
|
239
|
+
this.#noStoreTaken = cacheFieldTaken();
|
|
165
240
|
this.baseURL = (options.baseURL ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
166
241
|
this.timeout = options.timeout ?? DEFAULT_TIMEOUT;
|
|
167
242
|
this.maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;
|
|
@@ -182,50 +257,84 @@ var Transport = class {
|
|
|
182
257
|
durationMs: sent.durationMs
|
|
183
258
|
};
|
|
184
259
|
}
|
|
185
|
-
/**
|
|
186
|
-
|
|
260
|
+
/**
|
|
261
|
+
* Runs one operation of the spec and returns its answer, or throws one of the three errors. The
|
|
262
|
+
* answer's `.withResponse()` gives its request id and timing too.
|
|
263
|
+
*/
|
|
264
|
+
operation(call, options = {}) {
|
|
187
265
|
let path = call.path;
|
|
188
266
|
for (const [name, value] of Object.entries(call.pathParams ?? {})) path = path.replace(`{${name}}`, encodeURIComponent(value));
|
|
189
|
-
|
|
267
|
+
let url;
|
|
268
|
+
try {
|
|
269
|
+
url = this.#url(path, call.query);
|
|
270
|
+
} catch (error) {
|
|
271
|
+
return new APIPromise(Promise.reject(error));
|
|
272
|
+
}
|
|
273
|
+
return new APIPromise(this.respond(call.method, url, call.body, options, call.path, call.expects));
|
|
274
|
+
}
|
|
275
|
+
/** Sends a request and returns its answer only. See {@link Transport.respond}. */
|
|
276
|
+
async answer(method, url, body, options, label, expects) {
|
|
277
|
+
return (await this.respond(method, url, body, options, label, expects)).data;
|
|
190
278
|
}
|
|
191
279
|
/**
|
|
192
280
|
* Sends a request and reads its answer. `label` names the request in an error message: the
|
|
193
281
|
* operation's path with its `{id}` left in, so no value a caller sent ends up in a message.
|
|
282
|
+
* `expects`, when set, are the FHIR resource types the answer may be; any other is not an answer.
|
|
194
283
|
*/
|
|
195
|
-
async
|
|
196
|
-
const { response, text, attempts } = await this.#send(method, url, body, options, label);
|
|
284
|
+
async respond(method, url, body, options, label, expects) {
|
|
285
|
+
const { response, text, attempts, durationMs } = await this.#send(method, url, body, options, label);
|
|
197
286
|
const status = response.status;
|
|
198
287
|
const requestId = response.headers.get("x-request-id") ?? void 0;
|
|
199
288
|
const parsed = parseBody(text, response.headers.get("content-type"));
|
|
200
289
|
const name = `${method} ${label}`;
|
|
290
|
+
const timing = {
|
|
291
|
+
attempts,
|
|
292
|
+
durationMs
|
|
293
|
+
};
|
|
201
294
|
if (status >= 200 && status < 300) {
|
|
202
295
|
if (parsed === void 0) throw new NoAnswerError(`${name} answered ${status} with a body that is not JSON.`, {
|
|
203
296
|
reason: "unreadable",
|
|
204
|
-
attempts,
|
|
205
297
|
status,
|
|
206
|
-
requestId
|
|
298
|
+
requestId,
|
|
299
|
+
...timing
|
|
207
300
|
});
|
|
208
|
-
|
|
301
|
+
if (expects && !expects.includes(parsed?.resourceType)) {
|
|
302
|
+
const wanted = expects.map(withArticle).join(" or ");
|
|
303
|
+
throw new NoAnswerError(`${name} answered ${describeAnswer(parsed)} where ${wanted} was expected.`, {
|
|
304
|
+
reason: "unreadable",
|
|
305
|
+
status,
|
|
306
|
+
requestId,
|
|
307
|
+
...timing
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
return {
|
|
311
|
+
data: parsed,
|
|
312
|
+
requestId,
|
|
313
|
+
durationMs,
|
|
314
|
+
attempts,
|
|
315
|
+
status,
|
|
316
|
+
headers: response.headers
|
|
317
|
+
};
|
|
209
318
|
}
|
|
210
319
|
const errorBody = readErrorBody(parsed);
|
|
211
|
-
if (status === 401 || status === 403) throw new AuthError(`${name} was refused: the API key was not accepted (${status}).`, status, requestId, errorBody);
|
|
320
|
+
if (status === 401 || status === 403) throw new AuthError(`${name} was refused: the API key was not accepted (${status}).`, status, requestId, errorBody, timing);
|
|
212
321
|
if (status === 429 || status >= 500) {
|
|
213
322
|
const reason = noAnswerReason(status);
|
|
214
323
|
throw new NoAnswerError(`${name} got no answer (${reason}, ${status}) after ${attempts} attempt${attempts === 1 ? "" : "s"}.`, {
|
|
215
324
|
reason,
|
|
216
|
-
attempts,
|
|
217
325
|
status,
|
|
218
326
|
retryAfter: retryAfterSeconds(response.headers),
|
|
219
327
|
requestId,
|
|
220
|
-
body: errorBody
|
|
328
|
+
body: errorBody,
|
|
329
|
+
...timing
|
|
221
330
|
});
|
|
222
331
|
}
|
|
223
|
-
if (status >= 400) throw new RefusedError(`${name} was refused (${status}).`, status, requestId, errorBody);
|
|
332
|
+
if (status >= 400) throw new RefusedError(`${name} was refused (${status}).`, status, requestId, errorBody, timing);
|
|
224
333
|
throw new NoAnswerError(`${name} answered ${status}, which is not an answer.`, {
|
|
225
334
|
reason: "unreadable",
|
|
226
|
-
attempts,
|
|
227
335
|
status,
|
|
228
|
-
requestId
|
|
336
|
+
requestId,
|
|
337
|
+
...timing
|
|
229
338
|
});
|
|
230
339
|
}
|
|
231
340
|
/** A URL on this client's base, refusing any other host so the key is never sent to one. */
|
|
@@ -257,6 +366,11 @@ var Transport = class {
|
|
|
257
366
|
for (const [name, value] of Object.entries(options.headers ?? {})) headers[name.toLowerCase()] = value;
|
|
258
367
|
const timeout = options.timeout ?? this.timeout;
|
|
259
368
|
const maxRetries = options.maxRetries ?? this.maxRetries;
|
|
369
|
+
const fetchOptions = {
|
|
370
|
+
...this.#fetchOptions,
|
|
371
|
+
...options.fetchOptions
|
|
372
|
+
};
|
|
373
|
+
if (this.#noStoreTaken && !("cache" in fetchOptions) && !("next" in fetchOptions)) fetchOptions.cache = "no-store";
|
|
260
374
|
const started = Date.now();
|
|
261
375
|
let attempt = 0;
|
|
262
376
|
for (;;) {
|
|
@@ -268,6 +382,7 @@ var Transport = class {
|
|
|
268
382
|
let text;
|
|
269
383
|
try {
|
|
270
384
|
response = await this.#fetch(url, {
|
|
385
|
+
...fetchOptions,
|
|
271
386
|
method,
|
|
272
387
|
headers,
|
|
273
388
|
body: payload,
|
|
@@ -285,6 +400,7 @@ var Transport = class {
|
|
|
285
400
|
throw new NoAnswerError(`${method} ${label} got no answer (${reason}) after ${attempt} attempt${attempt === 1 ? "" : "s"}.`, {
|
|
286
401
|
reason,
|
|
287
402
|
attempts: attempt,
|
|
403
|
+
durationMs: Date.now() - started,
|
|
288
404
|
cause: error
|
|
289
405
|
});
|
|
290
406
|
}
|
|
@@ -320,7 +436,8 @@ var Operations = class extends Transport {
|
|
|
320
436
|
method: "GET",
|
|
321
437
|
path: "/v1/fhir/r4/InsurancePlan/{id}/$in-network",
|
|
322
438
|
pathParams: { id },
|
|
323
|
-
query: params
|
|
439
|
+
query: params,
|
|
440
|
+
expects: ["Parameters"]
|
|
324
441
|
}, options);
|
|
325
442
|
}
|
|
326
443
|
/**
|
|
@@ -334,7 +451,8 @@ var Operations = class extends Transport {
|
|
|
334
451
|
return this.operation({
|
|
335
452
|
method: "GET",
|
|
336
453
|
path: "/v1/fhir/r4/CodeSystem/$lookup",
|
|
337
|
-
query: params
|
|
454
|
+
query: params,
|
|
455
|
+
expects: ["Parameters"]
|
|
338
456
|
}, options);
|
|
339
457
|
}
|
|
340
458
|
/**
|
|
@@ -348,7 +466,8 @@ var Operations = class extends Transport {
|
|
|
348
466
|
return this.operation({
|
|
349
467
|
method: "POST",
|
|
350
468
|
path: "/v1/fhir/r4/CodeSystem/$lookup",
|
|
351
|
-
body
|
|
469
|
+
body,
|
|
470
|
+
expects: ["Parameters"]
|
|
352
471
|
}, options);
|
|
353
472
|
}
|
|
354
473
|
/**
|
|
@@ -362,7 +481,8 @@ var Operations = class extends Transport {
|
|
|
362
481
|
return this.operation({
|
|
363
482
|
method: "GET",
|
|
364
483
|
path: "/v1/fhir/r4/CodeSystem/$validate-code",
|
|
365
|
-
query: params
|
|
484
|
+
query: params,
|
|
485
|
+
expects: ["Parameters"]
|
|
366
486
|
}, options);
|
|
367
487
|
}
|
|
368
488
|
/**
|
|
@@ -376,7 +496,8 @@ var Operations = class extends Transport {
|
|
|
376
496
|
return this.operation({
|
|
377
497
|
method: "POST",
|
|
378
498
|
path: "/v1/fhir/r4/CodeSystem/$validate-code",
|
|
379
|
-
body
|
|
499
|
+
body,
|
|
500
|
+
expects: ["Parameters"]
|
|
380
501
|
}, options);
|
|
381
502
|
}
|
|
382
503
|
/**
|
|
@@ -390,7 +511,8 @@ var Operations = class extends Transport {
|
|
|
390
511
|
return this.operation({
|
|
391
512
|
method: "POST",
|
|
392
513
|
path: "/v1/fhir/r4",
|
|
393
|
-
body
|
|
514
|
+
body,
|
|
515
|
+
expects: ["Bundle"]
|
|
394
516
|
}, options);
|
|
395
517
|
}
|
|
396
518
|
/**
|
|
@@ -404,7 +526,8 @@ var Operations = class extends Transport {
|
|
|
404
526
|
return this.operation({
|
|
405
527
|
method: "GET",
|
|
406
528
|
path: "/v1/fhir/r4/metadata",
|
|
407
|
-
query: params
|
|
529
|
+
query: params,
|
|
530
|
+
expects: ["CapabilityStatement", "TerminologyCapabilities"]
|
|
408
531
|
}, options);
|
|
409
532
|
}
|
|
410
533
|
/**
|
|
@@ -418,7 +541,8 @@ var Operations = class extends Transport {
|
|
|
418
541
|
return this.operation({
|
|
419
542
|
method: "GET",
|
|
420
543
|
path: "/v1/fhir/r4/InsurancePlan/$counties",
|
|
421
|
-
query: params
|
|
544
|
+
query: params,
|
|
545
|
+
expects: ["Parameters"]
|
|
422
546
|
}, options);
|
|
423
547
|
}
|
|
424
548
|
/**
|
|
@@ -473,7 +597,8 @@ var Operations = class extends Transport {
|
|
|
473
597
|
return this.operation({
|
|
474
598
|
method: "GET",
|
|
475
599
|
path: "/v1/fhir/r4/Endpoint/{id}",
|
|
476
|
-
pathParams: { id }
|
|
600
|
+
pathParams: { id },
|
|
601
|
+
expects: ["Endpoint"]
|
|
477
602
|
}, options);
|
|
478
603
|
}
|
|
479
604
|
/**
|
|
@@ -487,7 +612,8 @@ var Operations = class extends Transport {
|
|
|
487
612
|
return this.operation({
|
|
488
613
|
method: "GET",
|
|
489
614
|
path: "/v1/fhir/r4/HealthcareService/{id}",
|
|
490
|
-
pathParams: { id }
|
|
615
|
+
pathParams: { id },
|
|
616
|
+
expects: ["HealthcareService"]
|
|
491
617
|
}, options);
|
|
492
618
|
}
|
|
493
619
|
/**
|
|
@@ -501,7 +627,8 @@ var Operations = class extends Transport {
|
|
|
501
627
|
return this.operation({
|
|
502
628
|
method: "GET",
|
|
503
629
|
path: "/v1/fhir/r4/InsurancePlan/{id}",
|
|
504
|
-
pathParams: { id }
|
|
630
|
+
pathParams: { id },
|
|
631
|
+
expects: ["InsurancePlan"]
|
|
505
632
|
}, options);
|
|
506
633
|
}
|
|
507
634
|
/**
|
|
@@ -515,7 +642,8 @@ var Operations = class extends Transport {
|
|
|
515
642
|
return this.operation({
|
|
516
643
|
method: "GET",
|
|
517
644
|
path: "/v1/fhir/r4/Location/{id}",
|
|
518
|
-
pathParams: { id }
|
|
645
|
+
pathParams: { id },
|
|
646
|
+
expects: ["Location"]
|
|
519
647
|
}, options);
|
|
520
648
|
}
|
|
521
649
|
/**
|
|
@@ -529,7 +657,8 @@ var Operations = class extends Transport {
|
|
|
529
657
|
return this.operation({
|
|
530
658
|
method: "GET",
|
|
531
659
|
path: "/v1/fhir/r4/Organization/{id}",
|
|
532
|
-
pathParams: { id }
|
|
660
|
+
pathParams: { id },
|
|
661
|
+
expects: ["Organization"]
|
|
533
662
|
}, options);
|
|
534
663
|
}
|
|
535
664
|
/**
|
|
@@ -543,7 +672,8 @@ var Operations = class extends Transport {
|
|
|
543
672
|
return this.operation({
|
|
544
673
|
method: "GET",
|
|
545
674
|
path: "/v1/fhir/r4/OrganizationAffiliation/{id}",
|
|
546
|
-
pathParams: { id }
|
|
675
|
+
pathParams: { id },
|
|
676
|
+
expects: ["OrganizationAffiliation"]
|
|
547
677
|
}, options);
|
|
548
678
|
}
|
|
549
679
|
/**
|
|
@@ -557,7 +687,8 @@ var Operations = class extends Transport {
|
|
|
557
687
|
return this.operation({
|
|
558
688
|
method: "GET",
|
|
559
689
|
path: "/v1/fhir/r4/Practitioner/{id}",
|
|
560
|
-
pathParams: { id }
|
|
690
|
+
pathParams: { id },
|
|
691
|
+
expects: ["Practitioner"]
|
|
561
692
|
}, options);
|
|
562
693
|
}
|
|
563
694
|
/**
|
|
@@ -571,7 +702,8 @@ var Operations = class extends Transport {
|
|
|
571
702
|
return this.operation({
|
|
572
703
|
method: "GET",
|
|
573
704
|
path: "/v1/fhir/r4/PractitionerRole/{id}",
|
|
574
|
-
pathParams: { id }
|
|
705
|
+
pathParams: { id },
|
|
706
|
+
expects: ["PractitionerRole"]
|
|
575
707
|
}, options);
|
|
576
708
|
}
|
|
577
709
|
/**
|
|
@@ -587,7 +719,8 @@ var Operations = class extends Transport {
|
|
|
587
719
|
return this.operation({
|
|
588
720
|
method: "GET",
|
|
589
721
|
path: "/v1/fhir/r4/Questionnaire/{id}",
|
|
590
|
-
pathParams: { id }
|
|
722
|
+
pathParams: { id },
|
|
723
|
+
expects: ["Questionnaire"]
|
|
591
724
|
}, options);
|
|
592
725
|
}
|
|
593
726
|
/**
|
|
@@ -601,7 +734,8 @@ var Operations = class extends Transport {
|
|
|
601
734
|
return this.operation({
|
|
602
735
|
method: "POST",
|
|
603
736
|
path: "/v1/fhir/r4/$reconcile-medications",
|
|
604
|
-
body
|
|
737
|
+
body,
|
|
738
|
+
expects: ["Bundle"]
|
|
605
739
|
}, options);
|
|
606
740
|
}
|
|
607
741
|
/**
|
|
@@ -615,7 +749,8 @@ var Operations = class extends Transport {
|
|
|
615
749
|
return this.operation({
|
|
616
750
|
method: "GET",
|
|
617
751
|
path: "/v1/fhir/r4/Endpoint",
|
|
618
|
-
query: params
|
|
752
|
+
query: params,
|
|
753
|
+
expects: ["Bundle"]
|
|
619
754
|
}, options);
|
|
620
755
|
}
|
|
621
756
|
/**
|
|
@@ -629,7 +764,8 @@ var Operations = class extends Transport {
|
|
|
629
764
|
return this.operation({
|
|
630
765
|
method: "GET",
|
|
631
766
|
path: "/v1/fhir/r4/HealthcareService",
|
|
632
|
-
query: params
|
|
767
|
+
query: params,
|
|
768
|
+
expects: ["Bundle"]
|
|
633
769
|
}, options);
|
|
634
770
|
}
|
|
635
771
|
/**
|
|
@@ -649,7 +785,8 @@ var Operations = class extends Transport {
|
|
|
649
785
|
return this.operation({
|
|
650
786
|
method: "GET",
|
|
651
787
|
path: "/v1/fhir/r4/InsurancePlan",
|
|
652
|
-
query: params
|
|
788
|
+
query: params,
|
|
789
|
+
expects: ["Bundle"]
|
|
653
790
|
}, options);
|
|
654
791
|
}
|
|
655
792
|
/**
|
|
@@ -663,7 +800,8 @@ var Operations = class extends Transport {
|
|
|
663
800
|
return this.operation({
|
|
664
801
|
method: "GET",
|
|
665
802
|
path: "/v1/fhir/r4/Location",
|
|
666
|
-
query: params
|
|
803
|
+
query: params,
|
|
804
|
+
expects: ["Bundle"]
|
|
667
805
|
}, options);
|
|
668
806
|
}
|
|
669
807
|
/**
|
|
@@ -681,7 +819,8 @@ var Operations = class extends Transport {
|
|
|
681
819
|
return this.operation({
|
|
682
820
|
method: "GET",
|
|
683
821
|
path: "/v1/fhir/r4/Organization",
|
|
684
|
-
query: params
|
|
822
|
+
query: params,
|
|
823
|
+
expects: ["Bundle"]
|
|
685
824
|
}, options);
|
|
686
825
|
}
|
|
687
826
|
/**
|
|
@@ -695,7 +834,8 @@ var Operations = class extends Transport {
|
|
|
695
834
|
return this.operation({
|
|
696
835
|
method: "GET",
|
|
697
836
|
path: "/v1/fhir/r4/OrganizationAffiliation",
|
|
698
|
-
query: params
|
|
837
|
+
query: params,
|
|
838
|
+
expects: ["Bundle"]
|
|
699
839
|
}, options);
|
|
700
840
|
}
|
|
701
841
|
/**
|
|
@@ -713,7 +853,8 @@ var Operations = class extends Transport {
|
|
|
713
853
|
return this.operation({
|
|
714
854
|
method: "GET",
|
|
715
855
|
path: "/v1/fhir/r4/Practitioner",
|
|
716
|
-
query: params
|
|
856
|
+
query: params,
|
|
857
|
+
expects: ["Bundle"]
|
|
717
858
|
}, options);
|
|
718
859
|
}
|
|
719
860
|
/**
|
|
@@ -731,7 +872,8 @@ var Operations = class extends Transport {
|
|
|
731
872
|
return this.operation({
|
|
732
873
|
method: "GET",
|
|
733
874
|
path: "/v1/fhir/r4/PractitionerRole",
|
|
734
|
-
query: params
|
|
875
|
+
query: params,
|
|
876
|
+
expects: ["Bundle"]
|
|
735
877
|
}, options);
|
|
736
878
|
}
|
|
737
879
|
/**
|
|
@@ -767,7 +909,8 @@ var Operations = class extends Transport {
|
|
|
767
909
|
return this.operation({
|
|
768
910
|
method: "GET",
|
|
769
911
|
path: "/v1/fhir/r4/Questionnaire",
|
|
770
|
-
query: params
|
|
912
|
+
query: params,
|
|
913
|
+
expects: ["Bundle"]
|
|
771
914
|
}, options);
|
|
772
915
|
}
|
|
773
916
|
/**
|
|
@@ -795,7 +938,8 @@ var Operations = class extends Transport {
|
|
|
795
938
|
return this.operation({
|
|
796
939
|
method: "GET",
|
|
797
940
|
path: "/v1/fhir/r4/ValueSet/$expand",
|
|
798
|
-
query: params
|
|
941
|
+
query: params,
|
|
942
|
+
expects: ["ValueSet"]
|
|
799
943
|
}, options);
|
|
800
944
|
}
|
|
801
945
|
/**
|
|
@@ -809,7 +953,8 @@ var Operations = class extends Transport {
|
|
|
809
953
|
return this.operation({
|
|
810
954
|
method: "POST",
|
|
811
955
|
path: "/v1/fhir/r4/ValueSet/$expand",
|
|
812
|
-
body
|
|
956
|
+
body,
|
|
957
|
+
expects: ["ValueSet"]
|
|
813
958
|
}, options);
|
|
814
959
|
}
|
|
815
960
|
/**
|
|
@@ -823,7 +968,8 @@ var Operations = class extends Transport {
|
|
|
823
968
|
return this.operation({
|
|
824
969
|
method: "GET",
|
|
825
970
|
path: "/v1/fhir/r4/ValueSet/$validate-code",
|
|
826
|
-
query: params
|
|
971
|
+
query: params,
|
|
972
|
+
expects: ["Parameters"]
|
|
827
973
|
}, options);
|
|
828
974
|
}
|
|
829
975
|
/**
|
|
@@ -837,7 +983,8 @@ var Operations = class extends Transport {
|
|
|
837
983
|
return this.operation({
|
|
838
984
|
method: "POST",
|
|
839
985
|
path: "/v1/fhir/r4/ValueSet/$validate-code",
|
|
840
|
-
body
|
|
986
|
+
body,
|
|
987
|
+
expects: ["Parameters"]
|
|
841
988
|
}, options);
|
|
842
989
|
}
|
|
843
990
|
};
|
|
@@ -879,11 +1026,12 @@ var Haau3 = class extends Operations {
|
|
|
879
1026
|
const next = page.link?.find((link) => link.relation === "next")?.url;
|
|
880
1027
|
if (!next) return;
|
|
881
1028
|
const url = this.url(next);
|
|
882
|
-
page = await this.answer("GET", url, void 0, options, url.pathname);
|
|
1029
|
+
page = await this.answer("GET", url, void 0, options, url.pathname, ["Bundle"]);
|
|
883
1030
|
}
|
|
884
1031
|
}
|
|
885
1032
|
};
|
|
886
1033
|
//#endregion
|
|
1034
|
+
exports.APIPromise = APIPromise;
|
|
887
1035
|
exports.AuthError = AuthError;
|
|
888
1036
|
exports.Haau3 = Haau3;
|
|
889
1037
|
exports.Haau3Error = Haau3Error;
|